CertSafari
    Anthropic Claude Certified Architect – Professional (CCAR-P) - December 7 onwards· Lessons

    Domain 2 · Lesson 9/39

    Prompting technique selection: few-shot, thinking, structured output and chaining

    Prompting Technique Selection

    17 min read
    2.17% of exam
    6 sources
    Published 18 Nov 2026
    Docs as of 18 Nov 2026

    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.

    Failure patterns mapped to the technique that addresses them
    Observed failureTechniqueWhere the cost lands
    Right content, drifting format, tone or spellingFew-shot examples in <examples> tagsInput tokens for the examples
    Wrong answers on multistep math, coding or analysisNative thinking, depth set by effortThinking billed as output tokens
    Malformed JSON, missing fields, wrong typesStructured outputs via output_config.formatSchema constrains decoding; no retries
    Stages must be logged, audited or branched onPrompt chaining: one API call per stageOne 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.

    Sources12

    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?

    Checkpoint 3 of 9· Exam question

    Which statement correctly describes how few-shot examples interact with thinking on current Claude models?

    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?

    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.

    Adaptive thinking with depth controlled by effort rather than a manual token budgetpython
    # 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.

    What selected models do with the thinking configuration
    ModelNo thinking fieldthinking: disabled
    Claude Opus 5.5Adaptive thinking400 error
    Claude Sonnet 5.5Adaptive thinking400 error (use between_tools)
    Claude Haiku 5.5Adaptive thinkingThinking off at high effort or below
    Claude Opus 4.8Thinking offThinking off
    Claude Sonnet 4.6Thinking offThinking 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?

    Sources3451

    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.

    A JSON schema sent in output_config.format; every listed field is required and no extra properties are allowedpython
        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,
                },
            }
        },

    Checkpoint 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?

    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?

    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)

    0 of 2 selected

    Sources13

    Sources

    (6)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “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. 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. 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. 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. 5.
      “Because effort applies to every output token, it works with or without thinking.”
      ↩︎ Native thinking versus prompted chain-of-thought
    6. 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

    Ready to test yourself?

    Practise Anthropic Claude Certified Architect – Professional (CCAR-P) - December 7 onwards in quiz mode.

    Spotted a mistake, or was something unclear? Tell us.