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.
Worked example: Travel Agent — Node.js backend + React frontend + LLM + MCP servers for flights/hotels/weather.
Every claim in this course was checked against the official
code.claude.com/docsand Anthropic API docs (current as of April 23, 2026, Claude Code v2.1.89, Opus 4.7 / Sonnet 4.6 / Haiku 4.5).
Why this course
There are plenty of Twitter threads about Claude Code where half the claims are correct, a quarter are stale, and the remaining quarter are personal heuristics presented as fact. This course:
- Verifies popular claims against docs and sources.
- Explains the internals — agent loop, prompt cache, harness, tool dispatch.
- Walks through an end-to-end example (Travel Agent) showing how to assemble it all from scratch.
- Gives ready-to-use recipes — CLAUDE.md, skills, hooks, subagents, MCP, plugins.
If you’re new to Claude Code, follow the lessons in order. If you already use it, jump to the lesson you need.
Recurring principles across the course
- Context is money and quality. The more tokens in the window, the more expensive and worse the model performs. Context management is the core skill.
- Skills ≠ Hooks. Skills are probabilistic suggestions to the model. Hooks are deterministic programmatic triggers.
- Subagent ≠ Agent Team. A subagent is a one-shot isolated helper. An Agent Team is a coordinated crew with a shared task list and mailbox.
- MCP ≠ Plugin. MCP is the protocol for plugging in external tools. A plugin packages local artifacts (skills/hooks/agents/MCP configs).
- The cache lives 5 minutes. Any pause >5 min triggers a cache miss by default. You can extend to 1 hour at the cost of 2× input tokens.
Conventions
- 📘 — excerpt from official docs
- ⚠️ — common mistake / gotcha
- 💡 — practical tip
- 🧪 — experimental (may change)
- 🔧 — concrete config snippet for Travel Agent
- ✅ — verified fact (with source)
- ❌ — myth / outdated
License and updates
Written on April 23, 2026 for Claude Code v2.1.89, targeting Opus 4.7 / Sonnet 4.6 / Haiku 4.5.
If you’re reading this 6+ months later, check the Claude Code release notes (/release-notes in the CLI) and re-verify against lesson 14.
- 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`),