Skip to content

Quick Reference

Condensed cheat sheets for the eight exam domains, crawled from the Quick Reference sheets of the source guide. Review these after finishing the lessons in a domain — they are summaries, not substitutes for the full content.

Whoever decides the next step names the tier. That single line settles most Domain 1 items.

  • Augmented LLM: one model call enhanced with retrieval, tools and memory. The basic building block; most problems need nothing more.
  • Workflow: LLM calls and tools orchestrated through predefined code paths. Code owns the control flow, so runs are predictable, testable and cheaper.
  • Agent: the model directs its own process and tool usage, deciding each step from environment feedback. Flexibility is the product. The price is cost, latency, a wider error surface and a guardrail burden.

Choosing: find the simplest solution possible. Steps known in advance and repeating → workflow. Step count unknown, each decision dependent on what the last one found → agent. On the exam: a stem naming a fixed, auditable, high-volume process keys the workflow; an agent’s extra spend must buy something the workflow could not deliver. The bigger-model swap is the standing distractor for what is actually a control-flow decision.

The most-tested fact in the domain: subagents do not share memory. A subagent’s context window starts fresh; the delegation prompt is the only channel from parent to worker. Anything agreed in the orchestrator’s own conversation does not exist for the subagent unless the brief states it. The one exception, as of September 2026, is a Claude Code fork, which inherits the whole conversation. Fork mode is on by default in interactive sessions and off in the Agent SDK and -p runs unless you turn it on.

  • Isolation is also the payoff: intermediate tool calls and file reads stay inside the worker. Only its final message returns, so the lead’s context grows by a summary. Anthropic reported a lead-plus-parallel-subagents system outperforming a single agent by 90.2% on its internal research evaluation.
  • Parallelism pays only on independent subtasks. Dependent stages must run in sequence; splitting them across parallel workers recreates the coordination problem at higher cost.
  • Trace multi-agent failures to the orchestrator first: overlapping scopes produce duplicates, unassigned topics produce gaps, and spawning breadth on a trivial query is an effort-scaling failure in the lead. The fix is a better brief: objective, output format, tool guidance, task boundaries, every time.
  • Results need not all pass through the lead. The multi-agent research post recommends that subagents store bulky work in external systems and pass lightweight references back to the coordinator.
  • Other multi-agent shapes (as of September 2026): Claude Code agent teams are experimental and off by default (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1), interactive only, with teammates messaging each other directly at a higher token cost. Named subagents can also message each other. Dynamic workflows put the plan in a script that decides what runs next, for dozens to hundreds of agents per run. A Managed Agents coordinator delegates one level only to a roster of at most 20 unique agents, which share the session’s sandbox and filesystem.

The bare loop: send the prompt with tools; if the response requests tools, execute them, append the results, call again; stop when the model responds without tool calls or a cap trips. The raw Messages API imposes no loop semantics: no default turn cap, no termination token.

Exact names are keyed facts:

Option Caps Terminal subtype
max_turns / maxTurns Tool-use round trips per run error_max_turns
max_budget_usd / maxBudgetUsd Cumulative estimated spend, subagents included error_max_budget_usd

Both default to no limit. The docs call a budget cap a good default for production agents. The budget is cumulative: subagent requests count toward total_cost_usd, spawns fail at the cap, and the run ends with the budget subtype. Invented near-misses (max_iterations, budget_limit, turn_cap) are the distractors.

Subagent depth and concurrency (as of September 2026, environment variables through the env option): CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH defaults to three layers below the main agent, and 1 turns nesting off. The concurrency cap, CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS, defaults to 20.

Input modes: single message input (one query() with a prompt string) suits one-shot or stateless work. Streaming input (an async generator of messages, sent through ClaudeSDKClient in Python) is the preferred mode: a long-lived session with image attachments, queued messages and interruption.

Every run ends with a ResultMessage. The subtypes the exam leans on are success, error_max_turns, error_max_budget_usd and error_during_execution (the docs list a fifth, error_max_structured_output_retries, as of August 2026). Every subtype carries total_cost_usd, num_turns and session_id. The result text exists only on success, so code checks the subtype before reading it.

A limit result is not a model failure. The guardrail fired as configured. Documented recovery: resume the session (pass the captured session_id to the resume option) with a raised limit, tighten the brief, or split the work. Prompt nudges and model swaps do not change the arithmetic of an under-scoped cap.

Deployment Models, and Hooks vs Prompts (1.2)

Section titled “Deployment Models, and Hooks vs Prompts (1.2)”
  • Who runs the harness is the deployment question. Self-hosted: your process runs the loop (custom or via the Agent SDK), full control, full operational burden. Anthropic-hosted: Claude Managed Agents, a separate product where Anthropic runs the agent harness and sandbox behind a REST API, giving stateful server-side sessions with minimal operations. As of August 2026 it is in beta (header managed-agents-2026-04-01), and the sandbox can be Anthropic-managed or self-hosted for data residency, so who runs the harness and where the sandbox lives are separate questions.
  • Managed Agents details (as of September 2026): a self-hosted sandbox keeps tool execution, files and network egress with you, but tool inputs and outputs still flow to Anthropic’s control plane. Agents are versioned: a plain agent ID runs the latest version, and passing a version object pins the session. Scheduled deployments run an agent on a cron schedule.
  • Self-hosted SDK sessions write transcripts to local disk by default. A SessionStore adapter mirrors them to your own storage so another host can resume the session. Containers that spin down between visits need one.
  • Write the loop yourself (Messages API plus client SDK) when the application needs full control of the cycle; the packaged SDK harness is the default for agent-shaped work.
  • Prompts request, hooks enforce. A system-prompt rule is an instruction the model may not follow under adversarial input. A PreToolUse hook fires before a tool executes, can deny it with a reason returned to the model, and runs deterministically in the application process regardless of what the model was persuaded to attempt. Harness concerns (caps, budgets, retries, validation, persistence) live in code. Model-behaviour concerns (context, tone, approach) live in the prompt.

Names verbatim from Building effective agents, American spellings included:

Pattern Mechanism Cue in the stem
Prompt chaining Fixed sequence, each call processes the previous output, optional programmatic gates Known steps, order matters
Routing Classify the input, dispatch to a specialised handler Distinct categories deserving different treatment
Parallelization — sectioning Independent subtasks run side by side Parts known and independent up front
Parallelization — voting Same task run several times, outputs aggregated in code Confidence through comparison
Orchestrator-workers Central model decomposes at runtime and delegates Subtasks cannot be predicted in advance
Evaluator-optimizer Generator plus evaluator, critique loops back until the output passes Explicit criteria, iterative refinement

Differentiators the exam drills: sectioning vs orchestrator-workers turns on when the subtasks become known; voting vs evaluator-optimizer turns on whether anything flows between attempts; a gate is a one-way pass/fail checkpoint, never a feedback loop.

An agent remembers nothing between sessions unless the design adds a mechanism.

  • Memory tool: generally available on the Messages API as tool type memory_20250818. Claude gets create/read/update/delete operations over files in a /memories directory that your application executes client-side; curated state carries into any future session.
  • Handler safeguards: map /memories onto real storage, reject paths outside it (canonicalise, refuse ../ and URL-encoded traversal), and cap how much a view returns, paging with view_range. In the multisession pattern, mark a feature complete only after end-to-end verification.
  • Session resume restores one specific conversation. Memory files carry curated state into any future session. Different tools for different continuity needs.
  • Context rot: recall degrades as token counts grow. The three documented long-horizon techniques: compaction (summarise and reinitialise the window; the Agent SDK does this automatically), structured note-taking (persist state outside the window, read back on demand), and sub-agent architectures (explore in clean windows, return condensed summaries). On the Messages API, as of September 2026, compaction is split into on-demand and token-threshold forms, and the docs recommend on-demand wherever it is available. Domain 1 keys the design move; Domain 6 owns the technique detail.

Match the stated need to what each framework leads with, never API trivia:

Framework Leads with
LangGraph Low-level orchestration: control flow as an explicit, inspectable, resumable graph; durable long-running state
Pydantic AI Typed Python agent SDK: declare an output type, every run returns validated against it
Strands Agents Model-driven loop with minimal orchestration code; open-source, from production systems inside Amazon, Python and TypeScript

A framework buys pre-built loop, state and orchestration machinery at the price of a dependency and an abstraction between you and the model. Plain code beats a framework for a fixed pipeline. The simplest-thing rule applies to tooling exactly as to architecture.

Domain 2 — Applications and Integration (33.1%)

Section titled “Domain 2 — Applications and Integration (33.1%)”

The derivation chain runs one way: business (why the system exists) begets functional (what it does), and functional plus the proposed architecture begets infrastructure (what the platform must provide). A statement naming no system behaviour and no platform property is a business requirement wherever it sits in the document.

  • Functional vs non-functional turns on the promise, not the precision. Behaviour is functional; a quality or constraint on behaviour (latency, throughput, availability, residency, cost ceiling) is non-functional however many digits it carries. The standing distractor promotes the most measurable statement to functional because it is measurable.
  • Rate limits and context windows are requirement inputs. RPM, ITPM and OTPM are enforced per model class with documented values, the anthropic-ratelimit-* response headers report your live limits, and cached tokens do not count toward ITPM on most models. Sizing peak load without consulting them is capacity-by-optimism.
  • The architecture decides which constraints bind: realtime paths make time-to-first-token load-bearing; batch paths swap it for the 24-hour completion window. The harder item shape derives the requirement the proposal implies but never states (residency for a personalisation store, throughput for a documented spike).
  • Domain 5 boundary: 2.1 names the constraint the platform must satisfy; choosing a model against it is Domain 5. Model-selection language in a requirements stem is the lure.

Items hand you an activity and ask which phase owns it. The ownership table:

Activity Phase
Designing the regression eval set (from requirements) Testing
Cutover plan swapping pilot for production flow Implementation (happens once)
Standing dashboards, error triage, prompt fixes, migration planning Operations and maintenance (recurs)
Decommissioning the pilot and disposing of its data Retirement (data disposition included)
  • Frameworks change cadence, never concerns. Agile, iterative and plan-driven all contain requirements, design, build, test, deploy, operate, retire; Claude applications just turn the loop fast, with the eval suite as the recurring gate.
  • The deprecation clock: Anthropic’s model lifecycle runs Active, Legacy, Deprecated, Retired. Deprecated still works but has a named replacement and a retirement date; retired fails every request; publicly released models get at least 60 days’ notice. Those dates bind Anthropic-operated platforms. Amazon Bedrock and Google Cloud set their own retirement schedules, so read the stem for the platform.
  • A team that discovers a retirement from failing requests skipped the maintenance phase, not the memo.

Exact names are the keyed facts. Required request parameters: model, max_tokens, messages. Up-front instructions go in the top-level system field; a mid-conversation system message is a separate mechanism on models that support it (see 6.2). The API is stateless: your application resends the transcript every turn. Documented stop_reason values: end_turn, max_tokens, stop_sequence, tool_use, pause_turn, refusal, model_context_window_exceeded. Total input is input_tokens + cache_creation_input_tokens + cache_read_input_tokens.

  • Tools: a definition is name + description + JSON Schema input_schema. The model stops with stop_reason tool_use; the caller executes client tools and returns a tool_result block (in a user turn) whose tool_use_id matches. tool_choice values: auto, any, tool, none. any and tool return a 400 on Claude Opus 5.5, Sonnet 5.5, Fable 5.1 and Mythos 5.1 and fail under manual extended thinking (checked 29 September 2026). Server tools (web search) run on Anthropic infrastructure with results in the same response.
  • Streaming event order: message_start → per block content_block_start, content_block_delta(s), content_block_stop → message_delta (cumulative usage) → message_stop, with ping possible throughout. Deltas: text_delta, input_json_delta (accumulate, parse at content_block_stop), thinking_delta + signature_delta. Errors can arrive mid-stream after the 200. Streaming moves time-to-first-token, not total cost or time.
  • Vision: image blocks with base64, url or file sources; JPEG, PNG, GIF, WebP; as of August 2026, 10 MB per image on the Claude API (5 MB on Bedrock and Google Cloud), 8000×8000 pixels, up to 100 images per request on 200k-context models (600 per request on other models). Cost is patch-based (~one visual token per 28×28-pixel patch), so pre-resize.
  • Thinking: current models take thinking.type adaptive with depth via output_config.effort; the older enabled + budget_tokens shape belongs to pre-adaptive models — deprecated on the 4.6 generation and rejected with a 400 from 4.7 onward. Pass thinking and redacted_thinking blocks back untouched in tool-use turns.
  • Caching: cache_control type ephemeral; a hit needs a 100% identical prefix, evaluated tools → system → messages, so stable content first, volatile last. Invalidation cascades downward. Default TTL 5 minutes (refreshed on use), "1h" available; below the per-model minimum cacheable length nothing caches, visible as zeroes in usage.
  • Batch vs realtime: up to 100,000 requests or 256 MB per batch at a 50% discount; results at completion or the 24-hour mark, stragglers expire unbilled; per-request results (succeeded, errored, canceled, expired) stream from a results_url that lives 29 days. Under-an-hour completion is typical, not guaranteed: a hard deadline inside the window keys realtime with bounded concurrency.
  • Errors: 400 invalid_request_error (also a spend limit you set, except on the Claude Code workspace, which can return a 429), 401 authentication_error, 402 billing_error, 403 permission_error, 404 not_found_error, 409 conflict_error (resolve the conflict, then retry), 413 request_too_large, 429 rate_limit_error (a rate limit carries retry-after; the tier’s monthly spend cap sends none, and no retry clears it), 500 api_error, 504 timeout_error (stream long-running requests), 529 overloaded_error (back off, do not hammer). SDKs retry transient failures twice by default. Spend-limit, 409 and 504 notes checked September 2026.
  • Vendor surfaces: what changes is authentication, endpoint, model-ID format and feature timing. Bedrock uses SigV4 and anthropic.-prefixed IDs; Google Cloud uses @date-suffixed IDs for dated pre-4.6 snapshots (current-generation IDs match the first-party format); Claude Platform on AWS is Anthropic-operated with first-party IDs.

The substrate is plain HTTP and JSON: 4xx means your request, 5xx means their server; idempotent retries are safe for reads and need thought (idempotency keys, duplicate checks) for creates; JSON payloads crossing a service boundary are interfaces, so contract changes are versioned and reviewed.

  • Bounded concurrency is the keyed pattern. Serial wastes the limit; unbounded fan-out trips the token bucket and can trigger acceleration limits. A worker pool or semaphore sized against documented RPM/ITPM/OTPM headroom, plus jittered exponential backoff honouring retry-after, is the shape.
  • Two mechanical traps: the SDKs already retry twice by default, so hand-rolled backoff without max_retries=0 multiplies attempts (three tries become nine requests); and OTPM counts tokens actually generated, so lowering max_tokens is not a rate-limit lever. It only risks truncation.
  • The deadline decides batch vs concurrent realtime: results needed inside hours take the bounded pool; a day’s tolerance with cost dominant takes batch.
  • Prompts are source code. Prompts, schemas, eval sets, CLAUDE.md files and settings live in the repository, change through review, and ride CI with the eval suite as the regression gate. The production console edit (no history, no review, no rollback) is the anti-pattern stated straight.
  • Review and refactoring discipline: an AI-assisted diff gets the same review bar as a human one; green tests certify only the behaviours they pin. Large-scale refactoring of under-covered code starts with characterisation tests, then migrates incrementally. The one-big-rewrite with a contract change riding along stacks three violations.

