Part 2 Chapter 16 Last verified 2026-06-13 Fresh

Shaping Input — The Prompting Craft

The craft that shapes what goes into the agent — five moves in the source's own order (be clear, show examples, elicit reasoning, structure with XML and roles, chain). The lead mental model is the brilliant-but-new employee; examples are the most reliable lever; two techniques changed under newer models (manual chain-of-thought is now a fallback, prefill on the last assistant turn is deprecated); and chaining is single-thread decomposition, not orchestration.

Volatility: feature-surface
Tools compared: claude-codecross-tool
On this page
  1. The order is the lesson: five moves on one surface
  2. Clarity is the foundation — brief the brilliant new employee
  3. Examples are the most reliable lever — and they come with a dosage
  4. What changed: reasoning is now elicited by the model, not the prompt
  5. Structure and roles — durable craft, with one deprecation inside it
  6. Chaining is the escape hatch — and it is not orchestration
  7. Where this connects
  8. Patterns
  9. Quick reference
  10. Practice

The spine framed every tool as a slice of the context budget. This chapter turns to the other thing you put in the window: the prompt itself — the text that shapes what the agent reasons over. Anthropic documents the craft as five moves, and it documents them in an order that is itself a teaching device: clarity first, then examples, then reasoning, then structure, then chaining. This is single-vendor, authoritative-by-construction guidance — Anthropic’s own prompt-engineering docs — so the honest tier is official, not convergence. Two of the five moves have shifted under newer models, and the chapter renders them as the current state, not the technique they once were.

The order is the lesson: five moves on one surface

Anthropic’s prompt-engineering hub lists the techniques as one ordered set — they run “from clarity and examples to XML structuring, role prompting, thinking, and prompt chaining.” [Official] Prompt engineering overview · AnthropicT1-official original That ordering is not a table of contents; it is a gradient of effort. You reach for the cheap, high-leverage move first (say what you want clearly), and you escalate to the expensive, structural moves (chain several prompts) only when the cheaper ones do not carry the task.

This matters for an agent system specifically. The prompt is context, and context is the budget the whole volume is about. A prompt that achieves its effect with clarity and three examples spends far less of the window than one that leans on elaborate structure and a multi-step chain — and it leaves more room for the tools, the conversation history, and the work itself.

Clarity is the foundation — brief the brilliant new employee

The single highest-leverage idea in the craft is to be explicit, because the model does not share your context. Anthropic’s mental model is the one to lead with: “Think of Claude as a brilliant but new employee who lacks context on your norms and workflows.” [Official] Prompting best practices · AnthropicT1-official original The metaphor does real work — almost every other clarity technique is a corollary of “brief the new hire properly.”

Two such corollaries are documented directly. Sequence the instruction when order matters: “Provide instructions as sequential steps using numbered lists or bullet points when the order or completeness of steps matters.” [Official] Prompting best practices · AnthropicT1-official original And supply the why, not just the what — “providing context or motivation behind your instructions, such as explaining to Claude why such behavior is important” [Official] Prompting best practices · AnthropicT1-official original lets the model generalize the instruction to cases you did not enumerate.

Examples are the most reliable lever — and they come with a dosage

Among the five moves, examples carry the strongest reliability claim in the source. Anthropic states that examples are “one of the most reliable ways to steer Claude’s output format, tone, and structure.” [Official] Prompting best practices · AnthropicT1-official original For an agent, that is the cheapest way to pin down a shape you care about — a response format, a tone, a decision boundary — without writing a paragraph of rules the model then has to interpret.

Unusually for prompting guidance, this move comes with a concrete dosage and a selection rule. The dosage is the one verbatim number anchored anywhere in the underlying research: “Include 3–5 examples for best results.” [Official] Prompting best practices · AnthropicT1-official original The selection rule is relevance — make examples that “mirror your actual use case closely” [Official] Prompting best practices · AnthropicT1-official original (the same guidance adds diverse, covering edge cases, and structured, wrapped in tags). Anthropic’s own interactive tutorial independently treats examples as a named foundational technique, dedicating its “Using Examples” chapter to it — corroboration that this is core craft, though as a teaching artifact rather than the normative guidance. [Official] Anthropic's Prompt Engineering Interactive Tutorial · AnthropicT2-release-notes original

What changed: reasoning is now elicited by the model, not the prompt

