← Study Guide

Quick-Reference Cheat Sheet

Last-minute review — one line per concept from the exam blueprint appendix. Skim this the morning of your exam.

Claude Agent SDK

Agentic loop
Drive control flow with stop_reason: continue on tool_use, stop on end_turn.
stop_reason
tool_use = run tools & iterate; end_turn = finished. Never parse text to decide.
Task tool
Spawns subagents. allowedTools must include Task. Multiple calls in one response = parallel.
allowedTools
Per-agent tool restriction. Scope to role — too many tools degrades selection.
Hooks
PostToolUse normalizes results; interception hooks block outgoing calls. Deterministic vs prompt.
fork_session
Branch from a shared baseline to explore divergent approaches.

Model Context Protocol (MCP)

Tool descriptions
PRIMARY selection signal — include inputs, examples, edge cases, boundaries.
isError flag
Signals tool failure back to the agent.
Structured errors
errorCategory (transient/validation/permission), isRetryable, human-readable text.
MCP resources
Expose content catalogs (schemas, issue summaries) to cut exploratory calls.
.mcp.json
Project scope (shared via VCS). Use ${ENV_VAR} expansion for secrets.
~/.claude.json
User scope — personal/experimental servers, not shared.

Claude Code

CLAUDE.md hierarchy
user (~/.claude) → project (.claude or root) → directory. User-level isn't shared.
@import
Reference external files to keep CLAUDE.md modular.
.claude/rules/
YAML paths: glob frontmatter for conditional, path-scoped conventions.
.claude/commands/
Project slash commands, shared via VCS.
.claude/skills/
SKILL.md frontmatter: context: fork, allowed-tools, argument-hint.
Plan vs direct
Plan = complex/architectural/multi-file; direct = simple/well-scoped.
--resume / --continue
--resume <name> = specific session; --continue = most recent.
/memory, /compact
Inspect loaded memory; compact context during long sessions.
Explore subagent
Isolate verbose discovery; return a summary to preserve context.

Claude Code CLI

-p / --print
Non-interactive mode for CI — prevents input hangs, exits after output.
--output-format json
Machine-parseable output for pipelines.
--json-schema
Enforce a structured output shape in CI.

Claude API

tool_use + JSON schema
Most reliable structured output; eliminates syntax errors (not semantics).
tool_choice
auto (may text), any (must call a tool), forced {type:'tool',name:'...'}.
Nullable fields
Make optional when source may lack data — prevents fabrication.

Message Batches API

Trade-offs
50% cheaper, up to 24h, NO latency SLA. No multi-turn tool calling.
custom_id
Correlate request/response; resubmit only failed IDs.
Fit
Overnight/weekly jobs — never blocking pre-merge checks.

Reliability & Context

Lost in the middle
Put key findings at start/end; use section headers.
Case facts block
Persist exact numbers/dates outside summarized history.
Escalation triggers
Explicit human request, policy gaps, no progress — NOT sentiment/confidence.
Provenance
Preserve claim→source mappings + dates through synthesis; annotate conflicts.
Confidence calibration
Field-level scores + labeled sets; segment accuracy by doc type/field.