Rubric
Contents — domains, guide and mocks

Zero-shot, few-shot and chain-of-thought

CCAR-P 2.312 min read · checked 21 September 2026

Task statementApply prompt engineering techniques (zero-shot, few-shot, chain-of-thought)

Which technique does this failure call for?

Zero-shot output falls short — how?
  • Wrong format, tone or labels
    Add few-shot examples3–5, diverse, in <example> tags
  • Wrong multi-step reasoning
    Let Claude thinkadaptive thinking, raise effort
  • Need to inspect each stage
    Chain promptsdraft, review, refine as separate calls
  • Instructions were vague
    Fix the zero-shot promptclearer task, context, criteria
Start from what is going wrong, not from a favourite technique. Several branches can apply at once — examples and thinking combine well.

Zero-shot: the baseline you always try first

A zero-shot prompt gives instructions and no worked examples. With current models it is the right starting point for most tasks, and it is only as good as its clarity. The best-practices guide’s golden rule is to show the prompt to a colleague with no context: if they would be confused, Claude will be too. State the task, the audience, the constraints and the output format; explain why rules matter; and number the steps when order is important.

The prompt engineering overview adds a precondition that architects should enforce: before tuning prompts, have success criteria, a way to test against them, and a first draft. Otherwise you cannot tell whether a technique helped. It also notes that some failures — latency and cost in particular — are better solved by choosing a different model than by prompting (covered in 2.1).

Few-shot: show, don’t just tell

The guide calls examples one of the most reliable ways to steer format, tone and structure, and recommends three to five of them. Make them relevant (close to real inputs), diverse (covering edge cases and varied enough that Claude does not latch onto an accidental pattern) and structured (each in <example> tags, grouped in <examples>, so they are not mistaken for instructions). Anthropic’s context-engineering post puts it as curating diverse, canonical examples rather than stuffing in a laundry list of every edge case.

Examples that teach versus examples that mislead

Look-alike examplestext

<examples>
<example>
Ticket: Charged twice.
Queue: billing
</example>
<example>
Ticket: Wrong invoice amount.
Queue: billing
</example>
<example>
Ticket: Refund not received.
Queue: billing
</example>
</examples>

Diverse, canonical examplestext

<examples>
<example>
Ticket: Charged twice for May.
Queue: billing
</example>
<example>
Ticket: VPN drops every hour
since the update; I can't
reach the file server.
Queue: network
</example>
<example>
Ticket: Laptop stolen, had
payroll files on it.
Queue: security (urgent)
</example>
</examples>
On the left, every example is a short complaint labelled “billing”, so Claude learns length and topic, not the rule. On the right, examples vary in length and topic and include the hard case.

Chain-of-thought: then and now

Chain-of-thought means getting the model to reason before it answers, so multi-step problems — calculations, policy application, diagnosis — are worked through rather than guessed. Classic prompt engineering did this in text: “think step by step”, or tags that separate <thinking> from <answer>. On current Claude models this capability is built in. Adaptive thinking (thinking: {"type": "adaptive"}) lets Claude decide per request whether to reason and how much, and the effort parameter is the main dial. The docs report that thinking is on by default on Opus 5 and Sonnet 5 when the parameter is omitted, and always on for Fable 5.1.

Two ways to get reasoning before an answer

Manual chain-of-thought (prompt text)

  • “Reason through this” plus <thinking> and <answer> tags
  • Reasoning is ordinary output you parse and strip
  • The fallback when thinking is off
  • Wording-sensitive; you pay for every visible token

Built-in thinking (API)

  • thinking: {type: "adaptive"} with effort
  • Reasoning arrives in separate thinking blocks
  • Claude skips it on easy requests
  • Billed as output even when display is omitted

The best-practices guide gives four pieces of advice for reasoning on current models. Prefer general instructions over prescriptive steps: “think thoroughly” often beats a hand-written plan, because the model’s reasoning frequently exceeds what a human would prescribe. Examples and thinking combine: put <thinking> sections inside your few-shot examples to show the reasoning pattern you want. Use manual chain-of-thought as a fallback when thinking is off — though on Opus 5 the guide prefers keeping thinking on at lower effort. And asking Claude to verify against test criteria catches errors, except on Opus 5, which already verifies well and can over-verify.

Few-shot plus built-in thinking for a claims policy (illustrative)python
EXAMPLES = """<examples>
<example>
<claim>Order 5 days late; customer paid for express.</claim>
<thinking>Express was paid, so the late-delivery policy
applies. Over 3 days late is tier 2, not tier 1.</thinking>
<answer>Eligible: tier 2 credit</answer>
</example>
<example>
<claim>Parcel arrived damaged; no photo supplied.</claim>
<thinking>Damage claims need a photo under the policy, so
the decision waits on evidence.</thinking>
<answer>Needs review: photo missing</answer>
</example>
</examples>"""

response = client.messages.create(
    model="claude-sonnet-5",
    max_tokens=8000,                     # room for thinking + answer
    thinking={"type": "adaptive"},
    output_config={"effort": "high"},
    system="You assess delivery claims.
" + POLICY + EXAMPLES,
    messages=[{"role": "user", "content": f"<claim>{claim}</claim>"}],
)

Thinking is steerable. The steering-thinking page says to set effort first and add prompt guidance only if triggering still does not match your needs. A system-prompt line such as “use extended thinking only when it will meaningfully improve quality” reduces it; “this task involves multistep reasoning, think carefully” encourages it; and a phrase appended to a single user message steers just that turn. Measure any steering on real traffic, because it trades quality for latency.

