CCAR-F
CCAR-F quick reference
The facts worth having in your head when you sit down. Print it, or read it on the way there.
Sixty questions, 120 minutes, pass mark 720. Weights: Agentic Architecture 27%, Tools & MCP 18%, Claude Code 20%, Prompt Engineering 20%, Context & Reliability 15%. Facts that change (model IDs, prices, window sizes, limits) are deliberately omitted; check the Anthropic docs.
Domain 1: Agentic Architecture & Orchestration
| stop_reason | Do |
|---|---|
end_turn | Done |
tool_use | Run tools, return all tool_result blocks in one user message, call again |
max_tokens | Truncated; raise limit or stream; never execute a cut-off tool call |
stop_sequence | Done; stop_sequence field says which |
pause_turn | Resend conversation unchanged (server tools); no new user message |
refusal | HTTP 200; read stop_details; do not blind-retry |
- Always append full
response.content(keepstool_useand thinking blocks). - Patterns: chaining (fixed steps, gates), routing (classify then dispatch), parallelisation (sectioning or voting), orchestrator-workers (dynamic subtasks), evaluator-optimizer (needs explicit criteria). Agent only if complex, valuable, viable and errors recoverable.
- Subagent: own context, gets only the brief, returns only a report.
.claude/agents/*.md(project beats user).descriptiondrives auto-delegation;toolsrestricts;modelcan downgrade. - Enforcement ladder: sandbox > permission rules > hooks > programmatic gates (
canUseTool,maxTurns, budgets) > prompt. Prompts guide; the rest bind. - Agent SDK:
query(prompt, options)streamsinit(session_id), assistant/user,result(cost). Loads no filesystem settings unlesssettingSourcesset. Hooks:PreToolUse,PostToolUse,UserPromptSubmit,Stop,SubagentStop,PreCompact, viaHookMatcher;PreToolUsereturnspermissionDecisionorupdatedInput. - Decompose by step, data or expertise; subtasks must be verifiable, brief, context-sized, no shared mutable state. Plan mode separates cheap plan risk from expensive edit risk.
- State: API stateless; Claude Code sessions resume with
--continue/--resume,/rewindrestores checkpoints;CLAUDE.mdfor curated memory, memory tool / auto memory for learned facts, external record for job progress. Replay can repeat side effects: idempotency.
Domain 2: Tool Design & MCP Integration
- Tool =
name+description(what, when, returns, side effects) +input_schema; describe every property;enumfor closed sets.strict: trueneedsadditionalProperties: false+required; guarantees shape, not meaning or correct tool choice. tool_use{id, name, input} ->tool_result{tool_use_id, content, is_error?} in the next user message; every call answered; parallel results in one message.tool_choice:auto|any|tool|none;disable_parallel_tool_use. Forced modes rejected by newest models -> structured outputs.- Server-side tools (web search/fetch, code execution) run on Anthropic's side, errors inside result blocks, may
pause_turn. Anthropic-defined client tools (bash, text editor, computer, memory): declaretype+name, no schema, you execute. - Streaming tool input arrives as
input_json_delta; parse only when complete. - MCP roles: host (app) runs one client per server; model never speaks MCP. Primitives: tools (model-controlled), resources (app-controlled), prompts (user-controlled); client offers sampling, roots, elicitation. JSON-RPC 2.0;
initialize->initialized->tools/list,tools/call. Tool failure = result withisError: true, not a protocol error. - Transports: stdio (local child process; log to stderr only) vs Streamable HTTP (remote, OAuth 2.1; HTTP+SSE deprecated).
- Build: Python
FastMCPdecorators, TSMcpServer.registerToolwith Zod; secrets via env / OAuth; test with MCP Inspector; shape results small. - Safety:
deny>ask>allow;mcp__server__toolormcp__server; shell allowlist not blocklist; tool results are untrusted; errors asis_errorresults not exceptions; idempotency via absolute ops, keys, check-then-act; annotations (readOnlyHint,destructiveHint) are hints.
Domain 3: Claude Code Configuration & Workflows
| Memory | Settings |
|---|---|
Enterprise CLAUDE.md -> ~/.claude/CLAUDE.md -> ./CLAUDE.md (+ parents) -> CLAUDE.local.md (gitignored); subdirs load on demand; @imports; .claude/rules/*.md with paths | Precedence: managed > CLI flags > .claude/settings.local.json > .claude/settings.json > ~/.claude/settings.json; arrays merge, scalars override |
- Modes:
default(prompt edits/commands),acceptEdits,plan(read-only),dontAsk(deny unless allowed; fail closed),bypassPermissions=--dangerously-skip-permissions(sandbox only;disableBypassPermissionsMode). - Rules:
Bash(cmd)exact,Bash(prefix:*),Edit(src/**),Read(./.env*),WebFetch(domain:x),mcp__s__t;deny>ask>allow, merged across scopes. DenyReadon secrets beats asking. - Hooks: can block =
PreToolUse,UserPromptSubmit,Stop,SubagentStop,PermissionRequest; cannot =PostToolUse,Notification,SessionStart,SessionEnd,PreCompact. Exit 0 ok (stdout -> context only forUserPromptSubmit/SessionStart); exit 2 block, stderr -> Claude; other non-zero non-blocking. JSON:continue,systemMessage,hookSpecificOutput.permissionDecision(allow/deny/ask),updatedInput,additionalContext;Stopusesdecision: "block"+reason. Matcher = regex on tool name. Reviewed via/hookswhen edited externally. - Commands (
.claude/commands/,$ARGUMENTS,!cmd``) = prompts, user-invoked. Skills (.claude/skills/<n>/SKILL.md) = progressive disclosure;disable-model-invocation(user-only),user-invocable: false(Claude-only),context: fork. Subagents = isolated workers. Plugins bundle all + hooks + MCP. - MCP:
claude mcp add --transport stdio|http name [-- cmd];list/get/remove/add-json; scopeslocal(default) >project(.mcp.json, needs approval,${VAR}) >user;/mcpfor OAuth/status;enableAllProjectMcpServers; resources@server:uri, prompts/mcp__server__prompt;--mcp-config+--strict-mcp-configfor CI; tool search defers large tool sets. - Headless:
claude -p;--output-format text|json|stream-json;--allowedTools,--disallowedTools,--permission-mode,--max-turns,--append-system-prompt,--resume,--fallback-model,--permission-prompt-tool. Unattended order: allow list +dontAsk> programmatic approval > bypass in ephemeral sandbox. GitHub:anthropics/claude-code-action,/install-github-app,claude_args.
Domain 4: Prompt Engineering & Structured Output
system= top-level param (operator authority): identity, rules, defaults. Variable data in user turn (also for caching). Role + audience + purpose. Clear and direct: goal, success criterion, positive instructions, edge cases, important rules first and last. Don't over-prescribe newer models.- Examples: 3-5, relevant, diverse, consistent, tagged; counter-examples labelled. XML tags separate instructions/data/examples; docs at top, question at end; quote-then-answer.
- CoT = visible reasoning (
<thinking>/<answer>+ stop sequence). Extended thinking =thinkingblocks before text. Older:{type: enabled, budget_tokens >= 1024, < max_tokens}. Current:{type: adaptive}+output_config.effort;budget_tokensrejected; thinking billed as output; summaries don't reduce bill. Pass thinking +redacted_thinkingback unchanged in tool exchanges. Incompatible with prefill and non-default sampling. Effort change invalidates messages cache. - Structured output ladder: prompt-only (no guarantee) < strict tools (valid args) <
output_config.format{type: json_schema}(valid response).additionalProperties: false, all inrequired, optional = nullable.messages.parse()from Pydantic/Zod. Still fails onmax_tokens,refusal; incompatible with citations. Shape != truth. max_tokensrequired, includes thinking.stop_sequences->stop_reason: stop_sequence+stop_sequencefield, string excluded. Temperature or top_p, not both; newest models reject non-defaults. Prefill: trailing assistant turn; older models only; current models 400; never with thinking.- Iteration: criteria -> eval set -> prompt -> inspect failures -> one change at a time. Templates
{{VAR}}, delimit user input, stable part first. Version prompts in git, log version per request (metadata), pin model, review with eval results; prompt/tool change invalidates cache for all. Console: Workbench, prompt generator, improver, Evaluate.
Domain 5: Context Management & Reliability
- Window = input + output (incl. thinking);
max_tokensmust fit. Counts: system, tools, history (tool results grow fastest), docs, images (~pixels/750), thinking.count_tokensbefore;usageafter; never third-party tokenisers. Budget: fixed prefix / history / retrieved / output reserve; compact at ~70-80%./context,/cost. - Caching: exact-byte prefix; order tools -> system -> messages;
cache_control: {type: ephemeral}, max 4 breakpoints, top-level = automatic; below model minimum = silently uncached. Writes ~1.25x (5 min) / ~2x (1 h), reads ~0.1x, reads refresh TTL. Metric:cache_read_input_tokens. Tools change -> all invalid; system -> system+messages; message edit -> from there; model switch -> all; thinking/effort -> messages. Silent killers: timestamps, unsorted JSON, varying tools. - Long conversations: Claude Code auto-compact,
/compact [focus],/clear,PreCompacthook. API compaction (beta) returns compaction block -> append fullresponse.content. Context editing clears old tool results/thinking (no summary). Sliding window drops. Precise facts -> files / memory tool. Subagents isolate noise. - RAG: hybrid retrieval + rerank + contextual retrieval.
documentblock sources: text, base64 PDF, url, file (Files API), custom content;title,context(not cited),citations: {enabled}all-or-nothing. Locations:char_location,page_location,content_block_location; cited text not billed as output.search_resultblocks for tool-returned content. Constrain source, quote first, allow "not found". Citations incompatible with structured outputs. - Errors: 400 invalid_request, 401 auth, 403 permission, 404 not_found, 413 too_large, 429 rate_limit, 500 api_error, 529 overloaded. Retry 429/500/529/network with jittered backoff; honour
retry-after; SDK retries 2x default; fix 4xx. Limits RPM/ITPM/OTPM per model;anthropic-ratelimit-*headers. Logrequest-id. Timeout 10 min default (Python s, TS ms); stream long outputs; retries multiply wall-clock. Batches for non-urgent. - Observability: log request-id, model, prompt version, usage, stop_reason, latency, tool outcomes;
metadata.user_id(no PII); Admin API usage/cost; Claude Code OpenTelemetry. Evals: realistic set + edge cases, hold-out; graders code / model (validated rubric) / human; agents: outcome + trajectory. Regression on every prompt/model/tool/retrieval change, gate on thresholds; feed production failures back.
