Reference

The memorizable facts, condensed. Everything here is original material summarizing Anthropic's public documentation — verify details against platform.claude.com/docs before relying on them in production.

Stop reasons

stop_reasonMeaning / action
end_turnFinished naturally — exit the agent loop.
tool_useExecute requested tool(s), return tool_result blocks in one user message.
pause_turnServer-side tool loop paused — append assistant content, re-send; server resumes.
max_tokensOutput cap hit — raise max_tokens or stream.
model_context_window_exceededConversation too large — compact or trim.
stop_sequenceA custom stop string fired.
refusalDeclined for safety — surface it, don't blind-retry.

tool_choice

ValueBehavior
autoClaude decides (default).
anyMust use at least one tool.
tool + nameMust use that specific tool.
noneTools visible, never called.
disable_parallel_tool_use: trueAdd to any value → max one call per response.

HTTP errors

CodeTypeRetry?
400invalid_request_errorNo — fix the request
401authentication_errorNo — fix the key
403permission_errorNo
404not_found_error (often a model-ID typo)No
413request_too_largeNo — shrink input
429rate_limit_errorYes — honor retry-after
500api_errorYes — backoff
529overloaded_errorYes — backoff

SDKs auto-retry 429/5xx with exponential backoff. Use typed exception classes, not string matching.

Prompt caching

FactValue
MechanismExact prefix match on rendered bytes — one changed byte invalidates everything after it
Render ordertools → system → messages
Max breakpoints4 per request
TTL5 min default, 1 h optional
Write cost≈1.25× base (5 min) / 2× (1 h)
Read cost≈0.1× base
Verifyusage.cache_read_input_tokens > 0
Classic invalidatorstimestamps/UUIDs in system prompt, unsorted JSON, varying tool set, model switch

Batches & tokens

FactValue
Batches discount50% off all token usage
Batch windowMost < 1 h, max 24 h; results kept 29 days
Token countingcount_tokens endpoint with your inference model — never tiktoken
Large outputsStream anything big — buffered requests hit HTTP timeouts

Claude Code files

PathPurpose
CLAUDE.md (root)Project memory, committed, team-shared; nested ones scope a subtree; @path imports files
~/.claude/CLAUDE.mdPersonal memory, all projects
.claude/settings.jsonProject settings, committed
.claude/settings.local.jsonPersonal overrides, git-ignored
.claude/commands/*.mdProject slash commands
.claude/agents/Custom subagent definitions
.mcp.jsonProject-scoped MCP servers, committed

Hook events

EventFires
PreToolUseBefore a tool call — can block or modify it
PostToolUseAfter a tool call completes
UserPromptSubmitWhen the user submits a prompt
SessionStartNew session begins
StopClaude finishes responding

Deterministic "every time X" rules → hooks. Conventions and context → CLAUDE.md.

MCP at a glance

ConceptDefinition
HostThe app (IDE, chat client) embedding MCP clients
ClientMaintains one connection to one server
ServerExposes capabilities
ToolsModel-invoked actions (side effects allowed)
ResourcesApplication-controlled data/context
PromptsUser-invoked templates
Transportsstdio (local) · streamable HTTP (remote)
Remote authOAuth at the client/host layer — never secrets in prompts

Independent community study resource — not affiliated with or endorsed by Anthropic. Claude is a trademark of Anthropic, PBC. All study material and practice questions here are original, written from Anthropic's public documentation. Everything runs in your browser; nothing you answer is stored or transmitted.