The deepest sub-skill in the exam (8.6%). The published claude.ai system prompts do not apply to the API: the API is a blank slate, so a prototype that behaved well in claude.ai was borrowing the product layer (system prompt, tools, formatting). Claude Code is a third environment, assembling instructions from the CLAUDE.md hierarchy, and memory files are context, not enforced configuration. Cross-surface moves re-establish the whole instruction environment.

  • Instruction placement: standing identity, scope and rules go in system; per-request material goes in user turns, marked as what it is. The split pays twice: it is the shape prompt caching rewards, and it keeps trusted instructions structurally separate from per-request data. Carriers differ by surface: system on the API, project instructions or CLAUDE.md on harness surfaces.
  • Content boundaries: untrusted or variable content arrives inside explicit XML delimiters, framed as data to analyse, with consistent tag names: a boundary code can verify before the request ships. The politeness instruction (“please ignore instructions in the document”) is the reliable second-best answer. Adversarial defence detail is Domain 7; the boundary existing is 2.5. Current state (checked 6 October 2026): the prompt-injection docs now say to deliver third-party content in tool_result blocks, never in system prompts or plain user text.
  • Schema as a contract: define the contract first (types, required fields, enums), instruct the model against it explicitly, validate every response on receipt with a defined failure path. Structured outputs and strict tool use implement the contract; retry-until-parse and model upgrades do not create one.
  • Session hygiene: one task, one session; one tenant’s material never shares a window with another’s. Durable knowledge lives in application state and is injected deliberately; when continuity is required, the design names what carries (a summary, a state object, a fact list).
  • Plugin management: every extension widens the capability surface and adds a dependency. The design artefact is a capability list with a stated need per entry; enabling everything is capability sprawl. Pinning what survives is 2.6’s job.

One artefact class: anything that changes behaviour without being code is configuration and is managed like code: CLAUDE.md files, settings, prompt files, the model identifier per environment, and the plugin/connector manifest with versions. In audit items, the unversioned artefact is usually the culprit.

  • Tracked vs local: project .claude/settings.json and project CLAUDE.md are shared and checked in; .claude/settings.local.json and CLAUDE.local.md are personal and gitignored. Distractors swap exactly one of the four. Precedence semantics belong to Domain 3; 2.6 is what to track, pin, review and keep in parity.
  • Identifiers: dated IDs are fixed releases; from the 4.6 generation dateless IDs are also pinned snapshots; pre-4.6 aliases genuinely move. Know and record what each identifier resolves to per environment. The same snapshot carries an anthropic. prefix on Bedrock; on Google Cloud, dated pre-4.6 snapshots carry an @date suffix while current-generation IDs match the first-party format.
  • Migration sequence: eval the candidate snapshot first, change the pin through review, deploy through the pipeline, audit usage for keys still calling the old model. Sixty days of notice exists so the sequence never inverts.
  • Prompt versioning and parity: a prompt is a release artefact with a version, a changelog and a revert path. Each environment runs a known, recorded configuration, which is what makes “staging passed” evidence about production. The classic failures: the hot-fix never backported, and environments silently on different model identifiers.
  • Secrets never join the class. Keys live in credential helpers (apiKeyHelper) or runtime environment variables, never in versioned files; a committed key lives in history after deletion, and encrypting it in place or gitignoring the shared settings file are the distractor mitigations.

The Five Components, and Where Each Lives (3.1)

Section titled “The Five Components, and Where Each Lives (3.1)”

The guide names Rules, Skills, Commands, Agents and Agent Memory. Each one is a file you can open, and nearly every item in this domain is a placement question: given a stated need, which family and which scope.

Component What it is Where it lives
Rules Markdown constraints; a project rule loads at launch with the same priority as .claude/CLAUDE.md, and paths frontmatter scopes a rule to matching files. User rules load first, but neither set overrides the other, so Claude may follow either where they conflict .claude/rules/, ~/.claude/rules/, plus the permissions block in settings.json
Skills A directory holding a SKILL.md; the body loads only when used, invoked by description match or as /skill-name. skillOverrides in settings changes its visibility without editing it .claude/skills/<name>/, ~/.claude/skills/<name>/, managed settings, plugins
Commands Built-in slash commands running fixed CLI logic, bundled prompt-based skills such as /doctor, and custom commands, which have merged into skills The CLI itself; .claude/commands/<name>.md
Agents Subagents with name and description required in frontmatter; each runs in its own context window and only its final result returns .claude/agents/, ~/.claude/agents/
Agent Memory Auto memory, the notes Claude keeps for itself; the MEMORY.md index loads at the start of every conversation, capped at its first 200 lines or 25KB. autoMemoryEnabled: false in project settings turns it off for one repository ~/.claude/projects/<project>/memory/

Collisions. A skill and a command file of the same name both create /name, and the skill wins. Across scopes, skill collisions resolve enterprise over personal over project, the exact inverse of settings precedence, and a favourite trap. Subagent names follow the settings direction instead: managed, then --agents JSON, then .claude/agents/, then ~/.claude/agents/, then plugins. Both invocable kinds take arguments through $ARGUMENTS, with $0 and $1 indexing positions zero-based, so $0 is the first argument.

Around the five (September 2026).

  • skillOverrides: user-invocable-only hides a skill from Claude but keeps /name working, name-only lists it without its description, off hides it everywhere. The /skills menu saves the choice to .claude/settings.local.json.
  • Subagent model: a definition’s model, or one Claude passes at spawn time, outranks CLAUDE_CODE_SUBAGENT_MODEL. Add CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1 to put every subagent on that model (needs v2.1.257 or later; forks and model: inherit skills still use the main model).
  • Subagent permissionMode: ignored while the main session is in acceptEdits, auto or bypassPermissions; the subagent takes the parent’s mode. To stop a subagent editing in every mode, leave editing tools out of its tools list.
  • Plugins: skills, subagents, hooks and MCP servers packaged as one unit. A repository shares a private marketplace’s plugin through extraKnownMarketplaces and enabledPlugins in its .claude/settings.json; the marketplace entry applies once a contributor trusts the folder. Managed settings carry the same two keys fleet-wide.
  • Output styles: .claude/output-styles/ or ~/.claude/output-styles/, chosen with outputStyle. On the full system prompt, a custom style drops Claude Code’s software engineering instructions unless its frontmatter sets keep-coding-instructions: true; the shorter system prompt never carries them.

The line that settles most placement items: CLAUDE.md is what you write for Claude, auto memory is what Claude writes for itself. Both are context. Neither enforces anything.

Four scopes, broadest first:

  1. Managed policy: /Library/Application Support/ClaudeCode/CLAUDE.md (macOS), /etc/claude-code/CLAUDE.md (Linux and WSL), C:\Program Files\ClaudeCode\CLAUDE.md (Windows). Deployed by IT, not excludable by individual settings.
  2. User: ~/.claude/CLAUDE.md, following you into every project.
  3. Project: ./CLAUDE.md or ./.claude/CLAUDE.md, shared through version control.
  4. Local: ./CLAUDE.local.md, personal and gitignored.

Discovered files are concatenated into context, never overridden: a more specific file lands after a broader one rather than replacing it. Claude Code walks up the directory tree from the working directory, so a session launched in foo/bar/ reads foo/CLAUDE.md before foo/bar/CLAUDE.md, each CLAUDE.local.md after its sibling. Files in subdirectories below load on demand when Claude reads there.

  • @path/to/import pulls in content from anywhere in a CLAUDE.md. Relative paths resolve against the file containing the import, imports expand at launch, and recursion stops at a maximum depth of four hops. A path in backticks stays literal.
  • /init is repository initialisation: Claude analyses the codebase and writes a starting CLAUDE.md of build commands, test instructions and conventions. Where one already exists it suggests improvements rather than overwriting.
  • /context proves what actually loaded, under Memory files. /memory opens any of it for editing.
  • claudeMdExcludes (September 2026) skips CLAUDE.md and rules files by path or glob, from any settings file; managed policy files cannot be excluded. In .claude/settings.local.json it keeps another team’s file out of your sessions only.
  • AGENTS.md (v2.1.277 or later) loads by default only when no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md exists in the working directory or above, so a personal CLAUDE.local.md switches it off. Project instructions set to claude-md-and-agents-md in /config loads both; Claude Code ignores that value in project and local settings files.

Settings run the other way, as a genuine precedence chain:

Rank Source Notes
1 Managed settings The OS policy directory; cannot be overridden
2 Command line arguments Temporary session overrides
3 .claude/settings.local.json Personal per-project state, auto-gitignored
4 .claude/settings.json The team baseline, checked in
5 ~/.claude/settings.json Applies when nothing else specifies the setting

Local beats project beats user is the order items key on for a single value such as model, and the middle boundary is where candidates slip: being checked in confers no rank. List settings such as permissions.allow merge across files (September 2026), so a local file can add entries but never remove a shared one. To prompt for a command the team allows, add an ask rule: rules are checked deny, then ask, then allow. Claude Code auto-gitignores the local file by adding **/.claude/settings.local.json to your global git excludes file, which excludes it from version control and not from loading.

Settings carry permissions (allow, ask, deny, defaultMode, additionalDirectories), hooks wiring, env, model selection, and toggles such as autoMemoryEnabled.

Workspace trust (September 2026). A cloned repository cannot grant itself capability: the permissions.allow rules and additionalDirectories in its .claude/settings.json, and .mcp.json approvals such as enabledMcpjsonServers committed there, take effect only once someone accepts the trust dialog for that folder. Deny and ask rules apply regardless.

Status line. statusLine runs your script with session JSON on stdin and re-runs it on events such as a new assistant message, so it can go quiet while the main session sits idle; refreshInterval adds a timer. Key any cache on the input’s session_id, not a process ID, which changes on every run.

The sentence items are built from, verbatim from the memory page: “Settings rules are enforced by the client regardless of what Claude decides to do. CLAUDE.md instructions shape Claude’s behavior but are not a hard enforcement layer.” When a stem says must never, the keyed answer is configuration, not prose.

Sessions save continuously as local JSONL transcripts at ~/.claude/projects/<project>/<session-id>.jsonl, so exiting loses nothing.

Route What it reaches
claude --continue (-c) The most recent session in the current directory
claude --resume The interactive picker
claude --resume <name-or-id> That specific session
/resume Another conversation, from inside a running session
/branch, or --fork-session on a resume A copy of the conversation as a new session, leaving the original intact

Sessions created by claude -p or the Agent SDK stay out of both the picker and a plain claude --continue (September 2026). They still resume by ID, and claude -p --continue includes them. A resumed session brings back the conversation and the model it was using. The permission mode is fussier (September 2026): it comes back only on a terminal resume by --continue, by ID or by a unique name without -p, and even then not for bypassPermissions or plan (among a few narrower cases), which fall back to the mode a new session would start in. The picker and /resume never restore it. claude -p --resume or -p --continue starts where a new -p run would, bar one narrow plan-mode case. Launch flags do not survive a resume either: pass --add-dir, --mcp-config, --settings, --plugin-dir or --fallback-model again, or move the setting into a settings file, which is re-read at every launch.

Inside a session: /clear starts an empty context for unrelated work, and the old conversation stays on disk and resumable. /compact [instructions] replaces history with a summary so the same task continues. /context shows what is eating the window. Treating the two as interchangeable ways to free space is the standing trap: only one of them keeps the task alive.

claude -p (--print) is the non-interactive mechanism: prompt in, result out, piped stdin up to 10MB, exit 0 on success and non-zero on failure so scripts can branch. It starts in Manual on every plan, so scripted runs declare their own autonomy.

Need Flags
Plain text back --output-format text (the default)
One machine-readable payload --output-format json, carrying result, session_id, cost and usage
Events as the run progresses --output-format stream-json, newline-delimited, carrying a system/init event of session metadata and ending with a result message
Token deltas stream-json plus --verbose and --include-partial-messages
Schema-conforming output --output-format json with --json-schema, read back from structured_output
Subagent text and thinking in the stream --forward-subagent-text; file each message by parent_tool_use_id, where null marks the main conversation
Autonomy for the run --permission-mode, --allowedTools (permission-rule syntax)
A scripted follow-up --continue, or --resume <session-id> captured from the JSON payload

Dated current-state note (September 2026): --bare skips auto-discovery of hooks, skills, custom commands, subagents, installed plugins, MCP servers, auto memory and CLAUDE.md. The docs recommend it for scripted and SDK calls and expect it to become the default for -p. A bare run gets what it needs by flag, such as --agents or --mcp-config. A -p run never shows the trust dialog. In a folder nobody has trusted, it ignores the project’s permissions.allow rules with a stderr warning, yet without --bare it still runs the hooks in the project’s settings files and connects its .mcp.json servers. Allow rules off, hooks and servers on. For a checkout you did not write, --bare or --setting-sources user keeps both out, and the allowlist goes on the command line with --allowedTools.

Invented near-miss flags are the standing distractor here: --headless, --stream and --auto do not exist.

The guide’s auto-mode feature. Config values are exact, and near-misses are the distractors:

Mode Runs without asking
default (Manual in the CLI, alias manual) Reads only
acceptEdits File edits and the common filesystem commands mkdir, touch, rm, rmdir, mv, cp and sed, for paths inside the working directory
plan Reads and exploration; edits stay blocked until you approve the plan
auto Whatever a second model, the classifier, approves in your place
dontAsk Only pre-approved tools and the read-only set; anything that would have prompted is denied
bypassPermissions Everything, for isolated containers and VMs only; --dangerously-skip-permissions is its flag form

Two rules outlive every mode: deny rules block even under bypassPermissions, and allow rules have no effect there.

Shift+Tab cycles modes mid-session and permissions.defaultMode sets where sessions start, with two exceptions in .claude/settings.json and .claude/settings.local.json. An auto value there does not take effect, and Claude Code falls back to the built-in default. Nor does bypassPermissions, which starts the session in Manual. Dated current-state note (September 2026): from Claude Code v2.1.283, interactive terminal and VS Code sessions start in auto mode on every plan and provider, while claude -p starts in Manual on every plan. A managed defaultMode only sets the starting point, and people can still switch to auto. disableAutoMode set to "disable" in managed settings takes it out of reach.

The Bash sandbox (September 2026) is a separate layer: the mode decides whether Claude asks, and the sandbox has the operating system limit what a command and its child processes can reach. sandbox.filesystem.allowWrite opens one extra writable path, such as a build cache, which the docs prefer to exempting the tool through excludedCommands. sandbox.allowUnsandboxedCommands: false closes the escape hatch in which Claude retries a blocked command outside the sandbox.

The judgement items reward: raise autonomy in proportion to isolation and reversibility. acceptEdits for edits you will read in a diff, plan before touching code you do not know, dontAsk with an explicit allowlist for CI, auto for an unattended run whose commands cannot be listed in advance, bypassPermissions only where the whole environment is disposable.

Domain 4 — Eval, Testing, and Debugging (2.6%)

Section titled “Domain 4 — Eval, Testing, and Debugging (2.6%)”

Isolate the Layer Before You Theorise (4.1)

Section titled “Isolate the Layer Before You Theorise (4.1)”

The guide’s phrase is “problem origin isolation between the integration layer and model output”, and the whole domain hangs off it.

  • Integration layer: everything between your code and a valid response. Authentication, request construction, size and schema validity, rate limiting, transport, timeouts, stream assembly, and your own parsing of what came back.
  • Model output: what is left once a well-formed request has been answered with HTTP 200 and stream and parse errors have been ruled out. Content that is wrong, incomplete, off-format or fabricated.

The fixes are disjoint, so the discriminator has to be evidence rather than intuition. A 4xx or 5xx carrying an error body that names an error.type is the integration layer speaking. A 200 alone does not settle it: first rule out stream errors (an event: error frame mid-stream) and your own parsing, and only then classify a 200 whose content you dislike as the prompt or the model speaking. The stop-reason page draws the same line: stop reasons sit inside a successful response and the content is valid, while errors are 4xx or 5xx request failures.

Retrieval-backed systems get one more question first: was the material assembled into the context window actually correct? A better prompt over the wrong documents buys a more confident wrong answer, and you settle it by inspecting the assembled request, never by re-prompting.

Log six fields on every call, successes included: request id, HTTP status, error.type, stop_reason, usage, raw content. Diagnosis items put the discriminating detail in the stem, and the item is testing whether you read it.

The type strings are exact and near-misses are distractors by construction. As of August 2026 the documented map is:

