Skip to content

Claude Code guide in three levels, Beginner to Advanced: hands-on lessons with checked exercises, every volatile fact cited to its source. Independent community guide.

docs: rework Advanced lessons around real repository work (#138)

Wesam Abousaid69738cc103ea
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6ba47d5..dea9fad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,7 @@ Editions 2 and 3: the Intermediate and Advanced paths, with checked exercises. E
- The Beginner lessons and capstone use code review, plan review, recovery and project instructions as practice tasks. The learning app's questions focus on decisions, and its checks read available evidence directly from files, git and the installed CLI.
- The Intermediate lessons and capstone use real work as practice tasks: a console error found through Chrome DevTools MCP and fixed, a commit made by a plugin, a lookup through a code intelligence plugin, and a malformed-link crash fixed in the capstone. Each lesson asks at most three graded questions, and the capstone asks none.
+- The Advanced lessons and capstone use real work as practice tasks: two backlog changes in parallel worktrees, a release-week backlog sorted by orchestration pattern, a migration across two folders that a saved workflow keeps fixing until the tests pass, a staged-change review you act on, and a bounded run whose diff you review for changes outside the task. Self-checks ask for a decision the check can't see, and the capstone groups its check list by lesson and caps the review script's spend with `--max-budget-usd`.
- The animated Claude mascot is back beside README's title, and the social card shows it in place of the trail blazes. It comes from [shanraisshan/claude-code-best-practice](https://github.com/shanraisshan/claude-code-best-practice) under the MIT License.
- Every stamped page is re-verified against Claude Code v2.1.292 (stable), and the social card carries the full tagline, "Learn it in three levels, with cited facts and checked exercises."
- The topic pages, [Commands by level](docs/reference/commands.md) and the [Feature map](docs/reference/feature-map.md) link the Intermediate and Advanced lessons and Electives, and "When to use what" on the [Intermediate index](docs/intermediate/README.md#when-to-use-what) links the dynamic workflows lesson.
diff --git a/docs/advanced/01-parallel-sessions.md b/docs/advanced/01-parallel-sessions.md
index 7239914..7520906 100644
--- a/docs/advanced/01-parallel-sessions.md
+++ b/docs/advanced/01-parallel-sessions.md
@@ -1,6 +1,6 @@
# Parallel sessions with worktrees
-<sub>**Advanced** · Lesson 1 of 7 · about 20 minutes · Needs: [Advanced index](README.md) · Verified against Claude Code v2.1.292 (stable) on 2026-10-15</sub>
+<sub>**Advanced** · Lesson 1 of 7 · about 20 minutes · Needs: [Advanced index](README.md) · Verified against Claude Code v2.1.292 (stable) on 2026-10-22</sub>
## Goal
@@ -42,7 +42,7 @@ The work comes back through git: each session commits on its branch, you merge t
Tidy the wording of the README's first section, then wait for me before you commit.
```
- Claude Code creates `.claude/worktrees/docs-pass/` on the branch `worktree-docs-pass`, and the session works there. Approve the edit when it asks. Asking it to wait holds the commit until step 4 even where no permission prompt would: a worktree session uses your main checkout's `.claude/settings.local.json` ([Settings files and precedence](https://code.claude.com/docs/en/settings#where-claude-code-keeps-the-local-file-in-a-git-repository)), so with the sandbox's auto-allow mode from [Intermediate lesson 4](../intermediate/04-permissions-and-sandbox.md) on there, sandboxed commands such as `git commit` run without asking ([Sandbox modes](https://code.claude.com/docs/en/sandboxing#sandbox-modes)).
+ Claude Code creates `.claude/worktrees/docs-pass/` on the branch `worktree-docs-pass`, and the session works there. In auto mode, the starting mode, Claude works without routine permission prompts ([Auto mode](https://code.claude.com/docs/en/permission-modes#eliminate-permission-prompts-with-auto-mode)), so a `git commit` wouldn't wait for you. Asking it to wait is what holds the commit until step 4: auto mode treats a boundary you state in the conversation as a reason to block the matching action ([Boundaries you state in conversation](https://code.claude.com/docs/en/permission-modes#boundaries-you-state-in-conversation)). If Claude Code asks before an edit, read it, then approve.
3. In terminal 2, start a second session with the short flag and give it a test task:
```bash
@@ -53,7 +53,7 @@ The work comes back through git: each session commits on its branch, you merge t
This worktree is a fresh checkout: install the dependencies, then add one missing test for a small exported function and run the tests. Wait for me before you commit.
```
- Claude Code creates `.claude/worktrees/test-pass/` on the branch `worktree-test-pass`; the session installs the dependencies there before it adds the test. Approve its steps the same way.
+ Claude Code creates `.claude/worktrees/test-pass/` on the branch `worktree-test-pass`; the session installs the dependencies there before it adds the test. If Claude Code asks before a command, read the command before you approve it.
4. In terminal 3, in your main checkout, look at all three checkouts while both sessions wait for you:
```bash
@@ -79,7 +79,9 @@ The work comes back through git: each session commits on its branch, you merge t
## Your turn
-Pick two small changes in your repository that touch different files, such as a fix in one module and a missing test for another. Make each one in its own worktree session, with both sessions running at the same time, and bring both into your branch.
+Pick two real changes from your repository's backlog that touch different files, such as a small bug fix in one module and a missing test for another. Make each one in its own worktree session, with both sessions running at the same time, and bring both into your branch.
+
+Before you start the sessions, decide what a fresh worktree of your repository lacks before its tests can run. Dependencies are the usual gap: tell each session to install them, as the Worked example's test session did ([Set up the worktree environment](https://code.claude.com/docs/en/worktrees#set-up-the-worktree-environment)). A gitignored file the tests read, such as a local config, is the other: list it in a `.worktreeinclude` file at your repository root, which copies only the files that match a pattern and are gitignored, or have the session create a test-only copy ([Copy gitignored files into worktrees](https://code.claude.com/docs/en/worktrees#copy-gitignored-files-into-worktrees)). Every worktree gets its own copy of each file you list, so list only what the tests need.
If the work they should build on isn't on the remote's default branch yet (see Watch out), get it there first, or add `"worktree": {"baseRef": "head"}` to `.claude/settings.local.json`, your personal settings file from [Intermediate lesson 4](../intermediate/04-permissions-and-sandbox.md), so new worktrees start from your local `HEAD` ([`worktree.baseRef`](https://code.claude.com/docs/en/settings-reference#worktree-baseref)).
@@ -96,7 +98,6 @@ Acceptance criteria:
- Both branches are merged into your branch with `git merge`, not [`git merge --squash`](https://git-scm.com/docs/git-merge#Documentation/git-merge.txt---squash).
- Your tests pass after both merges (not checked).
- Both worktrees are removed, and any branch you kept is deleted only after it's merged.
-- Optional, not checked: if your project needs a gitignored file to run, such as a local config, list it in a `.worktreeinclude` file at your repository root.
## Check
@@ -105,7 +106,7 @@ You are done when all of these are true:
- [ ] A committed `.gitignore` ignores `.claude/worktrees/`, and not the rest of `.claude/`.
- [ ] `.practice/a-1-worktrees.txt` lists two worktrees under `.claude/worktrees/` whose commits split from each other, and both are merged into your branch.
- [ ] Neither of those worktrees still exists: `git worktree list` doesn't show them.
-- [ ] Self-check (not tested): while both sessions worked, neither saw the other's uncommitted edits.
+- [ ] Self-check (not tested): you can name what a fresh worktree of your repository lacked, such as its dependencies or a gitignored config file, and say whether you listed it in `.worktreeinclude` or had the session set it up, and why.
Run `npm run check -- a-1 --dir <your repo>` from your practice copy.
@@ -113,7 +114,7 @@ If the first item fails, run `git -c core.excludesFile=/dev/null check-ignore -v
## Watch out
-- In most repositories on macOS, Linux and WSL 2, choosing "Yes, and don't ask again" for a Bash command in a worktree session saves the rule to your main checkout's `.claude/settings.local.json`. It then applies in the main checkout and in every worktree of the repository, and it stays after the worktree is removed ([What worktrees share with the main checkout](https://code.claude.com/docs/en/worktrees#what-worktrees-share-with-the-main-checkout)). Approve only commands you'd allow everywhere.
+- In most repositories on macOS, Linux and WSL 2, if a worktree session asks about a Bash command and you choose "Yes, and don't ask again", Claude Code saves the rule to your main checkout's `.claude/settings.local.json`. It then applies in the main checkout and in every worktree of the repository, and it stays after the worktree is removed ([What worktrees share with the main checkout](https://code.claude.com/docs/en/worktrees#what-worktrees-share-with-the-main-checkout)). Approve only commands you'd allow everywhere.
- Running several sessions at once multiplies token usage ([Run agents in parallel](https://code.claude.com/docs/en/agents)). Give each session one small task, and exit it once its branch is merged.
- A new worktree branches from the remote's default branch, not from your local `HEAD` ([Choose the base branch](https://code.claude.com/docs/en/worktrees#choose-the-base-branch)). Commits that aren't on that branch yet, such as unpushed commits or your feature branch's work, aren't in it, and merging its branch into a branch that's behind the remote's default branch brings in the commits that branch lacks. With no remote, a new worktree starts from your local `HEAD` instead.
@@ -125,6 +126,6 @@ If the first item fails, run `git -c core.excludesFile=/dev/null check-ignore -v
---
-<sub>Sources: [Run parallel sessions with worktrees](https://code.claude.com/docs/en/worktrees) · [All settings](https://code.claude.com/docs/en/settings-reference) · [Settings files and precedence](https://code.claude.com/docs/en/settings) · [Configure the sandboxed Bash tool](https://code.claude.com/docs/en/sandboxing) · [Run agents in parallel](https://code.claude.com/docs/en/agents) · [git-worktree](https://git-scm.com/docs/git-worktree) · [git-merge](https://git-scm.com/docs/git-merge) · [git-check-ignore](https://git-scm.com/docs/git-check-ignore) · [gitignore](https://git-scm.com/docs/gitignore) · [git-merge-base](https://git-scm.com/docs/git-merge-base) · [git-branch](https://git-scm.com/docs/git-branch)</sub>
+<sub>Sources: [Run parallel sessions with worktrees](https://code.claude.com/docs/en/worktrees) · [All settings](https://code.claude.com/docs/en/settings-reference) · [Choose a permission mode](https://code.claude.com/docs/en/permission-modes) · [Run agents in parallel](https://code.claude.com/docs/en/agents) · [git-worktree](https://git-scm.com/docs/git-worktree) · [git-merge](https://git-scm.com/docs/git-merge) · [git-check-ignore](https://git-scm.com/docs/git-check-ignore) · [gitignore](https://git-scm.com/docs/gitignore) · [git-merge-base](https://git-scm.com/docs/git-merge-base) · [git-branch](https://git-scm.com/docs/git-branch)</sub>
<sub>← [Advanced index](README.md) · [Choose an orchestration pattern](02-orchestration-patterns.md) → · Topic: [Subagents and parallel work](../topics/subagents-and-parallel-work.md) · [Stuck on this lesson?](https://github.com/wesammustafa/Claude-Code-Everything-You-Need-to-Know/issues/new?template=lesson-feedback.yml&lesson=a-1)</sub>
diff --git a/docs/advanced/02-orchestration-patterns.md b/docs/advanced/02-orchestration-patterns.md
index ad5e4cf..3b4c9f1 100644
--- a/docs/advanced/02-orchestration-patterns.md
+++ b/docs/advanced/02-orchestration-patterns.md
@@ -18,6 +18,8 @@ Subagents, a dynamic workflow and an agent team all split a job across workers;
Every pattern past one conversation adds usage: each subagent, and each agent a workflow spawns, sends requests of its own ([Why usage climbs](https://code.claude.com/docs/en/costs#why-usage-climbs-in-a-long-session)), and agent teams "use significantly more tokens than a single session" ([When to use agent teams](https://code.claude.com/docs/en/agent-teams#when-to-use-agent-teams)). So pick the cheapest pattern the job needs: ask these questions in order, and stop at the first answer that settles it.
+A big job is not always a job to split. Keep it in the main conversation when its steps share a lot of context, such as planning, making the change and testing it ([Choose between subagents and main conversation](https://code.claude.com/docs/en/sub-agents#choose-between-subagents-and-main-conversation)). And workers that only report back to you are not a team; a team is for workers who must share findings and challenge each other as they go ([Compare with subagents](https://code.claude.com/docs/en/agent-teams#compare-with-subagents)).
+
```mermaid
flowchart TD
accTitle: Who holds the plan
@@ -36,7 +38,7 @@ flowchart TD
## Worked example
-1. Pick three top-level folders in your repository, such as `src`, `test` and `docs`, and start `claude`.
+1. Pick three top-level folders in your repository, such as `src`, `test` and `docs`, and start `claude`. Keep [auto mode](https://code.claude.com/docs/en/permission-modes#which-mode-a-session-starts-in), the mode it starts in, for this lesson.
2. Ask the chart's questions about one job: a newcomer's summary of each folder. One conversation would fill with file reads it won't need again, so not the main conversation ([Choose between subagents and main conversation](https://code.claude.com/docs/en/sub-agents#choose-between-subagents-and-main-conversation)). The summaries needn't talk to each other, so no team. It's three tasks, done once, so subagents.
3. Ask for them, with your own folder names, as the docs' parallel research example does ([Run parallel research](https://code.claude.com/docs/en/sub-agents#run-parallel-research)):
@@ -47,16 +49,16 @@ flowchart TD
By default, an interactive session runs subagents in the background, so your prompt stays free ([Run subagents in foreground or background](https://code.claude.com/docs/en/sub-agents#run-subagents-in-foreground-or-background)). The panel below the prompt shows a row for each one while it works.
4. While they work, run `/tasks`. It lists each subagent with its state and the model it runs on; press Enter on a row to open its transcript ([Check on running work](https://code.claude.com/docs/en/agents#check-on-running-work), [Choose a model](https://code.claude.com/docs/en/sub-agents#choose-a-model)). Claude may start [built-in](https://code.claude.com/docs/en/sub-agents#built-in-subagents) `Explore` or `general-purpose` subagents, or forks of your conversation, so your rows will differ. When one finishes successfully, its row leaves the panel and the footer briefly shows `/tasks to see subagents`; the row of one that fails stays for a moment.
5. When the summaries arrive, run `/usage`. On a Pro, Max, Team or Enterprise plan, its usage breakdown attributes your recent usage to skills, subagents, plugins and MCP servers, and flags behaviors, such as long context, that account for a notable share of it ([Plan usage breakdown](https://code.claude.com/docs/en/costs#plan-usage-breakdown)). Its Session block, intended for API users such as those signed in with a Console account, shows this session's estimated cost ([Using the `/usage` command](https://code.claude.com/docs/en/costs#using-the-%2Fusage-command)). Both are estimates.
-6. Name what would change the answer. The same summary for every folder, cross-checked and rerun before each release, would be a workflow, the next lesson's pattern. Reviewers who must argue a root cause out between themselves would be an agent team.
## Your turn
-**Brief:** here are four jobs for your repository. Choose a pattern for each by what it needs and what it costs, write your choices down, then run the one that calls for subagents.
+**Brief:** five items from your team's backlog. Choose a pattern for each by what it needs and what it costs, write your choices down, then run job 1.
-1. Check the three largest source files for errors that are caught and ignored. Reading the files in your conversation would crowd it, and you only need the findings: one reviewer per file, once, and one short list back.
-2. Run the same check on every source file, verify each finding against the code before it's reported, and rerun it before every release.
-3. Fix a typo in one error message.
-4. Three investigators each test a different theory for a flaky test, message each other as they work to challenge each other's findings, and keep going until they agree on a cause.
+1. Before Friday's release, audit the three largest source files for errors that are caught and then dropped. You want suspects by file and line; nothing gets fixed yet.
+2. Add that audit to the release checklist for the whole codebase. The release manager has been burned by false alarms, so nothing goes on the list until it has been confirmed in the code.
+3. Rename a helper that about 40 files call, update every call site, and keep the build passing.
+4. A checkout test fails about one run in ten. There are three suspects: a race in a cache, an assertion that depends on the clock, and the order the tests run in. Have each suspect checked and bring back what each check found; you'll decide.
+5. Last month, three separate reports on that same test each blamed a different suspect, and nobody was convinced. This time the investigators should try to knock down each other's explanations while they work, until one survives that they all accept.
**Acceptance criteria:**
@@ -75,7 +77,7 @@ flowchart TD
- Job 1 ran as parallel subagents, one per file, in a session you started with `claude --settings .practice/a-2-hook.json` ([CLI reference](https://code.claude.com/docs/en/cli-reference#cli-flags)).
- Job 1 changed no file: the reviewers only report, and `git status` shows no change from them.
-- Only job 1 ran. The other three are choices.
+- Only job 1 ran. The other four are choices.
## Check
@@ -91,7 +93,7 @@ If a job's pattern is wrong, ask the chart's questions in order: the check's hin
## Watch out
-- A background subagent's permission prompts appear in your main session, and an answer that lasts beyond that one tool call, such as a grant for the rest of the session, applies to the whole session, your main conversation included ([Run subagents in foreground or background](https://code.claude.com/docs/en/sub-agents#run-subagents-in-foreground-or-background)). Approve each of those prompts for that one call only, never for the rest of the session, and ask reviewers only to read.
+- If Claude Code asks about a background subagent's tool call, the prompt appears in your main session, and an answer that lasts beyond that one tool call, such as a grant for the rest of the session, applies to the whole session, your main conversation included ([Tools, permissions, and results of background subagents](https://code.claude.com/docs/en/sub-agents#tools-permissions-and-results-of-background-subagents)). Answer such a prompt for that one call only, and ask reviewers only to read.
- Each subagent's result returns to your conversation, and each subagent spends tokens of its own while it runs, so many detailed results crowd your context and add to your usage. Ask for short results ([Run parallel research](https://code.claude.com/docs/en/sub-agents#run-parallel-research)).
- With agent teams turned on, a subagent that Claude names launches as a teammate, so a team can form when you asked for subagents. The hook also logs a line each time a teammate that runs inside your main terminal handles a new message ([Claude spawns teammates instead of subagents](https://code.claude.com/docs/en/agent-teams#claude-spawns-teammates-instead-of-subagents), [SubagentStart](https://code.claude.com/docs/en/hooks#subagentstart)). If you turned teams on, add `"env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "0" }` to `.practice/a-2-hook.json`, as a top-level key beside `"hooks"`. A `--settings` file overrides your user, project and local settings and a shell export, and only managed settings override it ([Settings precedence](https://code.claude.com/docs/en/settings#settings-precedence)).
@@ -103,6 +105,6 @@ If a job's pattern is wrong, ask the chart's questions in order: the check's hin
---
-<sub>Sources: [Run agents in parallel](https://code.claude.com/docs/en/agents) · [Orchestrate subagents at scale with dynamic workflows](https://code.claude.com/docs/en/workflows) · [Orchestrate teams of Claude Code sessions](https://code.claude.com/docs/en/agent-teams) · [Create custom subagents](https://code.claude.com/docs/en/sub-agents) · [Manage costs effectively](https://code.claude.com/docs/en/costs) · [Hooks reference](https://code.claude.com/docs/en/hooks) · [CLI reference](https://code.claude.com/docs/en/cli-reference) · [Settings files and precedence](https://code.claude.com/docs/en/settings)</sub>
+<sub>Sources: [Run agents in parallel](https://code.claude.com/docs/en/agents) · [Orchestrate subagents at scale with dynamic workflows](https://code.claude.com/docs/en/workflows) · [Orchestrate teams of Claude Code sessions](https://code.claude.com/docs/en/agent-teams) · [Create custom subagents](https://code.claude.com/docs/en/sub-agents) · [Manage costs effectively](https://code.claude.com/docs/en/costs) · [Hooks reference](https://code.claude.com/docs/en/hooks) · [Choose a permission mode](https://code.claude.com/docs/en/permission-modes) · [CLI reference](https://code.claude.com/docs/en/cli-reference) · [Settings files and precedence](https://code.claude.com/docs/en/settings)</sub>
<sub>← [Parallel sessions with worktrees](01-parallel-sessions.md) · [Advanced index](README.md) · [Run and save a dynamic workflow](03-dynamic-workflows.md) → · Topic: [Subagents and parallel work](../topics/subagents-and-parallel-work.md) · [Stuck on this lesson?](https://github.com/wesammustafa/Claude-Code-Everything-You-Need-to-Know/issues/new?template=lesson-feedback.yml&lesson=a-2)</sub>
diff --git a/docs/advanced/03-dynamic-workflows.md b/docs/advanced/03-dynamic-workflows.md
index e8ce4a8..4afff9e 100644
--- a/docs/advanced/03-dynamic-workflows.md
+++ b/docs/advanced/03-dynamic-workflows.md
@@ -4,12 +4,12 @@
## Goal
-By the end of this lesson you can have Claude write a dynamic workflow for a job that fans out across many files, keep the run small, and save it as a command that takes its input from `args`.
+By the end of this lesson you can have Claude write a dynamic workflow for a job that fans out across many files, read it and keep it small before it runs, and save a migration that keeps fixing until your tests pass as a command that takes its folder from `args`.
## You need
-- One of your own repositories with at least two folders that each hold a `TODO` or `FIXME` comment that still applies to the code: `git grep -n -E 'TODO|FIXME'` lists them. If yours has none, use a local clone of a project that has some; you won't push to it. Run the check from your copy of the practice template, with Node.js LTS. Set up the repository's `.practice/` folder as [Beginner lesson 1](../beginner/01-install-and-look-around.md#you-need) describes, if you haven't yet.
-- Usage: heavy. Each run starts several subagents, and `/deep-research` also searches the web ([Run a bundled workflow](https://code.claude.com/docs/en/workflows#run-a-bundled-workflow)). Cheap variant: skip step 3, keep each run to one small folder, and start Claude Code with `--model sonnet` as step 1 shows.
+- One of your own repositories with a test command that passes, such as `npm test`, and a migration it needs in at least two folders: an old form that `git grep -n -E '<pattern>'` finds, such as a deprecated call, an old import path or a helper you're replacing ([git grep](https://git-scm.com/docs/git-grep)). No migration in mind? Your copy of the practice template has one: files in `test/` and `practice/` build paths from `import.meta.url`, where Node.js offers [`import.meta.dirname`](https://nodejs.org/api/esm.html#importmetadirname). Run the check from your copy of the practice template, with Node.js LTS. Set up the repository's `.practice/` folder as [Beginner lesson 1](../beginner/01-install-and-look-around.md#you-need) describes, if you haven't yet.
+- Usage: heavy. Each run starts several subagents ([Cost](https://code.claude.com/docs/en/workflows#cost)). Cheap variant: keep each run to one small folder, and start Claude Code with `--model sonnet` as step 1 shows.
> [!NOTE]
> On Pro, dynamic workflows are off until you turn them on from the **Dynamic workflows** row in `/config`, and the size guideline defaults to `small` ([Orchestrate subagents at scale with dynamic workflows](https://code.claude.com/docs/en/workflows), [Set a size guideline](https://code.claude.com/docs/en/workflows#set-a-size-guideline)).
@@ -20,6 +20,8 @@ A dynamic workflow is a JavaScript script that Claude writes for your task. A ru
Because the plan is code, you can read it before it runs, independent agents can check each other's findings before they're reported, and you can save a run that did what you wanted as a command, `/<name>`, that can take new input from `args` each time ([When to use a workflow](https://code.claude.com/docs/en/workflows#when-to-use-a-workflow), [Pass input to a saved workflow](https://code.claude.com/docs/en/workflows#pass-input-to-a-saved-workflow)).
+Because the script holds the loop, a workflow can also keep fixing until a check passes, and stop when rounds stop making progress, as the docs' example prompts show for a type check ([Example workflow prompts](https://code.claude.com/docs/en/workflows#example-workflow-prompts)).
+
A size guideline tells Claude how many agents to aim for when it writes the script. It is advice, not a cap ([Set a size guideline](https://code.claude.com/docs/en/workflows#set-a-size-guideline)).
## Worked example
@@ -46,14 +48,7 @@ A size guideline tells Claude how many agents to aim for when it writes the scri
```
`small` asks Claude for the fewest agents; the docs suggest it "when you want to bound what a workflow spends". Claude Code keeps this choice in `~/.claude.json`, not in the repository, and it applies from your next prompt ([All settings](https://code.claude.com/docs/en/settings-reference#workflowsizeguideline), [Set a size guideline](https://code.claude.com/docs/en/workflows#set-a-size-guideline)).
-3. Skip this step in the cheap variant. Run the bundled research workflow ([Run a bundled workflow](https://code.claude.com/docs/en/workflows#run-a-bundled-workflow)). It needs the WebSearch tool, which Amazon Bedrock doesn't offer ([WebSearch tool behavior](https://code.claude.com/docs/en/tools-reference#websearch-tool-behavior)):
-
- ```text
- /deep-research What changed in the Node.js permission model between v20 and v22?
- ```
-
- Claude Code lists the planned phases and asks whether to run it. Because you ran the workflow by name, it also offers **Yes, and don't ask again for `<name>` in `<path>`** ([Approve the plan before it runs](https://code.claude.com/docs/en/workflows#approve-the-plan-before-it-runs)). Choose **Yes, run it**. The run works in the background. Its agents use your permission rules, so in Manual mode a search or a page fetch can stop for your approval, and the run waits until you answer ([Behavior and limits](https://code.claude.com/docs/en/workflows#behavior-and-limits)). When it finishes, the report appears in your session, citing its sources. Wait for it before you go on.
-4. Ask for a workflow of your own. Replace `<folder>` with a small folder of your repository:
+3. Ask for a workflow of your own. Replace `<folder>` with a small folder of your repository:
```text
use a workflow to audit every file under <folder> for errors that are caught and then ignored, and adversarially verify each finding before reporting it
@@ -79,26 +74,33 @@ A size guideline tells Claude how many agents to aim for when it writes the scri
```
`agent()` starts one subagent, `pipeline()` runs one per item in a list, and `parallel()` runs a set of agents at the same time ([What the saved script looks like](https://code.claude.com/docs/en/workflows#what-the-saved-script-looks-like)). Then choose **Yes, run it**.
-5. While it works, run `/workflows` and select your audit run; when the session has only one run, it opens that run directly. The progress view shows each phase with its agent counts. `↑` and `↓` select, `Enter` opens a phase and then an agent (its prompt, its recent tool calls and its result), `Esc` backs out, and `p` pauses the run or resumes it ([Watch the run](https://code.claude.com/docs/en/workflows#watch-the-run)). A one-line progress summary also shows in the task panel below the input box ([Run a bundled workflow](https://code.claude.com/docs/en/workflows#run-a-bundled-workflow)).
-6. When the run finishes and its findings appear in your session, run `/workflows`, select your audit run, not the `/deep-research` one, and press `s`. In the save dialog, `Tab` switches between `.claude/workflows/` in your project, shared with everyone who clones the repository once you commit it, and `~/.claude/workflows/`, available in every project but only to you. Make sure `.claude/workflows/` in your project is selected, pressing `Tab` if it isn't, then press `Enter` ([Save the workflow for reuse](https://code.claude.com/docs/en/workflows#save-the-workflow-for-reuse)). Claude Code writes the script as a `.js` file to the closest `.claude/workflows/` folder that already exists between your working directory and the repository root, or to `.claude/workflows/` at the root if there's none yet. From your next session on, the workflow runs as a command, `/<name>`, listed in `/` autocomplete beside `/deep-research` ([Bundled workflows](https://code.claude.com/docs/en/workflows#bundled-workflows)).
+4. While it works, run `/workflows` and select your audit run; when the session has only one run, it opens that run directly. The progress view shows each phase with its agent counts. `↑` and `↓` select, `Enter` opens a phase and then an agent (its prompt, its recent tool calls and its result), `Esc` backs out, and `p` pauses the run or resumes it ([Watch the run](https://code.claude.com/docs/en/workflows#watch-the-run)). A one-line progress summary also shows in the task panel below the input box ([Run a bundled workflow](https://code.claude.com/docs/en/workflows#run-a-bundled-workflow)).
+5. When the run finishes and its findings appear in your session, run `/workflows`, select your audit run, and press `s`. In the save dialog, `Tab` switches between `.claude/workflows/` in your project, shared with everyone who clones the repository once you commit it, and `~/.claude/workflows/`, available in every project but only to you. Make sure `.claude/workflows/` in your project is selected, pressing `Tab` if it isn't, then press `Enter` ([Save the workflow for reuse](https://code.claude.com/docs/en/workflows#save-the-workflow-for-reuse)). Claude Code writes the script as a `.js` file to the closest `.claude/workflows/` folder that already exists between your working directory and the repository root, or to `.claude/workflows/` at the root if there's none yet. From your next session on, the workflow runs as a command, `/<name>`, listed in `/` autocomplete beside the bundled `/deep-research` ([Bundled workflows](https://code.claude.com/docs/en/workflows#bundled-workflows)).
## Your turn
-**Brief:** build a workflow that finds every `TODO` and `FIXME` comment in a folder you name, checks whether each one still applies to the current code, and reports only the ones that do. Keep it small: have its agents check the comments in a few batches, not one agent per comment. Pick two folders that each still hold at least one `TODO` or `FIXME` that applies: a report that finds none cites no `path:line` and fails the check.
+**Brief:** migrate your repository one folder at a time, with a workflow you save. Build a workflow that takes a folder from `args`, finds every use of the old form in it, has agents migrate the files in a few batches that each own different files, not one agent per file, then runs your test command and keeps fixing until it passes. Run it on a small folder first and read what it spent in `/workflows` before you run it on a second folder.
**Acceptance criteria:**
- It's saved in `.claude/workflows/`, committed, and runs by name. Its first statement stays `export const meta`, a plain object literal with a `name` and a `description`: a variable, a function call or a spread there drops `/<name>` from `/` autocomplete ([Edit a saved script](https://code.claude.com/docs/en/workflows#edit-a-saved-script)).
- It reads the folder from `args`, so `Run /<name> on <folder>` works on any folder without editing the script.
-- Each reported item starts with its `TODO` or `FIXME` line as a `path:line` from the repository root, then says in one line why it still applies, without citing any other `path:line`. Items that no longer apply are left out.
-- A run on one small folder shows no `Large workflow` warning in the task panel. With a guideline chosen, the warning appears when a run schedules more agents than the guideline's count ([Cost](https://code.claude.com/docs/en/workflows#cost)).
+- It stops on its own: when your test command passes, or after two rounds in a row that make no progress, so a change your tests can't accept doesn't loop until the runtime's agent cap ([Behavior and limits](https://code.claude.com/docs/en/workflows#behavior-and-limits)).
+- After each run, `git grep -n -E '<pattern>' -- <folder>` lists nothing, your test command passes, and you've reviewed and committed the run's changes.
+- The pattern that finds the old form is saved on one line in `.practice/a-3-pattern.txt`, so the check can find the old form in your history.
+
+One way to get there: save the pattern before you start. For the practice template's migration, that's:
+
+```bash
+printf '%s\n' 'import\.meta\.url' > .practice/a-3-pattern.txt
+```
-One way to get there: write the first version with a "use a workflow" request on one folder, and save it as in step 6. Then run `/workflow-authoring`, which loads the reference Claude works from when it writes scripts, and ask Claude to change the saved script so it takes the folder from `args` ([Edit a saved script](https://code.claude.com/docs/en/workflows#edit-a-saved-script)). Run `/reload-skills`, then ask `Run /<name> on <folder>`.
+Write the first version with a "use a workflow" request on the small folder, read its script before you approve it, and save the run as in step 5. Then run `/workflow-authoring`, which loads the reference Claude works from when it writes scripts, and ask Claude to change the saved script so it takes the folder from `args` ([Edit a saved script](https://code.claude.com/docs/en/workflows#edit-a-saved-script)). Run `/reload-skills`, commit the script, then ask `Run /<name> on <folder>` for the second folder.
-When the script meets the other criteria, commit it. Then run it by name on two different folders, without editing it between the runs. After each run, ask Claude to save the report:
+After each run, review and commit its changes, then ask Claude to save the report:
```text
-Save that report to .practice/a-3-run1.md: the folder you ran it on as the first line, then one line per item that still applies, starting with its path:line, and nothing else.
+Save that report to .practice/a-3-run1.md: the folder you ran it on as the first line, then one line per file the migration changed, starting with the path:line of its first change, and nothing else.
```
Use `.practice/a-3-run2.md` for the second folder.
@@ -109,12 +111,12 @@ You are done when all of these are true:
- [ ] A committed script in `.claude/workflows/` has a literal `export const meta`, with a `name` and a `description`, as its first statement, and reads its input from `args`: `git ls-tree -r --name-only HEAD .claude/workflows` lists it.
- [ ] `.practice/a-3-run1.md` and `.practice/a-3-run2.md` name two different folders on their first lines, and each cites at least one `path:line` inside its folder.
-- [ ] Every cited `path:line` exists and holds `TODO` or `FIXME`.
-- [ ] Self-check (not tested): you ran the saved workflow by name for both reports without editing it between the runs, and neither run showed a `Large workflow` warning in the task panel.
+- [ ] The `git grep -E` pattern in `.practice/a-3-pattern.txt` matched inside both folders at an earlier commit, and matches inside neither at `HEAD`.
+- [ ] Self-check (not tested): your test command passes at `HEAD`, and before you approved the first run you read its script and can say how many agents it starts and what ends its fix rounds if the tests never pass.
Run `npm run check -- a-3 --dir <your repo>` from your practice copy.
-If the first item fails, check that the script is committed (`git check-ignore -v .claude/workflows/<file>.js` names any ignore rule that hides it; add it with `git add -f` and commit it) and that it reads `args`. If a report cites a `path:line` outside its folder, or none inside it, make sure the script reads the folder from `args` and reports only files inside it, start `claude` at the repository root so paths start there, and run it again on a folder where a `TODO` or `FIXME` still applies. If a cited line holds no `TODO` or `FIXME`, either the report cites other lines in its reasons or the file changed after the run: ask Claude to cite only the `TODO` and `FIXME` lines, or run the workflow again and save the new report with the prompt above.
+If the first item fails, check that the script is committed (`git check-ignore -v .claude/workflows/<file>.js` names any ignore rule that hides it; add it with `git add -f` and commit it) and that it reads `args`. If a report cites a `path:line` outside its folder, or none inside it, make sure the script reads the folder from `args`, start `claude` at the repository root so paths start there, and ask Claude to save the report again with only the files the migration changed in that folder. If the old form still matches at `HEAD`, commit the run's changes, or run the workflow on that folder again. If the pattern never matched, test it on a commit from before the run: `git grep -n -E '<pattern>' <commit> -- <folder>` should list the old form.
## Watch out
@@ -125,11 +127,11 @@ If the first item fails, check that the script is committed (`git check-ignore -
## Go further
- [This guide's own saved workflow](../../.claude/workflows/stale-docs-audit.js): a real script that reads `args`, groups its agents into phases, and has separate agents verify each claim before it's reported.
-- [Example workflow prompts](https://code.claude.com/docs/en/workflows#example-workflow-prompts): more task shapes, such as migrating many files or fixing until a check passes.
-- [When a run hits your usage limit](https://code.claude.com/docs/en/workflows#when-a-run-hits-your-usage-limit): when a run waits for your limit to reset instead of failing.
+- Optional: run the bundled research workflow on a question you'd otherwise research by hand, such as `/deep-research What changed in the Node.js permission model between v20 and v22?`. It fans out web searches, cross-checks the sources and returns a cited report. It needs the WebSearch tool, which Amazon Bedrock doesn't offer ([Run a bundled workflow](https://code.claude.com/docs/en/workflows#run-a-bundled-workflow), [WebSearch tool behavior](https://code.claude.com/docs/en/tools-reference#websearch-tool-behavior)).
+- [Example workflow prompts](https://code.claude.com/docs/en/workflows#example-workflow-prompts): more task shapes, such as finding flaky tests until a round turns up nothing new.
---
-<sub>Sources: [Orchestrate subagents at scale with dynamic workflows](https://code.claude.com/docs/en/workflows) · [Choose a permission mode](https://code.claude.com/docs/en/permission-modes) · [Create custom subagents](https://code.claude.com/docs/en/sub-agents) · [CLI reference](https://code.claude.com/docs/en/cli-reference) · [Commands](https://code.claude.com/docs/en/commands) · [All settings](https://code.claude.com/docs/en/settings-reference) · [Tools reference](https://code.claude.com/docs/en/tools-reference) · [Claude Code CHANGELOG](https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md)</sub>
+<sub>Sources: [Orchestrate subagents at scale with dynamic workflows](https://code.claude.com/docs/en/workflows) · [Choose a permission mode](https://code.claude.com/docs/en/permission-modes) · [Create custom subagents](https://code.claude.com/docs/en/sub-agents) · [CLI reference](https://code.claude.com/docs/en/cli-reference) · [Commands](https://code.claude.com/docs/en/commands) · [All settings](https://code.claude.com/docs/en/settings-reference) · [Tools reference](https://code.claude.com/docs/en/tools-reference) · [Claude Code CHANGELOG](https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md) · [git grep](https://git-scm.com/docs/git-grep) · [Node.js ECMAScript modules](https://nodejs.org/api/esm.html)</sub>
<sub>← [Choose an orchestration pattern](02-orchestration-patterns.md) · [Advanced index](README.md) · [Script Claude Code with `claude -p`](04-headless.md) → · Topic: [Subagents and parallel work](../topics/subagents-and-parallel-work.md) · [Stuck on this lesson?](https://github.com/wesammustafa/Claude-Code-Everything-You-Need-to-Know/issues/new?template=lesson-feedback.yml&lesson=a-3)</sub>
diff --git a/docs/advanced/04-headless.md b/docs/advanced/04-headless.md
index 01fd7e9..d6b3223 100644
--- a/docs/advanced/04-headless.md
+++ b/docs/advanced/04-headless.md
@@ -1,10 +1,10 @@
# Script Claude Code with `claude -p`
-<sub>**Advanced** · Lesson 4 of 7 · about 20 minutes · Needs: [Run and save a dynamic workflow](03-dynamic-workflows.md) · Verified against Claude Code v2.1.292 (stable) on 2026-10-15</sub>
+<sub>**Advanced** · Lesson 4 of 7 · about 20 minutes · Needs: [Run and save a dynamic workflow](03-dynamic-workflows.md) · Verified against Claude Code v2.1.292 (stable) on 2026-10-22</sub>
## Goal
-By the end of this lesson you can write a script that runs Claude Code with no one at the keyboard, reads its JSON result and exit code, and limits it to the tools and turns the job needs.
+By the end of this lesson you can write a script that runs Claude Code with no one at the keyboard, reads its JSON result and exit code, gets an answer in a shape you define, and limits the run to the tools and turns the job needs.
## You need
@@ -18,22 +18,26 @@ By the end of this lesson you can write a script that runs Claude Code with no o
With [`--output-format json`](https://code.claude.com/docs/en/headless#get-structured-output), it prints one JSON object with `result`, `is_error`, `num_turns`, `session_id` and `permission_denials` ([`SDKResultMessage`](https://code.claude.com/docs/en/agent-sdk/typescript#sdkresultmessage)). `result` holds the answer, or the failure message when something fails inside the run ([Basic usage](https://code.claude.com/docs/en/headless#basic-usage)). `subtype` is `success`, or why the run stopped early, such as `error_max_turns`; such a run has no `result` ([Handle the result](https://code.claude.com/docs/en/agent-sdk/agent-loop#handle-the-result)). Check the exit code and `is_error` before you use `result`.
+When a script needs fields rather than prose, add `--json-schema` with a [JSON Schema](https://json-schema.org/): the object then also holds `structured_output`, an answer in that shape ([Get structured output](https://code.claude.com/docs/en/headless#get-structured-output)). A run that ends without valid structured output has no `structured_output` field, so check that it's there before you use it.
+
Nobody can answer a permission prompt, so pass a mode every time: a run where nothing sets one can start in auto mode ([Auto-approve tools](https://code.claude.com/docs/en/headless#auto-approve-tools)). Three flags set the limits: `--permission-mode dontAsk` denies every call that would otherwise prompt, `--allowedTools` names what may run anyway, and `--max-turns` caps the turns ([CLI flags](https://code.claude.com/docs/en/cli-reference#cli-flags)).
+A `-p` run also loads what an interactive session would: hooks, skills, plugins, MCP servers, auto memory and CLAUDE.md, from the project and from `~/.claude`. `--bare` skips all of them, so a CI run behaves the same on every machine, and it is the mode the docs recommend for scripted calls ([Start faster with bare mode](https://code.claude.com/docs/en/headless#start-faster-with-bare-mode)). Bare mode never reads your subscription login: on the Anthropic API it needs `ANTHROPIC_API_KEY`, or an `apiKeyHelper` in `--settings`, so use it where the run has a key, as in CI. This lesson runs on your own login, so its steps use `--setting-sources user` instead, which drops less: it leaves out the project's settings files and its `.mcp.json`, and your user settings still load ([What runs before you trust a folder](https://code.claude.com/docs/en/permissions#what-runs-before-you-trust-a-folder)).
+
## Worked example
In your repository:
-1. Ask one question, and save the JSON:
+1. Ask for two facts a script can read, and save the JSON:
```bash
- claude -p "In one sentence, what does this repository do?" --output-format json --permission-mode dontAsk > .practice/a-4-first.json
+ claude -p "What does this repository do, in one sentence, and what command runs its tests?" --output-format json --permission-mode dontAsk --json-schema '{"type":"object","properties":{"summary":{"type":"string"},"test_command":{"type":"string"}},"required":["summary","test_command"]}' > .practice/a-4-first.json
echo "exit $?"
jq '{is_error, subtype, num_turns, session_id}' .practice/a-4-first.json
- jq -r .result .practice/a-4-first.json
+ jq '.structured_output' .practice/a-4-first.json
```
- It prints `exit 0`, then `"is_error": false` and `"subtype": "success"` with a turn count and a session ID, then one sentence about your repository (your wording will differ). Reading files in your working directory needs no approval, so `dontAsk` let Claude read what it needed ([dontAsk mode](https://code.claude.com/docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode)).
+ It prints `exit 0`, then `"is_error": false` and `"subtype": "success"` with a turn count and a session ID, then an object with a `summary` and a `test_command`, such as `"npm test"` (your values will differ). A script reads one field, as `jq -r '.structured_output.test_command // empty'` does, and stops when it comes back empty. Reading files in your working directory needs no approval, so `dontAsk` let Claude read what it needed ([dontAsk mode](https://code.claude.com/docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode)).
2. Ask for something that needs approval. `--setting-sources user` keeps your project's settings files out of the run ([CLI flags](https://code.claude.com/docs/en/cli-reference#cli-flags)), so neither the allow rule nor the sandbox's auto-allow mode from [Intermediate lesson 4](../intermediate/04-permissions-and-sandbox.md) approves the test command ([Auto-allow mode](https://code.claude.com/docs/en/sandboxing#auto-allow-mode)). It also leaves out the project's deny rules, such as your `.env` rules from that lesson, so steps 2 to 4 pass them again with `--disallowedTools`, which takes deny rules ([CLI flags](https://code.claude.com/docs/en/cli-reference#cli-flags)):
```bash
@@ -74,7 +78,7 @@ Acceptance criteria:
- It prints the `result` text, and exits non-zero when `claude` does or when `is_error` is `true`.
- With nothing staged, it says so and exits non-zero without calling Claude. `git diff --cached --quiet` exits with 0 when nothing is staged ([git diff](https://git-scm.com/docs/git-diff)).
-Commit the script. Then stage a small change, such as a one-line fix, and run `scripts/review-staged.sh` once: it saves `.practice/a-4-result.json`. Read the review before you commit that change.
+Commit the script. Then stage a small change, such as a one-line fix, and run `scripts/review-staged.sh` once: it saves `.practice/a-4-result.json`. Read the review before you commit that change, and act on it: fix one point it raises, or be able to say why you dismiss it.
## Check
@@ -84,7 +88,7 @@ You are done when all of these are true:
- [ ] Its `claude -p` call has the prompt right after `-p`, asks for JSON, runs in `dontAsk` mode, pre-approves only `Read`, `Grep` and `Glob`, and caps turns at 10 or fewer.
- [ ] It pipes the staged diff in, saves the JSON where its argument says, prints the result, exits non-zero when the run fails, and doesn't call Claude when nothing is staged.
- [ ] `.practice/a-4-result.json` holds a run that succeeded within your cap.
-- [ ] Self-check (not tested): you saw a run stop at `--max-turns`, in step 4 of the Worked example.
+- [ ] Self-check (not tested): you read the review of your staged change and fixed one point it raised, or can say why you dismissed it, before you committed.
Run `npm run check -- a-4 --dir <your repo>` from your practice copy, or `npm run check -- a-4` in the copy itself. The check runs your committed script with a stand-in for `claude`, so it uses none of your usage.
@@ -92,13 +96,13 @@ If the first item fails, run `chmod +x scripts/review-staged.sh`, then `git add`
## Watch out
-- A `-p` run shows no trust dialog: it runs the hooks in a project's `.claude/settings.json` and connects the servers in its `.mcp.json`, even in a folder you've never trusted ([Start faster with bare mode](https://code.claude.com/docs/en/headless#start-faster-with-bare-mode)). Before you script Claude Code in a repository you didn't write, pass `--setting-sources user`, so Claude Code reads neither the project's settings files nor its `.mcp.json` ([What runs before you trust a folder](https://code.claude.com/docs/en/permissions#what-runs-before-you-trust-a-folder)).
+- A `-p` run shows no trust dialog: it runs the hooks in a project's `.claude/settings.json` and connects the servers in its `.mcp.json`, even in a folder you've never trusted ([Start faster with bare mode](https://code.claude.com/docs/en/headless#start-faster-with-bare-mode)). Before you script Claude Code in a repository you didn't write, pass `--setting-sources user`, so Claude Code reads neither the project's settings files nor its `.mcp.json` ([What runs before you trust a folder](https://code.claude.com/docs/en/permissions#what-runs-before-you-trust-a-folder)). In a run with an API key, `--bare` keeps them out too.
- When `ANTHROPIC_API_KEY` is set, a `-p` run always uses that key instead of your plan ([Authentication precedence](https://code.claude.com/docs/en/authentication#authentication-precedence)). The JSON's `total_cost_usd` is a client-side estimate, not your bill ([Track cost and usage](https://code.claude.com/docs/en/agent-sdk/cost-tracking#estimates-not-billing)).
- In a folder you've never trusted, a `-p` run ignores the `permissions.allow` rules in the project's `.claude/settings.json` and prints a `this workspace has not been trusted` warning on stderr; trusting a parent folder doesn't count ([Project allow rules and workspace trust](https://code.claude.com/docs/en/permissions#project-allow-rules-and-workspace-trust), [Error reference](https://code.claude.com/docs/en/errors#workspace-has-not-been-trusted)). Pass the rules a script needs on its command line, with `--allowedTools`.
## Go further
-- [Run Claude Code programmatically](https://code.claude.com/docs/en/headless): structured output with `--json-schema`, streaming JSON, and continuing a run with `--resume` and its `session_id`.
+- [Run Claude Code programmatically](https://code.claude.com/docs/en/headless): streaming JSON, and continuing a run with `--resume` and its `session_id`.
- [Approve the plan before it runs](https://code.claude.com/docs/en/workflows#approve-the-plan-before-it-runs): start the workflow you saved in the previous lesson from a script, with `Workflow(<name>)` in your allow rules.
- [Agent SDK overview](https://code.claude.com/docs/en/agent-sdk/overview): the same agent loop from Python or TypeScript.
diff --git a/docs/advanced/05-github-actions.md b/docs/advanced/05-github-actions.md
index aee4f34..819ef20 100644
--- a/docs/advanced/05-github-actions.md
+++ b/docs/advanced/05-github-actions.md
@@ -111,7 +111,7 @@ You are done when all of these are true:
- [ ] A committed workflow runs `anthropics/claude-code-action` pinned to a release tag or a full commit SHA, in automation mode, with its credential from a secret and none in the file.
- [ ] Its limits are in the file: `--max-turns` of 10 or fewer, an `--allowedTools` list without unrestricted Bash, a read-only job token (no write access in `permissions` except `id-token: write`) and a `timeout-minutes` of 30 or fewer.
- [ ] `.practice/a-5-runs.json` shows a completed, successful manual run on a commit that holds the workflow.
-- [ ] Self-check (not tested): Claude answered your issue in a comment, and your run's summary page explains each broken link.
+- [ ] Self-check (not tested): you can say who can start a Claude run in this copy, and which text from an issue or comment reaches Claude as input (see Watch out).
Run `npm run check -- a-5` in this copy.
diff --git a/docs/advanced/06-share-your-setup.md b/docs/advanced/06-share-your-setup.md
index 776deb1..c99098f 100644
--- a/docs/advanced/06-share-your-setup.md
+++ b/docs/advanced/06-share-your-setup.md
@@ -1,6 +1,6 @@
# Share your setup with a team
-<sub>**Advanced** · Lesson 6 of 7 · about 20 minutes · Needs: [GitHub Actions](05-github-actions.md) · Verified against Claude Code v2.1.292 (stable) on 2026-10-15</sub>
+<sub>**Advanced** · Lesson 6 of 7 · about 20 minutes · Needs: [GitHub Actions](05-github-actions.md) · Verified against Claude Code v2.1.292 (stable) on 2026-10-22</sub>
## Goal
@@ -17,7 +17,9 @@ By the end of this lesson you can share your Claude Code setup with a team: comm
What everyone should get is committed: `.claude/settings.json`, `CLAUDE.md`, `.claude/rules/`, skills, agents and `.mcp.json` ([Explore the .claude directory](https://code.claude.com/docs/en/claude-directory#file-reference)). What is yours stays out of git: `.claude/settings.local.json`, which that table doesn't mark for commit, and `CLAUDE.local.md` ([What's not shown](https://code.claude.com/docs/en/claude-directory#what%E2%80%99s-not-shown)). Your local file outranks the shared one, so a teammate can override a team setting for themselves without a commit, though lists such as permission rules merge instead ([Settings files and precedence](https://code.claude.com/docs/en/settings#settings-precedence)).
-A plugin shares skills, agents and hooks with a team as one unit ([Create a Claude Code plugin](https://code.claude.com/docs/en/plugins/create#decide-when-to-use-a-plugin)), and a marketplace is a folder whose `.claude-plugin/marketplace.json` lists plugins ([Create a marketplace](https://code.claude.com/docs/en/plugins/create-marketplace)). Commit a marketplace inside the repository, declare it in `extraKnownMarketplaces` by a relative `directory` path, and turn its plugin on in `enabledPlugins`. Each teammate gets the plugin once they accept the workspace trust dialog for the folder ([Manage Claude Code plugins for your organization](https://code.claude.com/docs/en/plugins/org#require-plugins-per-repository)), and installs nothing: a plugin listed by a relative path loads from the marketplace itself ([Plugin loading reference](https://code.claude.com/docs/en/plugins/loading#enabled-in-project-settings-but-not-installed)).
+A committed `.claude/` folder already shares skills, agents and hooks with everyone who clones this one repository, under their short names. The docs say to keep that standalone setup while it serves one project, and to make a plugin when you want to install it in several projects or publish versioned releases ([Create a Claude Code plugin](https://code.claude.com/docs/en/plugins/create#decide-when-to-use-a-plugin)). This lesson builds the plugin inside one repository so you can see every step; when a second repository needs the same kit, move the marketplace to its own repository (Go further).
+
+A plugin shares skills, agents and hooks as one unit, and a marketplace is a folder whose `.claude-plugin/marketplace.json` lists plugins ([Create a marketplace](https://code.claude.com/docs/en/plugins/create-marketplace)). Commit a marketplace inside the repository, declare it in `extraKnownMarketplaces` by a relative `directory` path, and turn its plugin on in `enabledPlugins`. Each teammate gets the plugin once they accept the workspace trust dialog for the folder ([Manage Claude Code plugins for your organization](https://code.claude.com/docs/en/plugins/org#require-plugins-per-repository)), and installs nothing: a plugin listed by a relative path loads from the marketplace itself ([Plugin loading reference](https://code.claude.com/docs/en/plugins/loading#enabled-in-project-settings-but-not-installed)).
## Worked example
@@ -77,7 +79,7 @@ Your teammates keep asking how the repository's Claude Code setup works. Share a
## Your turn
-**Brief:** move one piece of your Intermediate setup into `team-kit`, so everyone who clones the repository gets it from the plugin. Take a skill, such as `tdd` from Intermediate lesson 1, or a subagent, such as `test-gaps` from lesson 6. For a harder move, take a hook from lesson 5: its entry goes in the plugin's `hooks/hooks.json`, in the same shape as in a settings file, with its script inside the plugin, called through `${CLAUDE_PLUGIN_ROOT}` ([Add components to a plugin](https://code.claude.com/docs/en/plugins/components#hooks)).
+**Brief:** your team wants the same Claude Code kit in its other repositories. Start the move: take one piece of your Intermediate setup into `team-kit`, so everyone who clones this repository gets it from the plugin, and the same plugin can later serve the others. Take a skill, such as `tdd` from Intermediate lesson 1, or a subagent, such as `test-gaps` from lesson 6. For a harder move, take a hook from lesson 5: its entry goes in the plugin's `hooks/hooks.json`, in the same shape as in a settings file, with its script inside the plugin, called through `${CLAUDE_PLUGIN_ROOT}` ([Add components to a plugin](https://code.claude.com/docs/en/plugins/components#hooks)).
**Acceptance criteria:**
@@ -92,16 +94,15 @@ Because `team-kit` is listed by a relative path in a marketplace on your disk, C
You are done when all of these are true:
-- [ ] A committed team marketplace lists a plugin by a relative path, and the entry's name matches the `name` in the plugin's `plugin.json`.
+- [ ] A committed team marketplace lists a plugin by a relative path, and `.practice/a-6-validate.json` records a strict validation of that plugin that passed.
- [ ] The committed `.claude/settings.json` registers that marketplace by a relative path and turns the plugin on.
- [ ] A component you moved is in the plugin and gone from `.claude/`.
- [ ] A committed `.gitignore` keeps `.claude/settings.local.json` and `CLAUDE.local.md` out, and git tracks neither.
-- [ ] `.practice/a-6-validate.json` records a strict validation of the plugin directory that passed.
-- [ ] Self-check (not tested): in a new session in your repository, after trust, your moved component loads from `team-kit` with no install command.
+- [ ] Self-check (not tested): you can say why a teammate gets `team-kit` with no `claude plugin install`, when each teammate had to install `claude-code-setup` in [Intermediate lesson 8](../intermediate/08-plugins.md).
Run `npm run check -- a-6 --dir <your repo>` from your practice copy.
-If the first item fails, run `claude plugin validate ./team-marketplace` and compare the entry's `name` with the plugin's `plugin.json`; a folder still named `dot-claude-plugin/` isn't a marketplace until you rename it to `.claude-plugin/`. If the second fails, check that the key under `extraKnownMarketplaces` is the marketplace's `name`, that the `path` is relative, such as `./team-marketplace`, and that the plugin's value is `true`, not `"true"`. If the third fails, run `git status`: the original may still be committed under `.claude/`, or the plugin's copy may not be committed yet. If the fourth fails, run `git rm --cached` on the tracked file, add both lines to `.gitignore` and commit. If the fifth fails, run the strict validation again from the repository's root and save its report after it passes.
+If the first item fails, run `claude plugin validate ./team-marketplace` and compare the entry's `name` with the plugin's `plugin.json`; a folder still named `dot-claude-plugin/` isn't a marketplace until you rename it to `.claude-plugin/`. If the marketplace passes, run the strict validation of the plugin again from the repository's root and save its report after it passes. If the second fails, check that the key under `extraKnownMarketplaces` is the marketplace's `name`, that the `path` is relative, such as `./team-marketplace`, and that the plugin's value is `true`, not `"true"`. If the third fails, run `git status`: the original may still be committed under `.claude/`, or the plugin's copy may not be committed yet. If the fourth fails, run `git rm --cached` on the tracked file, add both lines to `.gitignore` and commit.
## Watch out
diff --git a/docs/advanced/07-bounded-runs.md b/docs/advanced/07-bounded-runs.md
index 2492ace..134573e 100644
--- a/docs/advanced/07-bounded-runs.md
+++ b/docs/advanced/07-bounded-runs.md
@@ -88,30 +88,18 @@ Work in your repository. The folders `src/` and `test/` and the command `npm tes
```
If git reports a path as ignored, `git check-ignore -v <path>` shows the rule that matches it; add the path with `git add -f`.
-4. See a limit stop a run. Give the same bounds a tiny spend limit:
-
- ```bash
- claude -p "Run npm test and summarize the result" \
- --setting-sources project --settings .claude/bounded-run.json \
- --permission-mode dontAsk --model sonnet \
- --max-budget-usd 0.01 --output-format json > .practice/a-7-capped.json
- echo "exit $?"
- jq '{subtype, total_cost_usd}' .practice/a-7-capped.json
- ```
-
- It prints a non-zero exit code, then `"subtype": "error_max_budget_usd"`: the run stopped at the limit, and the JSON still records it ([Handle the result](https://code.claude.com/docs/en/agent-sdk/agent-loop#handle-the-result)). `total_cost_usd` can be above the limit, because it includes the response that crossed it ([Track costs on failed conversations](https://code.claude.com/docs/en/agent-sdk/cost-tracking#track-costs-on-failed-conversations)).
-5. Estimate the cost on a slice, one small part of a bigger task:
+4. Estimate the cost on a slice, one small part of a bigger task:
```bash
scripts/bounded-run.sh "Use your Edit tool to add a test for one untested function in src/<file>. Then run npm test as a command on its own, and then commit the test." .practice/a-7-slice.json
```
- The summary shows `"subtype": "success"`, the turns used, `total_cost_usd`, and under `denied` each call your bounds refused, such as the `git commit`; your list will differ. HEAD is the same before and after, and `git status` lists the new test, uncommitted. Your output will differ. `total_cost_usd` is a client-side estimate, not your bill ([Track cost and usage](https://code.claude.com/docs/en/agent-sdk/cost-tracking#estimates-not-billing)); on a Claude plan, `/usage` in a session shows your plan's usage limits ([Commands](https://code.claude.com/docs/en/commands#all-commands)). To bound the whole task, scale the slice's figure up and set the spend limit above it, with room to spare.
-6. Be the review gate. Read every change with `git status` and `git diff`, the bounds file included, run `npm test` yourself, and commit only what you accept. For a second opinion, start `claude` and have a subagent review the diff in a fresh context and report gaps ([Add an adversarial review step](https://code.claude.com/docs/en/best-practices#add-an-adversarial-review-step)).
+ The summary shows `"subtype": "success"`, the turns used, `total_cost_usd`, and under `denied` each call your bounds refused, such as the `git commit`; your list will differ. HEAD is the same before and after, and `git status` lists the new test, uncommitted. Your output will differ. `total_cost_usd` is a client-side estimate, not your bill ([Track cost and usage](https://code.claude.com/docs/en/agent-sdk/cost-tracking#estimates-not-billing)); on a Claude plan, `/usage` in a session shows your plan's usage limits ([Commands](https://code.claude.com/docs/en/commands#all-commands)). To bound the whole task, scale the slice's figure up and set the spend limit above it, with room to spare. A run that reaches the limit stops with `"subtype": "error_max_budget_usd"` and a non-zero exit code ([Handle the result](https://code.claude.com/docs/en/agent-sdk/agent-loop#handle-the-result)), and its `total_cost_usd` can be above the limit, because it includes the response that crossed it ([Track costs on failed conversations](https://code.claude.com/docs/en/agent-sdk/cost-tracking#track-costs-on-failed-conversations)).
+5. Be the review gate. Read every change with `git status` and `git diff`, the bounds file included, and look for changes outside the task: a test weakened or deleted so the suite passes, an edited config or bounds file, a moved HEAD. Run `npm test` yourself, and commit only what you accept. For a second opinion, start `claude` and have a subagent review the diff in a fresh context and report gaps ([Add an adversarial review step](https://code.claude.com/docs/en/best-practices#add-an-adversarial-review-step)).
## Your turn
-Bound a real task in your repository that is bigger than one slice, such as tests for every untested function in one folder.
+Bound a real task from your backlog that is bigger than one slice, such as tests for every untested function in one folder, or a mechanical migration across one folder.
Acceptance criteria:
@@ -122,7 +110,7 @@ Acceptance criteria:
- The sandbox is on and strict, sends sandboxed commands through your rules, and the run refuses to start without it.
- There's a turn limit, and a spend limit above what your slice cost, scaled to the task.
- The script is executable, and the script and the bounds file are committed.
-- You run it, then read the diff and run the tests yourself before you commit any of it.
+- You run it, review the diff for changes outside the task, and run the tests yourself before you commit any of it.
## Check
@@ -133,12 +121,11 @@ You are done when all of these are true:
- [ ] Every allow rule names one command or one folder, and the deny rules stop `git commit` and `git push`.
- [ ] The settings file turns the sandbox on in strict mode without auto-allow, and makes the run refuse to start without it.
- [ ] `.practice/a-7-slice.json` holds a slice run whose cost is under your spend limit.
-- [ ] `.practice/a-7-capped.json` holds a run a limit stopped.
-- [ ] Self-check (not tested): you read the diff and ran the tests before you committed any of it.
+- [ ] Self-check (not tested): in the run's diff you looked for changes outside the task, such as a weakened or deleted test, an edited config or an unexpected commit, and you can name one you rejected or would have.
Run `npm run check -- a-7 --dir <your repo>` from your practice copy, or `npm run check -- a-7` in the copy itself. The check runs your committed script with a stand-in for `claude`, so it uses none of your usage.
-If the first item fails, make sure the committed script is executable (`git ls-files -s scripts/bounded-run.sh` starts with `100755`) and calls `claude` by name, not by a path or through `npx`, and doesn't set `PATH`: the check reads the committed script, so commit each fix. If an allow rule fails, narrow it to the one folder or command the task needs. If the sandbox item names a key, add it to the settings file: without `failIfUnavailable`, a run whose sandbox can't start runs unsandboxed ([`sandbox.enabled`](https://code.claude.com/docs/en/settings-reference#sandbox-enabled)). If the slice item fails, make sure your script sends only `claude`'s JSON output (stdout) to the result path, then run step 5 again; a slice that ended in `error_max_budget_usd` means your spend limit is below one slice, so raise it.
+If the first item fails, make sure the committed script is executable (`git ls-files -s scripts/bounded-run.sh` starts with `100755`) and calls `claude` by name, not by a path or through `npx`, and doesn't set `PATH`: the check reads the committed script, so commit each fix. If an allow rule fails, narrow it to the one folder or command the task needs. If the sandbox item names a key, add it to the settings file: without `failIfUnavailable`, a run whose sandbox can't start runs unsandboxed ([`sandbox.enabled`](https://code.claude.com/docs/en/settings-reference#sandbox-enabled)). If the slice item fails, make sure your script sends only `claude`'s JSON output (stdout) to the result path, then run step 4 again; a slice that ended in `error_max_budget_usd` means your spend limit is below one slice, so raise it.
## Watch out
diff --git a/docs/advanced/capstone.md b/docs/advanced/capstone.md
index a980e1b..6da8703 100644
--- a/docs/advanced/capstone.md
+++ b/docs/advanced/capstone.md
@@ -1,6 +1,6 @@
# Advanced capstone: add CI review your team can share
-<sub>**Advanced** · Capstone · 30 to 60 minutes, plus run time · Needs: the seven [Advanced lessons](README.md), or their skills · Verified against Claude Code v2.1.292 (stable) on 2026-10-15</sub>
+<sub>**Advanced** · Capstone · 30 to 60 minutes, plus run time · Needs: the seven [Advanced lessons](README.md), or their skills · Verified against Claude Code v2.1.292 (stable) on 2026-10-22</sub>
This task puts the whole Advanced level together, in a new copy of the practice template that you tear down at the end. It has no worked example: the brief says what the team needs, and you choose how to build it. The [Advanced Exit](README.md#by-the-end-of-this-level-you-can) is the list of what you can do by the end of this level. The check reads what you commit and two files you save under `.practice/`, and you tick the rest of the Exit yourself under [What the check can't see](#what-the-check-cant-see).
@@ -34,13 +34,13 @@ Build each part the way its lesson taught:
```
Then merge both branches into `main` with `git merge`, not `git merge --squash`, and remove both worktrees.
-2. **A review script** ([lesson 4](04-headless.md)): `scripts/review-staged.sh`, to lesson 4's criteria. It pipes the staged diff into one `claude -p` call with JSON output and `dontAsk` mode ([dontAsk mode](https://code.claude.com/docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode)), pre-approves only `Read`, `Grep` and `Glob`, and caps turns at 10 or fewer ([CLI flags](https://code.claude.com/docs/en/cli-reference#cli-flags)). After the merges, stage a one-line change in the main checkout, run the script once, read the review and commit the change:
+2. **A review script** ([lessons 4](04-headless.md) and [7](07-bounded-runs.md)): `scripts/review-staged.sh`, to lesson 4's criteria. It pipes the staged diff into one `claude -p` call with JSON output and `dontAsk` mode ([dontAsk mode](https://code.claude.com/docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode)), pre-approves only `Read`, `Grep` and `Glob`, and caps turns at 10 or fewer ([CLI flags](https://code.claude.com/docs/en/cli-reference#cli-flags)). As in lesson 7, it also caps spend with `--max-budget-usd`, written as a number in the script. Claude Code checks that cap against its client-side cost estimate, and spend can pass it, so leave headroom ([CLI flags](https://code.claude.com/docs/en/cli-reference#cli-flags)). After the merges, stage a one-line change in the main checkout, run the script once, read the review and commit the change:
```bash
mkdir -p .practice && scripts/review-staged.sh .practice/a-capstone-run.json
```
- The saved JSON's `total_cost_usd` estimates what one review spends. As with lesson 7's slice, it's a client-side estimate, not your bill ([Track cost and usage](https://code.claude.com/docs/en/agent-sdk/cost-tracking#estimates-not-billing)).
+ The saved JSON's `total_cost_usd` estimates what one review spent, and it must come in under your cap. As with lesson 7's slice, it's a client-side estimate, not your bill ([Track cost and usage](https://code.claude.com/docs/en/agent-sdk/cost-tracking#estimates-not-billing)).
3. **The team's plugin** ([lesson 6](06-share-your-setup.md)): a marketplace in `team-marketplace/` that lists one plugin by a relative path, with the plugin in its own folder under `team-marketplace/`, as in lesson 6's example kit, and at least one skill or agent in the plugin. The committed `.claude/settings.json` registers the marketplace by a relative path and turns the plugin on ([Require plugins per repository](https://code.claude.com/docs/en/plugins/org#require-plugins-per-repository)). Both validations pass: `claude plugin validate` on the marketplace, and on the plugin directory with `--strict` ([plugin validate](https://code.claude.com/docs/en/plugins/cli-reference#plugin-validate)). The kit is a good start; its [`settings.snippet.json`](../../examples/advanced/06-share-your-setup/settings.snippet.json) also denies reading `.env`, which this copy has no rule for yet. Test the plugin only after the merges: a relative path resolves against the repository's main checkout, even from a worktree ([Require plugins per repository](https://code.claude.com/docs/en/plugins/org#require-plugins-per-repository)), so the part-3 session can't load it yet.
4. **A saved dynamic workflow** ([lessons 2](02-orchestration-patterns.md) and [3](03-dynamic-workflows.md)): from a session in the main checkout, after the merges, ask for a workflow that reviews each file under `src/` and has a second agent check each finding. While it runs, `/workflows` shows each agent's token usage ([Cost](https://code.claude.com/docs/en/workflows#cost)). Save it to the project: a project save writes to the closest `.claude/workflows/` folder that already exists between the session's working directory and the repository root, or, if none exists yet, to `.claude/workflows/` at the repository root ([Save the workflow for reuse](https://code.claude.com/docs/en/workflows#save-the-workflow-for-reuse)). Commit it.
5. **CI review with limits** ([lessons 5](05-github-actions.md) and [7](07-bounded-runs.md)): `.github/workflows/claude-review.yml` runs on `pull_request` ([Events that trigger workflows](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request)) and uses `anthropics/claude-code-action` (Anthropic) with a `prompt` that asks for a review of the pull request's changes ([Action parameters](https://code.claude.com/docs/en/github-actions#action-parameters)). Hold it to lesson 5's limits:
@@ -66,31 +66,24 @@ Listings checked against the listing bar on 2026-10-09.
You are done when all of these are true:
-- [ ] A committed `.gitignore` ignores `.claude/worktrees/` and not the rest of `.claude/`.
-- [ ] `.practice/a-capstone-worktrees.txt` lists two worktrees under `.claude/worktrees/` whose commits split from each other, and both are merged into your branch.
-- [ ] A committed script in `.claude/workflows/` has a literal `export const meta`, with a `name` and a `description`, as its first statement, and starts subagents with `agent()`.
-- [ ] `scripts/review-staged.sh` is committed and executable.
-- [ ] Its `claude -p` call asks for JSON, runs in `dontAsk` mode, pre-approves only `Read`, `Grep` and `Glob`, caps turns at 10 or fewer, and has the prompt right after `-p`.
-- [ ] It pipes the staged diff in, saves the JSON where its argument says, prints the result, exits non-zero when the run fails, and doesn't call Claude when nothing is staged.
-- [ ] `.practice/a-capstone-run.json` holds a run that succeeded within your cap.
-- [ ] A committed workflow runs `anthropics/claude-code-action` on `pull_request`, pinned to a release tag or a full commit SHA, in automation mode, with its credential from a secret and none in the file, a read-only job token (no write access in `permissions` except `id-token: write`, and `github_token` set to the job's own token), `--max-turns` of 10 or fewer, an `--allowedTools` list without unrestricted Bash and a `timeout-minutes` of 30 or fewer.
-- [ ] No Claude API key or token is committed, at `HEAD` or in the commit the check reads your workflow from.
-- [ ] A committed team marketplace lists a plugin by a relative path, and the entry's name matches the `name` in the plugin's `plugin.json`.
-- [ ] The committed `.claude/settings.json` registers that marketplace by a relative path and turns the plugin on.
+- [ ] Lesson 1: `.practice/a-capstone-worktrees.txt` lists two worktrees under `.claude/worktrees/` whose commits split from each other, both are merged into your branch, and a committed `.gitignore` ignores `.claude/worktrees/` and not the rest of `.claude/`.
+- [ ] Lessons 2 and 3: a committed script in `.claude/workflows/` has a literal `export const meta`, with a `name` and a `description`, as its first statement, and starts subagents with `agent()`.
+- [ ] Lesson 4: `scripts/review-staged.sh` is committed, executable and meets lesson 4's criteria: one `claude -p` call, with the prompt right after `-p`, JSON output, `dontAsk` mode, only `Read`, `Grep` and `Glob`, and 10 turns or fewer; the staged diff piped in; the JSON saved where its argument says and the result printed; a non-zero exit when the run fails; and no call to Claude when nothing is staged.
+- [ ] Lesson 5: a committed workflow runs `anthropics/claude-code-action` on `pull_request`, pinned to a release tag or a full commit SHA, in automation mode, with its credential from a secret and none in the file, a read-only job token (no write access in `permissions` except `id-token: write`, and `github_token` set to the job's own token), `--max-turns` of 10 or fewer, an `--allowedTools` list without unrestricted Bash and a `timeout-minutes` of 30 or fewer; and no Claude API key or token is committed, at `HEAD` or in the commit the check reads that workflow from.
+- [ ] Lesson 6: a committed team marketplace lists a plugin by a relative path, under the `name` in the plugin's `plugin.json`, and the committed `.claude/settings.json` registers that marketplace by a relative path and turns the plugin on.
+- [ ] Lesson 7: the review script's `claude -p` call caps spend with `--max-budget-usd`, and `.practice/a-capstone-run.json` holds a real run that succeeded within your turn cap and cost less than your spend cap.
- [ ] `npm test` passes, and `git status --porcelain` prints nothing.
-Run `npm run check -- a-capstone` in this copy. Each item that fails prints what to fix. The check runs your script with a stand-in for `claude`, so it uses none of your usage, and it reads the workflow from your history, so it passes before and after the teardown.
+Run `npm run check -- a-capstone` in this copy. It checks each box's parts one by one, and each part that fails prints what to fix. The check runs your script with a stand-in for `claude`, so it uses none of your usage, and it reads the workflow from your history, so it passes before and after the teardown.
## What the check can't see
The check doesn't look at these parts of the Advanced Exit. Tick them yourself, honestly:
-- [ ] I ran both worktree sessions at the same time, and neither saw the other's uncommitted edits.
-- [ ] I can take the per-file review, with a second agent checking each finding, through lesson 2's questions and say why they end at a dynamic workflow, not subagents in one conversation.
+- [ ] My CI review and my saved workflow both review code, and I can say which one I'd run on every pull request and which I'd keep for a sweep before a release, and why, by what each costs and how deep it goes.
- [ ] I can say when an unattended run needs the sandbox from [lesson 7](07-bounded-runs.md), and whether my review script and CI workflow need it.
-- [ ] I saw the CI run on my pull request and read Claude's review on its summary page before I merged.
-- [ ] A new session in the main checkout, after the merges, loaded my team plugin with no install command.
-- [ ] Before I turned CI on, I used the local run's `total_cost_usd`, as lesson 7 used its slice, to estimate what one review in CI spends, and saw in `/workflows` how many tokens the per-file review used.
+- [ ] Before I merged, I acted on at least one point in Claude's review on the run's summary page, or dismissed it with a reason.
+- [ ] Before I turned CI on, I multiplied the local run's `total_cost_usd` by the pull requests my team opens in a week, to estimate what CI review spends, and I saw in `/workflows` how many tokens the per-file review used.
When every box on this page is ticked, you've shown the Advanced Exit and finished the last of the guide's three levels. One step remains: the teardown below.