TechniqueBest forCostWatch out for
Zero-shotClear tasks with obvious outputLowestVague instructions masquerading as a model problem
Few-shotFormat, tone, labels, boundary casesExtra input tokens on every call (cacheable)Look-alike examples that teach the wrong pattern
Built-in thinkingMulti-step reasoning, planning, tool-heavy agentsOutput tokens and latencymax_tokens too small once thinking starts
Manual CoT in textModels or settings with thinking offVisible output tokensParsing the answer out of the reasoning
Prompt chainingAuditable pipelines, self-correctionMore callsChaining what one call with thinking could do

Self-correction as a prompt chain

  1. Draftgenerate the first answer
  2. Reviewcheck against stated criteria
  3. Refinefix what the review found
  4. Gatelog, evaluate or route to a human
The guide still recommends explicit chaining when you need to inspect or log intermediate outputs. Each arrow is a separate API call you can evaluate.

Traps the wrong answers are built from

Tempting but wrongDo this instead
Adding “think step by step” to every promptUse thinking where multi-step reasoning is needed and keep simple, latency-critical calls direct.
Few-shot examples that share one length, topic or phrasingUse 3–5 relevant, diverse examples, including the hardest boundary case.
Hand-writing a rigid reasoning procedure for a model that thinksGive goals and context; prefer general instructions like “think thoroughly”.
Fixing a reasoning failure with more output examplesDiagnose the failure type; enable or raise thinking for reasoning errors.
Tuning prompts with no success criteria or test setDefine criteria and an eval first, then compare techniques on it.

You should now be able to

  • Write clear zero-shot prompts and recognise when a failure is really an unclear instruction.
  • Design few-shot examples that are relevant, diverse and tagged.
  • Apply chain-of-thought through adaptive thinking and effort, or manual tags when thinking is off.
  • Combine examples with reasoning by showing thinking inside examples.
  • Choose prompt chaining when intermediate outputs must be inspected or logged.
  • Match each technique to its cost in tokens and latency.

Practice questions

Original questions written for this lesson, in the exam’s style. Answer first, then open the reasoning — every option is explained, including why the wrong ones are tempting.

  1. Question 1

    An insurer’s claim-triage prompt produces sensible decisions, but the output field names change from request to request, breaking the downstream parser.

    Which technique most directly addresses this?

    1. AEnable adaptive thinking at max effort for every claim.
    2. BAdd a few diverse, tagged examples of the exact output.
    3. CAsk Claude to reason step by step before answering.
    4. DSplit the task into five chained prompts for each field.
    Show answer and reasoning
    1. AIncorrect. More reasoning does not fix inconsistent field names, and it adds cost and latency.
    2. BCorrect. Examples are one of the most reliable ways to steer format; combined with a clear format spec they stabilise the fields.
    3. CIncorrect. The decisions are already sensible; this is a format problem, not a reasoning problem.
    4. DIncorrect. Chaining multiplies calls without addressing why the structure drifts.
  2. Question 2

    A retailer’s pricing assistant must apply stacked promotions (percentage off, then a voucher, then a loyalty cap). It gets single discounts right but miscalculates stacked ones.

    Which two changes are most appropriate? (Select 2.)

    1. AEnable adaptive thinking with a suitable effort level so Claude works through the steps.
    2. BInclude an example whose <thinking> section applies the promotions in the correct order.
    3. CAdd ten more examples of single-discount answers.
    4. DWrite “NEVER miscalculate” in the system prompt.
    5. EMove to a smaller, faster model to reduce latency.
    Show answer and reasoning
    1. ACorrect. This is a multi-step reasoning failure, which is exactly what thinking addresses.
    2. BCorrect. Showing the reasoning pattern inside an example helps Claude generalise it.
    3. CIncorrect. Those cases already work; more of them do not teach the stacking order.
    4. DIncorrect. It names the goal without giving a method.
    5. EIncorrect. It does nothing for accuracy and may make reasoning worse.
  3. Question 3

    An architect is migrating a prompt that ends with “Think step by step inside <thinking> tags, then answer in <answer> tags” to Claude Opus 5. What does current guidance suggest?

    1. AKeep the tags and also add a budget_tokens value for extra reasoning.
    2. BRemove all reasoning, since Opus 5 cannot reason about multi-step tasks.
    3. CRely on built-in adaptive thinking, tuning effort, rather than text CoT.
    4. DKeep the text CoT and add “verify your answer twice” for safety.
    Show answer and reasoning
    1. AIncorrect. budget_tokens is rejected on Claude 4.7 and later models.
    2. BIncorrect. Opus 5 reasons well; the question is how reasoning is delivered.
    3. CCorrect. The guide treats manual CoT as a fallback and, on Opus 5, prefers thinking at a lower effort to disabling it.
    4. DIncorrect. The guide notes Opus 5 already verifies well and such instructions can cause over-verification.
  4. Question 4

    A support team uses Claude to classify 50,000 short chat messages an hour for sentiment. A consultant proposes adding chain-of-thought reasoning to every call to improve quality, although accuracy already meets the target.

    What is the best response?

    1. AAccept it, because reasoning always improves accuracy.
    2. BAccept it, but hide the reasoning so it is not billed.
    3. CReplace the classifier with a chain of three prompts.
    4. DDecline; keep the direct classifier and reserve reasoning for failing cases.
    Show answer and reasoning
    1. AIncorrect. Accuracy already meets the bar; reasoning would add tokens and latency for no measured gain.
    2. BIncorrect. Thinking is billed in full whether or not it is displayed.
    3. CIncorrect. More calls add latency and cost to a task that already works.
    4. DCorrect. Use the lightest technique that meets the criteria; add reasoning only where an eval shows it helps.

Sources

Drafted with AI assistance and checked against the sources above; expert review is in progress. Spotted an error? Tell us and it gets fixed, dated and listed on how this is written.