Cheat Sheet and Finder
Twenty-six chapters is a lot to carry. This page is the part you will keep open: a finder from "I want to…" to the chapter that does it, the commands and file shapes you will retype most, the surprises that cost real time, and an honest ledger of what was run for real and what it cost. Every fact here appears, with its source, in the chapter it links to.
I Want To…
| I want to… | Use | Start at |
|---|---|---|
| Understand what a coding agent is | The agent loop: model, tools, permissions | Ch 3 |
| Compare tools without a leaderboard | Capabilities and trade-offs | Ch 4 |
| Install it and run a first session | Installation, sign-in, a read-only first task | Ch 7 |
| Write a better prompt | Five-part task, then the library and builder | Ch 8, 15, 16 |
| Work on a real codebase | Scenarios: explain, test, debug, refactor, review | Ch 9 |
| Tell Claude my project's rules | CLAUDE.md, context control, plan mode | Ch 10 |
| Read exactly what Claude did | stream-json, tool calls, denials, cost | Ch 17 |
| Save a repeatable procedure | A skill | Ch 18, 19 |
| Delegate reading or review in isolation | A subagent with a tool allowlist | Ch 20 |
| Run several workers at once | Parallel subagents; agent teams (experimental) | Ch 21 |
| Enforce a rule the model cannot forget | A hook (exit 2 or a JSON deny) | Ch 22 |
| Give Claude access to a tool or data | An MCP server | Ch 23 |
| Share my whole setup | A plugin | Ch 24 |
| Run Claude in a script or pipeline | claude -p with caps and a gate | Ch 25 |
| Verify a change Claude made | Re-run, probe, review, human decision | Ch 26 |
| Use it safely on untrusted code or secrets | Permissions, injection, trust | Ch 13 |
| Build my own agentic environment | Layers: skills, MCP, hooks, plugins, policy | Ch 12 |
| See where this is heading | What is documented, preview, or opinion | Ch 14 |
The Ones You Will Retype
| Task | Command or flag | Chapter |
|---|---|---|
| Run once, machine-readable | claude -p "…" --output-format json | 25 |
| Cap a run | --max-turns N --max-budget-usd X (checked after a step, so leave margin) | 25 |
| Pre-approve tools | --allowedTools "Read,Bash(git diff *)" with --permission-mode dontAsk | 25 |
| Schema-checked answer | --output-format json --json-schema '{…}', read .structured_output | 25 |
| Reproducible CI run | --bare (needs an API key; not run here) | 25 |
| See every step | --output-format stream-json --verbose | 17 |
| Continue a session | --resume <session-id> or --continue | 17 |
| Run as a subagent definition | claude --agent name | 20 |
| Restrict settings sources | --setting-sources user, --settings '{…}' | 15 |
| Register an MCP server | claude mcp add --transport stdio --scope project NAME -- cmd args | 23 |
| Inspect or remove it | claude mcp get NAME, list, remove, reset-project-choices | 23 |
| Check a plugin | claude plugin validate DIR (well-formed, not working) | 24 |
| Try a plugin without installing | claude --plugin-dir DIR, then /reload-plugins | 24 |
| Debug hooks | /hooks in a session, or claude --debug | 22 |
Hook exit codes: 0 success (stdout is context on UserPromptSubmit and SessionStart); 2 block, with stderr fed back to Claude; anything else is a non-blocking error, and exit 1 is the classic trap. A PreToolUse hook can instead exit 0 and print hookSpecificOutput with permissionDecision set to deny, allow, ask or defer (Chapter 22).
Where Everything Lives
| Thing | Project location | Personal location |
|---|---|---|
| Project rules | CLAUDE.md | ~/.claude/CLAUDE.md |
| Settings, permissions, hooks | .claude/settings.json (shared), settings.local.json (private) | ~/.claude/settings.json |
| Skill | .claude/skills/NAME/SKILL.md | ~/.claude/skills/NAME/SKILL.md |
| Subagent | .claude/agents/NAME.md | ~/.claude/agents/NAME.md |
| MCP servers | .mcp.json (project scope) | ~/.claude.json (local and user scope) |
| Plugin | a folder with .claude-plugin/plugin.json; skills, agents, hooks/hooks.json, .mcp.json at its root | ~/.claude/skills/ folders with a manifest load as plugins |
Skill frontmatter (Chapter 18): name, description, when_to_use, argument-hint, arguments, disable-model-invocation, user-invocable, allowed-tools, disallowed-tools, model, effort, context, agent, background, hooks, paths, shell. Subagent frontmatter (Chapter 20): name, description, tools, disallowedTools, model, permissionMode, maxTurns, skills, mcpServers, hooks, memory, background, effort, isolation, color, initialPrompt, plus omitClaudeMd and autoCompactWindow. Unknown keys are ignored silently in both, so lint them: Chapter 25 has a free script.
Twelve Things That Cost Real Time
Each of these was observed while building the hands-on chapters, not copied from a blog. The chapter link has the evidence.
- A broken skill can simply be missing. Two deliberately broken skills were absent from the session's skill list, and I could not establish why for the misspelled-key one (Ch 18).
- A hook can fail open. With
jqmissing, the Chapter 12 hook allowedrm -rfand exited 0 (Ch 22). - Exit 1 does not block. Only exit 2, or a JSON deny, does (Ch 22).
- PostToolUse sees only successes. An audit hook on it misses every blocked or denied attempt (Ch 22).
- MCP permissions are per tool. Allowing one tool did not allow its sibling (Ch 23).
claude mcp listprints every connector you have, including work URLs. Filter before sharing (Ch 23).- Validation is not a test.
claude plugin validatepassed a plugin whose server path was wrong (Ch 24). - Project hooks and servers run under
-pwith no trust dialog, unless you use--bare(Ch 25). - A capped or failed run has a null
result, and caps are checked after a step, so they overshoot (Ch 25). - A load error does not fail a run. A missing plugin or a bad MCP entry exits cleanly unless you gate on the start-up event (Ch 25).
- A subagent starts blind, and a confident reviewer can be wrong: one of three findings had a false premise (Ch 20, Ch 26).
- The raw event stream is not publishable. The start-up event lists your installed skills, servers and local paths (Ch 17).
What Was Run, and What It Cost
The examples repository keeps a log of every captured run: model, turns and the cost Claude Code estimated. Totalled by part:
| Part | What was executed for real | Estimated cost |
|---|---|---|
| 1 to 7 (Ch 1–14) | No Claude Code session. Command and project outputs where a page says Actual output; everything else is labelled illustrative or not executed | none |
| 8 · Prompts (Ch 15–17) | 29 library samples, 5 recipes, a stream timeline and a resume check | about $3.99 |
| 9 · Skills (Ch 18–19) | Five skill runs, including the loading experiment | about $0.42 |
| 10 · Agents (Ch 20–21) | Three subagent runs; no agent team was run | about $0.32 |
| 11 · Platform (Ch 22–24) | Hooks, MCP and plugin sessions on a cheap model, plus many free offline tests | about $0.03 |
| 12 · Automation (Ch 25–26) | Gate runs and the capstone's two sessions | about $0.22 |
| Total | 73 log rows (a few rows cover more than one run) | about $4.98 |
Three notes on reading that table. The costs are client-side estimates, not a bill. Most of Part 8's cost is the larger model answering about three dozen prompts; Part 11 was almost free because hooks, servers and plugins can be tested without a model and the sessions that remained used the small one. And what was not run matters as much: agent teams, HTTP and OAuth MCP servers, marketplace installs, --bare, GitHub Actions and the SDK packages appear on pages as documentation, with the pages saying so.
hooks/test_hooks.sh, mcp/test_protocol.sh and automation/lint_claude_config.py. None of them calls Claude, and between them they cover most of the failure modes in the list above.Key Takeaways, Exercises and Sources
- Know the loop: a model, tools, and permissions you set.
- Write requests you can check, and read the log, not the summary.
- Pick the extension by what it is: request (skill), worker (subagent), rule (hook), capability (MCP), package (plugin).
- Enforce with mechanisms, explain with prose. Allowlists and hooks hold; sentences ask.
- Cap and gate anything unattended, and fail the build yourself when the setup did not load.
- Verify with something you control, and keep the final decision with a person.
Exercise 1 Beginner
Make your own one-page cheat sheet: ten commands and file locations you actually use, each with the chapter or documentation page you verified it from. Delete any entry you cannot source.
Learning outcome: keep a reference you can trust.
Exercise 2 Intermediate
Take three tasks you did with Claude this week and place each in the "Which extension point?" picture. For one of them, build the extension and test it without a model first.
Learning outcome: choose the right mechanism.
Exercise 3 Advanced
Write your own ledger for a week of using Claude Code at work: what you ran, what you verified independently, and what you took on trust. Find the one trusted claim that would hurt most if wrong, and add a check for it.
Learning outcome: make trust explicit.
- This page summarises the earlier chapters; each fact is sourced there. The Anthropic documentation pages behind them are listed at the end of Chapter 25, 24, 23, 22, 20 and 18, with notes on which parts of each page were not read.
The ledger is computed from tools/spend.csv in the examples repository as of 2026-10-31. The Part 1 to 7 row repeats what those pages themselves state. Nothing on this page was executed separately.