The third move — eliciting step-by-step reasoning — is the first of two that have shifted under newer models, and the shift is a role-reversal. Manual chain-of-thought (telling the model to “think step by step”) used to be the default reasoning lever. It is now documented as a fallback: “When thinking is off, you can still encourage step-by-step reasoning by asking Claude to think through the problem.” [Official] Prompting best practices · AnthropicT1-official original The conditional — when thinking is off — is the whole point. Adaptive thinking now handles most multi-step reasoning internally as a model feature, so the prompting technique survives mainly for the case where that capability is unavailable.

The practical instruction for an agent builder: do not reach reflexively for “think step by step” in the system prompt. If thinking is available, it is doing that work already, and the manual instruction is redundant context. Reserve the prompting technique for the case it is now documented for.

Structure and roles — durable craft, with one deprecation inside it

The fourth move is the most stable part of the craft — except for one technique that has been retired outright.

Two of the three structuring techniques are documented-once, durable craft. XML tags “help Claude parse complex prompts unambiguously,” [Official] Prompting best practices: use XML tags · AnthropicT1-official original which matters most when a prompt mixes instructions, context, examples, and variable inputs — wrap each content type in its own tag so the model never has to guess where one ends and the next begins. And a role assignment in the system prompt is a one-line steering tool: “setting a role in the system prompt focuses Claude’s behavior and tone for your use case,” [Official] Prompting best practices · AnthropicT1-official original where even a single sentence makes a difference.

The third technique — prefilling the last assistant turn to steer format or skip a preamble — has been deprecated, not refined. On Claude 4.6+ models, “prefilled responses on the last assistant turn are no longer supported,” [Official] Prompting best practices · AnthropicT1-official original and a request that includes a prefilled assistant message now returns a 400 error. This is a former best-practice that became an error, and it must be rendered as the deprecation it is. The documented migration is to structured outputs for format control and to direct system-prompt instructions for skipping preambles.

Chaining is the escape hatch — and it is not orchestration

The fifth and most expensive move is to stop trying to do the job in one prompt and decompose it. Prompt chaining “decomposes a task into a sequence of steps, where each LLM call processes the output of the previous one,” [Official] Building effective agents · Erik Schluntz and Barry Zhang (2024)T1-official original and the workflow “is ideal for situations where the task can be easily and cleanly decomposed into fixed subtasks.” [Official] Building effective agents · Erik Schluntz and Barry Zhang (2024)T1-official original Explicit chaining stays worthwhile “when you need to inspect intermediate outputs or enforce a specific pipeline structure,” [Official] Prompting best practices · AnthropicT1-official original and its canonical shape is self-correction — generate a draft, have the model review it against criteria, have it refine based on the review. [Official] Prompting best practices · AnthropicT1-official original

Here is the boundary the rest of the volume depends on. Chaining is single-thread prompt decomposition: one conversation, a fixed sequence of calls, each feeding the next. It is not multi-agent orchestration — there is no second isolated window, no delegation, no runtime-chosen control flow. Reaching for sub-agents when a sequential pipeline would do is exactly the additive reflex the spine warned against, applied to coordination.

Where this connects

Two threads run out of this chapter. The first is the prefill deprecation: its migration target is structured outputs, the subject of the next chapter, which takes up forcing reliable machine-readable output where prefill used to. The second is the chaining boundary: the moment a task stops being a fixed sequence on one thread and becomes independent or quarantined work across windows, you have crossed from the prompting craft into coordination — the later, orchestration half of this volume, where the sub-agent and multi-agent patterns live. This chapter shapes the input to a single agent thread; those are the two places its edges hand off.

Patterns

Brief the new hire. Sketch: state the goal explicitly, give steps in order when order matters, and explain the motivation. When to use: first — always, before any heavier move. Prompting best practices · AnthropicT1-official original Mechanics: numbered/bulleted steps for ordered work; one sentence of why behind each non-obvious instruction. Remember: under-specification gets filled with a plausible default, rarely the one you wanted.

Show, don’t describe. Sketch: demonstrate the output shape with 3–5 examples instead of a prose rulebook. When to use: whenever you care about a specific format, tone, or decision boundary. Prompting best practices · AnthropicT1-official original Mechanics: mirror the real use case closely; cover edge cases; wrap each example in a tag. Remember: examples are the most reliable steering lever, and 3–5 is the documented dosage.

Structure the messy prompt. Sketch: tag distinct content types and assign a role. When to use: when a prompt mixes instructions, context, examples, and variable input. Prompting best practices: use XML tags · AnthropicT1-official original Mechanics: <instructions>/<context>/<input> tags; a one-line role in the system prompt. Prompting best practices · AnthropicT1-official original Remember: tags remove parsing ambiguity; a role focuses behavior and tone — durable craft, unlike prefill.

