How Claude Actually Works

The full course on how Claude actually works — tokens, context windows, tools, the agent loop, and everything under the chat box.

32 tutorials · start at part 1 or jump anywhere

  1. 1 How Claude Works: A 5-Layer Mental Model for Developers Master the 5-layer Claude Stack — model, Messages API, MCP tools, agent loop, surfaces — and place any Claude feature instantly. Jun 23, 2026
  2. 2 Claude's 5-Layer Stack: MCP, Hooks, Skills, and Subagents Explained Map every Claude feature to one of 5 layers or 2 cross-cutting planes — so any new Anthropic release clicks into place in seconds. Jun 23, 2026
  3. 3 How LLM Tokens Work — And Why They Explain Your AI Bill Claude never reads your words — it reads tokens. Understand tokenization, why it drives every dollar of your AI bill, and the letter-counting bug it creates. Jun 23, 2026
  4. 4 How Claude's Context Window Works: Limits, Costs, and Overflow What fills Claude's context window, which models get 1M tokens, why the middle degrades, and how to design around all three constraints. Jun 23, 2026
  5. 5 Understanding stop_reason in the Claude Messages API Master all 7 stop_reason values in the Claude Messages API — end_turn, tool_use, max_tokens, pause_turn, refusal, and more — to build agents that never go feral. Jun 23, 2026
  6. 6 How Claude Tool Calling Actually Works: The Request-Execute Model How Claude tool calling works: the model requests, your code executes. Covers the tool_use block, executor lanes, strict schemas, and dynamic tool discovery. Jun 23, 2026
  7. 7 What Is MCP (Model Context Protocol) and How It Works MCP is the USB-C moment for AI tools: one open protocol that collapses N×M custom integrations into N+M. Learn the three roles, three primitives, and two transports. Jun 23, 2026
  8. 8 How Claude Code's Agent Loop Works (and Why It Breaks) The agent loop is a while cycle around one API call. Learn how it runs, how it breaks in three classic ways, and the four code-level controls that keep it on track. Jun 23, 2026
  9. 9 Claude Code Hooks Explained: Deterministic Guards for the Agent Loop Learn how Claude Code hooks enforce hard rules at every lifecycle event — pre-tool, post-tool, session start/stop — that the model cannot override. Jun 23, 2026
  10. 10 How to Guarantee JSON Output from Claude with Structured Outputs Force schema-valid JSON from Claude every time using tool_choice, Pydantic schemas, a validation retry ceiling, and the native output_config.format API. Jun 23, 2026
  11. 11 How to Pin Model Output Format Using Few-Shot Examples Few-shot examples in the messages array fix format, locale, and edge-case failures that temperature tweaks never can — here's exactly how and why. Jun 23, 2026
  12. 12 Temperature, Top-P, and Top-K Explained: Controlling LLM Randomness Master temperature, top-p, and top-k: the three knobs that reshape a token probability distribution before every single LLM draw. Jun 23, 2026
  13. 13 How to Write Acceptance Criteria for LLM Output (Not Just 'Be Accurate') Replace vague LLM prompts with testable acceptance criteria: exact output schema, edge-case rules, missing-field behavior, and ambiguity tie-breakers. Jun 23, 2026
  14. 14 Confidence Fields and Human-in-the-Loop Routing for LLM Extraction Pipelines Add a confidence field to your forced tool schema and route low-confidence rows to a human review queue — cheap triage that catches the dangerous extractions. Jun 23, 2026
  15. 15 How Claude Code Edits Your Repo: Inside the Agentic Edit Loop Claude Code edits your repo via a surgical read → plan → edit → verify loop — not whole-file rewrites. Here's the exact mechanism, step by step. Jun 23, 2026
  16. 16 How CLAUDE.md File Hierarchy Works: User, Project, Subtree, Local How Claude Code's CLAUDE.md tier system (managed, user, project, subtree, local) loads rules and resolves conflicts — so your instructions actually fire. Jun 23, 2026
  17. 17 Claude Code Extensions: Skills, Subagents, Hooks, and Plugins Skills, subagents, hooks, and plugins are four distinct extension points in Claude Code — each doing a completely different job. Here's exactly how to tell them apart. Jun 23, 2026
  18. 18 Anthropic Agent SDK: Use Claude Code's Engine in Your App The Agent SDK exposes Claude Code's agent loop, built-in tools, and MCP support as a Python/TypeScript library — for agents your code drives, not a human. Jun 23, 2026
  19. 19 Anthropic Managed Agents: Claude Runs the Loop for You Anthropic's managed agents run the agent loop, sandbox, and session state server-side. Provision three assets — agents, memory stores, vaults — instead of owning the runtime. Jun 23, 2026
  20. 20 How to Run Claude Code Headlessly in CI/CD Pipelines Run Claude Code non-interactively with claude -p: parse JSON output, scope tools safely, and wire AI review steps into any CI pipeline. Jun 23, 2026
  21. 21 How Prompt Caching Cuts Your AI Bill ~90% (and the Floor Trap) Prompt caching stores a stable prefix so you stop paying full price to resend identical context. Real mechanics, current model floors, and the silent no-op trap. Jun 23, 2026
  22. 22 Context Engineering: Pin, Summarize, Prune, and Compact Four techniques to keep long Claude sessions coherent and cheap: pin stable facts, summarize resolved turns, prune tool output, and compact as a last resort. Jun 23, 2026
  23. 23 How to Write LLM Evals: Testing AI Apps with Real Data Replace gut-feel LLM testing with a real eval harness: datasets, graders, CI score gates, and LLM-as-judge calibration. Jun 23, 2026
  24. 24 Prompt Injection Attacks Explained: How to Defend Your AI Agent How untrusted content becomes agent commands, why indirect injection is the dangerous case, and the three layered defenses every production agent needs. Jun 23, 2026
  25. 25 Agent Escalation: When to Hand Off to a Human vs. Keep Handling The four deterministic signals that route to a human, why sentiment never qualifies, and how to structure a handoff that a human can act on in ten seconds. Jun 23, 2026
  26. 26 How Claude Token Billing Works: Input, Output, and Cache Costs Break a Claude API bill into input, output, and cached token buckets, understand the 5x output multiplier, and fix the three cost leaks that quietly inflate agent bills. Jun 23, 2026
  27. 27 How to Structure a Production Claude Agent: All Layers Explained The full layered architecture of a production Claude agent: gateway, model router, agent loop, scoped tools, policy hooks, prompt caching, evals, and clean escalation. Jun 23, 2026
  28. 28 Building a Customer Support Agent with Claude: Tools, Policy Hooks, and Escalation Build a production Claude support agent: scoped tools, a code-enforced policy hook that guards the refund cap, structured escalation, and a three-stream reliability log. Jun 23, 2026
  29. 29 Building a Multi-Agent Research System with Isolated Contexts Architect a coordinator–subagent research pipeline with isolated context bubbles, scoped tools, and provenance that survives synthesis — without context overflow. Jun 23, 2026
  30. 30 How to Build a Structured Data Extraction Pipeline with Claude Wire forced schemas, few-shot examples, validation retry, confidence routing, and prompt caching into one production extraction flow you'd actually ship. Jun 23, 2026
  31. 31 Claude Architecture Explained: 5 Layers and 2 Cross-Cutting Planes Master the Claude stack: 5 layers (model → protocol → reach → orchestration → surfaces) plus 2 planes that cut through every layer. Jun 23, 2026
  32. 32 CCA-F Exam Study Guide: Claude Certified Architect Foundations Map every CCA-F exam domain to the Claude stack layers, master the score weights, and build a focused study path — all in one reference. Jun 23, 2026