Status error.type Reading
400 invalid_request_error Malformed request; the docs note it “may also be used for other 4XX status codes not listed in this section”. As of September 2026 it is also what a spend limit you set returns
401 authentication_error Key malformed, revoked or expired
402 billing_error Account state, not request state
403 permission_error Valid key, no access to that resource
404 not_found_error Resource is not there
409 conflict_error Concurrent modification or a uniqueness collision; the docs say resolve the conflict, then retry
413 request_too_large Over the endpoint ceiling: 32 MB Messages and Token Counting, 256 MB Batch, 500 MB Files
429 rate_limit_error A rate limit carries retry-after and the anthropic-ratelimit-* headers. As of September 2026 the tier’s monthly spend cap also returns 429, with no retry-after and error.details.error_code enforced_spend_limit_reached
500 api_error Internal fault
504 timeout_error Request failure, never a 200; for long-running requests the docs point to streaming
529 overloaded_error Capacity, and the type the docs use as their example of a mid-stream error frame

Every error body has the same shape: a top-level type of error, a nested error object that always carries a type and a message, and a request_id. On the direct Claude API, Cloudflare returns the 413 before the request reaches the API servers.

This split picks the recovery, and nothing else in the domain gets tested harder.

  • Deterministic, request-shaped: 400, 401, 402, 403, 404, 413. Properties of the request you sent, so the identical request fails identically however many times you send it. Fix the request, the credential or the payload.
  • Transient, moment-shaped: 429, 500, 504, 529 and raw connection failures. The retryable class.
  • Long-request 504: a 504 that clusters on the longest requests is a request-length problem. As of September 2026 the errors page points long-running requests at streaming (or the Message Batches API), because a retry restarts the same long generation.
  • Fix-then-retry: 409 conflict_error is in the SDKs’ retried set, but the documented recovery is “resolve the conflict, then retry the request” — a backoff schedule alone does not clear it.
  • Spend limits (September 2026): the tier’s monthly spend cap returns a 429 with no retry-after and error.details.error_code enforced_spend_limit_reached. No retry clears it, the SDKs’ own included, until access resumes on the first of the next month or the organisation moves up a tier. A spend limit you set on the organisation or a workspace returns a 400 whose message says so (limits on the Claude Code workspace can return a 429 instead). Neither is fixed in the request: raise the limit or the tier.

The SDKs encode the basic split, not the exceptions: they retry connection errors, 408, 409, 429 and 500 and above “with exponential backoff, twice by default, honoring the retry-after header when present”, tunable through max_retries / maxRetries.

Branch on typed classes, most specific first, never on error strings. Python and TypeScript: 400 BadRequestError, 401 AuthenticationError, 403 PermissionDeniedError, 404 NotFoundError, 409 ConflictError, 422 UnprocessableEntityError, 429 RateLimitError, 500 and above InternalServerError, and APIConnectionError for transport, all descending from APIError. Python adds APIStatusError as the catch-all and APITimeoutError; TypeScript throws APIConnectionTimeoutError. Because RateLimitError descends from APIStatusError, catching the generic class first swallows every 429 silently.

The gap that catches people out: the documented table names no class for 402 or 413, so those are read off status_code.

Dated current-state note (August 2026): both SDKs default to a 10-minute timeout, and TypeScript computes a longer one for a large max_tokens without streaming, floored at 10 minutes and scaling to as much as 60.

stop_reason on a Successful Response (4.1)

Section titled “stop_reason on a Successful Response (4.1)”

Once a call returns 200, stop_reason says whether you have a complete answer, a truncated one, a paused one or a refusal. Seven values are documented:

Value What happened What fixes it
end_turn Natural finish; an empty one (two or three tokens, no content) often follows text added after tool_result blocks Use the response. If empty, send the tool results on their own. A continuation prompt in a new user message is the last resort
max_tokens Truncated at the cap you set Raise the cap or narrow the task; retry higher if it cut a tool_use block
stop_sequence One of your sequences fired Check which, in the stop_sequence field
tool_use Claude is calling a client tool Run it and send tool_result blocks back
pause_turn Server-side sampling loop hit its iteration limit while executing server tools, ten per request by default (August 2026); never fires with a client tool_use block pending Send the response back as-is with the same tools, and cap the continuations, since a continued turn can pause again
refusal Safety classifiers declined, as “a normal HTTP 200 response, not an error” Read stop_details, then retry on a different model: server-side fallback (beta), the SDK middleware or your own retry. Discard any partial output
model_context_window_exceeded Stopped at the model’s context-window limit rather than your cap; treat the response as truncated Not a bigger cap. Context budgeting is our reading; the docs prescribe no fix

Dated current state (August 2026): model_context_window_exceeded “is currently typed only in the SDKs’ beta namespace”, so typed access goes through client.beta.messages and the Beta-prefixed types. Sonnet 4.5 and newer models return the value without a beta header; earlier models need the model-context-window-exceeded-2025-08-26 header before it appears at all — so a developer logging stop_reason on an older model will never see it.

The field converts a vague symptom into a class. “The notices stop mid-sentence” stops being a quality complaint the moment stop_reason reads max_tokens: configuration fault, configuration fix, and no prompt rewrite or model swap touches it.

Under streaming it hides. stop_reason is null in message_start, supplied in message_delta, and provided in no other event, so a client that never reads message_delta is blind to truncation by construction.

Errors After a 200, and the Tool Contract (4.1)

Section titled “Errors After a 200, and the Tool Contract (4.1)”

Two failure classes walk straight past a handler wrapped around the call.

  • Mid-stream errors. Over SSE “an error can occur after the API returns a 200 response. In that case, error handling doesn’t follow these standard mechanisms”. The frame is event: error carrying something like overloaded_error, so handling belongs on the stream itself. New event types may be added, so unknown ones are ignored on purpose. Recovery is version-split: on Claude 4.5 and earlier the captured partial goes back in an assistant message, on Claude 4.6 and later in a user message with an instruction to continue. “Tool use and extended thinking blocks cannot be partially recovered. You can resume streaming from the most recent text block.”
  • Tool failures. A tool that raises, returns nothing, or returns an unstructured blob leaves the model to improvise, so the agent that then loops or fabricates has a tool-contract defect rather than a quality problem. The recovery is a tool_result carrying tool_use_id, content and is_error set to true “if the tool execution resulted in an error”, with content worth reading: “Instead of generic errors like failed, include what went wrong and what Claude should try next (for example, Rate limit exceeded. Retry after 60 seconds.)”. Server-tool errors are the exception, handled transparently by the API, so you never set is_error for those.

Every wrong answer in this sub-skill is a recovery aimed at a different class from the one in the stem.

Class in the stem Recovery that addresses it
Transient fault Capped exponential backoff with jitter, honouring retry-after
Deterministic client fault Fix and re-issue: a credential, a smaller payload or the Files or Batch endpoint, a corrected request
Spend limit (a 429 with no retry-after, or a self-set limit’s 400) No retry: raise the limit or the tier, or wait for access to resume
Refusal (a 200) A different model, never the same one again; count refusals as their own signal
Schema-invalid output Re-ask with the specific validation errors attached, then enforce with output_config.format and a json_schema, or strict: true on a tool definition
Persistent truncation The token budget or the task scope
Persistent fabrication Grounding: permit “I don’t know”, quote before answering, retract any claim without a supporting quote

Rate-limit 429s carry their own evidence. retry-after gives “the number of seconds to wait until you can retry the request. Earlier retries will fail”, and the anthropic-ratelimit-*-remaining headers show the headroom. Limits use a token bucket, so a short burst trips a ceiling the per-minute average never approaches, and an organisation-wide jump in usage produces 429s from acceleration limits, whose fix is ramping traffic gradually rather than retrying harder.

Jitter is not decoration: synchronised retries from a flushed backlog re-create the burst that caused the 429.

Schema failures announce which half is broken. An unsupported JSON Schema feature returns “a 400 error with details”, which is itself the discriminator between a defect in your schema and a defect in the output.

Two questions sit under all of it. Idempotency, because a retry that re-executes a side-effecting tool call is a bug. And exhaustion: degrade explicitly or fail loudly, because serving the last run’s output as though it were fresh turns a visible outage into an invisible one.

Traces That Reproduce, and Proving the Fix (4.1)

Section titled “Traces That Reproduce, and Proving the Fix (4.1)”

A usable trace is one the failure can be reproduced from without the original operator: request id, the exact request sent including the assembled context rather than your template, the raw response, stop_reason, usage, every tool call with its inputs and results, and the retry history. If a failure cannot be reproduced from the logs, the logging is the first defect to fix.

The request id is load-bearing. It arrives on every response as the request-id header and as _request_id on Python and TypeScript response objects, and it is the only identifier shared between your logs and Anthropic support. Any other header comes back through with_raw_response or .withResponse().

Reading a multi-step run has one rule: find the first step where the trace diverges from what you expected, and diagnose that step. Later steps are usually consequences. An agent that fabricated a figure at step nine because a tool returned an empty string at step three has a tool-contract defect, and debugging step nine fixes the wrong thing with great confidence.

Reproduce, change one variable at a time, prove the fix against a fixed set of cases. Anthropic’s eval guidance backs the discipline: “Design evals that mirror your real-world task distribution. Don’t forget to factor in edge cases!”, automate the grading where you can, and use a different model to grade than the one that generated the output. Promoting each failing input into a permanent regression case is our engineering practice rather than a documented Anthropic rule.

Domain boundary: what a status code means and how the SDK retries belong to 2.3, structured-output validation to 6.3, guardrails to Domain 7 and model tiers to Domain 5. Domain 4 asks which layer failed, which class this is, and which recovery addresses it.

Domain 5 — Model Selection and Optimisation (16.8%)

Section titled “Domain 5 — Model Selection and Optimisation (16.8%)”

Next-Token Generation, and What Follows (5.1)

Section titled “Next-Token Generation, and What Follows (5.1)”

Claude sits on an autoregressive model, pretrained “to predict the next word, given the previous context of text in the document”. At inference it emits one token at a time, each conditioned on everything before it, its own output included. Three consequences carry the marks:

  • Generation is serial, so response time scales with output length. Input length drives the prefill and therefore time to first token; output length drives the long tail. Reach for the wrong one and you answer a latency complaint with a capability lever.
  • There is no lookahead and no revision. A token, once emitted, is part of the record. That is why a stated output contract and a worked example placed before the task beat an instruction to fix the format afterwards.
  • Each token conditions the next, so an early wrong turn compounds instead of self-correcting. The model is continuing what it has written, not sampling afresh at each position.

Thinking is the same mechanism run before the visible answer: reasoning tokens are generated first, billed as output, and counted against max_tokens.

Tokens Are Measured, Never Estimated (5.1)

Section titled “Tokens Are Measured, Never Estimated (5.1)”

A token is a unit of the model vocabulary, not of human text: tokens “can correspond to words, subwords, characters, or even bytes (in the case of Unicode)”. Code, JSON, tables and non-English text tokenise differently from prose, so a ratio calibrated on paragraphs misprices a workload of log lines. Don’t rely on a tokens-per-word ratio. The documentation carries two such ratios that disagree with each other, roughly 3.5 characters per token in the Glossary against roughly 4 characters or 0.75 words in the Pricing FAQ, and that disagreement is the lesson.

Three instruments, three jobs, and swapping one for another is a wrong answer by construction:

Instrument Question it answers Cost
POST /v1/messages/count_tokens How many input tokens is this request estimated to use, before I send it? Free, with rate limits separate from message creation
The usage object on the response What did this one request actually consume? Nothing extra; it is on every response
The Usage and Cost Admin API What is the organisation spending, by key, workspace, model and tier? Needs an Admin API key

The counting endpoint accepts the same structured inputs as a real message (system prompt, tools, images, PDFs) and returns a single input_tokens field. Its answer is explicitly “an estimate” and it does not apply caching logic.

Dated current-state note (August 2026): “Claude 4.7 and later models and Claude Mythos Preview use a newer tokenizer. The same input text produces approximately 30 percent more tokens than on earlier models.” The endpoint “returns the count under the tokenizer of the model you pass”, so a count taken against last year’s model is the wrong number for this year’s, for both the bill and the window headroom. Recount whenever you change models.

The Context Window Is One Shared Budget (5.1)

Section titled “The Context Window Is One Shared Budget (5.1)”

The window is not an input allowance. Everything competes for the same space: “the system prompt, every message in messages (including tool results, images, and documents), and your tool definitions. The output Claude generates for the turn, including its extended thinking, counts too.”

Two corollaries are routinely got backwards. Caching creates no headroom: “Cached prompt prefixes still occupy the context window: prompt caching changes what you pay for those tokens, not whether they count.” And bigger is not automatically better: “As token count grows, accuracy and recall degrade, a phenomenon known as context rot.”

Overflow has two behaviours, and the discriminator is whether the input alone is too big:

Situation Behaviour When it surfaces
Input alone exceeds the window 400 invalid_request_error (“prompt is too long”), on every model Before any generation
Input plus max_tokens exceeds it, Claude 4.5 and newer Request accepted; generation stops with stop_reason: "model_context_window_exceeded" Mid-generation
Input plus max_tokens exceeds it, earlier models Validation error instead Before any generation

Dated current state (August 2026): the newer behaviour can be turned on for earlier models — the docs say to “use the model-context-window-exceeded-2025-08-26 beta header” to opt in. The stop reason is also “currently typed only in the SDKs’ beta namespace”, so typed access goes through client.beta.messages.

Both branches are arithmetic against a budget and both have budget fixes: send less, retrieve fewer and better passages, split the job, or move to a larger window. Neither is a prompt fault and neither is fixed by a more capable tier. Rolling first-in-first-out truncation of old messages is chat-interface behaviour, not API behaviour, and it is the standing distractor here.

Non-Determinism, and the Dials That Are Gone (5.1)

Section titled “Non-Determinism, and the Dials That Are Gone (5.1)”

The single most durable claim in the domain, because it is a property of the service rather than of a release: “Even with temperature set to 0, the results will not be fully deterministic and identical inputs may produce different outputs across API calls. This applies both to Anthropic’s first-party inference service and to inference through third-party cloud providers.”

Temperature zero buys consistency, not reproducibility. Never build a component whose correctness requires two identical calls to return identical bytes. Constrain the shape instead: a worked example, an explicit output contract, validation at the boundary. Store what has to stay stable rather than regenerating it and comparing.

Dated current-state note (August 2026): the sampling dials are not merely weak, they are rejected. The API parameter deprecations table lists temperature, top_p and top_k as “Deprecated (Claude Opus 4.7 and later)”, returning “a 400 error when set to a non-default value on Claude 4.7 and later models and Claude Mythos Preview”, with the recommended replacement “Omit and use prompting to guide model behavior.” On older models the restriction applies only while thinking is on. The documentation set is not internally consistent here: the Reducing latency page still suggests experimenting with temperature and has not been updated. Treat the deprecations table and the Thinking page as the authority.

Four Model Options, Four Different Problems (5.1)

Section titled “Four Model Options, Four Different Problems (5.1)”

The guide names these four together, and the durable knowledge is which complaint each one answers. They are not interchangeable.

Option How it is set What it moves
Extended thinking thinking: {type: "enabled"} with budget_tokens Reasoning depth, under a budget you set yourself
Adaptive thinking thinking: {type: "adaptive"} Reasoning depth, delegated: Claude decides “when and how deeply to think based on the request”
Effort output_config: {effort: ...}, levels low, medium, high, xhigh, max How much work the model does across the whole response, tool calls included
Fast mode speed: "fast" with the fast-mode-2026-02-01 beta header Output tokens per second, with “no change to intelligence or capabilities”

Extended thinking is the older interface: the legacy Claude Haiku 4.5 still uses it, and the newest models reject it.

Effort is the workhorse and the first lever to try. The default depends on the model. As of 14 October 2026, “Most Claude models default to high effort”, while “Claude Opus 5.5 and Claude Haiku 5.5 default to medium”. “Setting effort to the model’s default ("medium" on Claude Opus 5.5 and Claude Haiku 5.5, "high" on other models) produces exactly the same behavior as omitting the effort parameter entirely.” Two properties earn it first place. It “applies to every output token”, so “it works whether or not thinking is enabled”. And it covers tool calls as well as text, so “Lower effort also means fewer and terser tool calls” rather than merely shorter prose. It is “a behavioral signal, not a strict token budget”.

