Capstone

Mastering Claude Code · ~9 min

The Claude Code Decision Table

Eleven lessons collapse into one reflex: read the symptom in front of you, reach for the surface that fits — and when the job leaves the interactive session, pick SDK, bare mode, or a dynamic workflow on purpose.

Why this, for you: the hard part of Claude Code was never any single feature — it's knowing which one the moment in front of you calls for. Stare too long and you reach for the heaviest tool by reflex: a 1,000-agent workflow for a one-file edit, the SDK for a task claude -p already does. This table makes the cheap answer the automatic one.

The through-line of the whole course: match the surface to the structure of the work, and add machinery only where the task earns it. Below is every lesson as a lookup, then a sharper decision among the three ways to run Claude outside the chat — and a mixed review to prove it stuck.

1 Symptom → move

Symptom you're staring atMoveLesson
About to let an agent write before you trust its planPlan Mode — explore read-only, agree the plan, then let it edit; cheap correction beats expensive reworkL1
One context filling with unrelated subtasksDelegate to sub-agents and teams — bounded work, clean main context, parallel fan-outL2
A long run drifting and you're flying blindWatch it — agent-view plus the monitor tool to steer mid-run instead of afterL3
A rule keeps getting ignored when you "ask nicely"Hooks — enforce and auto-fix deterministically at PreToolUse / PostToolUseL4
Babysitting every approval, or want raw speedPermission modes — auto mode for speed, hard-deny and disallowed-tools for the floorL5
The team drifts from shared guardrailsManaged settings — ship one drop-in so everyone inherits the same configL6
A skill underperforms and you keep restarting to fix itThe eval loop — measure against evals, reload mid-session, tighten without a restartL7
You want always-on custom behavior, packagedBuild a plugin — wire extension points and background monitorsL8
Parallel agents colliding in one repo or monorepoWorktrees and sparse paths — isolate batch work so agents never collideL9
Recurring work pinning your machineScheduling and cloud routines — move it off your laptopL10
The job has left the interactive session entirelyPick the surface — SDK, bare mode, or dynamic workflow (below)L11

2 The three surfaces when the job leaves the chat

The last row is the one this lesson grounds. Once work runs without you driving a session, three surfaces split cleanly by a single question — who holds the loop, and how reproducible does the run need to be?

You need…SurfaceWhat carries it
Claude's agent loop embedded in an app, CI, or productAgent SDKquery() — an async generator of typed messages; the same runtime as Claude Code, as a library
A scripted one-shot call that behaves identically on every machine--bare flagclaude --bare -p — skips all local config discovery; you pass back only what the task needs
To orchestrate dozens-to-hundreds of agents at scaleDynamic workflowA script Claude writes and a background runtime executes; intermediate results stay in script variables
The decision axis is who holds the plan. Sub-agents and skills keep it in Claude's context, turn by turn. A workflow moves it into a script — so the orchestrator's context holds only the final answer, which is what lets one run coordinate up to 1,000 agents (16 concurrent).

The SDK gives you that loop programmatically: settingSources controls which filesystem config it reads (CLAUDE.md, skills, hooks), and the omit-default has flipped between releases — so pin a version and set it explicitly ([] for isolation, ["user","project","local"] for CLI parity). The --bare flag is the deterministic opposite: it skips hooks, MCP servers, skills, plugins, auto-memory, and CLAUDE.md discovery, keeps only Bash / read / edit, and is ~14% faster to the first API request — Anthropic has said it will become the default for -p.

# Same job, three surfaces — pick by who holds the loop # 1. Embedded loop in CI/app: for await (const m of query({ prompt, options:{ maxTurns:5, settingSources:["project"] }})) ... # 2. Reproducible one-shot (auth via ANTHROPIC_API_KEY, OAuth/keychain off): claude --bare -p "Review the diff" --allowedTools "Read" --max-turns 5 # 3. Scale fan-out, results stay out of context: Run a workflow to audit every endpoint under src/routes/ for missing auth checks

The heaviest surface is rarely the right one

Each surface has a backfire, and they rhyme: reach for the SDK for a single task and you've added a dependency claude -p already covers; reach for a workflow for linear work one conversation can hold and you pay token cost with no return — that's a sub-agent job; reach for --bare when your -p runs are already deterministic and you've mostly added flag noise for a 14% saving. Workflows are also a research preview (v2.1.154+) with no mid-run sign-off. Match the tool to the structure, not the ambition.

↪ Your win: a Claude Code reflex

Mixed review — the surfaces, plus a spaced recall

Question 1To embed Claude's full agent loop inside a CI pipeline or product, the surface is…

Question 2Because --bare skips OAuth and keychain reads, a bare run must get its auth from…

Question 3A dynamic workflow keeps the orchestrator's context clean by holding intermediate results in…

Question 4A linear task one conversation can comfortably hold should run as…

Question 5 · spaced recall from an earlier lessonIn Plan Mode, before you approve, the agent works…

You finished the course. Ask me to apply this decision table to a real automation of yours — wire a query() gate into CI, convert a turn-by-turn task into a saved /<name> workflow, or decide whether --bare is worth it for your existing -p runs. Or revisit any lesson; the surfaces compound when you use them together.
✎ Feedback