INTERMEDIATE · 14 lessons · ~6 hours
Claude Code Guide
A 14-lesson course on Claude Code internals: harness, context window, prompt cache, skills, hooks, MCP, subagents, models, anti-patterns. Built around an end-to-end Travel Agent example.
- 01 01. What is Claude Code: harness, agent loop, and your place in it Claude Code is a harness around an LLM, not the model itself. The model decides which tool to call; the harness executes it, returns the result, and runs the agent loop until the final answer.
- 02 02. Context window and prompt cache Context window is both money and quality. Opus/Sonnet 4.6 standard — 200k tokens; 1M available via alias opus[1m]/sonnet[1m]. Prompt cache cuts the bill 10x, but lives only 5 minutes by default.
- 03 03. CLAUDE.md: levels, imports, auto-memory CLAUDE.md is a "paste this every time" in a nice wrapper: an automatic prefix for each session. It has five levels (managed, user, project, local, subdirectory), they concatenate rather than overwrite each other.
- 04 04. Skills: SKILL.md, scripts, references Skill is a directory with SKILL.md and optional scripts/references/templates, not a single markdown file. A brief description of the skill goes into each request; the full SKILL.md "unfolds" only when the task matches.
- 05 05. Hooks: deterministic control over agent loop Hooks are git hooks for Claude Code: points in the lifecycle where the harness is guaranteed to execute your script. In Claude Code v2.1.89 there are 28+ events, exit code 2 blocks model action, JSON response {"action":"block"} does the same.
- 06 06. MCP Servers MCP (Model Context Protocol) — "USB-C for AI integrations": write a server once, and it's consumed by Claude Code, Claude Desktop, Cursor, Continue, custom SDK. Three transports (stdio, SSE, HTTP); exports tools, resources, prompts, elicitation.
- 07 07. Plugins: packaging skills + hooks + agents + MCP Plugin — npm package for Claude Code: packaging skills, hooks, subagents, slash-commands, and MCP-config into a single versioned entity. Manifest .claude-plugin/plugin.json, installation via /plugin install, marketplaces.
- 08 08. Tool calls and agent loop under the hood Tool call — a fundamental mechanism that transforms an LLM from a chatbot into an agent. The model returns not text, but a tool_use block; the harness executes the call and returns tool_result. Understanding this cycle, you understand 80% of how any AI-agent works.
- 09 09. Subagents: isolated agent cycles Subagent is a mini-session of Claude Code with its own context and system prompt. Only the final summary is returned to the main context. It saves from context overflow on browse-heavy tasks and causes unexpected bills if launched without restraint.
- 10 10. Agent Teams (experimental) If subagents are "sent an assistant on a business trip, waited for the result", then Agent Teams is "assembled a team of several developers, gave them a task list and they work in parallel"
- 11 11. Models and pricing Model selection is a speed/cost/quality trade-off, not "always Opus". Cache reads cost 0.1× input (10× cheaper), output ~5× input. Opus 4.7 has a new tokenizer (+35% tokens on the same texts), on Bedrock/Vertex default aliases are shifted back one version.
- 12 12. Travel Agent from Scratch: blueprint Bringing it all together. One real project. One monorepo. Specific files, configs, structure. From here on, you copy-paste and adapt.
- 13 13. Best practices: daily routine and anti-patterns All previous chapters are about mechanics. This one is about discipline. Without it, even a perfect configuration eventually turns into a mess: cache misses, skills get stale, hooks fail silently,
- 14 14. Verifying Claims from the Original Thread This chapter is a line-by-line breakdown of the ~20 points that started the guide preparation. Each claim has been verified against official documentation (`docs.claude.com`, `code.claude.com/docs`),