Prompting Patterns
A small set of reusable prompting techniques that handle most of what production systems need
Most "advanced prompt engineering" is just a handful of patterns applied carefully. Knowing them and when to reach for each is more useful than chasing every new clever trick.
Role and Task Setup
The opening of the prompt should establish:
- Who the model is — "You are a senior code reviewer."
- What the task is — concrete, in one sentence.
- What the output should look like — format, length, structure.
A well-set-up prompt removes most of the ambiguity that causes models to drift.
Few-Shot Examples
When a task is hard to describe but easy to demonstrate, paste examples:
Input: "We need to refactor the auth flow."
Output: { "category": "feature", "priority": "high" }
Input: "Fix the typo on the homepage."
Output: { "category": "bug", "priority": "low" }
Input: "{user input here}"
Output:Three to five examples that span the variation in your input space usually beats a long prose explanation of what to do.
Chain of Thought
Asking the model to "think step by step" before answering improves performance on multi-step problems. Modern reasoning models do this implicitly; for non-reasoning models, explicit CoT is still worth using when accuracy matters more than latency.
Decomposition
When a task is complex, break it into smaller prompts:
- Plan the steps.
- Execute each step.
- Compose the final answer.
This is also what most agent frameworks are doing under the hood.
Self-Critique and Revision
Have the model produce a draft, then critique its own draft against a rubric, then revise. Costs more tokens but often improves quality on open-ended tasks more than any other prompting change.
Negative Instructions Are Fragile
"Don't mention X" works less reliably than "respond using only Y." Whenever possible, frame instructions positively — tell the model what to do, not what to avoid.
Iterate on Real Failures
The best source of prompting improvements is your own failure cases. Keep a running log of model outputs that were wrong; the pattern that fixes a real failure beats any generic "tip" by a wide margin.