Prompt Engineering Patterns
The reusable shapes — task-context-format, role assignment, few-shot, chain-of-thought — applied to real briefs, not toy examples.
Principle
Good prompting is not magic — it is a set of repeatable patterns that produce predictable results.
Patterns
1. Be Clear and Direct
State exactly what you want. Vague requests produce vague outputs.
2. Separate Data from Instructions
Put the content you want transformed inside clear tags. Keep instructions outside.
3. Use XML Tags
<thinking>, <answer>, <example>, <input>, <output> — tags give Claude structure to follow.
4. Few-Shot Where Possible
Show 2–3 examples of desired input/output before asking for the real thing.
5. Assign a Role
Tell Claude who it is: "You are a senior engineer reviewing this PR."
6. Chain of Thought
Force reasoning before the answer: "Work through this step by step inside <thinking> tags."
7. Specify the Format
"Return JSON matching this schema." "Write this as a bulleted list." "Keep it under 120 words."
8. Specify Constraints
What should it avoid? What examples should it follow? Constraints shape the output more than instructions do.
When to Use
These patterns apply to every Claude interaction — Desktop, Code, and API.
Further reading
- "Nouns and Verbs" — the underlying grammar that makes a prompt land.
- Prompt Engineering 101 — the foundational course that walks each of these patterns through worked examples.
- Real-World Prompts — chains, evals, and rollback for prompts that ship to production.