What you will be able to do
- Write a small set of targeted examples that resolves an ambiguous choice, such as which of two tools to call
- Include the reasoning for why one action beat a plausible alternative
- Use paired examples to separate acceptable code patterns from genuine issues and cut false positives
- Use examples to stop extraction pipelines from fabricating values or returning empty required fields
1.Resolving ambiguous choices with examples
Formatting is the easy case. The harder one is a request that could reasonably go two ways. The model has to decide something, and the right decision depends on context the instructions don't spell out. Anthropic's context-engineering post puts the bar plainly: if a human engineer can't say for certain which tool should be used, an agent can't be expected to do better.
Anthropic's advanced tool use post names this situation as one where examples help most: similar tools where examples clarify which one to use, such as create_ticket vs create_incident. Its advice on writing those examples is just as pointed: focus on ambiguity, and only add examples where correct usage isn't obvious from the schema. A schema can say what is valid. It can't say which of two valid choices fits a borderline request. The post warns that these gaps lead to malformed tool calls and inconsistent parameter usage.
The prompting guide's diversity rule applies here as well. If every example is an easy, unambiguous request, Claude learns nothing about the borderline. The example set should be built around the requests that actually split between the two tools.
Checkpoint 1 of 8· Check yourself
Where does Anthropic's advanced tool use post say tool examples are most worth their extra tokens?
The post lists similar tools as a 'most beneficial' case and lists the other three as 'less beneficial'.
“Similar tools where examples clarify which one to use (e.g., create_ticket vs create_incident)”Source: www.anthropic.com
Checkpoint 2 of 8· Exam question
A pull-request review agent is meant to flag branches (conditional paths) that lack test coverage. In practice it inconsistently flags newly introduced branches that are already exercised indirectly by an existing integration test, producing noisy false positives that erode reviewer trust. Detailed instructions about 'coverage' have not resolved the inconsistency. What should the team add to the prompt?
Correct answer: A — A couple of examples pairing a diff with a coverage judgment: one branch with no test, one covered indirectly
- A. Correct. Showing a genuinely uncovered branch alongside a lookalike branch that is indirectly covered, with the resulting judgment for each, demonstrates the exact distinction the agent needs to generalize, which is the ambiguous-case handling that few-shot examples are designed to convey.
- B. Flagging every new branch unconditionally removes the judgment call entirely and guarantees the same false-positive pattern the team is trying to eliminate, since indirectly covered branches would still be flagged.
- C. An arbitrary line-count threshold is unrelated to whether a branch actually has test coverage and would let genuinely uncovered small diffs slip through while ignoring the indirect-coverage ambiguity entirely.
- D. Running the full suite and enforcing a strict coverage percentage swaps in a numeric gate instead of resolving the ambiguous case the prompt is failing on, and it does not use examples to teach the distinction.
2.Examples that show why, not just what
An example that shows only the final choice teaches what to do. An example that also shows why this action beat a plausible alternative teaches the rule for deciding, and Claude can carry that rule to cases you didn't write. The prompting guide supports both halves. It says multishot examples work with thinking, so an example can include its reasoning and not just its answer. It also says that explaining why a behaviour matters helps Claude understand your goals and give more targeted responses.
How many examples? The exam guide's working number is two to four targeted examples. The sources give ranges in the same spirit rather than a single figure. The blog says to start with one example and add more only if needed. The tool-examples post suggests one to five per tool and says to aim them at ambiguity. The context-engineering post says to prefer a curated canonical set to an exhaustive list. In practice, each example should cover a different ambiguity and briefly state why the alternative was rejected.
This works for any judgement call, not only tool selection. Take a test-coverage reviewer that keeps missing untested branches. Show it an example where a function's tests cover the main path but skip one conditional branch, with reasoning that explains why that gap counts and a covered branch doesn't. That is an application of the principle. The sources don't discuss test coverage specifically.
A realistic borderline request, the tool that was chosen, and one or two sentences explaining why the other tool was the wrong fit for this request. The same structure, repeated across two to four distinct borderline requests, gives Claude a decision rule rather than a list of memorised cases.
Checkpoint 3 of 8· Check yourself
Which example set best teaches Claude to choose consistently between two overlapping tools?
The guidance says to aim examples at ambiguity, and reasoning inside examples is supported. Clear-cut cases and keyword lists don't teach the borderline decision.
“Focus on ambiguity (only add examples where correct usage isn't obvious from schema)”Source: www.anthropic.com
Sources1
3.Separating acceptable patterns from genuine issues
Automated reviewers lose trust through false positives. A rule like 'flag pattern X' fires on every instance of X, including the many places where X is deliberate and correct. Writing more rules rarely helps, because what makes an instance acceptable is context that's hard to put into words.
Paired examples deal with this directly. Show one instance of the pattern that is acceptable, with a short reason, and one that is a genuine issue, with a short reason. The pair teaches the boundary between them, not the surface syntax. This is the diversity requirement in practice: vary the examples enough that Claude doesn't learn the unintended shortcut that this syntax always means a bug. Because Claude generalises from examples, the distinction carries over to code that looks nothing like the examples. That gives you fewer false positives without losing real findings.
Checkpoint 4 of 8· Check yourself
A reviewer flags every use of a certain pattern, and most flags fall on intentional, acceptable uses. Which prompt change best cuts false positives while still catching real problems?
Contrasting examples teach the boundary, so Claude can generalise it. Removing the check or raising thresholds hides real issues as well.
“Diverse: Cover edge cases and vary enough that Claude doesn't pick up unintended patterns.”Source: platform.claude.com
Checkpoint 5 of 8· Exam question
A team's code-review assistant prompt already spells out an exhaustive, itemized rubric for flagging issues, but reviewers still receive inconsistently formatted findings across runs: some list severity before location, others omit the suggested fix entirely. The team wants the most effective fix for this output-consistency problem. What should they do?
Correct answer: B — Add three to five worked examples in example tags that each show the exact field order and formatting wanted
- A. Piling on more prose instructions is the approach the team already tried; detailed instructions alone tend to produce inconsistent formatting because the model still has to infer the exact structure from a description rather than seeing it demonstrated.
- B. Correct. When detailed instructions alone produce inconsistent formatting, concrete input-output examples are the most reliable way to pin down the exact structure and field order, and a handful of well-chosen examples covering an edge case generalizes better than more prose.
- C. Temperature controls sampling randomness and can reduce run-to-run variance, but it does not teach the model what the correct field order or completeness should be, so structural inconsistency driven by ambiguous instructions would persist.
- D. Adding a second formatting pass adds latency and cost and does not address the root cause: the first call's instructions are still ambiguous about structure, so the second call inherits inconsistent input to reformat.
Sources1
4.Extraction: showing the honest answer for vague input
In extraction, the expensive failure is fabrication: a confident, precise value where the source is vague or silent. Anthropic's guide to reducing hallucinations starts with letting Claude say it doesn't know. It describes explicitly giving Claude permission to admit uncertainty as a simple technique that can drastically reduce false information. The prompt-engineering blog says the same: give explicit permission to express uncertainty instead of guessing.
Permission tells Claude that an honest non-answer is allowed. An example shows what that non-answer looks like in your format, which is the job few-shot prompting does best. The summarization cookbook's output has this pattern. Where the lease didn't address utilities or maintenance, the summary records 'Not explicitly specified' rather than inventing terms or dropping the field.
The sources don't discuss informal measurements, such as a vague quantity in a free-text note. The principle carries over, though. Include an example in which the vague input is recorded faithfully, with the informal wording kept or uncertainty marked, rather than turned into a made-up number. That keeps usable information and blocks the fabrication.
Checkpoint 6 of 8· Check yourself
An extractor sometimes invents precise values when the source text is vague. Which approach does Anthropic's guidance support?
Permission to admit uncertainty is a documented way to reduce false information, and an example fixes how that uncertainty is written down. Forcing or estimating a value encourages fabrication.
“Explicitly give Claude permission to admit uncertainty. This simple technique can drastically reduce false information.”Source: platform.claude.com
Checkpoint 7 of 8· Exam question
A team built a classification prompt with twenty exact input-output pairs, one for every edge case they had personally encountered in their historical data. The prompt performs well on those twenty inputs but degrades noticeably whenever a customer submits a new input that is similar to, but not identical to, one of the twenty. What change would best help the model generalize its judgment to these novel-but-similar inputs?
Correct answer: A — Reduce the twenty examples to a small set that makes the underlying decision rule visible to the model
- A. Correct. A small number of examples chosen to reveal the reasoning behind the classification, rather than an exhaustive literal catalog, lets the model generalize that judgment to novel inputs instead of only matching the specific cases it was shown.
- B. Continuing to add every literal case the team encounters reinforces exact-match behavior rather than the underlying pattern, so novel-but-similar inputs would remain likely to be misclassified.
- C. Removing examples entirely discards the demonstrated reasoning pattern altogether; instructions alone are typically less effective than well-chosen examples at conveying nuanced judgment for this kind of case.
- D. More token budget for reasoning does not supply the model with the demonstrated judgment pattern it is missing; the failure here is about what the model has been shown, not how much room it has to think.
5.Varied document structures and empty required fields
The opposite failure is a required field that comes back empty or null even though the information is in the document. Usually it sits somewhere unexpected. A citation may appear inline instead of in a bibliography, or methodology may be woven into other sections instead of having its own heading. If every example in the prompt uses the 'standard' layout, Claude has only ever seen the field in one place.
The sources don't discuss citations or methodology sections specifically. The guidance that applies is the guide's first two properties. Relevant means the examples mirror the documents you really process. Diverse means they cover the edge cases. In practice, include an example of each structural variant you meet, with the required field correctly extracted from wherever it appears. The tool-examples post makes the matching point about variety: show minimal, partial and full specification patterns. Its create_ticket set includes a call with a title only, which teaches that a sparse but correct answer is valid.
{
"title": "Add dark mode support",
"labels": ["feature-request", "ui"],
"reporter": {
"id": "USR-67890",
"name": "Alex Chen"
}
},
{
"title": "Update API documentation"
}Taken together with the previous section, this gives a balanced example set. Some examples show a field found in an unusual place, which fixes false nulls. Others show a field truly absent and recorded honestly, which prevents fabrication. Wrap each one in its own <example> tag so Claude can tell the examples apart from the instructions.
Checkpoint 8 of 8· Check yourself
An extractor returns null for a required field whenever papers put that information inline rather than in a dedicated section. What is the most targeted fix?
Examples should mirror the real inputs and cover their edge cases. Showing extraction from each layout teaches Claude where to look, while the other options hide the problem or throw away data.
“Relevant: Mirror your actual use case closely.”Source: platform.claude.com
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.To eliminate empty fields, instruct the extractor that every field must always contain a value.Why is that wrong?
Forcing a value where the source is vague pushes Claude to guess. The guidance is to allow uncertainty and show, by example, how to record it.
Covered in Extraction: showing the honest answer for vague input
2.Examples should cover the clear, typical requests for each tool so Claude learns the basics.Why is that wrong?
Examples are most useful where the correct choice isn't obvious. A set made only of clear-cut cases teaches nothing about the borderline.
Covered in Resolving ambiguous choices with examples
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
“Diverse: Cover edge cases and vary enough that Claude doesn't pick up unintended patterns.”
↩︎ Resolving ambiguous choices with examples“Multishot examples work with thinking.”
↩︎ Examples that show why, not just what“explaining to Claude why such behavior is important, can help Claude better understand your goals”
↩︎ Examples that show why, not just what“Diverse: Cover edge cases and vary enough that Claude doesn't pick up unintended patterns.”
↩︎ Separating acceptable patterns from genuine issues“Relevant: Mirror your actual use case closely.”
↩︎ Varied document structures and empty required fields - 2.https://www.anthropic.com/engineering/advanced-tool-useSecondary source
“These ambiguities can lead to malformed tool calls and inconsistent parameter usage.”
↩︎ Resolving ambiguous choices with examples“Show variety with minimal, partial, and full specification patterns”
↩︎ Varied document structures and empty required fields“Focus on ambiguity (only add examples where correct usage isn't obvious from schema)”
↩︎ Exam trap 2“Similar tools where examples clarify which one to use (e.g., create_ticket vs create_incident)”
↩︎ Checkpoint“Focus on ambiguity (only add examples where correct usage isn't obvious from schema)”
↩︎ Checkpoint - 3.https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/reduce-hallucinationsOfficial docs
“Explicitly give Claude permission to admit uncertainty. This simple technique can drastically reduce false information.”
↩︎ Extraction: showing the honest answer for vague input - 4.
“Utilities: Not explicitly specified”
↩︎ Extraction: showing the honest answer for vague input
Also cited
“Give the AI explicit permission to express uncertainty rather than guessing. This reduces hallucinations and increases reliability.”
↩︎ Exam trap 1