A visual guide to production prompts for Claude: system prompts, explicit criteria, few-shot examples, XML tags, reasoning and measuring changes.
In 30 seconds
Stable instructions go in the system prompt; per-request content goes in messages.
Say what "good" means: context, criteria, severity scale and output format.
A few varied examples, including edge cases, fix inconsistent labels faster than more rules.
Measure prompt changes on a representative evaluation set.
Stable parts first, clearly delimited parts after. The same order also makes prompt caching work.
Explicit beats emphatic
"Review this code" gets a generic review. "Review this Python service for security, error handling and test gaps; rate each finding high, medium or low; output one finding per item with file, line, problem and fix" gets consistent, useful output. Capital letters and "very carefully" add urgency, not information. When a rule has a reason, give the reason: absolute rules without context get applied where their author never intended — an agent told never to say anything negative will deny a real outage.
Examples show the boundary
If a classifier wobbles between "billing" and "account", definitions alone rarely settle it. Three to five examples that include the confusing cases show exactly where the line sits. Vary them so the model learns the rule rather than copying surface features such as length or wording.
Delimit your inputs
Long prompts mix instructions, examples and data. Wrapping each in clearly named tags — <instructions>, <examples>, <contract> — stops example text being mistaken for the contract and lets instructions refer to parts precisely: "extract only from the contract tag".
Room to reason
For multi-step rules, an immediate one-word answer is often wrong. Let Claude work through the rules first — with extended thinking or a reasoning section kept separate from the final answer — and parse only the answer.
Prompting is an experiment
A prompt that shines on five hand-picked inputs can fail on real traffic. Build an evaluation set from representative inputs, including the awkward ones, define what success means, and measure before and after each change. Patching the prompt for every complaint grows something nobody can maintain.
Part of Domain 4: Prompt Engineering & Structured Output (20% of the exam). Explanations are our own, checked against Anthropic's documentation on November 22, 2026.
Common traps
Trap
Why it fails
Do this instead
IMPORTANT in capitals on every rule
Emphasis everywhere means emphasis nowhere
State criteria and reasons
Examples that all look alike
The model copies the pattern, not the rule
Vary examples; include edge cases
Tuning on five favourite inputs
Overfits; fails on real traffic
Measure on a representative eval set
Check yourself
Two original practice questions on this lesson. Try them before opening the answers.
Check yourself 1
Scenario: Customer support resolution agent
A classification prompt gives inconsistent labels for edge cases between "billing" and "account". Which technique most directly improves consistency?
A. Add varied examples that include the tricky edge cases and their correct labels
B. Merge "billing" and "account" into a single label to remove the ambiguity
C. Ask Claude to explain each label it assigns in a full paragraph of written reasoning
D. Repeat the label definitions at both the start and the end of the prompt
Show answer and explanation
Answer: A. Few-shot examples covering the boundary cases show exactly where the line is drawn, which definitions alone often fail to do. Repetition does not resolve ambiguity, long explanations do not define the boundary, and merging labels changes the business requirement instead of meeting it. Keep examples varied so the model does not copy surface features.
Check yourself 2
Scenario: Structured data extraction
A prompt includes a long contract, the extraction instructions and two examples, all as plain paragraphs. Claude sometimes treats example text as if it were part of the contract. What is the best fix?
A. Remove the examples altogether, since they are the part being confused with the contract
B. Move the examples to the end of the prompt, after the contract text has been given
C. Wrap the contract, instructions and examples in separate, clearly named XML-style tags
D. Put a one-line reminder of where the contract starts just before the contract text
Show answer and explanation
Answer: C. Clear delimiters separate data from instructions and examples and allow unambiguous references ("extract only from the contract tag"). Reordering without separators still leaves boundaries unclear, a reminder before the contract does not mark where it ends or where examples begin, and dropping the examples throws away their benefit.