What you will be able to do
- Identify the failure pattern behind a weak Claude response and choose the prompting technique that fixes it
- Decide between native thinking and manual chain-of-thought prompting based on the model and its thinking configuration
- Use few-shot examples and structured outputs to fix format failures without paying for extra reasoning
- Recognise when sequential prompt chaining is needed and when a single call does the job
Key concept
Failure-matched technique selection — Every prompting technique fixes a particular kind of failure and costs tokens in a particular way. First work out what went wrong (format, reasoning, schema validity or pipeline control), then add the cheapest technique that fixes that failure and nothing more.
1.Diagnose the failure before adding a technique
A plain zero-shot prompt, meaning clear instructions with no examples and no requested reasoning, is the starting point. Many failures go away once you make the instructions more specific. Claude responds well to explicit direction about output format and constraints, and it does better when you explain why a rule exists, because it can generalise from the reason. Before you add machinery, check whether a colleague with no context could follow the prompt. If they would be confused, Claude will be too.
When clearer instructions are not enough, look at what kind of failure you have. A response can have the right content in the wrong shape. It can be a wrong answer to a problem that needed intermediate work. It can be JSON that a parser rejects. Or it can come from a multi-stage process whose stages nobody can see. Each of these has its own fix, and each fix costs something different. Examples sit in the input. Thinking tokens are billed as output. Extra API calls multiply the whole request. A technique that targets the wrong failure adds cost and leaves the defect in place.
| Observed failure | Technique | Where the cost lands |
|---|---|---|
| Right content, drifting format, tone or spelling | Few-shot examples in <examples> tags | Input tokens for the examples |
| Wrong answers on multistep math, coding or analysis | Native thinking, depth set by effort | Thinking billed as output tokens |
| Malformed JSON, missing fields, wrong types | Structured outputs via output_config.format | Schema constrains decoding; no retries |
| Stages must be logged, audited or branched on | Prompt chaining: one API call per stage | One full request per stage |
Prompting is not always the answer. Some failing evals are about latency or cost, and those are often easier to fix by changing models than by changing the prompt. The trade-offs between tiers are covered in model tier selection.
Checkpoint 1 of 9· Match them up
Clearer instructions did not fix these failures. Match each technique to the failure it fixes.
Tap a term, then the definition that fits it.
Each technique fixes one kind of failure. Examples fix shape and tone. Thinking fixes reasoning. Schema-constrained decoding fixes JSON validity. Separate calls give you stage outputs you can see and audit. If you pick the wrong technique, you pay for it and the defect stays.
“Examples are one of the most reliable ways to steer Claude’s output format, tone, and structure.”Source: platform.claude.com
2.Few-shot examples fix format drift
If the content is correct and only the shape varies, the model needs to be shown the shape, not given more time to think. Few-shot (or multishot) prompting does this by adding a few input/output pairs to the prompt. This makes output more accurate and more consistent, and the cost is the input tokens the examples take up. Thinking does not touch the problem, because the model was not getting the label wrong. It was wrapping a correct label in inconsistent prose.
How you write the examples matters as much as having them. Good examples are:
- Relevant: they closely match the real inputs, such as real-looking tickets for a ticket triager.
- Diverse: they cover edge cases and vary enough that Claude does not copy an accidental pattern, such as every example ending with the same label.
- Structured: each one is wrapped in an example tag, with the whole set inside an examples tag, so Claude can tell them apart from the instructions.
Thinking does not replace examples. When thinking is on, worked examples in the prompt shape how Claude approaches similar problems inside its own thinking blocks. For reasoning tasks, write each example as three parts: the problem, the method to apply, and the expected answer. The examples are ordinary prompt content, so they are still read and used whatever the thinking setting.
Checkpoint 2 of 9· Check yourself
A team moves a multistep pricing-analysis prompt to a deployment with thinking turned on. The prompt has several worked examples, and an engineer suggests removing them to save input tokens. What should the team do?
Examples are ordinary prompt content, so Claude still uses them when thinking is on. Worked examples shape how Claude reasons about similar problems inside its thinking blocks, so each one should show the problem, the method and the answer. If you cut the method, the examples lose the part that guides the reasoning.
“Worked examples in your prompt shape how Claude approaches similar problems in its own thinking blocks.”Source: platform.claude.com
Checkpoint 3 of 9· Exam question
Which statement correctly describes how few-shot examples interact with thinking on current Claude models?
Correct answer: A — Worked examples in the prompt shape how Claude approaches similar problems in its thinking blocks, so write each as problem, method, answer.
- A. Docs state that multishot examples work with thinking and influence how the model reasons in its thinking blocks. Presenting problem, method and expected answer is the recommended shape.
- B. Prompt examples are not ignored when thinking is on. They remain input that steers both reasoning and output, so the claim that thinking overrides them is wrong.
- C. No prefilled assistant turn is needed, and prefill on the last assistant turn is not supported on newer models. Examples go in the prompt like any other input.
- D. Prompt content, examples included, is billed as input tokens. Only the thinking the model generates is billed as output tokens, so examples remain usable.
Checkpoint 4 of 9· Exam question
You are the architect of a support-ticket triage service that calls Claude through the Messages API. A zero-shot prompt defines five priority labels. The labels chosen are almost always right, but the output format drifts: some responses add a sentence of rationale, others use lowercase or synonyms, and the downstream router rejects about one response in ten. Which change fixes this failure pattern for the lowest added token cost?
Correct answer: B — Add three to five diverse sample tickets to the prompt in <examples> tags, each paired with a bare label in the approved spelling.
- A. Extended deliberation helps when the model picks wrong answers, but the labels here are already almost always right. Thinking does not constrain the output format, and its tokens are billed as output, so it raises cost while the drift stays.
- B. Few-shot examples are the standard way to steer output format and consistency. A handful of diverse, tagged ticket-and-label pairs showing bare label strings with no rationale adds only a few hundred input tokens and targets the observed drift directly.
- C. Three sequential calls resend the ticket and add latency and tokens on every ticket, far more than a few examples in one prompt. Chaining pays off when intermediate outputs must be inspected, which the failure here does not require.
- D. The reasoning was never the problem, since the labels are already right, and reasoning text adds output tokens to each response. A regex can pull out a correctly spelled label but cannot turn synonyms into one of the five allowed labels.
Sources1
3.Native thinking versus prompted chain-of-thought
Thinking is for failures that come from answering in one pass. A model with no scratch space has to get everything right on the first attempt. Thinking lets Claude restate the problem, try approaches, check intermediate results and drop paths that don't work before it answers. That improves performance on math, coding, analysis and long-running agentic work. The cost is real: thinking tokens are billed as output tokens even when the thinking text is not returned, and they count toward max_tokens.
On current models thinking is adaptive. For each request, Claude judges how complex it is and decides whether to think and how much. A simple factual question may get a direct answer with no thinking block. A tricky debugging task gets deep reasoning. The main control is the effort parameter, set at output_config.effort. Effort applies to every output token, so it works with or without thinking. If Claude thinks more than your workload needs, lower the effort before you try prompt-based steering.
# After: adaptive thinking with effort
client.messages.create(
model="claude-opus-5-5",
max_tokens=16000,
thinking={"type": "adaptive"},
output_config={"effort": "high"},
messages=[{"role": "user", "content": "..."}],
)Manual chain-of-thought is a fallback for when thinking is off. You ask Claude to work through the problem before answering and to put the final answer in answer tags so it can be extracted. Whether thinking is off depends on the model. Some older models think only when you ask them to. Several current models think by default. On Claude Fable 5.2, Claude Fable 5.1, Claude Fable 5, Claude Opus 5.5, Claude Opus 5 and Claude Sonnet 5.5, rely on native thinking, at a lower effort if cost matters. A prompt that asks those models to write their reasoning out in thinking tags might be declined.
| Model | No thinking field | thinking: disabled |
|---|---|---|
| Claude Opus 5.5 | Adaptive thinking | 400 error |
| Claude Sonnet 5.5 | Adaptive thinking | 400 error (use between_tools) |
| Claude Haiku 5.5 | Adaptive thinking | Thinking off at high effort or below |
| Claude Opus 4.8 | Thinking off | Thinking off |
| Claude Sonnet 4.6 | Thinking off | Thinking off |
When you do steer reasoning with words, keep it general. A prompt like "think thoroughly" often produces better reasoning than a step-by-step plan written by hand, because Claude's reasoning often goes beyond what a person would prescribe. Self-check instructions such as "verify your answer against these tests" catch errors reliably on most models. Claude Opus 5 is the exception: it already verifies its own work, and carried-over verification instructions make it over-verify, which adds tokens and latency. On that model, delete those instructions rather than rewording them.
Checkpoint 5 of 9· Check yourself
You're moving a prompt from an older model to Claude Opus 5.5. The prompt says "think step by step inside thinking tags, then answer." Accuracy on the multistep analysis matters, and so does keeping cost down. What is the right change?
Manual chain-of-thought is a fallback for when thinking is off. On Claude Opus 5.5, thinking is always on, sending 'disabled' returns a 400 error, and a request to write out reasoning in thinking tags might be declined. Lowering effort is how you control thinking cost. General guidance also works better than a step-by-step plan written by hand.
“rely on thinking instead, at a lower effort level if cost or latency matters: a prompt that asks the model to write out its reasoning”Source: platform.claude.com
4.Structured outputs when code parses the reply
If the reply goes straight into a parser, examples alone leave some risk. Even with careful prompting, JSON can come back with syntax errors, missing required fields, inconsistent types or schema violations, and each of those forces a retry. Structured outputs remove that risk at decode time. You send a JSON schema in output_config.format, and constrained decoding guarantees the response matches it. Strict tool use (strict: true) gives the same guarantee for tool names and inputs.
output_config={
"format": {
"type": "json_schema",
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"email": {"type": "string"},
"plan_interest": {"type": "string"},
"demo_requested": {"type": "boolean"},
},
"required": ["name", "email", "plan_interest", "demo_requested"],
"additionalProperties": False,
},
}
},Pick structured outputs when downstream code branches on a field: extraction into an invoice record, a classification with category and confidence, or a review verdict that routes work. Pick examples when the output is free text whose tone or layout has to stay consistent. The two can be combined. A schema fixes the structure, and examples show what good values look like. Schema constraints the API does not support, such as minimum, are moved into field descriptions by the SDK helpers, and a helper that validates responses still enforces them in your code.
Checkpoint 6 of 9· Fill the gap
This request needs a reply that a parser can rely on to match the schema. Which key under output_config carries the JSON schema?
output_config={
" ? ": {
"type": "json_schema",
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"email": {"type": "string"},
"plan_interest": {"type": "string"},
"demo_requested": {"type": "boolean"},
},
"required": ["name", "email", "plan_interest", "demo_requested"],
"additionalProperties": False,
},
}
},The JSON schema goes in output_config.format with type "json_schema", and constrained decoding then guarantees that the reply matches it. The effort key also sits under output_config, but it controls how many tokens Claude spends, not the shape of the reply.
Source: platform.claude.comCheckpoint 7 of 9· Check yourself
An invoice-extraction service sends Claude's reply straight into a parser. The team added several well-written examples, but some replies are still rejected because required fields are missing or a number comes back as a string. What is the most direct fix?
Examples reduce format errors but do not remove them, and thinking targets reasoning failures, not schema validity. A schema in output_config.format guarantees required fields and correct types at decode time, so no retries or repair calls are needed.
“Structured outputs guarantee schema-compliant responses through constrained decoding”Source: platform.claude.com
Sources6
5.Prompt chaining when stages must be visible
Current models handle most multistep reasoning internally through adaptive thinking, so splitting a task across calls only to improve reasoning usually just costs more. Explicit prompt chaining, which breaks a task into a sequence of API calls, is for two other needs: inspecting intermediate outputs, and enforcing a fixed pipeline structure. A single call with thinking cannot give you either. Its intermediate work is in thinking blocks, which are a summary or empty, never the raw reasoning, so there is no stage output for an auditor to read or for your code to branch on.
The most common chain is self-correction. One call generates a draft, a second reviews it against criteria, and a third refines it based on the review. Because each step is a separate API call, you can log, evaluate or branch at any point. Combine this with structured outputs on the review call: return the verdict as a schema field, and the routing code reads a defined value instead of scanning prose. Asking for reasoning wrapped in thinking tags in one call and parsing it afterwards is not a substitute. The tagged text is not a guaranteed stage boundary, and some models decline the request.
Checkpoint 8 of 9· Check yourself
Compliance rules say a contract workflow must keep a record of the draft, the checklist review and the refined version. If the review fails, the contract must go to legal. Which design meets both requirements?
A thinking block holds a summary of the reasoning, or nothing at all. It is never a stage output that an auditor can inspect or that code can branch on. A tagged reasoning request is not a guaranteed stage boundary, and some models decline it. A summary written after the fact is not a real intermediate output either. Separate calls give you an output you can log at each step, and a schema field on the review gives the routing code a defined value to read.
“what you see is never the raw chain of thought: the text in a thinking block is a summary of Claude’s reasoning.”Source: platform.claude.com
Checkpoint 9 of 9· Exam question
A loan-document summarisation workflow on the Messages API must follow a fixed sequence of draft, review against a compliance checklist, and refinement. Auditors require inspecting every intermediate output, and routing depends on the review verdict. Which two techniques fit these stated needs? Choose two.(Select 2)
Correct answers: A, B — Run draft, review and refine as separate calls so each intermediate output can be logged, evaluated, and branched on.; Have the review call return its verdict under a JSON schema with structured outputs, so code can branch on a defined field.
- A. Explicit chaining remains the right technique when intermediate outputs must be inspected or a pipeline structure enforced. Each separate call is a point to log, evaluate or branch.
- B. A schema-constrained verdict gives the routing code a defined field to read, so branching does not depend on parsing free text.
- C. A single call hides the draft and review stages, so auditors cannot inspect them and routing cannot depend on a verdict that is never exposed.
- D. Examples shape style and format but give no visible checklist review step. The audit and routing requirements go unmet however good the summaries look.
- E. Tag-wrapped reasoning inside one call yields unstructured text that may be declined or reshaped, and it is not a separable stage that auditors or routing code can rely on.
Sources
(6)
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.”
↩︎ Diagnose the failure before adding a technique“Diverse: Cover edge cases and vary enough that Claude doesn’t pick up unintended patterns.”
↩︎ Few-shot examples fix format drift“Structured: Wrap examples in <example> tags (multiple examples in <examples> tags) so Claude can distinguish them from instructions.”
↩︎ Few-shot examples fix format drift“Present each example as a problem, the method to apply, and the expected answer.”
↩︎ Few-shot examples fix format drift“When thinking is off, you can still encourage step-by-step reasoning by asking Claude to think through the problem before it answers”
↩︎ Native thinking versus prompted chain-of-thought“Claude Opus 5 is the exception: it verifies its own work well without explicit instruction”
↩︎ Native thinking versus prompted chain-of-thought“With adaptive thinking and subagent orchestration, Claude handles most multistep reasoning internally.”
↩︎ Prompt chaining when stages must be visible“is still useful when you need to inspect intermediate outputs or enforce a specific pipeline structure”
↩︎ Prompt chaining when stages must be visible“Examples are one of the most reliable ways to steer Claude’s output format, tone, and structure.”
↩︎ Key concept“Worked examples in your prompt shape how Claude approaches similar problems in its own thinking blocks.”
↩︎ Exam trap 1“a prompt that asks the model to write out its reasoning, for example in <thinking> tags, might be declined.”
↩︎ Exam trap 2“Each step is a separate API call so you can log, evaluate, or branch at any point.”
↩︎ Exam trap 4“Examples are one of the most reliable ways to steer Claude’s output format, tone, and structure.”
↩︎ Checkpoint“Examples are one of the most reliable ways to steer Claude’s output format, tone, and structure.”
↩︎ Prediction“Worked examples in your prompt shape how Claude approaches similar problems in its own thinking blocks.”
↩︎ Checkpoint“rely on thinking instead, at a lower effort level if cost or latency matters: a prompt that asks the model to write out its reasoning”
↩︎ Checkpoint - 2.
“Not every success criterion or failing eval is best solved by prompt engineering.”
↩︎ Diagnose the failure before adding a technique“you can sometimes improve latency and cost more easily by choosing a different model.”
↩︎ Diagnose the failure before adding a technique - 3.
“This is why thinking improves performance on complex tasks such as math, coding, analysis, and long-running agentic work”
↩︎ Native thinking versus prompted chain-of-thought“the text in a thinking block is a summary of Claude’s reasoning”
↩︎ Prompt chaining when stages must be visible“the tokens Claude spends reasoning are billed as output tokens, even when the thinking text isn’t returned to you”
↩︎ Exam trap 3“what you see is never the raw chain of thought: the text in a thinking block is a summary of Claude’s reasoning.”
↩︎ Checkpoint - 4.
“If you want Claude to think less often, lower the effort level before reaching for prompt-based steering.”
↩︎ Native thinking versus prompted chain-of-thought - 5.
“Because effort applies to every output token, it works with or without thinking.”
↩︎ Native thinking versus prompted chain-of-thought - 6.
“Structured outputs constrain Claude’s responses to follow a specific schema, ensuring valid, parseable output for downstream processing.”
↩︎ Structured outputs when code parses the reply“Without structured outputs, Claude can generate malformed JSON responses or invalid tool inputs that break your applications.”
↩︎ Structured outputs when code parses the reply“Structured outputs guarantee schema-compliant responses through constrained decoding”
↩︎ Checkpoint