Study Guide
The 5 exam domains, key concepts, mental models, exam traps, and exam day tips — all in one place.
D1 — Agentic Architecture
The 5 Anthropic Patterns
- Prompt chaining — output of one call feeds next
- Routing — classifier decides which specialist handles request
- Parallelization — fan out to multiple agents simultaneously
- Orchestrator-workers — hub delegates to specialist workers
- Evaluator-optimizer — generate → critique → loop
Architecture Decision Rules
- Steps known upfront → deterministic workflow (not agent)
- Steps unknown, judgment needed → agentic system
- Distinct task types → add router
- Independent subtasks → parallelize
- Quality matters more than speed → evaluator-optimizer
Stop Reasons (all 4)
- end_turn → Claude is done, return to user
- tool_use → execute tool, feed result back, call Claude again
- max_tokens → handle truncation
- stop_sequence → parse and handle
HITL Rules
- Irreversible actions → always HITL
- External parties affected → always HITL (even if technically reversible quickly)
- Cascading failures possible → HITL
- Production + catastrophic risk → TWO independent controls
Error Classification
- Tool error (404, bad params) → retry with fix, max 2-3 attempts
- Reasoning error → restructure prompt
- Environment error (DB down, 503) → escalate IMMEDIATELY, never retry
Minimal Footprint Principle
- Request only necessary permissions
- Prefer reversible over irreversible
- Don't store data longer than needed
- Give agents only tools they need for the specific task
D2 — Claude Code Configuration
CLAUDE.md Hierarchy (highest to lowest, top wins on conflicts)
- Enterprise policy ← cannot be overridden
- Project-level /project/CLAUDE.md (committed to git)
- User-level ~/.claude/CLAUDE.md
- Path-scoped /project/subdir/CLAUDE.md
- Lower levels ADD TO higher levels, never replace them
File Locations
- Slash commands → .claude/commands/ in project repo (committed)
- Personal commands → ~/.claude/commands/
- MCP shared team → .mcp.json (committed to repo)
- MCP personal → ~/.claude.json
- File exclusion → permissions.deny in .claude/settings.json (NOT .claudeignore — it's broken/unreliable)
- Organisation enforcement → managed-settings.json deployed via MDM
Settings Hierarchy
- managed-settings.json ← cannot be overridden
- CLI arguments
- .claude/settings.local.json
- .claude/settings.json ← project level
- ~/.claude/settings.json ← user level (lowest)
Hooks
- pre_tool_call → fires before tool executes
- post_tool_call → fires after tool completes
- pre_compact → fires before context compaction
- on_error → fires on error
Hook Exit Codes
- 0 → success, continue normally
- 1 → error, surface to Claude
- 2 → block, prevent next action
Skills Frontmatter (ONLY 3 valid fields — exam tests invented ones as traps)
- description: "when to use this skill"
- triggers: ["activation phrase"]
- context: fork — runs skill in isolated subagent; main session sees only final result
CI/CD Flags
- -p → non-interactive mode
- --output-format json → machine-readable output
- --json-schema → enforce output structure
- --mcp-config → specify MCP servers
Session Commands
- /compact → summarize, continue (preserve task context)
- /clear → wipe everything (fresh start)
- /memory → view project knowledge
SDK vs CLI
- -p flag → CI/CD one-shot tasks
- SDK → programmatic session control in applications
D3 — Prompt Engineering
tool_choice Values
- auto → Claude decides whether to use a tool
- any → Claude must use a tool (any)
- {"type": "tool", "name": "x"} → force specific tool
Output Enforcement (weakest → strongest)
- 1. Prose instruction ("always return JSON")
- 2. Few-shot examples
- 3. XML tags
- 4. JSON schema in system prompt
- 5. tool_choice forced + schema ← strongest
When to Use What
- Inconsistent format → few-shot examples
- Legal/compliance consistency → deterministic code
- Structured extraction → tool schema + forced tool_choice
- Complex multi-factor reasoning → extended thinking
- Edge case classification → few-shot examples targeting the boundary
Prompt Caching
- Cache: large stable content (system prompts, reference documents)
- Don't cache: dynamic user messages
- Benefit: ~90% cost and latency reduction on cached tokens
- Cache when: same document reused across many queries
Key Principles
- Positive instructions beat negative instructions
- System prompt = enforced (persists whole conversation)
- User prompt = conversational (per turn)
- Few-shot examples go in system prompt
- "Prompts are suggestions, code is enforcement" — the core rule
D4 — Tool Design & MCP
MCP Primitives
- Tools — actions Claude can call (have side effects)
- Resources — read-only data Claude can browse
- Prompts — reusable workflow templates
Tool Design Rules
- 1. Single responsibility — one tool, one purpose
- 2. Descriptions are instructions, not just labels
- 3. isError: true for ALL failures
- 4. retryable: false for business errors, true for technical errors
- 5. Prefer existing community servers over building custom
- 6. Resources for read-only data, Tools for actions
Description Formula
- "Does X specifically.
- Input: [exact params needed]
- Output: [exactly what is returned]
- Use when: [specific scenario]
- Prefer over [competing tool] when: [condition]"
Config Locations
- Shared team MCP → .mcp.json committed to repo
- Personal MCP → ~/.claude.json
- Tokens → always ${ENV_VAR} expansion, never hardcoded
MCP Attack Vectors
- Prompt injection → malicious content in tool RESULTS → defend: sanitize outputs in app code
- Tool description poisoning → malicious content in tool DESCRIPTIONS → defend: only connect to trusted servers
Transport Types
- SSE → remote servers over HTTP
- stdio → local servers as subprocess
D5 — Context & Reliability
RAG K Selection
- Incomplete answers → increase K
- Contradictory answers → decrease K + recency ranking
- Missing adjacent context → chunk neighbors (N-1, N, N+1)
- All three symptoms in one system → dynamic K per query type
- Fixed character chunking → fix chunk strategy FIRST, then tune K
Context Window Strategies
- Sliding window → keep last N turns (loses older context)
- Summarize and compress → replace history with summary
- External memory + retrieval → store all, retrieve relevant
Context Management Rules
- Short sessions → in-context fine
- Long sessions (30min+) → external scratchpad file
- Multi-issue customer sessions → structured extraction per issue
- Returning user after time gap → new session + summary + fresh tool calls
- Crash mid-pipeline → resume from last checkpoint
Reliability Patterns
- Idempotency key → prevent double execution on retry
- Checkpointing → persist progress externally, resume from failure
- isError: true → signal failure to Claude
- retryable flag → guide Claude's retry behavior
Error Propagation
- Every agent boundary is an error checkpoint
- Silent failure (isError not set) → Claude treats error as data
- Explicit failure (isError: true) → Claude handles appropriately
- Never pass bad output to next stage without isError
Observability Stack
- Logging → every tool call, input, output, timestamp
- Tracing → full request path through multi-agent system
- Alerting → notify when error rate exceeds threshold
- Log quality signals, not just completion
The 5 Mental Models
The conceptual frameworks the exam tests repeatedly.
1. Prompts vs Code
Prompt instruction → Claude may or may not follow Code enforcement → Claude cannot violate Schema constraint → Structurally impossible to violate Exam application: whenever a question offers both a prompt fix AND a code/schema fix → code wins
2. Architecture Simplicity
Single agent → lowest overhead, least capable Workflow → predictable, fast, rigid Multi-agent → flexible, powerful, expensive Inter-agent communication = extra API call Sequential multi-agent = overhead without parallelization benefit Only add agents when task genuinely needs them
3. HITL Calibration
Too little HITL → dangerous (autonomous irreversible actions) Too much HITL → useless (agent asks about everything) Correct HITL → surgical, based on: - Irreversibility - External party impact - Recovery time - Catastrophic failure risk
4. RAG Symptoms → Fixes
"Incomplete, missing info" → MORE chunks (increase K) "Contradictory, confused" → FEWER chunks (decrease K) "Accurate but missing context" → NEIGHBORING chunks (N-1, N+1) Multiple symptoms → DYNAMIC K per query type Bad chunk strategy → FIX CHUNKS FIRST, then K
5. Schema as Safety Mechanism
Schema slot exists → information can be captured correctly No schema slot → Claude defaults to something plausible (dangerous in medical, legal, financial) Before fixing prompts: ask "does the schema have a slot for the correct information?" If no → fix schema first.
The 5 Exam Traps
| Trap | Description | The Fix |
|---|---|---|
| Single fix when both needed | Picking one valid control when two independent controls exist | Always check for "both A and B" option |
| Prompt over code | Reaching for few-shot examples when schema/code enforcement exists | Ask: is there a structural fix? |
| Aggregate hiding segments | 97% overall accuracy looks good but hides 71% on one segment | Always segment analysis before automation |
| Complex = Claude | Assuming complex business rules need Claude | Complex but explicit rules → deterministic code |
| Retry environment errors | Retrying 503/DB down errors | Environment errors → escalate immediately, never retry |
Exam Day Tips
- Read every question twice — the scenario contains all the clues
- Check for "both A and B" options — when two fixes operate at different layers, the combined answer is usually correct
- "Critical flaw" = safety gap — never structural improvement
- "Must never" = code enforcement — never prompt instructions
- Prompts are suggestions, code is enforcement — the universal tiebreaker
- First instinct is usually right — don't overthink
- Watch for signal words: "legal requires", "compliance mandates", "cannot vary" → deterministic code
- "NOW" + prior failures + explicit human request → escalate immediately, no questions
- Aggregate metrics hide segment failures — always check per-segment before automating
- Environment errors → never retry — 503, DB down, network failure = escalate immediately