The Course
chapter 10optional · go deeper

Going Deeper

Advanced patterns for when you outgrow the basics

You've finished the core course. This chapter is the long tail — patterns for builders who want to push Claude Code further than "it edits files for me." Three independent sections you can read in any order, skip freely, or save for later.

Nothing here is required to ship. All of it is what separates an app that works from an app that works at scale.

optional · advancedskim-safe3 sections
before you startset your expectations
by the end of this chapter

You'll have scanned three advanced tracks — model routing, sub-agents, prompt patterns — and mapped at least one concrete thing to your own code. Nothing here is required; it's the menu for when you want to push Claude Code further.

lesson

A menu, not a syllabus

Unlike Chapters 1–9, this one is intentionally non-linear. Each section solves a different problem:

  • Multi-model routing — cost control. When you call the wrong Claude model, you overpay by 10× on average. One routing table fixes it.
  • delegation — context control. When Claude's main thread gets cluttered by tool-heavy research, your next answer gets worse. Delegate the noisy work to a sub-agent; keep the main thread clean.
  • Production prompt patterns— reliability control. Patterns that separate a prompt you'd demo from a prompt you'd bill against (how prompts survive truncation, schema drift, hallucinated citations).

Read in whatever order matches the problem you're currently hitting. If nothing feels urgent, skim and come back.

section 1multi-model routing

Using one model for everything is like using a sledgehammer for every nail, screw, and cable. Routing the right subtask to the right model drops cost by 60–90% on most AI-backed features. The table below is the pocket reference.

modelcoststrengthsavoid when
Claude Haiku
cheap
$Short turns, classification, routing, cached system prompts. Fast + cheap.Long reasoning, vision, anything creative or synthesis-heavy.
Claude Sonnet
balanced
$$Vision, coding, most agent workloads. The default answer when unsure.Trivial classification (use Haiku) or deep multi-pass synthesis (use Opus).
Claude Opus
premium
$$$Deep reasoning, multi-pass refinement, high-stakes synthesis (research, final rankings).Anything that could work on Sonnet. Opus cost per call is ~5× Sonnet.
Gemini Flash
cheap
$Long-context retrieval, very long video/audio. Cheap per token.Tool use workflows (weaker than Claude models). Short-turn latency-sensitive paths.
Gemini Pro
balanced
$$Huge context window (1M+ tokens). Video understanding. Good for full-repo ingestion.Agentic loops. Not as good as Claude at tool-use orchestration.
live exampletwo-pass with two models
CREATE / EDIT THIS FILE·src/lib/ai/two-pass.ts
Haiku does the verbose thinking cheaply; Sonnet refines what ships. Combined cost ~15% of running Sonnet twice.
// Pass 1 — cheap, verbose analysis
const rough = await anthropic.messages.create({
  model: 'claude-haiku-4-5-20251001',
  system: cachedSystem(ANALYST_PROMPT),
  messages: [{ role: 'user', content: input }],
})

// Pass 2 — premium, refined output
const final = await anthropic.messages.create({
  model: 'claude-sonnet-4-6',
  system: cachedSystem(REFINER_PROMPT),
  messages: [
    {
      role: 'user',
      content: `PRIVATE SCRATCH — refine silently, never reference:

${extractText(rough)}

User-facing output below.`,
    },
  ],
})
ts
section 2sub-agent delegation

are separate conversations Claude Code spawns to do work, returning only the final answer. They share no context with the main thread — which is the point. Use them to keep your main context clean while heavy research happens in the background.

explore agent

Read-heavy codebase surveys

Answers "where in this repo is X?" or "how do Y flows wire together?" by doing 10–30 Glob/Grep/Read calls and returning a structured summary with file paths.

Best for: discovery, audits, impact analysis.

plan agent

Architecture proposals

The takes a change request, reads the relevant code, proposes 1–2 concrete approaches with trade-offs, and returns a change list — without editing anything.

Best for: kicking off features, scoping refactors, any non-trivial change.

general-purpose

Complex multi-tool jobs

For tasks that need 15+ tool calls and you don't want polluting the main conversation. Full tool access; returns a single final message.

Best for: long investigations, bulk refactors, research that doesn't fit in an Explore.

the movelaunch three parallel explores

When you need to survey the codebase before a change, don't do it yourself — launch three Explore agents in parallel from a single message. Each gets a focused brief. You get three thorough answers in the time one prompt takes to write.

Example: before a billing refactor, launch parallel Explores to map (a) every place that reads the billing table, (b) every place that writes to it, (c) every handler that can modify it. Merge the reports. You now know the blast radius before writing a single line.

section 3production prompt patterns

Ten patterns that separate prompts you'd demo from prompts you'd bill against. Relevant for any app that wires Claude (or any LLM) into its product — the capstone's Summarise feature is a minimal use of these. Click any tile to expand the full pattern with a copy-ready example.

10/10
you did it

Course complete

That's the whole course. Ten chapters, five primitives, a capstone app, a shipping checklist, and now a menu of advanced tracks to return to whenever a specific problem calls for one.

You started by installing Claude Code and making one small edit. You're ending with a shipped AI-backed SaaS and the habits that keep it working 30 days in. That's the delta this course was built for.

Go build something.

exercisestry this in your own repo0/3