What you will be able to do
- Write a zero-shot prompt that states the task, the output and the reason behind each constraint
- Decide when a prompt needs examples, and start with one before adding more
- Choose and format few-shot examples that are relevant, diverse and clearly separated from instructions
Key concept
Few-shot (multishot) prompting — Few-shot prompting means putting a small number of worked examples in the prompt so Claude can copy the format, tone and structure you want. You add examples when instructions alone do not get you consistent output.
1.Zero-shot: instructions without examples
A zero-shot prompt describes the task and gives Claude no worked examples. Anthropic's documentation does not use the term "zero-shot". Its advice on writing clear instructions is still the advice for this case, because the wording of your instructions is all Claude has to go on. The core rule is that Claude responds well to clear, explicit instructions. If you want more than the minimum, you have to ask for it. Don't count on the model to infer that from a vague request.
The documentation compares two versions of one request. "Create an analytics dashboard" is the weak version. The strong version adds: "Include as many relevant features and interactions as possible. Go beyond the basics to create a fully-featured implementation." The task is the same. The second prompt also says how much work is expected. The docs suggest a test: show your prompt to a colleague who knows little about the task. If they would be confused, Claude will be too. If the order or completeness of the steps matters, write the steps as a numbered or bulleted list.
The documentation prefers the version with a reason: "Your response will be read aloud by a text-to-speech engine, so never use ellipses since the text-to-speech engine will not know how to pronounce them." If you give the motivation behind a constraint, Claude can apply it to related cases the rule never names. A zero-shot prompt carries only the information you write into it, so this reasoning is an important part of it.
Sources1
2.Few-shot: show the output instead of describing it
Some requirements are hard to put into words, such as a house style for summaries, a tone, or a strict layout. For these, Anthropic calls examples one of the most reliable ways to steer Claude's output format, tone and structure. Claude's blog lists when examples are worth adding: the format is easier to show than describe, you need a specific tone or style, the task involves subtle patterns or conventions, or simple instructions haven't produced consistent results.
Here's an example of the summary style I want:
Article: [link to article about AI regulation]
Summary: EU passes comprehensive AI Act targeting high-risk systems. Key provisions include transparency requirements and human oversight mandates. Takes effect 2026.
Now summarize this article in the same style: [link to your new article]Examples add tokens and can add unintended patterns, so add them one at a time. The blog's advice is to start with one example (one-shot). Add more examples (few-shot) only if the output still does not match what you need. Treat it as a ladder: an instruction first, then one example, then several.
| Approach | What the prompt contains | When to reach for it |
|---|---|---|
| Zero-shot | Explicit instructions, constraints and the reasons for them | The output can be fully described in words |
| One-shot | Instructions plus a single example | The format or style is easier to show than to describe |
| Few-shot | Instructions plus several examples | One example still hasn't produced consistent results |
A team's support-ticket triage prompt asks Claude to output a category label and priority score, but real outputs vary in formatting and label spelling across similar tickets. The team has not yet included any example outputs in the prompt. Which change is most likely to make outputs consistent?
Correct answer: B — Wrap three to five diverse ticket-and-output pairs in <example> tags so Claude can pattern-match on the intended format and labels
- A. Incorrect. Raising temperature increases output variability rather than reducing it, and does nothing to establish a consistent output format or label vocabulary.
- B. Correct. Multishot (few-shot) prompting with several diverse, clearly demarcated examples is the documented technique for steering output format, tone, and structure toward consistency.
- C. Incorrect. A single example provides too little pattern diversity to reliably anchor formatting across varied ticket types, and best-practice guidance recommends three to five examples.
- D. Incorrect. Adding an unrelated summarization and self-explanation step does not address the underlying lack of demonstrated output format and may introduce further inconsistency.
3.Picking examples that teach the right pattern
Claude copies what it sees in examples, so a careless example teaches the wrong thing. The blog warns that Claude 4.x and similar models pay very close attention to details in examples. If every example opens the same way or has the same length, Claude may copy that too. The prompting guide gives three properties to aim for. Examples should be relevant, meaning they closely mirror your real use case. They should be diverse, meaning they cover edge cases and vary enough that Claude doesn't pick up unintended patterns. And they should be structured, meaning each is wrapped in <example> tags, with the set inside <examples>, so Claude can tell them apart from instructions.
When outputs go wrong, it is tempting to add another rule for each failure. Anthropic's context-engineering guidance advises against stuffing a laundry list of edge cases into a prompt. It recommends curating a set of diverse, canonical examples that show the expected behaviour. The Sonnet 5 prompting guide makes a related point: positive examples of the behaviour you want tend to work better than negative examples or instructions about what not to do.
Take out the prohibitions and add one or two positive examples of replies at the length and level of detail you want. Positive examples of the right level of concision tend to work better than negative examples or instructions about what not to do.
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.The more edge-case rules you write into the prompt, the more reliably Claude will behave.Why is that wrong?
Anthropic advises against listing every edge case as a rule. It recommends a small, curated set of diverse, canonical examples that show the expected behaviour.
2.Several near-identical examples are the safest way to lock in a format.Why is that wrong?
Near-identical examples teach their accidental similarities as well. Examples should vary enough that Claude doesn't pick up patterns you didn't intend.
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practicesOfficial docs
“Claude responds well to clear, explicit instructions. Being specific about your desired output can help enhance results.”
↩︎ Zero-shot: instructions without examples“explicitly request it rather than relying on the model to infer this from vague prompts.”
↩︎ Zero-shot: instructions without examples“Provide instructions as sequential steps using numbered lists or bullet points when the order or completeness of steps matters.”
↩︎ Zero-shot: instructions without examples“Claude is smart enough to generalize from the explanation.”
↩︎ Zero-shot: instructions without examples“Examples are one of the most reliable ways to steer Claude's output format, tone, and structure.”
↩︎ Few-shot: show the output instead of describing it“Structured: Wrap examples in <example> tags (multiple examples in <examples> tags) so Claude can distinguish them from instructions.”
↩︎ Picking examples that teach the right pattern“A few well-crafted examples (known as few-shot or multishot prompting) improve accuracy and consistency.”
↩︎ Key concept“Diverse: Cover edge cases and vary enough that Claude doesn't pick up unintended patterns.”
↩︎ Exam trap 2 - 2.https://claude.com/blog/best-practices-for-prompt-engineeringSecondary source
“Pro tip: Start with one example (one-shot). Only add more examples (few-shot) if the output still doesn't match your needs.”
↩︎ Few-shot: show the output instead of describing it“Claude 4.x and similar advanced models pay very close attention to details in examples.”
↩︎ Picking examples that teach the right pattern - 3.https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-sonnet-5Official docs
“Positive examples showing how Claude can communicate with the appropriate level of concision tend to be more effective than negative examples”
↩︎ Picking examples that teach the right pattern
Also cited
“Instead, we recommend working to curate a set of diverse, canonical examples that effectively portray the expected behavior of the agent.”
↩︎ Exam trap 1