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_reason | Meaning / action |
end_turn | Finished naturally — exit the agent loop. |
tool_use | Execute requested tool(s), return tool_result blocks in one user message. |
pause_turn | Server-side tool loop paused — append assistant content, re-send; server resumes. |
max_tokens | Output cap hit — raise max_tokens or stream. |
model_context_window_exceeded | Conversation too large — compact or trim. |
stop_sequence | A custom stop string fired. |
refusal | Declined for safety — surface it, don't blind-retry. |
tool_choice
| Value | Behavior |
auto | Claude decides (default). |
any | Must use at least one tool. |
tool + name | Must use that specific tool. |
none | Tools visible, never called. |
disable_parallel_tool_use: true | Add to any value → max one call per response. |
HTTP errors
| Code | Type | Retry? |
| 400 | invalid_request_error | No — fix the request |
| 401 | authentication_error | No — fix the key |
| 403 | permission_error | No |
| 404 | not_found_error (often a model-ID typo) | No |
| 413 | request_too_large | No — shrink input |
| 429 | rate_limit_error | Yes — honor retry-after |
| 500 | api_error | Yes — backoff |
| 529 | overloaded_error | Yes — backoff |
SDKs auto-retry 429/5xx with exponential backoff. Use typed exception classes, not string matching.
Prompt caching
| Fact | Value |
| Mechanism | Exact prefix match on rendered bytes — one changed byte invalidates everything after it |
| Render order | tools → system → messages |
| Max breakpoints | 4 per request |
| TTL | 5 min default, 1 h optional |
| Write cost | ≈1.25× base (5 min) / 2× (1 h) |
| Read cost | ≈0.1× base |
| Verify | usage.cache_read_input_tokens > 0 |
| Classic invalidators | timestamps/UUIDs in system prompt, unsorted JSON, varying tool set, model switch |
Batches & tokens
| Fact | Value |
| Batches discount | 50% off all token usage |
| Batch window | Most < 1 h, max 24 h; results kept 29 days |
| Token counting | count_tokens endpoint with your inference model — never tiktoken |
| Large outputs | Stream anything big — buffered requests hit HTTP timeouts |
Claude Code files
| Path | Purpose |
CLAUDE.md (root) | Project memory, committed, team-shared; nested ones scope a subtree; @path imports files |
~/.claude/CLAUDE.md | Personal memory, all projects |
.claude/settings.json | Project settings, committed |
.claude/settings.local.json | Personal overrides, git-ignored |
.claude/commands/*.md | Project slash commands |
.claude/agents/ | Custom subagent definitions |
.mcp.json | Project-scoped MCP servers, committed |
Hook events
| Event | Fires |
PreToolUse | Before a tool call — can block or modify it |
PostToolUse | After a tool call completes |
UserPromptSubmit | When the user submits a prompt |
SessionStart | New session begins |
Stop | Claude finishes responding |
Deterministic "every time X" rules → hooks. Conventions and context → CLAUDE.md.
MCP at a glance
| Concept | Definition |
| Host | The app (IDE, chat client) embedding MCP clients |
| Client | Maintains one connection to one server |
| Server | Exposes capabilities |
| Tools | Model-invoked actions (side effects allowed) |
| Resources | Application-controlled data/context |
| Prompts | User-invoked templates |
| Transports | stdio (local) · streamable HTTP (remote) |
| Remote auth | OAuth 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.