Dated current-state note (September 2026): adaptive thinking is already on with no configuration needed on Claude Opus 5.5, Opus 5, Sonnet 5.5, Sonnet 5, Fable 5.1, Fable 5 and the Mythos models, and as of 14 October 2026 on Claude Haiku 5.5 too. On those models the thinking display field defaults to "omitted": thinking blocks come back with an empty thinking field until you set display: "summarized", and no setting returns the raw chain of thought. Read the thinking blocks rather than asking for the reasoning in the answer, because on Claude Fable 5.1, Opus 5.5, Opus 5, Sonnet 5.5 and Fable 5 that request can be refused with stop_details.category: "reasoning_extraction", a category billed even when the refusal arrives before any output. Fast mode is a research preview delivering “up to 2.5x higher output tokens per second compared to standard speed”, limited to Claude Opus 5.5, Claude Opus 5 and Claude Opus 4.8, on the Claude API only, at premium pricing: $8 in and $40 out per MTok on Claude Opus 5.5, $10 and $50 on the other two. Its gain is in OTPS, “not time to first token (TTFT)”, so it tells on long streamed answers and barely registers on short ones. It is unavailable with the Batch API or a Priority Tier commitment, and switching between fast and standard speed invalidates the prompt cache.

The selection rule, in three sentences. A hard problem answered shallowly wants more reasoning. A routine problem that costs too much wants less effort. An answer that is already correct but arrives too slowly for a person watching wants faster delivery, meaning streaming first and fast mode where it exists, not a different model.

The guide’s vocabulary is zero-shot (an instruction, no demonstration), single-shot (one worked input-output pair) and multi-shot (several). The current documentation calls the same family “few-shot or multishot prompting” and makes the durable claim: “Examples are one of the most reliable ways to steer Claude’s output format, tone, and structure.”

The quality tests are named. Examples should be Relevant (“Mirror your actual use case closely”), Diverse (“Cover edge cases and vary enough that Claude doesn’t pick up unintended patterns”) and Structured (wrapped in <example> tags so Claude can tell them from instructions), with “Include 3-5 examples for best results.”

Diversity is the one candidates underrate: a set of examples sharing an incidental property teaches that property. If every example happens to be a clean run, the model learns that notes never report an exception.

When to reach for examples: a failure of form or of boundary, meaning inconsistent structure, unclear classification edges or drifting tone. Not a failure of budget (a request that will not fit) or of fact (something the model cannot know). Examples cost input tokens on every call, which is exactly why a stable example block at the front of a prompt is a caching candidate.

Underneath every Claude application is one HTTP POST and one JSON document. Three headers on POST /v1/messages (plus anthropic-workspace-id with a multi-workspace key): the credential as Authorization: Bearer <key> (as of September 2026 the older x-api-key header is the legacy fallback, still accepted), anthropic-version (2023-06-01) and content-type. The response is ordinary JSON with an id, a role, an array of typed content blocks, a stop_reason and a usage object. Failures arrive in a fixed envelope: a top-level type of error, a nested error object always carrying a type and a message, and a request id that also rides on the request-id response header.

