CONCEPT Examples are the highest-leverage steer
Examples are one of the single most reliable ways to steer Claude's output — its format, tone, and structure. Anthropic's own guidance puts it plainly: a few well-crafted examples (called few-shot or multishot prompting) improve accuracy and consistency more dependably than any amount of abstract description. A prose instruction like "return the result as a concise JSON object" leaves dozens of decisions open — key names, casing, nesting, how to handle a missing field. A single concrete example closes all of them at once by demonstrating the exact shape you want.
The mechanism is pattern completion. When Claude sees two or three input→output pairs, it infers the latent function connecting them and applies it to the real input. This does two things instructions alone can't: it pins the exact output shape (so you get parseable, uniform results), and it reduces misinterpretation of ambiguous instructions (Claude sees what you meant, not just what you said).
| Approach | What Claude gets | Typical result |
|---|---|---|
| Zero-shot (tell only) | An abstract description of the task | Correct-ish, but format & edge-case handling drift |
| One-shot | One concrete input→output pair | Format locked; still guesses on variety |
| Multishot (3–5 examples) | The pattern plus its range | Consistent shape, fewer misreads, edge cases covered |
DIAGRAM Tell vs. show
from abstract words"] Q -->|"3–5 worked examples (multishot)"| SHOW["Claude pattern-matches
the demonstrated shape"] TELL --> DRIFT["🟠 Format drift
ambiguity misread"] SHOW --> LOCK["🟢 Shape locked
misreads reduced"] classDef ok fill:#d4edda,stroke:#28a745,color:#155724; classDef gate fill:#ffe8cc,stroke:#ff9f40,color:#9a4a0a; class LOCK ok; class DRIFT gate;
CODE Zero-shot vs. multishot on the same task
Same classifier, two prompts. The multishot version demonstrates the exact label vocabulary and output
shape instead of hoping Claude guesses it. Note the current model id claude-opus-4-8 and the
top-level system parameter carrying the instruction, with the few-shot examples in the
user turn.
# BAD — zero-shot: format & label set left to chance system = "Classify the support ticket's urgency." user = "The checkout page 500s for every user." # → "This seems highly urgent..." (prose, not a label — unparseable) # GOOD — multishot: examples pin the label set AND the shape system = "Classify each support ticket's urgency as one of: P0, P1, P2." user = """<examples> <example> <ticket>Login works but the logo is slightly misaligned.</ticket> <urgency>P2</urgency> </example> <example> <ticket>Checkout 500s for every user; no one can pay.</ticket> <urgency>P0</urgency> </example> </examples> <ticket>Password reset emails are delayed by ~10 minutes.</ticket>""" message = client.messages.create( model="claude-opus-4-8", max_tokens=16000, system=system, messages=[{"role": "user", "content": user}], ) # → "P1" (exactly the vocabulary and shape the examples demonstrated)
TRADE-OFFS What examples cost you
✅ Adding examples
- Locks output format & label vocabulary
- Reduces misinterpretation of vague instructions
- Improves accuracy and consistency across runs
- Cheaper to write than an exhaustive spec
⚠️ The costs
- Every example is input tokens on every call
- Poorly chosen examples steer wrongly (see 3.5)
- Too few / too narrow → over-fit to their surface form
- Inconsistent example formatting confuses Claude
EXAM TRAPS
PRACTICE
Q1 · Why do examples reduce misinterpretation better than more instructions?
Instructions describe the task abstractly and leave many decisions (format, casing, edge cases, label vocabulary) unspecified. An example demonstrates the resolved output, so Claude pattern-matches the exact shape you meant rather than guessing from words. This is why multishot reliably improves accuracy and consistency.
Q2 · When is multishot most worth the token cost?
When output must be uniform (parsed downstream), stylistically specific (a house tone/format), or the instruction is hard to phrase precisely. In those cases a few examples are cheaper and more reliable than an exhaustive prose spec.
Q3 · Do examples replace clear instructions?
No. They disambiguate instructions. The strongest prompts combine a short, direct instruction with 3–5 examples that show it applied — instructions state intent, examples pin the exact realization.