Chain only fixed sequences. Sketch: decompose a too-big task into a predefined sequence of calls, each feeding the next. When to use: the task cleanly decomposes into fixed subtasks, or you must inspect intermediate output. Building effective agents · Erik Schluntz and Barry Zhang (2024)T1-official original Mechanics: the self-correction shape — generate, review against criteria, refine — as separate calls. Prompting best practices · AnthropicT1-official original Remember: this is single-thread; if the work is independent or needs isolation, that is orchestration, not chaining.

Quick reference

  • The order is the ladder: clarity → examples → reasoning → structure/roles → chaining; climb only as far as the task forces you. Prompt engineering overview · AnthropicT1-official original
  • Lead with clarity: the brilliant-but-new-employee model — be explicit, sequence when order matters, give the why. Prompting best practices · AnthropicT1-official original
  • Examples are the most reliable lever: mirror the use case; documented dosage is 3–5 (the one anchored number). Prompting best practices · AnthropicT1-official original
  • Changed — CoT: manual “think step by step” is now a fallback for when thinking is off; adaptive thinking does it by default (volatile; recheck per model release). Prompting best practices · AnthropicT1-official original
  • Changed — prefill: prefilling the last assistant turn is deprecated on 4.6+ (returns a 400); migrate format control to structured outputs (volatile; recheck per model release). Prompting best practices · AnthropicT1-official original
  • Durable structure: XML tags remove parsing ambiguity; Prompting best practices: use XML tags · AnthropicT1-official original a role in the system prompt focuses behavior. Prompting best practices · AnthropicT1-official original
  • Boundary: chaining is single-thread decomposition, not orchestration. Building effective agents · Erik Schluntz and Barry Zhang (2024)T1-official original
  • Tier honesty: this is single-vendor official guidance (Anthropic’s own docs + one corroborating tutorial), authoritative by construction — not triangulated across independent practitioners, so no convergence claim.

Practice

Exercise solutions

Solution ↑ Exercise

The five moves, in order, are: be clear and direct, use examples (multishot), elicit reasoning (chain-of-thought), structure with XML tags and roles, and chain complex prompts. Reading them as a ladder is right for an agent system because a prompt is context — the same finite window currency the volume is built around — and each rung up the ladder spends more of that window than the last (a multi-step chain costs far more than a clear instruction with three examples). So you climb only as far as the task forces you: solving it on the bottom two rungs leaves the most window for tools, history, and the actual work, which is the whole capability-axis discipline applied to the prompt rather than to the tool set.

Solution ↑ Exercise

Manual chain-of-thought. (a) It used to be the default reasoning lever — telling the model to “think step by step” before answering to improve multi-step reasoning. (b) It is now documented as a fallback: “when thinking is off, you can still encourage step-by-step reasoning.” (c) Today, rely on adaptive/extended thinking, which handles most multi-step reasoning internally as a model feature; reserve the manual prompt for the case where thinking is unavailable, and do not add a redundant “think step by step” when it is on.

Prefill. (a) It used to steer output format or skip a preamble by opening the assistant’s response for it. (b) It is now deprecated on Claude 4.6+ — prefilled responses on the last assistant turn are no longer supported, and such a request returns a 400 error. (c) Migrate format control to structured outputs and skip-the-preamble to a direct system-prompt instruction.

Both claims are tagged volatile because they are model-version-dependent statements about a moving feature surface (current as of the Claude Opus 4.7-era docs), not durable principles — the “when thinking is off” condition narrows as thinking becomes default-on, and the prefill gate is tied to specific model versions. The tag obliges a concrete action: recheck the source per model release before relying on either, rather than treating the chapter’s snapshot as permanent.

Solution ↑ Exercise

The cheaper fix is the fifth rung of the prompting ladder — prompt chaining, specifically the self-correction pattern (generate a draft, review it against criteria/rubric, refine based on the review), run as a fixed sequence of calls so you can inspect each intermediate output. This is a chaining problem and not an orchestration one because the work is a predefined, single-thread sequence: gather → draft → check → revise, each step feeding the next on one conversation, with no independent or quarantined work that needs its own isolated window. Splitting it into multiple agents adds coordination cost and extra windows to paper over what is really an unstructured single prompt — the additive reflex applied to the wrong axis. Chaining ≠ orchestration: if the task decomposes into fixed steps you can lay out in advance, chain it; reach for separate agents only when the work is genuinely independent or needs context isolation, which the coordination half of the volume takes up.