logo

Advanced Prompt Patterns

Once the basics are stable, the next step is using patterns that reduce ambiguity and improve reliability.

Structured output

Ask the model to return a fixed schema such as JSON. This is especially useful when the result feeds another system.

Step decomposition

Break complex tasks into stages:

  1. analyse the input
  2. extract the relevant facts
  3. produce the final answer

That often works better than asking the model to do everything in one jump.

Role plus constraint framing

Role prompts are useful when they come with concrete constraints. "Act as an expert" is weak. "Act as a code reviewer and list only functional bugs with file references" is much stronger.

Evaluation loop

For important tasks, ask the model to check its own output against explicit criteria before finalising it. That does not guarantee correctness, but it does reduce obvious failure modes.

P
AI Engineer

Prompt Engineering Practical Guide

Learn practical prompt engineering techniques across ChatGPT, Claude, Gemini, and real use cases.

高级模式:System Prompt 和 Prompt Chain

Advanced Prompt Patterns

Once the basics are stable, the next step is using patterns that reduce ambiguity and improve reliability.

#Structured output

Ask the model to return a fixed schema such as JSON. This is especially useful when the result feeds another system.

#Step decomposition

Break complex tasks into stages:

  1. analyse the input
  2. extract the relevant facts
  3. produce the final answer

That often works better than asking the model to do everything in one jump.

#Role plus constraint framing

Role prompts are useful when they come with concrete constraints. "Act as an expert" is weak. "Act as a code reviewer and list only functional bugs with file references" is much stronger.

#Evaluation loop

For important tasks, ask the model to check its own output against explicit criteria before finalising it. That does not guarantee correctness, but it does reduce obvious failure modes.