Anthropic ships client SDKs for seven languages (Python, TypeScript, C#, Go, Java, PHP, Ruby) plus the ant CLI: “Each SDK provides idiomatic interfaces, type safety, and built-in support for streaming, retries, and error handling.” Unpacked, that is credential and version headers, typed requests and responses, a typed exception hierarchy, automatic retry of the transient class, a default timeout, parsed SSE events with an accumulation helper, one interface over sync and async, _request_id on responses, auto-pagination, and dedicated client classes for the cloud platforms. None of it is interesting. All of it is yours the moment you drop the dependency.

What it emphatically does not change is where the items live. No SDK-only models, no SDK discount, no higher or waived rate limits, no uptime guarantee, no immunity from an error class. Models, prices, rate limits and contractual terms are properties of the API and of your agreement, not of a package. The exam-safe formulation: the SDK changes the ergonomics of calling the API and nothing about the API itself.

Branch on the class, most specific first, never on message text, which is not a contract:

Status Exception
400 BadRequestError
401 AuthenticationError
403 PermissionDeniedError
404 NotFoundError
409 ConflictError
422 UnprocessableEntityError
429 RateLimitError
500 and above InternalServerError
transport failure APIConnectionError

Two defaults are misread more often than anything else here. The retried set: “Certain errors are automatically retried 2 times by default, with a short exponential backoff. Connection errors (for example, because of a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors are all retried by default.” The timeout: “By default requests time out after 10 minutes.” They compose, because “requests that time out are retried twice by default”, so worst-case wall clock is roughly the timeout multiplied by the attempt count.

Not every 429 is transient. As of September 2026 a usage tier’s monthly spend cap also returns one, with no retry-after header and an error.details.error_code of enforced_spend_limit_reached. It “keeps failing until access resumes”, the SDK’s own retries included. Read that field before queueing a RateLimitError for retry.

Stacking your own loop on top does not add resilience. It multiplies attempts, re-sends deterministic failures that will never succeed, and pushes a rate-limited endpoint further into the limit. Set max_retries and the timeout deliberately at one layer, and let the other decide policy: degrade, queue, or fail loudly.

Construct one client and reuse it. The client owns an HTTP connection pool. A client built inside every request handler throws that pool away per call, paying a fresh TLS handshake and multiplying open sockets under concurrency. It presents as latency that grows with traffic and connection errors that look like an upstream problem, so a stem describing exactly those symptoms is usually describing this defect.

Transports, and the Layer the Websocket Belongs To (5.2)

Section titled “Transports, and the Layer the Websocket Belongs To (5.2)”

The reliable item shape is a developer proposing the right transport at the wrong layer.

Transport Right when Direction
Plain request/response The caller needs a complete answer before it can act: batch jobs, classifiers, service-to-service One round trip
Server-sent events, set with stream: true A person is waiting and should watch the answer form One-way, over ordinary HTTP
WebSocket Your own application needs a persistent two-way channel to its own client Two-way

MDN on SSE: “This is a one-way connection, so you can’t send events from a client to a server.” MDN on WebSockets: they make it “possible to open a two-way interactive communication session between the user’s browser and a server”. Anthropic draws the layer line in its own hosting guidance: an application container “exposes an HTTP or WebSocket endpoint” to its clients, while separately “The SDK needs outbound HTTPS to api.anthropic.com.”

No documented Anthropic API surface accepts a websocket connection from a client, so “open a websocket to Anthropic so the user sees text appear” is wrong at the protocol level rather than merely suboptimal. The reverse is equally testable: streaming from the API needs no websocket in your front end, and a websocket in your front end gives you no streaming from the API. Independent decisions at different layers.

A stream can fail after the server has returned HTTP 200. A 200 opens the stream, and “The API may occasionally send errors in the event stream. For example, during periods of high usage, you may receive an overloaded_error”, delivered as an event: error frame mid-stream. Error handling wrapped around the call but not the iteration produces a silently truncated answer with no exception. Two more mechanics. Streaming is sometimes obligatory: the trigger is expected duration rather than any published max_tokens figure, and the Python SDK “will throw a ValueError if a non-streaming request is expected to take longer than approximately 10 minutes” (passing stream=True or overriding timeout disables that check). And “The token counts shown in the usage field of the message_delta event are cumulative”, so they are read rather than summed.

The ordering is the durable part and is stated first-party. As of 14 October 2026 the cost guidance reads: “From lowest to highest cost and capability, the current models are Claude Haiku 5.5, Claude Sonnet 5.5, Claude Opus 5.5, and Claude Fable 5.1 (the frontier model)”. A month earlier the same sentence began with Claude Haiku 4.5 and Claude Sonnet 5. That drift is the reason to learn the family order and not the version numbers. Comparative latency runs the other way, so the three axes the guide names, quality, latency and cost, are not independent.

Everything in this table is dated and will move. It follows the Models overview comparison table:

Model API id $ in / out per MTok Adaptive thinking Default effort Latency Context window Max output
Claude Haiku 5.5 claude-haiku-5-5 0.10 / 0.50 (prompts up to 100k tokens) Yes medium Fastest 1M 128k
Claude Sonnet 5.5 claude-sonnet-5-5 2 / 10 Yes high Fast 1M 128k
Claude Opus 5.5 claude-opus-5-5 4 / 20 Yes (always on) medium Moderate 1M 128k
Claude Fable 5.1 claude-fable-5-1 10 / 50 Yes (always on) high Slower 1M 128k

From the 4.6 generation the dateless format is itself a pinned snapshot, so every id in the table is already pinned. Older models carry a snapshot date in the id instead: the legacy Claude Haiku 4.5 is claude-haiku-4-5-20251001, and claude-haiku-4-5 is a convenience pointer that resolves to it.

Documented characters, which follow from the ordering: Haiku is for “The lowest latency and price”: real-time work, high-volume processing and sub-agent tasks. Sonnet is “The best combination of speed and intelligence” for code generation, data analysis and agentic tool use. Opus is for “Complex agentic coding and enterprise work”. Fable 5.1 is “For demanding reasoning and long-horizon agentic work”.

Capability was not uniform when the guide was written, which is why it names adaptive thinking support in its own scope. Claude Haiku 4.5, the fastest model then and a legacy model now, rejects adaptive thinking, carrying the older extended thinking form instead, and it has no effort parameter either. As of 14 October 2026 all four current models have adaptive thinking, Claude Haiku 5.5 included. A design that depends on the model regulating its own reasoning depth still rules out any model without it, Haiku 4.5 among them, on capability before cost is discussed.

Selection Is Constraint-Matching, Not Tier Dogma (5.3)

Section titled “Selection Is Constraint-Matching, Not Tier Dogma (5.3)”

Start from the criteria the documentation names: Capabilities, Speed, Cost and Effort. The fourth is the one candidates skip, and it is a lever inside a model rather than a choice between models: “Several Claude models support an effort parameter that trades intelligence for latency and cost within a single model. Tuning effort is often a better lever than switching models.”

Two documented starting strategies bracket the space, and neither is a default:

  • Efficiency-first: start with the fastest tier, test thoroughly, upgrade “only if necessary for specific capability gaps”. Home ground: prototyping, tight latency bars, cost-sensitive and high-volume straightforward work.
  • Capability-first: start with “the strongest starting point for your task”, optimise the prompt for it, then consider “increasing efficiency by lowering effort or downgrading models over time”. That is not the same as the most capable model: as of September 2026 the page starts on Claude Opus 5.5 and moves to the frontier Claude Fable 5.1 only if evals at xhigh or max effort still fall short. Home ground: complex reasoning, “tasks requiring nuanced understanding”, accuracy outweighing cost.

Then compare in the right currency and on the right sample. Currency: “You pay for completed tasks, though, so compare models on cost per completed task. A more capable model finishes a task with less work: fewer turns, less searching, less re-reading of its own context, and less backtracking.” Sample: “Price the tail of your workload, not the median: compare models on the hardest tenth of your tasks, not the typical one.” And the line that kills every price-list argument: “The ranking flips by workload, and no price list tells you which way.”

The eval is the gate. “Create benchmark tests specific to your use case - having a good evaluation set is the most important step in the process”, run “with your actual prompts and data”. A benchmark table or a price cut is not a migration gate, because published numbers are measured on somebody else’s tasks. Vary one thing at a time, run each effort level in a separate session (changing top-level effort mid-session starts the cache over and distorts the cost comparison), and remember a prompt tuned for the old model is not a neutral test of the new one.

A sweep can end in a policy, not one level. As of September 2026 the cost guidance documents one for checkable work: “run every task at a low setting and re-run only the failures at a higher one”. On its coding benchmark that slightly beat running everything at high, for a little over half the cost. It needs a failure signal you trust, and every first-pass failure takes two runs of wall-clock time.

Lifecycle States, and Why a Model Change Is a Code Change (5.3)

Section titled “Lifecycle States, and Why a Model Change Is a Code Change (5.3)”

The vocabulary is exact and testable. Legacy is not Deprecated and Deprecated is not Retired:

State What it guarantees
Active “The model is fully supported and recommended for use.”
Legacy “The model will no longer receive updates and may be deprecated in the future.”
Deprecated “The model is still functional but no longer recommended”, with a recommended replacement and an assigned retirement date.
Retired “The model is no longer available for use. Requests to retired models will fail.”

Anthropic commits to “providing at least 60 days’ notice before model retirement for publicly released models”, and “Every Claude model ID is a pinned snapshot”. Two planning facts follow: a retirement date is a deadline on your roadmap, so staying on what works has an expiry; and because ids are pinned, nothing changes underneath you unless you change it, which is what makes a planned migration possible at all.

A new model is a new system, and the differences come in three kinds:

  • Behaviour shifts in named ways: default response length, how literally instructions are read, tool-calling tendency, readiness to delegate to subagents.
  • Interface changes break code outright: manual extended thinking with budget_tokens, assistant prefill, and non-default temperature, top_p or top_k all return a 400 on the newest models.
  • Cost changes arrive even when nothing breaks, because a prompt written to compensate for an older model is followed literally by a newer one.

Interface changes fail loudly; the expensive ones do not. Swapping the model string in one place and carrying the prompts, effort settings and thinking configuration across unchanged is the shape of the quiet failures. Run the eval suite, audit the prompts against the model you are moving to, re-sweep effort, then shadow on a traffic slice before cutover.

The Bill Is a Handful of Token Counts, Each at Its Own Rate (5.4)

Section titled “The Bill Is a Handful of Token Counts, Each at Its Own Rate (5.4)”

A cost model is arithmetic over usage multiplied by real traffic: “price the five priced token counts in each response’s usage at their own rates, summed across the task’s requests” (wording as of September 2026; cache writes bill at the 5-minute or 1-hour multiplier). The top-level four are input_tokens, cache_creation_input_tokens, cache_read_input_tokens and output_tokens.

Two structural facts drive almost every decision after that:

  • Output is priced several times input on every model. A workload that generates a lot relative to what it sends is output-dominated; one that sends a lot relative to what it generates is input-dominated; the fix for each is different.
  • input_tokens does not mean all of the input. It counts the tokens after the last cache breakpoint, so on a cached request the real input volume is the sum of all three input fields. Read it alone on a heavily cached workload and you will conclude the prompt shrank when it did not.

Name the dominant axis before choosing a lever. A long standing prefix re-sent hundreds of times a day with short answers is an input problem, and shortening the answers optimises the wrong axis entirely. A workload sending two hundred tokens and generating four thousand is an output problem, and caching the prompt moves almost nothing. Thinking tokens bill as output and are reported under output_tokens_details.thinking_tokens, so a reasoning-heavy workload is output-dominated even when its visible answers are short. Do the arithmetic on one representative day of real traffic, never on one request.

Tracking is engineering, not accounting. Three layers, three jobs. Per request, log the counts beside the request id and a feature label, on successes as well as failures. Per feature, alert on the ratio you expect: a cache hit rate, an input-to-output ratio, a cost per completed task. A regression should announce itself rather than turn up on an invoice. Per organisation, the Usage and Cost Admin API is the authoritative aggregate, grouping “by API key, workspace, model, service tier, context window, data residency, or speed”; it needs an Admin API key, is “unavailable for individual accounts”, surfaces data within about five minutes, and supports polling once a minute.

Measuring a change against a monthly invoice is the distractor. An invoice aggregates every workload and every traffic fluctuation, so nothing can be attributed to anything.

Caching Economics, Dated August 2026 (5.4)

Section titled “Caching Economics, Dated August 2026 (5.4)”

Domain 2 owns how caching is configured. Domain 5 owns whether it pays, and the economics are asymmetric. Key on the shape; look up the numbers. A write costs more than not caching, a read costs a fraction, and the longer lifetime costs more to write than the shorter one.

Operation Multiplier on base input Duration
5-minute cache write 1.25x Cache valid for 5 minutes
1-hour cache write 2x Cache valid for 1 hour
Cache read (hit) and refresh 0.1x (0.05x on Claude Opus 5.5; 0.025x on Claude Fable 5.1 and Mythos 5.1, as of September 2026) Same duration as the preceding write

“A cache hit costs 10% of the standard input price, which means caching pays off after one cache read for the 5-minute duration (1.25x write), or after two cache reads for the 1-hour duration (2x write).”

The rule in words: caching pays when a large, stable prefix is re-sent often enough within its lifetime to amortise the write. Each of the four conditions has teeth.

  • Large: prompts below the model minimum “are processed without caching” and return no error, so a small prefix silently does nothing. The minimums as of 14 October 2026: 512 tokens on Claude Fable 5.1, Mythos 5.1, Opus 5.5, Opus 5, Sonnet 5.5, Fable 5, Mythos 5 and Haiku 5.5; 1,024 on Claude Opus 4.8, Sonnet 5, Sonnet 4.6 and Sonnet 4.5; 2,048 on Mythos Preview, Opus 4.7 and Haiku 3.5; 4,096 on Claude Opus 4.6, Opus 4.5 and Haiku 4.5.
  • Stable: the prefix must match byte for byte, so a timestamp, a per-request identifier, an unsorted serialised object or a varying tool list ahead of the breakpoint drives the hit rate to zero silently.
  • Often enough: a prefix used once loses money outright, paying the write premium and never collecting the read discount.
  • Within its lifetime: the clock is “measured from the start of the request that writes or reads the cache entry, not from response end”, it “is refreshed at no additional cost each time cached content is used”, and generation time counts against it. A response that streams for minutes has eaten most of the shorter window before the next request begins.

Check-pointing a growing conversation. The request renders in a fixed order, tools then system then messages, and a change at one level invalidates that level and everything after it. The settled transcript is the stable part and the new turn is the volatile part, so the breakpoint belongs at the boundary and must advance as it moves; automatic caching does that advancing for you. With explicit breakpoints, two limits shape the design: at most 4 breakpoints per request, and a 20-block lookback window per breakpoint. A conversation that grows further past the last write than that lookback will miss, and the fix is a second breakpoint placed closer and from the start. Anything inserted mid-prefix invalidates everything downstream, which is why appending is cheap and editing history is expensive. Configuration counts as prefix: the thinking configuration and the resolved effort level render into the prompt, and switching between fast and standard speed does the same. As of September 2026 a per-message effort change (beta, supporting models) is the exception: an effort-only system message sets the new level from the next user turn and the cached prefix still matches.

Verifying is part of the change. A cache_read_input_tokens of zero where you expected a hit is a silent invalidator, not a pricing surprise.

Anthropic splits them cleanly. Free wins “cut spend without touching quality: prompt caching, token hygiene, a prompt audit against the model you are running, batch processing at 50% off for work that can wait up to 24 hours, and workspace spend limits as the backstop.” Trade-offs “exchange cost for intelligence: model choice, effort, output caps and task budgets, an elapsed-time clock, and multi-model architectures.”

Take the free wins first, in this order:

  1. Prompt caching is the largest single measured lever: as of September 2026, caching cut agent-loop cost by a factor of 2.7 to 5.3 on Anthropic’s benchmarks and cut a small triage agent’s bill by 83 per cent, and “cache reads are routinely the largest single component of task cost”.
  2. Token hygiene, meaning pruning stale tool output, retrieving fewer and better passages, dropping dead transcript and right-sizing images. In the measured triage run it took that 83 per cent saving to 88 per cent.
  3. A prompt audit against the model you actually run, removing instructions written for an older one that a newer one now follows literally.
  4. Batch processing at a 50 per cent discount on both input and output, in exchange for asynchronous delivery inside 24 hours. Route anything nobody is waiting on through it, and nothing that anybody is.

Then the trade-offs, where effort is the direct dial and a cheaper tier is legitimate for tasks that pass an eval with a stated pass bar.

And then the one that is not a lever at all. As of September 2026: “A task budget saves money, because the model sees it. max_tokens is a safety cap: lowering it cut cost per attempt without lowering cost per solved task.” It “caps a single response, invisibly to the model, so lowering it does not make the model economize. The turns that needed the room are discarded and still billed.” In Anthropic’s internal measurement a tight cap cut off a large share of attempts, and very few of those still passed. Attempts got cheaper and fewer tasks got solved, so cost per solved task barely moved. The correct handling inverts the instinct: set max_tokens high enough that nothing is cut off (the page suggests 64,000 for agentic work, or the 128,000 maximum when one cut-off attempt is costly), “treat stop_reason: max_tokens as a failure”, and take the saving from levers the model can respond to.

A task budget is the lever the model can see. As of September 2026 it is a beta, set as task_budget inside output_config, that shows the model a running token countdown for the whole agentic loop, so the model trims low-value work and wraps up rather than being cut off mid-action. It is advisory, leaving max_tokens as the hard per-request ceiling, and a mid-task change invalidates the cached prefix, so set it once on the first request. Size it from your own measured per-task usage. The Task budgets page suggests starting at the 99th percentile of that usage, then testing up or down.

Domain boundary: Messages-API mechanics, streaming event shapes and how cache_control is configured belong to 2.3; pinning and recording a snapshot is 2.6; prompt craft is Domain 6; failure diagnosis is Domain 4. Domain 5 owns the economics and the choice.

Domain 6 — Prompt and Context Engineering (11%)

Section titled “Domain 6 — Prompt and Context Engineering (11%)”

Bloat and Drift Are Different Faults (6.1)

Section titled “Bloat and Drift Are Different Faults (6.1)”

Two symptoms, two causes, two fixes, and half the sub-skill turns on telling them apart.

Fault Symptom Cause Fix
Bloat Cost and latency climbing per step, request eventually will not fit Full tool payloads, whole files and complete search results accumulating Prune spent tool output, compact the settled transcript, isolate the sprawling step
Drift Output changing character while the task stays the same: formats vary, a rule gets skipped, an established fact gets contradicted Standing rules stated once, hundreds of turns back Move the rules to a surface present on every request

Anthropic’s framing is an attention budget: “Every new token introduced depletes this budget by some amount”, so as volume grows “the model’s ability to accurately recall information from that context decreases”.

The standing distractor in every degradation item is a bigger context window. It postpones the size failure, does nothing for recall, and costs more per step on the way. Window size fixes neither fault.

Load just in time. The cheapest cure for bloat is to keep material out of the window until the task needs it. Keep “lightweight identifiers (file paths, stored queries, web links, etc.)” and load the data through tools when the task needs it, rather than pasting everything up front. Runtime lookups are slower, so the engineering guidance (current as of September 2026) also describes a hybrid: a small core up front, the rest fetched as needed.

The guide calls it tool output pruning. Current docs implement it as context editing, a Messages API beta behind the header context-management-2025-06-27, strategy type clear_tool_uses_20250919.

Parameter What it does
trigger Input-token count at which clearing starts (default 100,000)
keep How many of the most recent tool use and result pairs stay intact (default 3 tool uses)
clear_at_least Minimum reclaimed before clearing is worth doing
exclude_tools Tools whose uses and results are never cleared
clear_tool_inputs Whether the call’s arguments go with its result (default false)

Three mechanics matter more than the list. Clearing is server-side, so your client keeps the full unmodified history. Cleared results are replaced with placeholder text telling Claude something was removed, so nothing vanishes silently. And the response reports what happened in context_management.applied_edits, with cleared_tool_uses and cleared_input_tokens: the numbers worth logging per step. The token-counting endpoint previews the effect, returning original_input_tokens beside the post-clearing input_tokens.

Why clear_at_least exists: clearing invalidates the cached prefix from the clearing point, so a trivial reclaim costs a cache write and saves nothing. clear_thinking_20251015 does the same job for extended-thinking blocks and must be listed first in the edits array when both are present.

Compaction and the Preservation Contract (6.1)

Section titled “Compaction and the Preservation Contract (6.1)”

When a long transcript has to continue rather than end, compaction replaces the settled portion with a structured summary. As of September 2026 it comes in two beta forms, and the docs are plain about the choice: “Use on-demand compaction wherever it is available.”

Form Who decides when Header and parameter What you send back
On demand Your code, by sending a compaction request compact-2026-09-04; top-level "compaction": {"type": "summarize"}; the reply is one compaction block with stop_reason compaction The block first in messages, in place of the messages it summarises
At a token threshold The API, when input tokens reach the trigger compact-2026-01-12; a compact_20260112 edit in context_management (minimum trigger 50,000 input tokens, default 150,000) The response, appended as usual; the API ignores every content block before the compaction block

The two stay apart: the compaction parameter cannot be sent with context_management.

Three facts decide whether the technique is used correctly:

  • The summarised turns stop reaching the model, and nothing is archived anywhere retrievable. Documents, images and fetched URLs inside them are lost too, so re-send anything a later turn still needs.
  • A custom instructions string replaces the default summarisation prompt entirely. Anything the default kept is no longer asked for unless your string names it: “Summarise the code changes” gets you the code changes and little else.
  • Billing catches people out. The compaction pass is its own iteration in usage.iterations, and the top-level input_tokens and output_tokens exclude it (on an on-demand request they read zero), so a cost model reading only those undercounts every compacting run.

Context awareness. As of September 2026, Claude Sonnet 5, Claude Sonnet 4.6, Claude Sonnet 4.5 and Claude Haiku 4.5 track how much of their window is left and may start wrapping up as it nears the limit. In a harness that compacts, say so in the prompt and tell the model not to stop early.

The preservation contract is something you write down: keep decisions and their reasons, established facts and sources, constraints and prohibitions still binding, open questions, and the state of unfinished work. Drop raw payloads already reduced to facts and superseded attempts. Anthropic’s warning is blunt: “overly aggressive compaction can result in the loss of subtle but critical context whose importance only becomes apparent later”. What that produces is a quiet contradiction fifteen steps on, not a crash.

Isolation, and Where a Fact Should Live (6.1)

Section titled “Isolation, and Where a Fact Should Live (6.1)”

Isolation is not summarising the sprawl afterwards. It is keeping it out of the main window in the first place: each subagent “runs in its own conversation, which starts fresh unless the subagent is a fork”, and “either way, intermediate tool calls and results stay inside the subagent; only its final message returns to the parent”.

The handover is the half that gets skipped, and it runs both ways. Unless the subagent is a fork, its context window “starts fresh, with no parent conversation, but isn’t empty”: it gets its own system prompt and the Agent tool’s prompt string, and no parent conversation history, tool results or system prompt. So every path, constraint and convention goes into that prompt, and the return shape is specified as precisely as the inputs.

Reach for a subagent when the task produces verbose output you do not need in the main context, when you want to enforce specific tool restrictions or permissions, or when the work is self-contained and can return a summary. Stay in the main conversation when the task needs frequent back-and-forth or iterative refinement, when multiple phases share significant context, when the change is quick and targeted, or when latency matters, since a subagent that is not a fork starts fresh and may need time to gather context. The same shape without subagents is a multi-step workflow: run the sprawling step as its own API call, keep the structured result, start the next step from that rather than from the transcript that produced it.

Transcript versus memory: a transcript records how you got here; memory is the set of facts that must still be true tomorrow. Replaying a prior conversation so the model “remembers” pays full input cost for everything that ever happened, into the most crowded possible window, every session. The memory tool is the documented alternative. It is generally available with no beta header, declared as {"type": "memory_20250818", "name": "memory"}, and client-side: Claude issues view, create, str_replace, insert, delete and rename against paths under /memories, and your handler executes them. The injected memory protocol names the design assumption: “ASSUME INTERRUPTION: Your context window might be reset at any moment, so you risk losing any progress that is not recorded in your memory directory.”

The three techniques compose: prune the spent payloads, compact the settled transcript, and write anything that must outlive the compaction into memory before it fires. (The docs say compaction needs no client-side bookkeeping. That holds for the threshold form. On demand, the swap is your code’s job.)

With a long document and a question about it, the document goes first. For inputs over about 20k tokens: “Place your long documents and inputs near the top of your prompt, above your query, instructions, and examples”, with the measured claim that “queries at the end can improve response quality by up to 30 percent in tests, especially with complex, multidocument inputs”.

The mechanism is that the instruction the model acts on is the last thing it read. Two refinements travel with the rule: wrap each document in its own tags with source metadata so multi-document inputs stay individually addressable, and ask Claude to quote the relevant parts first, before carrying out the task, which narrows attention and leaves you a string you can search for in the source.

The Messages API is stateless: you re-send the whole conversation every request, so where an instruction sits is a decision you re-make on every call.

  • Top-level system field carries durable material: who Claude is here, standing rules, tone, scope limits, refusal boundaries. It sits ahead of every message, so it is present on every turn.
  • User turn carries per-request material: this task, this document, this question.

The recurring scenario is standing rules put in the opening user message of a long session and ignored by the twentieth exchange. The answer is placement. Capitalising the rule, adding ALWAYS, or repeating it three times does not move it closer to the turn where it has to apply, and every repetition spends context on the drift it is trying to cure.

Generally available, no beta header. As of September 2026: Claude Fable 5.1, Claude Mythos 5.1, Claude Fable 5, Claude Mythos 5, Claude Opus 5.5, Claude Opus 5, Claude Opus 4.8 and Claude Sonnet 5.5. Not available on Claude Sonnet 5; use the top-level system field there. Append a message with role system where the new instruction becomes relevant instead of editing the top-level field, which keeps the earlier turns byte-identical and the cached prefix intact.

Authority is the point: “a user message is treated as coming from the end user, while a system message is treated as coming from you, the application operator. When the two conflict, system instructions take precedence.” Later system messages take precedence over earlier ones and over the top-level field for the turns that follow.

Placement rules, all examinable, all returning a 400 when broken:

  • It cannot be the first entry in messages. Anything applying from the start belongs in the top-level field.
  • It must immediately follow a user turn (a turn carrying tool_result blocks counts) or an assistant turn ending in a server tool result.
  • It must either end the array or be immediately followed by an assistant turn.
  • Between a tool_use block and its tool_result is the position named explicitly as invalid.
  • These rules bind a message that carries content. As of 14 October 2026 an empty-content message that only sets output_config.effort is accepted anywhere, unless it sits next to one that carries content.

Turn-scoped messages (beta as of September 2026, header mid-conversation-system-clear-at-2026-08-21). Set clear_at to "next_user_message" and the message renders only until a later user message exists (a tool_result-only user message counts). Then it stays in the array, renders nothing and costs no input tokens. The use is a per-turn reminder in a tool loop: append a fresh copy after each round of tool results and re-send the old copies unchanged.

Never a place for untrusted content. System content is treated as operator instruction and followed, so raw tool output or a fetched document put there gains operator-level authority.

A Claude application carries instructions on more surfaces than the system prompt: tool descriptions, schema field descriptions, and in Claude Code the CLAUDE.md hierarchy and rules files.

The rule for choosing is mechanical: put the instruction on the surface guaranteed to be present at the moment it must apply. A constraint on how one tool’s arguments are built belongs in that tool’s description, where it is read every time the model considers that tool, and is wasted in a system prompt carrying twenty other things. A constraint on the whole application’s tone belongs in the system prompt and is invisible inside one tool’s description.

One rule stated three ways is three rules. That is a conflict the model resolves at run time, and the resolution changes whenever any one copy is edited. Pick the surface, state it once, delete the others.

The golden rule is a usable test: “Show your prompt to a colleague with minimal context on the task and ask them to follow it. If they’d be confused, Claude will be too.”

  • Say what to do, not what to avoid.
  • Give the motivation. The documented example replaces “NEVER use ellipses” with a sentence explaining that a text-to-speech engine will read the output, which also covers the adjacent cases you did not think to prohibit.
  • Decompose compound instructions into ordered steps; number them when order or completeness matters.
  • State the audience, the format and the length explicitly.

How current models read wording (as of September 2026):

  • Literal scope. Claude Sonnet 5 and Claude Opus 4.8 do not silently generalise an instruction from one item to the next. State the scope: “Apply this formatting to every section, not just the first one.”
  • Suggest versus act. “Can you suggest some changes” may get only suggestions. Say “Change this function”, or add a standing default-to-action instruction.
  • Post-tool summaries. Current models may skip the summary after tool calls. Ask for one if someone is watching.
  • Prompt style. Match your prompt’s formatting to the output you want. Less markdown in the prompt can mean less in the response.
  • Emphasis overshoots. Claude Opus 4.5 and Claude Opus 4.6 respond more strongly to the system prompt, so “CRITICAL: You MUST use this tool when…” can over-trigger. Write “Use this tool when…”.

Examples are the strongest signal you can put in a prompt: “examples are one of the most reliable ways to steer Claude’s output format, tone, and structure”. Three to five, each relevant (mirroring the real use case), diverse (covering the edge case you care about, varied enough that no unintended pattern is learned) and structured (wrapped in example tags, multiple examples inside an examples wrapper).

The failure modes are as tested as the technique. Inconsistent examples teach inconsistency. Examples of the wrong shape outrank your description. An undelimited example is indistinguishable from the task, which is how a model answers the example instead of the question. Three consistent examples beat eight that disagree.

Output Constraints, and Two Techniques That Are Gone (6.2)

Section titled “Output Constraints, and Two Techniques That Are Gone (6.2)”

State the shape you want: describe the format explicitly, give a template or worked example of the exact shape, use XML format indicators to demarcate a section, and where the output feeds a machine move to structured outputs, which are enforced rather than requested.

max_tokens is not a length control. It is a hard cap on generation. The response does not become shorter and tighter; it stops mid-sentence, and the API says so with stop_reason of max_tokens. In a tool-use turn it can leave an incomplete tool_use block that has to be retried at a higher cap. For brevity, ask for two sentences with no preamble and show an example of two sentences.

Two older techniques need dating rather than quiet omission:

Technique Current state Replacement
Prefilling the assistant turn “Starting with Claude 4.6 models and Claude Mythos Preview, prefilled responses … are no longer supported”; such requests return a 400 Structured outputs for format; “Respond directly without preamble.” in the system prompt
temperature, top_p, top_k Any non-default value on Claude Opus 4.7 or later returns a 400; the Python SDK (v1.0 and later) no longer defines them and raises a TypeError first Omit them from the payload entirely

The keyed reasoning is unchanged by the removals: sampling never addressed format, focus or caution in the first place.

The guide files input sanitization here, and the half that belongs to this sub-skill is ordinary hygiene: making sure the model can tell your instructions from the material you asked it to work on. Four documented techniques.

  • Delimit. Wrap each type of content in its own XML tag, use consistent descriptive names, nest when there is a hierarchy.
  • Label. Say what the content is and where it came from, so the model can calibrate how far to trust it.
  • JSON-encode. Where possible, wrap third-party strings in a JSON object rather than concatenating them, because “JSON escaping provides unambiguous delimiters between the untrusted payload and the surrounding structure, so an attacker cannot close a quote or tag to ‘break out’ into an instruction context”.
  • Route it. Third-party content goes in tool_result blocks, never in system prompts or plain user text. The corollary catches people out: your own instructions must not live inside tool results either, because content there is treated as untrusted data and may be ignored or flagged. Send them in the user turn that follows the tool result, or in a mid-conversation system message.

Beyond the four: strip or escape stray markup that would break your own structure, never concatenate incoming text against an instruction sentence, and truncate or chunk deliberately rather than letting an oversized paste push your instructions out of view. Domain 7 owns the adversarial threat model; this sub-skill owns doing the structuring correctly whether or not anyone is attacking you.

Iterating So a Change Can Be Attributed (6.2)

Section titled “Iterating So a Change Can Be Attributed (6.2)”

Two cheap things, usually skipped:

  • A fixed evaluation set. Real inputs, including the two edge cases that actually bite, scored the same way every run. The docs put this ahead of any technique.
  • One variable at a time. Move the rules into the system field and re-run. Add two consistent examples and re-run. Replace the described format with an enforced schema and re-run.

The set stays still while the prompt moves. Adding cases mid-experiment because the new prompt exposed a new failure makes every earlier score incomparable: note the case, finish the comparison, then extend the set and re-baseline.

Asking the model which change helped is not evidence. It has no privileged access to why its own distribution shifted, and a fluent post-hoc rationalisation reads exactly like an explanation. The score on the fixed set is the evidence. Where a change targets a rare failure, sample the same case repeatedly, because one pass through a non-deterministic system cannot tell a fix from luck.

A model move is an iteration too. As of September 2026, Claude Opus 5 verifies its own work unprompted, and verification steps carried over from older prompts cause over-verification. Remove them rather than reword them, then re-score.

Three Ways to Produce Structured Output (6.3)

Section titled “Three Ways to Produce Structured Output (6.3)”

The ranking is about who enforces the shape.

Mechanism How When
JSON outputs output_config.format with type json_schema; “Structured outputs guarantee schema-compliant responses through constrained decoding” The response itself is the structured value
Strict tool use strict set to true on a tool definition, constraining tool names and inputs The structured value is an action’s arguments
Instruction plus example Describe the schema, show one worked example Neither of the above is available

Both enforced mechanisms can be used in one request. The docs are blunt about the ordering: if you need Claude to always output valid JSON conforming to a schema, use structured outputs instead of the prompt-engineering techniques.

Four operational facts. The Python helper is client.messages.parse(...) with a Pydantic model, returning response.parsed_output. The helper still takes the model as output_format and sends output_config.format for you. On a raw request, as of September 2026, “The output_format parameter is deprecated and will be removed in the future. To use it anyway, add the structured-outputs-2025-11-13 beta header. Without it, the API returns a 400 error.” The first request with a new schema pays grammar-compilation latency. Compiled grammars cache for 24 hours from last use, and changing output_config.format invalidates the prompt cache for that conversation thread.

Two more, as of September 2026. Required properties come first in the output, then optional ones, so a streamed or positional reader sees that order. If order matters, mark everything required. Strict mode has request-wide complexity limits: 20 strict tools, 24 optional parameters, 16 union-typed parameters, and a 400 (“Schema is too complex for compilation”) when the compiled grammar is still too large.

Parsing answers one question: “is this syntactically well-formed?”. Validation answers another: “does the data meet the schema, the business rules and the reference constraints?”. Structured outputs collapse the first question, which is precisely why the second gets forgotten.

Unsupported in the schema subset: numerical constraints (minimum, maximum, multipleOf), string constraints (minLength, maxLength), recursive schemas, complex types within enums, external $ref, and array constraints beyond minItems of 0 or 1. additionalProperties must be set to false. A schema can guarantee thickness_mm is present and a number; it cannot guarantee it falls between 8 and 40.

Everything the schema cannot express is the validation layer’s job, in four checks:

Check Catches
Structural Missing required fields, wrong types, enum values outside the declared set (compare case-insensitively: as of September 2026 enum and const capitalisation is not guaranteed)
Range and plausibility Numbers outside domain bounds, dates outside the possible window, malformed formats
Cross-field consistency A total that does not equal its parts, an end date before a start, a status incompatible with its own fields
Referential An identifier that names nothing real; the only check that catches a confidently invented one

Write it as code that runs on every response, with one behaviour on failure: raise, with the raw response body and the request id attached. The substitute-a-default branch converts a loud failure that would have been fixed into a quiet wrong record trusted for months.

Check stop_reason Before the Payload (6.3)

Section titled “Check stop_reason Before the Payload (6.3)”

Defensive parsing starts with the stop reason, not the content blocks. Seven documented values: end_turn, max_tokens, stop_sequence, tool_use, pause_turn, refusal, model_context_window_exceeded (a compaction request adds an eighth, compaction; see 6.1). Three of them mean the content is not what you asked for.

  • max_tokens: the response hit your limit, so it is truncated.
  • model_context_window_exceeded: the response filled the model’s window, and the documented instruction is to treat it as truncated.
  • refusal: Claude declined. It arrives as a normal HTTP 200 with a stop_details object naming the policy category, so an integration branching only on status sees a success with no useful content.

What makes this defensive parsing rather than error handling is that a truncated response can be syntactically valid up to the cut. A JSON object stopped after its fourth field still parses if your parser is lenient.

Never take everything from the first brace to the last. Taking everything between the first opening brace and the last closing brace succeeds on truncated output, on output wrapped in prose, and on output followed by commentary, turning three distinct failures into one silently wrong record. It also swallows a draft written before the final JSON. Without structured outputs, when JSON is asked for in the prompt, the documented parse (as of September 2026) reads only the text blocks, treats a max_tokens stop as failed, keeps the last complete JSON value, then checks its fields and retries once.

Tone carries no information about accuracy. Fluent, well-formatted, appropriately hedged output is what the system produces whether or not the standard it cites exists.

  • Give permission to decline. “Allow Claude to say ‘I don’t know’… This simple technique can drastically reduce false information”, and give the exact wording so the abstention is machine-detectable rather than a paragraph of hedging.
  • Ground in quotes. For documents over about 20k tokens, extract word-for-word quotes first, then perform the task. Make each claim carry a supporting quote and remove claims that lack one.
  • Best-of-N verification. Run the same prompt several times; disagreement between runs is a fabrication signal.
  • Citations. For documents you supply, set citations.enabled and the API extracts cited_text itself, so citations “are guaranteed to contain valid pointers to the provided documents”. As of September 2026, citations with output_config.format in the same request return a 400.
  • The closing caveat sets the expectation: these techniques “don’t eliminate them entirely. Always validate critical information”.

When validation fails, re-asking with the identical request is the weakest move available: it samples the same distribution again and, if the schema or prompt is at fault, fails the same way indefinitely. Attach the specific errors: which field was missing, which value fell outside its range, which two fields disagreed. Cap the attempts explicitly, because an uncapped retry loop on a systematic failure is a cost incident. Then treat repeated failure as a defect: the same field failing across many inputs means the schema asks for something the source does not contain, the prompt has not said where to find it, or the validator asserts something the domain does not guarantee. Log the raw response, the stop reason, the usage block, the request id, the validation error and the input, so you can tell which.

Claude receives one context: system prompt, conversation turns, tool definitions, tool results. All of it is text, and nothing structural marks your sentences as commands and a supplied document’s sentences as data. Injection is a property of how these systems work, not a defect awaiting a patch. No release note will retire it.

Direct injection and jailbreaks Indirect injection
Adversary The user of your application Whoever shaped content Claude reads
Arrives via The input the user types Emails, fetched pages, OCR text, tool results
Controls sit on The input path: harmlessness screen, input validation, a system prompt stating boundaries and how to refuse, a policy for repeat offenders backed by an opaque, hashed metadata.user_id The tool surface and the outbound path

Indirect is the class that matters in agentic applications: the attacker never touches your interface. On the exam: items describe which situation you are in, and the wrong answer is usually the right control for the other one. The guide’s own published rationale kills three postures outright: temperature is irrelevant to injection, a polite request is not an enforceable control, and a more instruction-following model can be more susceptible, because injected text is instructions too.

The browser use tool (as of September 2026) puts what Claude sees of a page in your executor’s hands. Treat everything a page supplies as untrusted, and build page reads from what the page renders, the accessibility tree or visible text, never raw DOM source, so hidden text never reaches Claude.

Current docs have moved past wrapping everything in XML tags. Five rules, in the order the page gives them:

  1. Deliver third-party content inside tool_result blocks, never in system prompts or plain user text blocks. Claude is trained to treat instructions inside tool results with scepticism.
  2. Say what the content is and where it came from, in the tool description or in the structure of the result.
  3. State the policy in your system prompt: content from tools, documents and searches is untrusted data, and instructions inside it are information to report rather than commands to follow.
  4. JSON-encode the untrusted string where possible, rather than concatenating it. Escaping gives unambiguous delimiters, so an attacker cannot close a quote or a tag to break out into an instruction context.
  5. The one developers get backwards: do not put your own instructions inside a tool result. Claude treats that content as untrusted data and may ignore it or flag it as an injection attempt. Yours go in the user turn that follows or, on models that support one, a mid-conversation system message.

All five make the model a better reader of provenance. None is enforcement, which is why the next two moves exist.

Screening, and Least Privilege Over the Tool Surface (7.1)

Section titled “Screening, and Least Privilege Over the Tool Surface (7.1)”

Screening runs in both directions: inbound, a harmlessness screen on the user’s content using a lightweight model (the docs name Claude Haiku 5.5), with the verdict constrained by structured outputs to a parseable boolean rather than prose, and a stop_reason: "refusal" on the screening call treated as a harmful verdict; outbound, the same pattern on a tool’s raw output before it is returned as a tool_result. It is a check with an enforcement point, because the application decides whether the content reaches the model. But it is also a model, so it is probabilistic and it misses. That is exactly why it composes with deterministic controls instead of replacing them.

Least privilege has three distinct moves, and they are not interchangeable:

Move Mechanism Strength
Remove the tool disallowed_tools=["Bash"]; a bare name strips the definition from the request Strongest: Claude never sees the tool
Scope the tool disallowed_tools=["Bash(rm *)"]; denied in every permission mode, bypassPermissions included An enforceable boundary, not a preference
Narrow the credential Read-only where reading suffices; the end user’s entitlements rather than a service account’s Bounds the blast radius

The published evaluation order: hooks → deny rules → ask rules → permission mode → allow rules → the canUseTool callback. Two reciprocal traps live in it. A call approved at any earlier step skips canUseTool entirely, so a security check written there is silently bypassed for that tool. And allowed_tools does not constrain bypassPermissions, so listing three read-only tools alongside that mode still approves everything you left off the list.

Leak, PII, and Whose Authority the Call Carries (7.1)

Section titled “Leak, PII, and Whose Authority the Call Carries (7.1)”

Prompt leak. No method is foolproof. The documented ordering is monitoring first, then output screening and post-processing, and only then leak-resistant prompt engineering, which comes last because it adds complexity to the model’s main task and may degrade performance elsewhere. Rank the fixes: the durable one is not putting the value in the context at all; the practical one is an output check; the fragile one is instructing the model to keep a secret. Prefilling the assistant turn is not supported on Claude 4.6 and later, so it is not available as a leak control.

The outbound path is where a leak travels, so constrain which tools can send, fetch or write, and to where. In a browser use executor (September 2026) that means refusing any navigate scheme other than http or https, checked with a URL parser rather than a string prefix, and confining file_upload to a dedicated, allowlisted directory, never the browser’s download folder.

PII is a data-flow decision at four points: what enters the context (minimise, redact, tokenise), what the provider retains, what your own systems keep, and what your users are told (every consumer-facing chatbot must disclose that it is AI). Retention detail as verified 2026-08-21: retained data is never used for training without express permission, and ZDR is arranged per organisation, never extending automatically to a sibling organisation on the same account. ZDR also excludes Console usage, Managed Agents sessions, consumer plans and features such as code execution, and it does not override retention of a flagged session for up to two years. Covered Models require 30-day retention and are not ZDR-eligible. Your own request-and-response log is a complete second copy of everything the model saw, so redact at the write.

The confused deputy. An agent acts on somebody’s behalf. If its credential is broader than the person it acts for, any text that can steer it has borrowed the wider authority. Keep the three checks distinct: authentication establishes who the caller is, authorisation establishes what that caller may do and is checked per action, integrity covers whether the data and the action are what they claim to be (approval gates, audit records). Multi-tenant isolation follows from authorisation, never from a system-prompt sentence. Retrieve-then-filter is a defect, not a control.

Ask three questions of any proposed control: what does it inspect, where does the code run, and what happens when it fires? If the answer to the third is that the model reads something and decides, it is a behaviour shaper, not a guardrail. Most guardrail tables shrink the first time you run that test over them.

Layer Catches Limit
Input checks Classification, pattern filtering, redaction, shape validation Probabilistic, and blind to anything arriving on a channel they do not sit on
System prompt and training Genuinely shapes behaviour; stating an untrusted-content policy is recommended Enforces nothing. The single most important sentence in the sub-skill
Tool-level controls Which tools exist, credential scope, approvals, deterministic pre-execution checks Where enforcement actually lives; removal beats denial
Output checks Shape validation, policy classification, redaction, and blocking the resulting action Skipping the action half is the common defect

Layer because each layer fails differently, not from belt-and-braces sentiment. Layers are not interchangeable: a stricter output check cannot see what an input screen would have caught before the draft was written. Claude Code ships a worked example: a permission system, context-aware analysis, input sanitisation, network commands such as curl and wget left out of the auto-approved set, an isolated context window for web fetch, trust verification for first-time codebases and new MCP servers, command injection detection, and fail-closed matching. Its own caveat closes the point: no system is completely immune.

The governing document is the Usage Policy. “Acceptable Use Policy” survives only as the URL slug and an alias. Three parts:

  • Universal Usage Standards: prohibitions applying to everyone.
  • High-risk Use Case Requirements: these apply to a High-risk AI Recommendation, a recommendation in one of eleven High-risk Areas: legal, medical, finance, credit, insurance, housing, employment, education and credentials, healthcare access, public benefits and services, and legal status and adjudication. Two controls attach: a qualified person with the authority to change or modify it must meaningfully review it before it is delivered as advice or used to implement a decision, and the person affected must be clearly told that AI was used to produce it.
  • Additional Use Case Guidelines: consumer-facing chatbots and agents, products serving minors, agentic use cases, and software listed in Anthropic’s directories. Every consumer-facing chatbot or AI agent that communicates directly with external users must disclose that users are interacting with AI rather than a human, at a minimum at the beginning of each chat session or in the product interface, whether or not a High-risk AI Recommendation is involved. If you ship an agent that acts on somebody’s behalf, this part describes your product: you are responsible for making sure that what it does, including through tools, browsers and connected systems, complies with the policy.

Read the high-risk controls as build work: a human gate with a named owner who can change the output, a disclosure the affected person sees, a refusal path, an escalation route, and a log entry proving the gate ran. The exam distractor is always a technically sound control that does not discharge the obligation, such as a better classifier where the policy asks for a qualified person’s review. The exam tests whether you notice that a scenario has landed inside a High-risk Area at all.

Fail Closed, and Deployment Discipline (7.2)

Section titled “Fail Closed, and Deployment Discipline (7.2)”

Availability engineering says degrade gracefully and keep serving. On the security path the instinct is inverted: when the classifier times out, validation is inconclusive, or the approval service does not answer, refuse or hold the consequential action. Proceeding converts the check into a suggestion that any dependency failure removes, and whoever can cause the failure gets the unguarded path for free.

Two properties make a hold shippable: separate the consequential action from the whole feature (holding one publication is not an outage), and give the held work somewhere to go and someone to tell: a queue, a notification, and a resume trigger. Retrying is fine; ending the retry chain at the model is not, because that swaps the enforcement point for the layer that enforces nothing.

Named instances. Claude Code’s fail-closed matching: in Manual mode (config value default), unmatched commands require approval by default. As of September 2026 interactive sessions start in auto mode from v2.1.283, while claude -p and the Agent SDK start in default. The Agent SDK’s dontAsk mode denies any call that would otherwise prompt, which is what a headless agent with nobody to prompt should do. Calls your allow rules pre-approve, and calls that need no approval in default mode, still run.

Rollout and observation are part of the guardrail, not operations beside it. Stage the exposure, monitor security-relevant events rather than only the error rate, red-team your own agent before deploying with documents and tool outputs that deliberately carry injection attempts, give reports an owner, and keep a rollback nobody has to argue for. The docs treat analysis of outputs as an input to the guardrails: findings refine prompts, validation and filtering. A well-built deployment with no observation is a wrong answer, not merely an under-instrumented one.

One idea, quoted verbatim: hooks give “deterministic control: certain actions always happen rather than relying on the LLM to choose to run them.” When a team has told the model three times not to do something, the fix is not a fourth telling; it is a check the model does not participate in.

PreToolUse mechanics, all keyed facts:

Signal Effect
Exit 2 Blocks; the reason on stderr reaches Claude
Exit 0 No objection, which is not approval; the normal permission flow still applies
Any other non-zero, without valid JSON on stdout Non-blocking error, and the action proceeds, unless the hook sets onFailure: "block" (October 2026). A script that exits 1 has quietly disabled itself
JSON hookSpecificOutput permissionDecision of allow, deny, ask or defer, with permissionDecisionReason. defer is honoured only in a -p run, which exits with the call preserved for a later resume. Precedence across hooks: deny > defer > ask > allow

On blocking-capable events, exit 2 wins regardless, and even a printed allow cannot override it. Hooks run first in the evaluation order, so a hook deny binds even in bypassPermissions. The reciprocal stops over-claiming: a hook returning allow does not clear a matching deny or ask rule. Hooks tighten; they do not loosen.

Matchers (as of September 2026): a matcher of only letters, digits, _, -, spaces, commas and | is an exact name or list. Any other character makes it an unanchored regular expression, so Edit.* also matches NotebookEdit. mcp__archive matches no tool, while mcp__archive__.* matches the whole server. Other safety events: UserPromptSubmit can block a prompt before Claude processes it. PostToolUse cannot undo a call, but updatedToolOutput replaces what Claude sees, while decision: "block" only adds a reason beside the original output.

Limits worth stating out loud. Five types exist and only some are deterministic: command, http and mcp_tool run code you control, while prompt is a single-turn model evaluation and agent is multi-turn verification with tool access, both documented as being for decisions requiring judgement rather than deterministic rules, and agent hooks are still experimental. A rule about intent is not hook-shaped. A hook is a synchronous check, so it costs wall-clock time on the path it guards (our observation, not a documented limit, though the per-type timeout defaults exist because of it). Both ways of removing that latency open the gate: an async hook cannot block, and a command hook that times out on PreToolUse does not block either, so the call proceeds through the permission flow. disableAllHooks is an off switch, and only managed settings keep managed hooks running when a lower-scope file turns them off. Path-based deny rules do not reach a subprocess that opens files itself, so OS-level enforcement across every process means the sandbox, not a rule.

Keys: Where They Live, and What to Do When One Leaks (7.4)

Section titled “Keys: Where They Live, and What to Do When One Leaks (7.4)”

Anything shipped to a client is public. A JavaScript bundle, a mobile binary, a desktop application: the running code reads the credential, so anyone who can run the code can read it. Minification and encoding are transformations the code reverses on every start. Obfuscation is not secrecy. The fix is a boundary rather than a hiding place: the client talks to your backend, and the backend holds the credential and calls Claude. It buys three things, where distractors usually fix only the first. It removes the credential from the client. It gives you a place to authenticate the user and authorise the request. And it gives you the enforcement point for per-user rate limiting and quota. One dated exception, verified 2026-08-21: App Attest lets an attested iOS or macOS installation call the API with no back end, on workspace-scoped tokens that expire after an hour and authorise only Messages API calls. It is not a licence for a browser bundle.

Fact Detail
Static key sk-ant-api... sent as Authorization: Bearer; the x-api-key header is legacy but still supported (September 2026). SDKs read ANTHROPIC_API_KEY. Disable a leaked key (reversible) or delete it (permanent)
Key types Personal (acts as you; archived when you are removed), service account (the identity for shared or automated workloads), workspace (legacy; acts as no one and keeps working whoever created it)
Expiration Chosen at creation from 3 hours, 1 day, 7 days, 30 days, a custom duration or Never. Cannot be changed afterwards. Expired keys return 401 authentication_error and cannot be reactivated
Its place Limits the lifetime of a leaked credential, and the docs call it no substitute for secret hygiene
Workload Identity Federation Exchange an IdP identity token at POST /v1/oauth/token for a short-lived token; the SDK refreshes it. No sk-ant-api... string to mint, distribute or rotate. Caveat: only as strong as the IdP configuration. A federation rule’s match conditions (subject_prefix, claims such as ref, audience, a CEL condition) decide who may mint, and its oauth_scope is a ceiling, so a Claude-only workload gets workspace:inference
Creation Console only. The Admin API reads, renames and changes status (inactive disables reversibly, archived deletes) and audits; it does not provision
Managed Agents vaults Beta. Credentials registered once and referenced by ID per session; an environment_variable secret is swapped in at egress, so the agent never sees it. Outbound only: a token fetched with it arrives unredacted

The exposure playbook is a sequence, and the sequence is the examinable part. 1. Kill the credential, because until the exposed key is dead everything else is decoration. 2. Remove it from wherever it leaked, knowing git history, build caches, CDN copies and screenshots keep their own copies. 3. Fix the design that put it there, usually the client-side architecture. 4. Review the access logs, and only then decide whether the incident is closed. Every wrong answer here is a real step performed in the wrong order.

Verification at the Point of Use, and Attribution (7.4)

Section titled “Verification at the Point of Use, and Attribution (7.4)”

Authenticate the caller at the edge, then verify the level at the point of use, per action, so an elevated operation re-checks entitlement rather than inheriting the answer a session got when it opened. Where an agent acts on somebody’s behalf, its tool calls carry that person’s authority, not a service account’s. Approval flows belong here too: who may authorise an elevated action, and how the decision is recorded so it can be produced later.

A key with no attribution cannot be investigated. If three services share one credential, an anomalous spike names none of them, and the first fix is a distinct key per service so the alert has something to point at, not a better alert. Usage and cost attribution runs per key and per workspace, so keys scoped by project or environment give every line of spend a caller. The Admin API lists keys with status, workspace and expires_at, so rotation is auditable rather than remembered. Usage and Cost API and Rate Limits API for the numbers, the Compliance API Activity Feed for the audit record, and for Claude Code, OpenTelemetry events through the OTLP logs exporter as the audit source. Tool arguments such as the Bash command need OTEL_LOG_TOOL_DETAILS=1, and an API-key session carries no account, so attach identity with OTEL_RESOURCE_ATTRIBUTES.

Two documented details that make good items. Organisation roles are user, claude_code_user, developer, billing and admin, with workspace roles separate. And on offboarding, it depends on the key type: personal keys are archived when their owner is removed, service account keys keep working unless the service account is archived, and legacy workspace keys keep working regardless. A production service belongs on a service account key, never on a person’s.

When the model decides whether to call a tool, it reads the name, the description and the input_schema. It cannot see your handler, your docstring, your API contract or the meeting where the team agreed which tool to use when.

That single fact does most of the diagnostic work in the sub-skill. If the model chose badly, the information it needed was absent from one of those three surfaces, and the fix is to put it there. Options reaching for a bigger model, a lower temperature or an extra layer of routing all propose to solve an information problem with something that supplies no information.

What a description must carry, from the docs’ own checklist:

  • what the tool does
  • when it should be used, and when it should not
  • what each parameter means and how it affects the tool’s behaviour
  • caveats and limitations, explicitly including what the tool does not return

The stated floor is at least three to four sentences per tool, more if the tool is complex, and the ranking is unusually blunt: detailed descriptions are “by far the most important factor in tool performance”. Not the schema. Not the model. The failure mode is a description that paraphrases the name, because it adds nothing the name did not already carry.

Disambiguation, Consolidation, and the Router Trap (8.1)

Section titled “Disambiguation, Consolidation, and the Router Trap (8.1)”

Two faults look similar and take opposite remedies. Getting the pairing the wrong way round is the strongest distractor an item in this sub-skill can offer, because both moves are recommended somewhere in the docs.

Fault What the stem says Remedy
Overlap Two tools over adjacent parts of the same system, chosen inconsistently Rewrite both descriptions: each names the sibling and says when not to use itself
Sprawl One tool per endpoint, several thin wrappers over adjacent operations Consolidate behind an action-style parameter: fewer, more capable tools

Disambiguation is a sentence you write, never a property the model infers, and the when-not-to-use clause is the half candidates leave out and the half the exam keys. If the boundary is genuinely hard to state in one sentence, that is evidence the two tools want to be one tool with a parameter.

The routing tool is the trap that sounds like engineering. Adding a third tool to decide between two confusable ones relocates the ambiguity rather than removing it. The router draws the same distinction from the same uninformative descriptions, the model must now also decide whether to call the router, and a turn is spent arriving back where it started. Indirection cannot supply information a description is missing.

Two more properties keep a growing surface legible: namespacing by service or resource (github_list_prs, not list_prs), which matters more once tool search is in play, and result shape: return only high-signal fields, with semantic stable identifiers such as slugs or UUIDs rather than opaque internal references.

Two dated additions, checked 2026-09-30:

  • Clashes between MCP servers. The MCP specification scopes tool-name uniqueness to a single server, so a client aggregating several servers can meet two tools both called search. Prefix each with a server identifier, not with the self-reported serverInfo name, which is not guaranteed to be unique.
  • Attribution in results. A client tool’s tool_result can carry search_result blocks with a source and title you supply. With citations enabled (off by default), Claude cites them the way it cites web search results, so attribution comes from your data rather than from a reference Claude copies out.

The Schema and the Optional Properties (8.1)

Section titled “The Schema and the Optional Properties (8.1)”

The description says when to reach for a tool. The schema says what a well-formed call looks like, and unlike the description it is enforced rather than suggested. Closed sets belong in enum, mandatory fields in required, units and formats in the per-property description. A schema that permits nonsense will receive nonsense.

Optional properties on a tool definition, verified 2026-08-21 and rechecked 2026-09-30:

Property What it does Availability
strict Guarantees Claude’s tool names and inputs match your schema exactly, removing the missing-parameter class of failure at source All tools except mcp_toolset and the computer use and browser use toolsets
input_examples An array of example input objects, each validated against the tool’s own input_schema; an invalid example returns a 400 User-defined and Anthropic-schema client tools; not on server tools, nor on the computer use or browser use toolsets
defer_loading Excludes the definition from the initial system prompt, expanding it inline when tool search returns a tool_reference for it All tools; set per member inside configs on the client toolsets
cache_control Sets a prompt-cache breakpoint at this tool definition All tools
allowed_callers Restricts which callers may call the tool ("direct", or code running in a code-execution sandbox, which is programmatic tool calling) All tools except mcp_toolset; only "direct" on the computer use and browser use toolsets
eager_input_streaming Turns fine-grained input streaming on (true) or keeps standard buffered streaming (false) for this tool User-defined tools only

input_examples costs roughly 20–50 tokens for a simple example and 100–200 for a complex nested object, which is why it earns its place on tools with nested objects, optional parameters or format-sensitive fields and nowhere else. strict constrains the structure of the call and input_examples shows how to fill in its parameters, but neither replaces a description of when to use the tool: both act on a call the model has already decided to make. Deferred definitions sit outside the cached prefix, so put the cache breakpoint on a tool that is not deferred. Each deferred tool also costs a search step before Claude can call it, so the tool search docs advise keeping your three to five most frequently used tools non-deferred.

Programmatic tool calling (generally available as of September 2026) is the lever for results rather than definitions. Add a code execution caller such as code_execution_20260120 to a tool’s allowed_callers, and Claude can call that tool from code it writes in the code execution container. Each call still comes back to your application to run, but intermediate results never enter Claude’s context, so a fan-out over many records or a large result to filter takes one trip through the model instead of one per call. Not available for strict: true tools or for tools from the MCP connector.

This is interface design, not exception handling, and it holds the most consequential item in the sub-skill.

A handler that catches a timeout and returns an empty list hands the model a well-formed result asserting that nothing went wrong and that there is nothing there. The most probable continuation from that position is a confident answer assembled from surrounding context, which is what fabrication looks like from the outside. Returning the last known good value is worse: confidently wrong, current-looking, and leaving no trace that anything failed.

The pattern that works is a tool_result carrying is_error: true and a body written for a reader who has to decide what to do next. The docs put it directly: instead of generic errors like failed, include what went wrong and what Claude should try next, for example Rate limit exceeded. Retry after 60 seconds.

Two honest qualifications, both places candidates over-claim:

  • On genuinely invalid tool calls the documented behaviour is that Claude “will retry 2-3 times with corrections before apologizing to the user”. The folk story of an endless identical retry is not a documented mechanism.
  • Server tools are handled differently. The API deals with their errors itself, and you do not need to handle is_error results for them.

A longer timeout and a bounded retry are both good engineering and both appear as confident, fully-stated distractors. Neither changes what the model receives when the call finally fails; they only change how often it fails.

Client, Server, and the Dated Inventory (8.1)

Section titled “Client, Server, and the Dated Inventory (8.1)”

A client tool is yours: the model emits a tool_use block, your process runs the function under your credentials inside your network, and you return a tool_result. Anthropic’s infrastructure never executes it, which is exactly why a client tool can reach a database on a private subnet.

A server tool is Anthropic’s: the call appears as a server_tool_use block whose id carries the srvtoolu_ prefix, the API executes it internally, its result arrives in the same assistant turn paired by tool_use_id, and you return no tool_result at all.

Anthropic-provided is not Anthropic-executed. Anthropic ships both kinds, and several familiar Anthropic-schema tools sit on the client side with your process running them. Answer from the capability boundary first. Where a tool runs only matters when the question says so. Don’t assume a location it leaves out, and don’t rely on today’s list of built-in tools, because it changes between releases. That inventory, verified against the Tool reference on 2026-08-21 and unchanged on 2026-09-30:

Execution Tools, with current type strings
Server Web search (web_search_20260318, _20260209, _20250305), web fetch (web_fetch_20260318, _20260309, _20260209, _20250910), code execution (code_execution_20260521, _20260120, _20250825), advisor (advisor_20260301, beta), tool search (tool_search_tool_regex_20251119, tool_search_tool_bm25_20251119), MCP connector (mcp_toolset, beta)
Client Memory (memory_20250818), bash (bash_20250124), text editor (text_editor_20250728, _20250124), computer use (computer_toolset_20260801, computer_20251124, computer_20250124), browser use (browser_toolset_20260801)

Read the shape rather than the list: search, fetch and sandboxed execution are the platform’s environment, so they never reach a private network; memory, bash, editing and driving a machine or a browser are operations on your environment, so they have to be yours to run.

Dispatch, Approval Bands, and Symptom-to-Surface (8.1)

Section titled “Dispatch, Approval Bands, and Symptom-to-Surface (8.1)”

The harness receives the tool-use request, resolves the name to a handler, validates the input, applies whatever policy the operation’s classification demands, executes under a timeout, logs the call and formats the result. Putting those concerns at the dispatch point rather than inside each handler is what keeps a tool function a plain function you can unit-test with no model anywhere near it.

Execution order is yours too. When one turn carries several tool_use blocks, the API does not prescribe an order (checked 2026-09-30). Run independent, read-only calls in parallel. Anything with side effects, shared state or ordering requirements goes one at a time. If you stop a sequential batch at a failure, still return a tool_result for each skipped call, with is_error: true and a short explanation.

Approval is the policy living in that layer, and the classification is a design decision made once, when the tool set is designed:

Band Operations Example
Automatic Read-only, reversible Read a record
Confirm Consequential, reversible with effort Amend a draft
Two-party gate Genuinely dangerous, not quietly undone Submit an irreversible return

Unknown tools are never automatic. Nor is a tool that merely declares itself safe: as of September 2026 MCP tool annotations such as readOnlyHint and destructiveHint are hints, not guaranteed to describe the tool faithfully, and clients must treat them as untrusted unless the server is trusted. Deciding the bands and expressing them in the tool surface is 8.1. Making the gate an enforceable control that fires whether or not the model cooperates is Domain 7. An option relying on an operator noticing something is not a control on either side of that line.

Half the items arrive as a symptom, so run it as a routine:

  • Wrong tool chosen → the descriptions. Ask whether any sentence in either one distinguishes the two cases; if none does, write the disambiguating sentence plus a when-not-to-use clause in both.
  • Invented data → what the tool returns on failure. Something returned a well-formed result carrying no information and no error.
  • Repeated identical calls, or a stall → an unactionable result: one saying a request failed without saying whether a retry helps or what a valid input looks like.

What MCP Buys, and the Three Participants (8.2)

Section titled “What MCP Buys, and the Three Participants (8.2)”

Start from the failure it prevents. One internal system, several Claude applications, no shared protocol: each application grows its own integration, and they drift silently until a field changes and breaks two of them in a way nobody notices for a month. MCP replaces that with one server: the capability implemented once, exposed over a standard protocol, connected to by any compliant client. The gain becomes visible at the next schema change: made in one place, by the team that owns the underlying system, seen by every connected client.

That is a maintenance and ownership argument, not a capability one, and holding the two apart settles most items here. A custom tool inside one application can do the same job. That is not what a stem naming several applications and independent maintenance is asking.

The specification names three participants, and the direction matters:

  • MCP Host: “The AI application that coordinates and manages one or multiple MCP clients.”
  • MCP Client: “A component that maintains a connection to an MCP server and obtains context from an MCP server for the MCP host to use.”
  • MCP Server: “A program that provides context to MCP clients.”

The host creates one client per server, so a host connected to four servers runs four clients. Your Claude application sits on the client side. The thing wrapping your internal system is the server. And local and remote describe where a server runs, not what it is, because the same program is an MCP server whether it runs as a child process on one laptop or as a service several teams reach over the network. Any option denying that is a flat statement of fact that happens to be false.

What the 2026-07-28 revision changed about the connection (checked 2026-09-30):

  • No initialize handshake: every request carries its own protocol version and client capabilities.
  • Every server must answer server/discover with its supported versions and capabilities.
  • Change notifications such as toolsListChanged are opt-in, through a subscriptions/listen stream.
  • No protocol-level sessions and no Mcp-Session-Id header. State across calls uses an explicit, opaque handle returned by a creation tool and passed back as an ordinary argument; an expired or unknown handle gets a tool error that says so.
  • Roots, Sampling and Logging are deprecated: still working, but not for new implementations.

The sharpest examinable distinction in the sub-skill. Ask who decides a capability gets used.

Primitive What it is Controlled by Methods
Tools Functions the LLM can actively call, deciding when based on user requests Model tools/list, tools/call
Resources Passive read-only data for context: file contents, database schemas, API documentation Application resources/list, resources/templates/list, resources/read
Prompts Pre-built instruction templates telling the model to work with specific tools and resources; user-controlled, requiring explicit invocation rather than automatic triggering User prompts/list, prompts/get

Resources carry a URI, either fixed (records://schema/batch) or a parameterised template (records://batch/{batch_id}). Applications typically surface prompts as slash commands.

The trap is flattening all three into tools, because tools are the primitive most authors already understand. Its sharpest form is a standard document template people want to pull in on demand: user-initiated, and a template, therefore a prompt. Making it a tool hands the decision to the model, which is the opposite of what the person starting the job wanted. The mirror case is passive reference data such as a schema or a fixed dataset, which belongs in a resource the application fetches by URI.

Two result details from the 2026-07-28 revision:

Field What it does
outputSchema and structuredContent A tool can declare an output schema; its results must then carry structuredContent that conforms to it, which the client should validate, and the same JSON also goes in a text block for older clients. Server-produced data, unrelated to strict or to the model’s structured outputs
ttlMs and cacheScope Required caching hints on list and read results. ttlMs is a freshness hint in milliseconds; public lets a shared gateway serve one cached tool list to every user, private keeps a per-user resources/read result inside one authorisation context

Two transport mechanisms in the current specification, and the choice is a reading of the deployment, never a preference:

Transport Mechanism Typical topology
stdio Standard input/output streams between local processes on the same machine; no network overhead Local server, typically one client
Streamable HTTP HTTP POST for client-to-server messages, optional Server-Sent Events for streaming; standard HTTP authentication including bearer tokens, API keys and custom headers Remote server, typically many clients

The question is never which transport is better. It is who needs to reach this server, and from where. One developer wrapping a local command line is single-user and local, which points at stdio. A capability three applications and several machines must share is remote and multi-user, which points at the HTTP-based transport and pulls authentication, deployment, availability and access control into scope; the specification recommends OAuth for obtaining tokens.

The inverted pairing is the standing distractor: stdio proposed for the genuinely shared capability (one copy per machine, which is the drift MCP was adopted to remove) and a remote transport for the local wrapper (deployment, authentication and availability obligations bought for no reuse). Both halves sound like transport knowledge; only the topology reading separates them.

The stdio stdout rule. On stdio the server’s stdout is the protocol channel, and the server must not write anything there that is not a valid MCP message. A stray print() in a handler corrupts the JSON-RPC messages and breaks the server. Log to stderr or a file; the 2026-07-28 revision points servers that used the deprecated Logging feature to stderr on stdio, or to OpenTelemetry.

Don’t answer from a transport name. This part of the specification has already moved once. The exam guide’s own wording for this sub-skill says “stdio, sockets”; the current specification lists two standard mechanisms, with sockets appearing only as a custom transport that should reuse the stdio framing; and Anthropic’s MCP connector page still names SSE alongside Streamable HTTP for its own remote requirement, although the 2026-07-28 revision marks the old HTTP+SSE transport Deprecated. Current protocol revision, checked 2026-09-30: 2026-07-28. Learn the topology rule, which is stable.

A remote server is a service: a version, an owner, an availability expectation, an authentication story and a list of who may connect. The moment several surfaces depend on it, its outages are their outages. The reuse benefit and the operational obligation arrive together.

Reaching a Server from a Claude Application (8.2)

Section titled “Reaching a Server from a Claude Application (8.2)”

One server can serve several Claude surfaces at once, each configuring its connection its own way. That is the reusability claim, made concrete.

On the Claude API the MCP connector reaches remote servers straight from the Messages API without a separate MCP client. Its two limitations are examinable as consequences rather than trivia, and both are stated verbatim on the docs page:

  • “Of the feature set of the MCP specification, only tool calls are currently supported.”
  • “The server must be publicly exposed through HTTP (supports both Streamable HTTP and SSE transports). Local STDIO servers cannot be connected directly.”

The request carries an mcp_servers array plus an mcp_toolset entry in tools naming one of them, and Claude’s calls return as mcp_tool_use and mcp_tool_result blocks. For local stdio servers, or when you need MCP prompts and resources rather than tools alone, the SDKs ship client-side helper functions instead. As of September 2026 the connector is a beta, not available on Amazon Bedrock or Google Cloud. A newer beta header, mcp-client-2026-09-15, pins a server’s tool list, so a server that changes its tools mid-conversation does not change what Claude sees. Claude Code’s own configuration specifics belong to Domain 3.

The tools an MCP server exposes are ordinary tools and answer to everything in 8.1. Being reachable over a protocol changes nothing about what a good description or a good error result looks like.

Four Mechanisms, One Decision Sequence (8.3)

Section titled “Four Mechanisms, One Decision Sequence (8.3)”
Mechanism One sentence Cannot
Built-in tools Capabilities Anthropic provides: the platform defines the schema and, for the server-executed ones, runs them. The server-executed ones need no code, handler or deployment; client-executed ones still need your application to run them Automatically reach arbitrary internal APIs; the server-executed ones cannot reach your private network at all
Custom tools Functions you define and your code executes, under your credentials inside your network Be free of maintenance; you own them entirely
Skills Packaged procedural knowledge: a SKILL.md with YAML frontmatter, optionally bundled with reference files and scripts, loaded when relevant Grant a capability; a Skill changes how Claude does something it can already do
MCP servers A capability exposed over a standard protocol so several clients share one implementation, versioned and owned independently Avoid being a service, with everything that implies

Four questions, in order. Most items are settled by the first or the second.

  1. Does the platform already provide this? Searching the public web, fetching a page, running code in a sandbox are covered, and as of September 2026 so is acting on webpages in a browser your application runs (the browser use tool, a client toolset). If the requirement matches one, building anything is work you did not need.
  2. Does the model need to DO something in a system, or to KNOW how to do something it can already do? Doing means a tool. Knowing means a Skill.
  3. If it is a tool, will more than one application or surface need it, and does another team own the underlying system? Yes to either points at an MCP server. No to both points at a custom tool.
  4. If it is knowledge, is it procedural and only occasionally relevant? Then a Skill loads it on demand instead of carrying it in every prompt.

The guide’s own Domain 8 rationale states the boundary that disposes of a whole family of distractors: built-in tools “do not automatically reach arbitrary internal APIs”. Reaching an internal system needs code executing where that system is reachable, which means a custom tool or an MCP server, and nothing else on the list qualifies.

Browser use against its neighbours (checked 2026-09-30). The docs say to choose browser use when the task stays inside webpages and means acting on them, or when pages build their content with JavaScript. For reading pages, web fetch and web search are lighter; for a task that needs a whole desktop, use computer use. Your application runs every browser use call against its own browser, and nothing runs on Anthropic’s side.

If the model lacks information it cannot reach or an action it cannot perform, that is a tool, and no volume of instruction substitutes. A records lookup, a write to a database, a job trigger. On the Claude API the boundary has teeth: Skills there run in a sandboxed container with no network access and no runtime package installation, so a Skill genuinely cannot fetch your records however precisely it documents them.

If the model can already perform the task but does it inconsistently, in the wrong format, or against the wrong conventions, that is knowledge, and packaging it as a Skill is how it gets applied without occupying every request. House reporting conventions, a document template, a review checklist, a written procedure a team keeps re-pasting.

The two near-misses are mirror images and both are deliberately attractive. A checklist requirement dressed as “build a tool that returns the checklist” is the first; the tell is that the model can already perform the task and is simply doing it inconsistently. A lookup requirement dressed as “write a Skill that documents the system thoroughly” is the second; the tell is that no amount of instruction supplies access.

A Skill and a tool are usually two halves of one requirement, not rivals: the tool supplies what the model cannot reach, the Skill governs how it handles what comes back. An option assigning every requirement in a mixed stem to the same mechanism is almost always wrong on that uniformity alone.

Against a custom tool, an MCP server is decided by reuse and ownership, never capability, because both can do the same job for one application. The single sharpest signal in a stem is a second consumer, actual or imminent. The move is also cheap. Taking a capability from a custom tool to an MCP server is a relocation of the same implementation behind a protocol, not a rewrite, so “we would have to rebuild it” is a false objection when a distractor raises it.

Progressive Disclosure and the Skill Field Limits (8.3)

Section titled “Progressive Disclosure and the Skill Field Limits (8.3)”

Progressive disclosure is what makes Skills cheap to install, and the reason a Skill beats pasting a procedure into every prompt:

Level When loaded Token cost Content
Metadata Always, at startup ~100 tokens per Skill name and description from the YAML frontmatter
Instructions When the Skill is triggered Under 5k tokens The SKILL.md body
Resources As needed None until accessed Bundled files; reference files load when read, scripts run through bash and only their output enters context

So an installed but untriggered Skill costs roughly a hundred tokens. That reframes the comparison: not Skill against tool, but a Skill against carrying several pages of house conventions on every request, including the four jobs in five that never touch them.

The description is the trigger. It is what Claude matches the request against, so it must say both what the Skill does and when to use it. A description saying only what the Skill contains will sit there unused, which is the commonest reason a shipped Skill never fires.

Field requirements, verified 2026-08-21:

Field Constraints
name Maximum 64 characters; lowercase letters, numbers and hyphens only; no XML tags; cannot contain the reserved words “anthropic” or “claude”
description Non-empty; maximum 1024 characters; no XML tags

Skills by Surface, and the Four Postures (8.3)

Section titled “Skills by Surface, and the Four Postures (8.3)”

Where a Skill runs differs by surface, and the differences bear on the answers. Verified 2026-08-21:

Surface How Skills arrive Sharing Network
Claude API Upload through the Skills API; needs the code execution tool and a skill_id in the container parameter Workspace-wide: all workspace members can access them None, and no runtime package installation
Claude Code Filesystem-based: ~/.claude/skills/ (personal) or .claude/skills/ (project) Personal or project, also shareable through plugins Full
claude.ai Uploaded as zip files in settings Individual to each user; no org-wide distribution Varies with user and admin settings

Custom Skills do not sync across surfaces. A Skill uploaded to one is not available on another, and a Claude Code Skill is separate from both.

Skills compose with each other (checked 2026-09-30). One API request can carry up to 20 Skills, so a pre-built Skill such as xlsx can sit beside a custom Skill holding the house layout rules and template. The Skills guide’s own example pairs Excel with a custom DCF analysis Skill. A new custom Skill version is a complete snapshot, so a revised template means uploading the full file set again.

Four wrong moves recur, each one something a real developer has genuinely proposed:

  • Pasting the data into every request. Stale by construction for a system whose value is its current state. It also spends context on every call including the majority that need none of it, and scales with the size of the data rather than the size of the question. The guide rejects it in its own words: pasting data gives no live access and wastes context.
  • Hard-coding the procedure into every system prompt. Works until there are three applications, then there are three copies that drift and nobody knows which is authoritative. Same drift argument MCP makes about integrations, applied to knowledge.
  • Assuming a built-in tool can reach an internal service. The reasoning is that the tool already fetches things over HTTP. It cannot, because a server-executed tool such as web fetch is the platform’s capability running in the platform’s environment.
  • Reaching for fine-tuning. A genuine technique aimed at the wrong class of problem: it changes how a model behaves on a distribution of inputs, grants access to nothing, and keeps no procedure current when the procedure changes next quarter.