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: add the Advanced Electives and Beyond this guide (#101)

Wesam Abousaidb79fe10e675e
diff --git a/README.md b/README.md
index 7c989b1..fd5f3e6 100644
--- a/README.md
+++ b/README.md
@@ -48,14 +48,14 @@ macOS, Linux and WSL. For Windows and other installers, see the [official setup
**Intermediate Electives:** [Skill patterns](docs/intermediate/electives/skill-patterns.md) · [Claude in Chrome](docs/intermediate/electives/claude-in-chrome.md) · [The status line](docs/intermediate/electives/status-line.md) · [Fast mode](docs/intermediate/electives/fast-mode.md)
-**Advanced** (being rebuilt): [Level index](docs/advanced/README.md) · [Parallel sessions with worktrees](docs/advanced/01-parallel-sessions.md) · [Choose an orchestration pattern](docs/advanced/02-orchestration-patterns.md) · [Run and save a dynamic workflow](docs/advanced/03-dynamic-workflows.md) · [Script Claude Code with `claude -p`](docs/advanced/04-headless.md) · [GitHub Actions](docs/advanced/05-github-actions.md) · [Share your setup with a team](docs/advanced/06-share-your-setup.md) · [Put bounds on autonomous runs](docs/advanced/07-bounded-runs.md) · [Capstone](docs/advanced/capstone.md)
+**Advanced** (being rebuilt): [Level index](docs/advanced/README.md) · [Parallel sessions with worktrees](docs/advanced/01-parallel-sessions.md) · [Choose an orchestration pattern](docs/advanced/02-orchestration-patterns.md) · [Run and save a dynamic workflow](docs/advanced/03-dynamic-workflows.md) · [Script Claude Code with `claude -p`](docs/advanced/04-headless.md) · [GitHub Actions](docs/advanced/05-github-actions.md) · [Share your setup with a team](docs/advanced/06-share-your-setup.md) · [Put bounds on autonomous runs](docs/advanced/07-bounded-runs.md) · [Capstone](docs/advanced/capstone.md) · [Beyond this guide](docs/advanced/beyond-this-guide.md)
+
+**Advanced Electives:** [Agent teams](docs/advanced/electives/agent-teams.md) · [Agent view](docs/advanced/electives/agent-view.md) · [`/goal`, `/loop` and routines](docs/advanced/electives/goal-loop-routines.md) · [Testing and publishing a plugin](docs/advanced/electives/publish-a-plugin.md) · [Dev containers](docs/advanced/electives/dev-containers.md)
**Topics:** [All topics](docs/topics/README.md) · [Permissions and safety](docs/topics/permissions-and-safety.md) · [Memory and context](docs/topics/memory-and-context.md) · [Models, effort and cost](docs/topics/models-effort-and-cost.md) · [Skills](docs/topics/skills.md) · [Hooks](docs/topics/hooks.md) · [Subagents and parallel work](docs/topics/subagents-and-parallel-work.md) · [MCP](docs/topics/mcp.md) · [Plugins](docs/topics/plugins.md) · [Automation](docs/topics/automation.md)
**Reference:** [Reference index](docs/reference/README.md) · [Models and effort](docs/reference/models.md) · [Commands by level](docs/reference/commands.md) · [Feature map](docs/reference/feature-map.md) · [Further learning](docs/reference/further-reading.md) · [Glossary](docs/reference/glossary.md) · [Changelog](docs/reference/changelog.md)
-**From the previous edition, not yet re-verified:** [Agent teams](docs/agent-teams.md)
-
**Examples:** [How to use the examples](examples/README.md)
</details>
@@ -87,7 +87,7 @@ The previous edition's README sections moved. If a link brought you here, find i
- <a id="2-general-purpose-subagents--when-one-claude-isnt-enough"></a><a id="3-specialized-subagents--drop-in-role-prompts"></a>Moved to [Delegate to a custom subagent](docs/intermediate/06-subagents.md). The drop-in role prompts were removed in edition v2026.10: see the [CHANGELOG](CHANGELOG.md#removed-listings).
- <a id="running-agents-in-parallel"></a><a id="subagents--running-agents-in-parallel"></a><a id="orchestrating-specialists-from-the-main-session"></a>Moved to [Choose an orchestration pattern](docs/advanced/02-orchestration-patterns.md).
- <a id="1-git-worktrees--parallel-branches-parallel-sessions"></a>Moved to [Parallel sessions with worktrees](docs/advanced/01-parallel-sessions.md).
-- <a id="agent-teams-experimental---2026"></a><a id="agent-teams-experimental"></a><a id="enable-it"></a><a id="the-example-that-justifies-the-cost"></a><a id="staff-a-team-with-the-role-prompts-you-already-have"></a><a id="three-things-that-catch-people-out"></a><a id="monitoring-and-the-naming-trap"></a><a id="best-practices"></a>Moved to [Agent teams (previous edition)](docs/agent-teams.md).
+- <a id="agent-teams-experimental---2026"></a><a id="agent-teams-experimental"></a><a id="enable-it"></a><a id="the-example-that-justifies-the-cost"></a><a id="staff-a-team-with-the-role-prompts-you-already-have"></a><a id="three-things-that-catch-people-out"></a><a id="monitoring-and-the-naming-trap"></a><a id="best-practices"></a>Moved to [Agent teams](docs/advanced/electives/agent-teams.md).
- <a id="dynamic-workflows"></a><a id="try-it-in-2-minutes--no-script-required"></a><a id="starting-your-own"></a>Moved to [Run and save a dynamic workflow](docs/advanced/03-dynamic-workflows.md).
- <a id="beyond-one-terminal--the-2026-automation-surface"></a>Moved to [Feature map](docs/reference/feature-map.md).
- <a id="model-context-protocol-mcp"></a><a id="the-nm-problem-mcp-solves"></a><a id="three-pillars"></a><a id="the-mcp-registry--self-discovering-agents"></a><a id="the-mcp-ecosystem-today"></a>Moved to [Connect a tool with MCP](docs/intermediate/07-mcp.md).
diff --git a/docs/advanced/02-orchestration-patterns.md b/docs/advanced/02-orchestration-patterns.md
index e863998..388b3f3 100644
--- a/docs/advanced/02-orchestration-patterns.md
+++ b/docs/advanced/02-orchestration-patterns.md
@@ -32,7 +32,7 @@ flowchart TD
```
> [!NOTE]
-> "Agent teams are experimental and disabled by default." ([Orchestrate teams of Claude Code sessions](https://code.claude.com/docs/en/agent-teams)) This lesson names them as one option and doesn't run one.
+> "Agent teams are experimental and disabled by default." ([Orchestrate teams of Claude Code sessions](https://code.claude.com/docs/en/agent-teams)) This lesson names them as one option and doesn't run one; the [Agent teams](electives/agent-teams.md) Elective does.
## Worked example
diff --git a/docs/advanced/README.md b/docs/advanced/README.md
index 9d4dcd7..3b4ed18 100644
--- a/docs/advanced/README.md
+++ b/docs/advanced/README.md
@@ -53,17 +53,21 @@ Each lesson takes 10 to 20 minutes, plus the time an agent run takes.
Optional lessons beside the core path:
-- Agent teams
-- Agent view
-- `/goal`, `/loop` and routines
-- Testing and publishing a plugin
-- Dev containers
+- [Agent teams](electives/agent-teams.md): a lead and teammates that message each other, staffed from your own subagent definitions.
+- [Agent view](electives/agent-view.md): hand tasks to background sessions from one screen, and step in only when one needs you.
+- [`/goal`, `/loop` and routines](electives/goal-loop-routines.md): keep Claude working toward a condition, on an interval, or on a schedule in the cloud.
+- [Testing and publishing a plugin](electives/publish-a-plugin.md): check a plugin's files and behavior, then publish it in your own marketplace.
+- [Dev containers](electives/dev-containers.md): run Claude Code in a container with a firewall, keep your sign-in, and let it work unattended.
## Official companions
- [Run agents in parallel](https://code.claude.com/docs/en/agents): Anthropic's comparison of the ways Claude Code takes on several tasks at once.
- [The AI-native SDLC playbook](https://academy.claude.com/courses/ai-native-sdlc-playbook): Claude Academy's course on reshaping a team's development lifecycle around AI.
+## Beyond this guide
+
+[Beyond this guide](beyond-this-guide.md): building your own agents and MCP servers, and running and rolling out Claude Code for an organization.
+
---
<sub>Sources: [Run agents in parallel](https://code.claude.com/docs/en/agents) · [The AI-native SDLC playbook](https://academy.claude.com/courses/ai-native-sdlc-playbook)</sub>
diff --git a/docs/advanced/beyond-this-guide.md b/docs/advanced/beyond-this-guide.md
new file mode 100644
index 0000000..65a1008
--- /dev/null
+++ b/docs/advanced/beyond-this-guide.md
@@ -0,0 +1,60 @@
+# Beyond this guide
+
+<sub>**Advanced** · Verified against Claude Code v2.1.285 (stable) on 2026-10-09</sub>
+
+Where to go once you finish Advanced. The guide teaches one developer's use of Claude Code, alone or with a team. Building your own agents and MCP servers, running Claude Code for a whole organization, and getting a team to adopt it are separate jobs with their own official docs, so this page links them and doesn't teach them.
+
+Every item is published by Anthropic, except the MCP project's pages on modelcontextprotocol.io.
+
+Listings checked against the listing bar on 2026-10-09.
+
+## Build your own agents
+
+To build Claude Code's agent loop into your own application:
+
+- [Agent SDK overview](https://code.claude.com/docs/en/agent-sdk/overview): the tools, agent loop and context management that power Claude Code, as a Python or TypeScript library. Its first table compares it with other Claude tools.
+- [Agent SDK quickstart](https://code.claude.com/docs/en/agent-sdk/quickstart): build an agent that finds and fixes bugs in existing code.
+- [Intro to Claude](https://platform.claude.com/docs/en/intro): the Claude API, with a path from a first API call to a working integration.
+
+To drive the same agent loop from a language other than Python or TypeScript, the docs suggest running the CLI as a subprocess with `-p` and `--output-format json` ([Agent SDK overview](https://code.claude.com/docs/en/agent-sdk/overview#compare-the-agent-sdk-to-other-claude-tools)), as the script in [Script Claude Code with `claude -p`](04-headless.md) does.
+
+A product or service you build on the Agent SDK should use API key authentication through the Claude Console or a supported cloud provider ([Legal and compliance](https://code.claude.com/docs/en/legal-and-compliance#authentication-and-credential-use)). Unless previously approved, Anthropic doesn't allow third-party developers to offer claude.ai login for their products ([Agent SDK overview](https://code.claude.com/docs/en/agent-sdk/overview#get-started)).
+
+While you write code that calls the Claude API, the bundled `/claude-api` skill loads Claude API reference material for your project's language, and Claude also loads it on its own when your code imports `anthropic` or `@anthropic-ai/sdk` ([Skills](https://code.claude.com/docs/en/skills#work-on-claude-api-projects)).
+
+## Build MCP servers
+
+[Connect a tool with MCP](../intermediate/07-mcp.md) used a server someone else wrote. To write your own:
+
+- [Find and build MCP servers](https://code.claude.com/docs/en/mcp#find-and-build-mcp-servers): where the Claude Code docs point server builders, for protocol basics and for connector authentication, testing and submission to the Anthropic Directory.
+- [Build an MCP server](https://modelcontextprotocol.io/docs/develop/build-server) (Vendor: the MCP project): the MCP project's own tutorial, and its [SDKs](https://modelcontextprotocol.io/docs/sdk) for building servers and clients.
+- [Introduction to Model Context Protocol](https://academy.claude.com/courses/introduction-to-model-context-protocol): Claude Academy's course on building servers and clients from scratch with the Python SDK.
+- [Model Context Protocol: Advanced topics](https://academy.claude.com/courses/model-context-protocol-advanced-topics): Claude Academy's course on sampling, notifications and roots.
+
+## Run Claude Code for an organization
+
+[Share your setup with a team](06-share-your-setup.md) commits a setup to the repository your team works in. An organization also sets policy, sign-in, network access and reporting for every machine:
+
+- [Set up Claude Code for your organization](https://code.claude.com/docs/en/admin-setup): Anthropic's decision map for administrators, and the place to start. It covers API providers, managed settings, policy enforcement, usage monitoring and data handling, and says where SSO and seat assignment are configured.
+- [Deploy managed settings](https://code.claude.com/docs/en/managed-settings), for delivering your organization's settings to every developer's machine on each operating system, and [Configure server-managed settings](https://code.claude.com/docs/en/server-managed-settings), for delivering them from the claude.ai console without device management.
+- [Authentication](https://code.claude.com/docs/en/authentication#set-up-team-authentication), for the ways a team or organization can configure access to Claude Code, and the [Enterprise deployment overview](https://code.claude.com/docs/en/third-party-integrations), which helps you choose between deploying through Anthropic and through a cloud provider.
+- [Enterprise network configuration](https://code.claude.com/docs/en/network-config) for proxy servers, custom certificate authorities and mTLS, and [Run Claude Code through a gateway](https://code.claude.com/docs/en/gateways) for central credentials, usage tracking and cost controls.
+- [Monitoring](https://code.claude.com/docs/en/monitoring-usage), for exporting usage, cost and tool activity through OpenTelemetry, and [Track team usage with analytics](https://code.claude.com/docs/en/analytics), the usage and adoption dashboard.
+- [Data usage](https://code.claude.com/docs/en/data-usage): Anthropic's training and retention policies, and where a session's data goes.
+
+If your organization deploys managed settings, a setting from a lesson may not apply on a work machine, or on any machine where you sign in with a work account: no user, project, local or `--settings` value overrides them, apart from a few security-sensitive exceptions where a stricter value from a lower level still counts ([Deploy managed settings](https://code.claude.com/docs/en/managed-settings), [Configure server-managed settings](https://code.claude.com/docs/en/server-managed-settings#platform-availability)). When developers connect through a gateway with a gateway credential, usage is billed to the organization's provider account at API rates, and their claude.ai subscriptions aren't used or charged ([Subscriptions and gateways](https://code.claude.com/docs/en/gateways#subscriptions-and-gateways)).
+
+## Roll it out to a team
+
+Once the setup is in place, these help people adopt it:
+
+- [Champion kit](https://code.claude.com/docs/en/champion-kit): for an engineer already using Claude Code who wants to help their team adopt it.
+- [Communications kit](https://code.claude.com/docs/en/communications-kit): launch announcements, drip-campaign messages and FAQ answers for the administrators and engineering leads who roll Claude Code out.
+- [The AI-native SDLC playbook](https://academy.claude.com/courses/ai-native-sdlc-playbook): Claude Academy's course for engineering, platform and security leads whose organization already uses Claude Code.
+- [Running an AI-native engineering org](https://claude.com/resources/articles/running-an-ai-native-engineering-org): how the Claude Code team's processes and structure changed once agentic coding became its default way of working.
+
+---
+
+<sub>Sources: the pages linked above, each checked on 2026-10-09.</sub>
+
+<sub>Up: [Advanced](README.md)</sub>
diff --git a/docs/advanced/capstone.md b/docs/advanced/capstone.md
index 05a29b6..55bde6f 100644
--- a/docs/advanced/capstone.md
+++ b/docs/advanced/capstone.md
@@ -113,4 +113,4 @@ Run `npm run check -- a-capstone` once more: it still passes.
<sub>Sources: [Run parallel sessions with worktrees](https://code.claude.com/docs/en/worktrees) · [Orchestrate subagents at scale with dynamic workflows](https://code.claude.com/docs/en/workflows) · [Track cost and usage](https://code.claude.com/docs/en/agent-sdk/cost-tracking) · [Choose a permission mode](https://code.claude.com/docs/en/permission-modes) · [CLI reference](https://code.claude.com/docs/en/cli-reference) · [Model configuration](https://code.claude.com/docs/en/model-config) · [Configure permissions](https://code.claude.com/docs/en/permissions) · [Plugin commands reference](https://code.claude.com/docs/en/plugins/cli-reference) · [Manage Claude Code plugins for your organization](https://code.claude.com/docs/en/plugins/org) · [Claude Code GitHub Actions](https://code.claude.com/docs/en/github-actions) · [Authentication](https://code.claude.com/docs/en/authentication) · claude-code-action at v1.0.237: [action.yml](https://github.com/anthropics/claude-code-action/blob/v1.0.237/action.yml) · GitHub: [Events that trigger workflows](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows), [Workflow syntax](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax), [Workflow commands](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands) · GitHub CLI manual: [gh repo create](https://cli.github.com/manual/gh_repo_create), [gh secret set](https://cli.github.com/manual/gh_secret_set), [gh secret delete](https://cli.github.com/manual/gh_secret_delete), [gh secret list](https://cli.github.com/manual/gh_secret_list) · the [Advanced lessons](README.md), which cite the official pages for each step.</sub>
-<sub>← [Put bounds on autonomous runs](07-bounded-runs.md) · [Advanced index](README.md) · [Stuck on this capstone?](https://github.com/wesammustafa/Claude-Code-Everything-You-Need-to-Know/issues/new?template=lesson-feedback.yml&lesson=a-capstone)</sub>
+<sub>← [Put bounds on autonomous runs](07-bounded-runs.md) · [Advanced index](README.md) · [Beyond this guide](beyond-this-guide.md) → · [Stuck on this capstone?](https://github.com/wesammustafa/Claude-Code-Everything-You-Need-to-Know/issues/new?template=lesson-feedback.yml&lesson=a-capstone)</sub>
diff --git a/docs/advanced/electives/agent-teams.md b/docs/advanced/electives/agent-teams.md
new file mode 100644
index 0000000..b7d6811
--- /dev/null
+++ b/docs/advanced/electives/agent-teams.md
@@ -0,0 +1,141 @@
+# Agent teams
+
+<sub>**Advanced** · Elective · about 20 minutes, plus run time · Needs: [Choose an orchestration pattern](../02-orchestration-patterns.md) · Verified against Claude Code v2.1.285 (stable) on 2026-10-09</sub>
+
+> [!NOTE]
+> "Agent teams are experimental and disabled by default." ([Orchestrate teams of Claude Code sessions](https://code.claude.com/docs/en/agent-teams))
+
+## Goal
+
+By the end of this Elective you can staff an agent team from your own subagent definitions, show that a team formed, and shut its teammates down by name.
+
+## You need
+
+- [Choose an orchestration pattern](../02-orchestration-patterns.md), and the subagent definitions you wrote in [Delegate to a custom subagent](../../intermediate/06-subagents.md).
+- One of your own repositories, with its `.practice/` folder set up as [Beginner lesson 1](../../beginner/01-install-and-look-around.md#you-need) describes.
+- macOS, Linux or WSL 2, and `jq`: the hooks that log the team are shell commands that use it.
+- An interactive session: in a `-p` run, Claude doesn't spawn teammates ([Enable agent teams](https://code.claude.com/docs/en/agent-teams#enable-agent-teams)). The default in-process display, where teammates run inside your terminal, works in any terminal ([Choose a display mode](https://code.claude.com/docs/en/agent-teams#choose-a-display-mode)).
+- Usage: heavy. Each teammate is a separate Claude instance with its own context window, and token usage scales with the number of active teammates ([Token usage](https://code.claude.com/docs/en/agent-teams#token-usage)). Cheap variant: change one small file in the Worked example, run two teammates in Your turn, and shut the teammates down as soon as they report.
+
+## The idea
+
+An agent team is several Claude Code sessions working together. Your session is the lead: it spawns teammates, each in its own context window. Teammates message each other directly, and you can message any of them, while subagents mainly return a result to the caller ([Compare with subagents](https://code.claude.com/docs/en/agent-teams#compare-with-subagents)).
+
+A teammate loads your CLAUDE.md, MCP servers and skills plus the lead's spawn prompt, but not the lead's conversation, so the prompt carries the task ([Context and communication](https://code.claude.com/docs/en/agent-teams#context-and-communication)). Name a subagent definition in it, and the teammate runs with that definition's `tools` and instructions, and its `model` unless the spawn prompt names one; an in-process teammate also gets `SendMessage`, so a read-only one can still reach the others ([Use subagent definitions for teammates](https://code.claude.com/docs/en/agent-teams#use-subagent-definitions-for-teammates)).
+
+Teams "use significantly more tokens than a single session" ([Token usage](https://code.claude.com/docs/en/agent-teams#token-usage)), and teammates share your working tree ([Choose an approach](https://code.claude.com/docs/en/agents#choose-an-approach)). Use them where independent views pay off: a review through distinct lenses, or rival hypotheses argued out.
+
+## Worked example
+
+1. In your repository, download the two read-only reviewers from this guide's [agent teams example](../../../examples/advanced/electives/agent-teams/README.md). Read them before you use them:
+
+ ```bash
+ mkdir -p .claude/agents
+ for a in security-reviewer test-reviewer; do
+ curl -fsSL "https://raw.githubusercontent.com/wesammustafa/Claude-Code-Everything-You-Need-to-Know/main/examples/advanced/electives/agent-teams/dot-claude/agents/$a.md" -o ".claude/agents/$a.md"
+ done
+ grep -H '^tools:' .claude/agents/security-reviewer.md .claude/agents/test-reviewer.md
+ ```
+
+ Each line ends in `tools: Read, Grep, Glob`: the reviewers can read files, but can't edit them or run commands, `git` included. Grep and Glob, the search tools, are absent by default on macOS, Linux and WSL; a subagent that lists them and leaves out Bash gets them back ([Glob tool behavior](https://code.claude.com/docs/en/tools-reference#glob-tool-behavior)). Both set `model: sonnet`. If a session is already open here and `.claude/agents/` is new, restart it: Claude Code watches only the agent folders that existed when the session started ([Write subagent files](https://code.claude.com/docs/en/sub-agents#write-subagent-files)).
+2. Use a change you're working on, or make a throwaway one: change one tracked source file the way a real change would, for example a function that reads user input, with no new test. Leave it uncommitted. The reviewers can't run `git diff`, so save the change where they can read it:
+
+ ```bash
+ git diff > .practice/a-teams.diff
+ ```
+
+3. Save this as `.practice/a-teams.json`:
+
+ ```json
+ {
+ "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" },
+ "teammateMode": "in-process",
+ "hooks": {
+ "TeammateIdle": [
+ { "hooks": [ { "type": "command", "command": "jq -r '.teammate_name' >> \"$CLAUDE_PROJECT_DIR/.practice/a-teams-teammates.txt\"" } ] }
+ ]
+ }
+ }
+ ```
+
+ It turns agent teams on only for the sessions you start with it ([Enable agent teams](https://code.claude.com/docs/en/agent-teams#enable-agent-teams), [Claude spawns teammates instead of subagents](https://code.claude.com/docs/en/agent-teams#claude-spawns-teammates-instead-of-subagents)), and `teammateMode` keeps their teammates in the in-process display that these steps describe ([`teammateMode`](https://code.claude.com/docs/en/settings-reference#teammatemode)). Its hook, [`TeammateIdle`](https://code.claude.com/docs/en/hooks#teammateidle), writes each teammate's name to `.practice/a-teams-teammates.txt` when it is about to go idle.
+4. Start the lead with the file:
+
+ ```bash
+ CLAUDE_CODE_ENABLE_TODO_TOOLS=1 claude --settings .practice/a-teams.json
+ ```
+
+ `--settings` applies the file's keys on top of your settings, for this session only ([CLI reference](https://code.claude.com/docs/en/cli-reference#cli-flags)). The variable gives the session the Task tools on every model; without it, Claude Code provides them only on the older models that [Task tool availability](https://code.claude.com/docs/en/tools-reference#task-tool-availability) lists, and teammates coordinate by message instead of a shared task list. Run `/context`: its custom subagents include `security-reviewer` and `test-reviewer` ([See what loaded into context](https://code.claude.com/docs/en/debug-your-config#see-what-loaded-into-context)).
+5. Ask for the team. Give each teammate one lens, as the docs' [parallel code review](https://code.claude.com/docs/en/agent-teams#run-a-parallel-code-review) does, plus a name and an [agent type](https://code.claude.com/docs/en/agent-teams#use-subagent-definitions-for-teammates):
+
+ ```text
+ Create an agent team to review the change saved in .practice/a-teams.diff and the files it touches.
+ Spawn two teammates: one named security, using the security-reviewer agent type, and one named
+ tests, using the test-reviewer agent type. When both have reported, write one combined report
+ to .practice/a-teams-review.md.
+ ```
+
+ Claude Code launches teammates without asking you to confirm ([How Claude starts agent teams](https://code.claude.com/docs/en/agent-teams#how-claude-starts-agent-teams)). A row for each appears in the agent panel below the prompt. Subagents show in the same panel, so the panel alone doesn't prove a team formed ([Start your first agent team](https://code.claude.com/docs/en/agent-teams#start-your-first-agent-team)): step 7's log does. `Ctrl+T` toggles the task list ([Talk to teammates directly](https://code.claude.com/docs/en/agent-teams#talk-to-teammates-directly)). The prompt names no model, so each teammate runs on its definition's `model`, unless you've set `CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1` ([Specify teammates and models](https://code.claude.com/docs/en/agent-teams#specify-teammates-and-models)). When both have reported, the lead writes the combined report (your wording will differ); approve the write if Claude Code asks.
+6. Shut the teammates down by name:
+
+ ```text
+ Ask the security and tests teammates to shut down.
+ ```
+
+ Each teammate approves and exits, or rejects the request with an explanation ([Shut down teammates](https://code.claude.com/docs/en/agent-teams#shut-down-teammates)); if one rejects, read its reason and ask again. A teammate whose row has disappeared from the panel is hidden, not stopped, so name it in the request too ([Start your first agent team](https://code.claude.com/docs/en/agent-teams#start-your-first-agent-team)). Then exit the session. Claude Code removes the team's config when the session ends and keeps its task list for resumed sessions, so there's no separate cleanup step ([Architecture](https://code.claude.com/docs/en/agent-teams#architecture)).
+7. Read the log:
+
+ ```bash
+ sort -u .practice/a-teams-teammates.txt
+ ```
+
+ It lists `security` and `tests`, so a team formed.
+
+## Your turn
+
+Debug with competing hypotheses, as the docs' [Investigate with competing hypotheses](https://code.claude.com/docs/en/agent-teams#investigate-with-competing-hypotheses) example does. Pick a real bug or puzzling behavior in your repository whose cause you don't know and that reading the code could explain. Write a read-only investigator definition, for example by copying `test-reviewer.md` to `.claude/agents/hypothesis-tester.md` and rewriting it. Start a new session the same way, so the lead starts clean, and have it spawn three teammates from your definition, each owning one hypothesis and messaging the others to challenge their theories. Cheap variant: two teammates.
+
+Acceptance criteria:
+
+- Your definition has its own `name` and `description`, `model: sonnet`, and a single-line `tools:` that names only `Read`, `Grep` and `Glob`, as the two reviewers' lines do and as the docs' read-only example does ([Quickstart: create your first subagent](https://code.claude.com/docs/en/sub-agents#quickstart-create-your-first-subagent)). A definition with no `tools` line inherits every tool available to subagents ([Frontmatter reference](https://code.claude.com/docs/en/sub-agents#supported-frontmatter-fields)).
+- Every teammate runs from your definition, under a name you chose in the spawn prompt.
+- The lead saves the explanation that survived, and the theories it ruled out, to `.practice/a-teams-debate.md`.
+- No tracked file changes beyond your change from the Worked example.
+- You ask every teammate, by name, to shut down.
+
+## Check
+
+You are done when all of these are true:
+
+- [ ] Every definition a teammate used is read-only. This prints nothing when each has a single-line `tools:` that names only `Read`, `Grep` and `Glob` (use your definition's file name):
+
+ ```bash
+ for f in .claude/agents/security-reviewer.md .claude/agents/test-reviewer.md .claude/agents/hypothesis-tester.md; do
+ grep -qxE 'tools: *(Read|Grep|Glob)( *, *(Read|Grep|Glob))* *' "$f" || echo "$f: tools: names more than Read, Grep and Glob, or is missing"
+ done
+ ```
+
+- [ ] A team formed, not only subagents: `sort -u .practice/a-teams-teammates.txt` lists every teammate name you chose.
+- [ ] Both results are saved: `ls .practice/a-teams-review.md .practice/a-teams-debate.md` lists both files.
+- [ ] The teams changed no tracked file: `git diff | diff - .practice/a-teams.diff` prints nothing.
+- [ ] Self-check (not tested): the debate report says which theories the teammates ruled out and why, and you asked every teammate, by name, to shut down.
+
+If the teammates log is missing, no team formed: start the lead with the step 4 command and ask explicitly for an agent team. If `git diff` differs from your saved change, the lead or a teammate edited a tracked file: read the difference, undo that edit, and check each definition's `tools:` line. When you're done, keep the change, or undo a throwaway one with `git restore <file>`.
+
+## Watch out
+
+- Teammates start with your permission mode, except `dontAsk`, and if you run with `--dangerously-skip-permissions`, every teammate does too. Their permission prompts appear in your session for you to answer ([Permissions](https://code.claude.com/docs/en/agent-teams#permissions)). While teams are on, a subagent that Claude names launches as a teammate, so a team can form when you didn't ask for one: this Elective turns teams on only for sessions started with `--settings`, not in your user or project settings ([Enable agent teams](https://code.claude.com/docs/en/agent-teams#enable-agent-teams)).
+- Each active teammate keeps using tokens until it exits or the session ends. Keep teams small, put Sonnet in the definitions, keep spawn prompts focused, and shut teammates down when their work is done ([Agent team token costs](https://code.claude.com/docs/en/costs#agent-team-token-costs)).
+- Two teammates editing the same file overwrite each other's work, so give each its own files ([Avoid file conflicts](https://code.claude.com/docs/en/agent-teams#avoid-file-conflicts)). And `/resume` and `/rewind` don't bring in-process teammates back: after a resume, ask the lead to spawn new ones ([Limitations](https://code.claude.com/docs/en/agent-teams#limitations)).
+
+## Go further
+
+- [Enforce quality gates with hooks](https://code.claude.com/docs/en/agent-teams#enforce-quality-gates-with-hooks): `TeammateIdle`, `TaskCreated` and `TaskCompleted` hooks that exit with code 2 keep a teammate working, or stop a task from being created or completed, until your rule passes.
+- [Have teammates plan before implementing](https://code.claude.com/docs/en/agent-teams#have-teammates-plan-before-implementing): read-only planning for teams that change code. Claude Code approves each plan as it arrives, without the lead reviewing it; the teammate's edits and commands still go through your permission prompts.
+- [Choose a display mode](https://code.claude.com/docs/en/agent-teams#choose-a-display-mode): each teammate in its own tmux or iTerm2 pane, in place of the in-process panel.
+
+---
+
+<sub>Sources: [Orchestrate teams of Claude Code sessions](https://code.claude.com/docs/en/agent-teams) · [Run agents in parallel](https://code.claude.com/docs/en/agents) · [Create custom subagents](https://code.claude.com/docs/en/sub-agents) · [Hooks reference](https://code.claude.com/docs/en/hooks) · [Tools reference](https://code.claude.com/docs/en/tools-reference) · [All settings](https://code.claude.com/docs/en/settings-reference) · [CLI reference](https://code.claude.com/docs/en/cli-reference) · [Debug your configuration](https://code.claude.com/docs/en/debug-your-config) · [Manage costs effectively](https://code.claude.com/docs/en/costs)</sub>
+
+<sub>Back to the [Advanced index](../README.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-agent-teams)</sub>
diff --git a/docs/advanced/electives/agent-view.md b/docs/advanced/electives/agent-view.md
new file mode 100644
index 0000000..987a505
--- /dev/null
+++ b/docs/advanced/electives/agent-view.md
@@ -0,0 +1,134 @@
+# Agent view
+
+<sub>**Advanced** · Elective · about 20 minutes, plus run time · Needs: [Parallel sessions with worktrees](../01-parallel-sessions.md) · Verified against Claude Code v2.1.285 (stable) on 2026-10-09</sub>
+
+> [!NOTE]
+> "Agent view is in research preview. The interface and keyboard shortcuts may change as the feature evolves." ([Manage multiple agents with agent view](https://code.claude.com/docs/en/agent-view))
+
+## Goal
+
+By the end of this Elective you can hand several independent tasks to background sessions from one screen, step in only when one needs you, and merge or discard what each one did.
+
+## You need
+
+- Your copy of the practice template, and Node.js LTS, for the Worked example; one of your own repositories for Your turn. You practice in throwaway clones of them whose remote is a folder on your machine, so nothing a session pushes leaves your machine. Step 1 makes the clone for the Worked example.
+- macOS, Linux or WSL 2, and two terminals: one for agent view, one for git. On macOS, keep the clones outside Desktop, Documents and Downloads, where a background session can report `Operation not permitted` until you grant it access ([Background sessions can't read Desktop, Documents, or Downloads on macOS](https://code.claude.com/docs/en/agent-view#background-sessions-can%E2%80%99t-read-desktop-documents-or-downloads-on-macos)).
+- Usage: moderate. Each session draws on your usage independently ([Quick start](https://code.claude.com/docs/en/agent-view#quick-start)), and each row's one-line summary is a short Haiku-class request when a turn ends, and every few minutes during a long turn ([Row summaries](https://code.claude.com/docs/en/agent-view#row-summaries)). Cheap variant: in step 3, dispatch only the first task, then type `! npm test` as the second. A shell job runs the command in place of Claude, so no model is invoked, and its row clears itself a few minutes after the command ends ([Run a shell command](https://code.claude.com/docs/en/agent-view#run-a-shell-command)). Steps 4 to 8 then apply to the one Claude session: expect one worktree, one branch and one session to remove.
+
+## The idea
+
+[Agent view](https://code.claude.com/docs/en/agent-view), opened with `claude agents`, is one screen for your background sessions: full Claude Code conversations that run with no terminal attached. Every prompt you type there starts its own session, which a background service keeps running after you close the screen. Each row shows whether its session is working, needs your input, or is done ([Read session state](https://code.claude.com/docs/en/agent-view#read-session-state)).
+
+In [lesson 1](../01-parallel-sessions.md) you made the worktrees yourself. Here Claude does: before a dispatched session edits a file, it moves into its own worktree under `.claude/worktrees/`. Claude Code tells it to commit on the worktree's branch and push that branch if the repository has a remote, unless the task, your `CLAUDE.md` or memory says you handle git yourself. It is told never to push to `main` or `master`, force-push or merge. Whatever the task, it ends with a report of what it did and where the work is ([How file edits are isolated](https://code.claude.com/docs/en/agent-view#how-file-edits-are-isolated)).
+
+> [!WARNING]
+> A background session acts while you aren't watching. Opened from your shell without `--permission-mode`, agent view starts each session the way a new `claude` session in that folder would, usually in auto mode ([Permission mode](https://code.claude.com/docs/en/agent-view#permission-mode), [Which mode a session starts in](https://code.claude.com/docs/en/permission-modes#which-mode-a-session-starts-in)), where Claude commits without asking and pushes its branch when the repository has a remote. Open agent view with a permission mode you chose, never with `--dangerously-skip-permissions`, and practice in a clone whose remote is a folder on your machine.
+
+## Worked example
+
+1. From the folder that holds your practice template copy, make a throwaway clone with a local remote, and check that its tests pass. Replace `<template copy>` with your copy's folder name:
+
+ ```bash
+ git clone --bare <template copy> av-origin.git
+ git clone av-origin.git av-practice
+ cd av-practice
+ mkdir -p .practice
+ printf '%s\n' .practice/ .claude/worktrees/ >> "$(git rev-parse --git-path info/exclude)"
+ npm test
+ ```
+
+ `npm test` passes, and `origin` is now the folder `av-origin.git`, so a push stays on your machine. The exclude lines keep two folders out of `git status` without a commit: `.practice/`, where Your turn saves its files (as in [Beginner lesson 1](../../beginner/01-install-and-look-around.md#you-need)), and the worktrees Claude creates ([gitignore](https://git-scm.com/docs/gitignore), [Start Claude in a worktree](https://code.claude.com/docs/en/worktrees#start-claude-in-a-worktree)).
+2. In the first terminal, open agent view with two dispatch defaults: Manual mode, in which only reads run without asking ([Available modes](https://code.claude.com/docs/en/permission-modes#available-modes)), and Sonnet ([Model aliases](https://code.claude.com/docs/en/model-config#model-aliases)):
+
+ ```bash
+ claude agents --permission-mode manual --model sonnet
+ ```
+
+ Accept the trust dialog for the new folder. The header names the model new sessions use ([Set the model](https://code.claude.com/docs/en/agent-view#set-the-model)), and every session you dispatch from this view starts with both defaults ([Dispatch defaults](https://code.claude.com/docs/en/agent-view#dispatch-defaults)). If you have no other background sessions, the list shows empty section headers, each with a description. If `claude agents` lists your subagents and exits instead, check that no settings file sets `disableAgentView` to `true` and that `CLAUDE_CODE_DISABLE_AGENT_VIEW` isn't set ([Turn off agent view](https://code.claude.com/docs/en/agent-view#turn-off-agent-view)).
+3. Dispatch two tasks that touch different files. Type each one and press `Enter`; every prompt starts its own session:
+
+ ```text
+ Add a --json option to src/cli.js that prints the broken links as a JSON array instead of text lines. Add a test for it in a new file, test/cli.test.js, and run npm test.
+ ```
+
+ ```text
+ Write docs/config.md describing each linkcheck.json option in src/config.js, with its default and an example. Don't change any code.
+ ```
+
+ Two rows appear under `Working`, each named from its prompt.
+4. When a session needs your approval, for an edit or a command, its row moves under `Needs input`. Select it with `↑` or `↓` and press `Space`: the peek panel shows what it's waiting on ([Peek and reply](https://code.claude.com/docs/en/agent-view#peek-and-reply)). A reply typed there doesn't answer a permission prompt, so press `→` to attach. At v2.1.285, a background session waiting for your approval can show as done (fixed in v2.1.286), and `claude agents` sometimes doesn't show the permission prompt a session is waiting on (fixed in v2.1.287) ([CHANGELOG](https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md)): if a row shows as done without a report, or its peek shows no prompt, attach with `→`.
+5. Attached, the session fills the terminal, with a short recap of what happened while you were away. Read what Claude wants to do, and approve it if it fits the task, but not with `Yes, and switch to auto mode`, which a command's prompt can offer: it would switch this unwatched session to auto mode ([Switch permission modes](https://code.claude.com/docs/en/permission-modes#switch-permission-modes)). You can stay attached and approve its next requests, such as a `git commit` or `git push` it asks to run, then press `←` on an empty prompt: you're back in the table, and the session keeps running ([Attach to a session](https://code.claude.com/docs/en/agent-view#attach-to-a-session)). Do the same whenever a row needs you.
+6. In the second terminal, in `av-practice`, look at your checkout while the sessions work:
+
+ ```bash
+ git status --short
+ git worktree list
+ ```
+
+ `git status --short` prints nothing: the sessions edit elsewhere. Once a session has asked to edit, `git worktree list` shows a worktree for it under `.claude/worktrees/`, with its branch in brackets.
+7. When each session's row is under `Completed`, peek at it: its result says what it did and where the work is, such as its branch (your wording will differ). A result that doesn't say what the session did and where the work is may still be waiting for your approval, as step 4 warns: attach with `→` and answer it first. In the second terminal, merge what you want to keep, then run the tests:
+
+ ```bash
+ git merge --no-edit <branch>
+ npm test
+ ```
+
+ Run the merge once for each branch you keep, using the branch name from its session's result or from `git worktree list`. `npm test` passes; if you kept the `--json` branch, it runs more tests than in step 1.
+8. Clean up from the second terminal. List this folder's sessions, each with its short `id`, then remove each one:
+
+ ```bash
+ claude agents --json --all --cwd "$PWD"
+ claude rm <id>
+ ```
+
+ `claude rm` also removes the worktree Claude created for the session when that's safe. It keeps a worktree that holds uncommitted changes, or commits it can't confirm are saved elsewhere, and says why. Commits on the remote, or merged into the default branch you have checked out, count as saved ([What deleting a session removes](https://code.claude.com/docs/en/agent-view#what-deleting-a-session-removes)). Afterwards `git worktree list` shows only your checkout. Press `Esc` in agent view to return to your shell.
+
+## Your turn
+
+**Brief:** in a throwaway clone of your own repository, made as in step 1 with new folder names and your own test command, hand off two tasks you've been putting off that touch different files. Each worktree is a fresh checkout ([Set up the worktree environment](https://code.claude.com/docs/en/worktrees#set-up-the-worktree-environment)), so a task that runs your tests should say to install the dependencies in its worktree first, as lesson 1's test task did. While both sessions work, save the two `.practice/` files the criteria below name.
+
+Then, in your second terminal, start a session in the clone yourself with `claude --permission-mode manual`: a session you move in keeps the mode it was in, and a plain `claude` usually starts in auto mode ([Permission mode](https://code.claude.com/docs/en/agent-view#permission-mode)). Ask it a question about the code that needs no edits, and move it into agent view with `/background`, which frees that terminal and returns you to your shell ([Send the session to the background](https://code.claude.com/docs/en/agent-view#send-the-session-to-the-background)). A session you move in keeps working in your checkout, with no worktree of its own. Supervise all three from agent view until each dispatched session's work is merged or discarded.
+
+**Acceptance criteria:**
+
+- Agent view is opened with a permission mode and a model you chose for the work.
+- Two dispatched sessions each change files the other doesn't touch.
+- While both work, once each has asked to edit, and before you start the session you move in, you save your checkout's state:
+
+ ```bash
+ git status --short > .practice/a-view-status.txt
+ git worktree list > .practice/a-view-worktrees.txt
+ ```
+
+- That session is moved into agent view with `/background` (alias `/bg`) after your question ([Commands](https://code.claude.com/docs/en/commands)).
+- Every `Needs input` row is answered: a question from the peek panel, a permission prompt by attaching.
+- What you keep is merged into your branch, your tests pass, and every session you started is removed with `claude rm <id>`.
+
+## Check
+
+You are done when all of these are true:
+
+- [ ] Your checkout stayed clean while the dispatched sessions worked, and each had a worktree of its own: `.practice/a-view-status.txt` is empty, and `.practice/a-view-worktrees.txt` lists a path under `.claude/worktrees/` for each of them. In your clone, `[ ! -s .practice/a-view-status.txt ] && grep /.claude/worktrees/ .practice/a-view-worktrees.txt` prints one line for each.
+- [ ] `git log --oneline` on your branch shows the work you kept, and your tests pass.
+- [ ] `claude agents --json --all --cwd "$PWD"` lists no session whose `kind` is `background`, and `git worktree list` shows nothing under `.claude/worktrees/`.
+- [ ] Self-check (not tested): you answered every `Needs input` row from agent view, without switching to your shell, and you can say which requests the peek panel answered and which needed you to attach.
+
+If the first item fails, save the files again on your next run, while both dispatched sessions work: a session that hasn't asked to edit has no worktree yet, a session you moved in edits your checkout in place, and a settings file that sets [`worktree.bgIsolation`](https://code.claude.com/docs/en/settings-reference#worktree-bgisolation) to `"none"` turns the worktrees off. If your branch lacks work you kept, or your tests fail after a merge, find the session behind it. A session leaves git to you when the task, your `CLAUDE.md` or memory says you handle it, and work left uncommitted in its worktree must be committed there before you can merge it: attach to that session and ask it to commit. For a branch that broke your tests, fix it yourself, or attach to that session before you remove it and tell it what failed; then merge the fix. If `claude rm` kept a session, read the reason it printed, such as uncommitted changes or unpushed commits, and follow [What deleting a session removes](https://code.claude.com/docs/en/agent-view#what-deleting-a-session-removes). Remove a worktree left without a session with `git worktree remove <path>` ([`.claude/worktrees/` is filling up](https://code.claude.com/docs/en/agent-view#claude%2Fworktrees%2F-is-filling-up)), running `git worktree unlock <path>` first if git says it's locked ([Clean up subagent and background-session worktrees](https://code.claude.com/docs/en/worktrees#clean-up-subagent-and-background-session-worktrees)).
+
+## Watch out
+
+- Deleting a session in agent view, with `Ctrl+X` twice, removes the worktree Claude created for it, uncommitted changes included; `claude rm` keeps a worktree that has them ([What deleting a session removes](https://code.claude.com/docs/en/agent-view#what-deleting-a-session-removes)). Commit or merge what you want to keep first.
+- Background sessions use your usage the same as interactive ones, so several at once use it several times as fast ([Limitations](https://code.claude.com/docs/en/agent-view#limitations)).
+- `/agents` inside a session is a different command from `claude agents`, despite the similar name ([Check on running work](https://code.claude.com/docs/en/agents#check-on-running-work)).
+
+## Go further
+
+- [Read session state from a script](https://code.claude.com/docs/en/agent-view#read-session-state-from-a-script): poll `claude agents --json --all` from a status bar or another program.
+- [Copy the session with /fork](https://code.claude.com/docs/en/agent-view#copy-the-session-with-%2Ffork): send a copy of your conversation to the background and keep working where you are.
+- [Message your other Claude Code sessions](https://code.claude.com/docs/en/cross-session-messaging): let the sessions you dispatch pass findings to each other.
+
+---
+
+<sub>Sources: [Manage multiple agents with agent view](https://code.claude.com/docs/en/agent-view) · [Run agents in parallel](https://code.claude.com/docs/en/agents) · [Choose a permission mode](https://code.claude.com/docs/en/permission-modes) · [Run parallel sessions with worktrees](https://code.claude.com/docs/en/worktrees) · [All settings](https://code.claude.com/docs/en/settings-reference) · [Commands](https://code.claude.com/docs/en/commands) · [Model configuration](https://code.claude.com/docs/en/model-config) · [Claude Code CHANGELOG](https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md) · [gitignore](https://git-scm.com/docs/gitignore)</sub>
+
+<sub>Back to the [Advanced index](../README.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-agent-view)</sub>
diff --git a/docs/advanced/electives/dev-containers.md b/docs/advanced/electives/dev-containers.md
new file mode 100644
index 0000000..38a2146
--- /dev/null
+++ b/docs/advanced/electives/dev-containers.md
@@ -0,0 +1,130 @@
+# Dev containers
+
+<sub>**Advanced** · Elective · about 20 minutes, plus run time · Needs: [Put bounds on autonomous runs](../07-bounded-runs.md) · Verified against Claude Code v2.1.285 (stable) on 2026-10-09</sub>
+
+## Goal
+
+By the end of this Elective you can run Claude Code inside a dev container, keep your sign-in across a rebuild, and let it work unattended behind a firewall.
+
+## You need
+
+- For the Worked example: your copy of the practice template on GitHub, and GitHub Codespaces on your account. Nothing to install on your computer: the copy's dev container installs Claude Code.
+- For Your turn: one of your own repositories with no `.devcontainer/` folder, with its `.practice/` folder set up as [Beginner lesson 1](../../beginner/01-install-and-look-around.md#you-need) describes.
+- Also for Your turn: Docker, VS Code with the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) ([System requirements](https://code.visualstudio.com/docs/devcontainers/containers#_system-requirements)), and `jq`, on macOS, Linux or WSL 2. Without Docker, do the Worked example and the Check's self-check.
+- Usage: light. A codespace also uses your GitHub account's Codespaces compute while it runs, and storage while it exists ([GitHub Codespaces billing](https://docs.github.com/en/billing/concepts/product-billing/github-codespaces)).
+
+## The idea
+
+A [dev container](https://code.claude.com/docs/en/devcontainer) is a Docker container your editor connects to, on your computer or a cloud host such as GitHub Codespaces. With Claude Code in it, Claude's commands run in the container, while its edits land in your repository. Unlike the Bash sandbox from [Intermediate lesson 4](../../intermediate/04-permissions-and-sandbox.md), which wraps only shell commands, it holds the whole Claude Code process: file tools, MCP servers and hooks too ([Compare sandboxing approaches](https://code.claude.com/docs/en/sandbox-environments#compare-sandboxing-approaches)).
+
+Three pieces, each adding to the one before:
+
+- The **Claude Code Dev Container Feature** adds the CLI to any dev container ([Add Claude Code to your dev container](https://code.claude.com/docs/en/devcontainer#add-claude-code-to-your-dev-container)).
+- A **named volume** at `~/.claude`, plus `CLAUDE_CONFIG_DIR` set to that path, keeps your sign-in when a rebuild discards the home folder ([Persist authentication and settings across rebuilds](https://code.claude.com/docs/en/devcontainer#persist-authentication-and-settings-across-rebuilds)).
+- The **reference container** adds a non-root user and a firewall that limits outbound traffic to the destinations its script allows. The docs support it for unattended `--dangerously-skip-permissions` runs, which skip permission prompts (bypass mode); the CLI refuses the flag as root ([Run without permission prompts](https://code.claude.com/docs/en/devcontainer#run-without-permission-prompts), [Dev containers](https://code.claude.com/docs/en/sandbox-environments#dev-containers)).
+
+> [!WARNING]
+> With `--dangerously-skip-permissions`, "dev containers do not prevent a malicious project from exfiltrating anything accessible inside the container, including the Claude Code credentials stored in `~/.claude`" ([Development containers](https://code.claude.com/docs/en/devcontainer)). VS Code's Dev Containers extension also reuses your local Git credentials in the container and forwards a running SSH agent, and the reference firewall lets GitHub and SSH through, so a run can push with them ([Sharing Git credentials with your container](https://code.visualstudio.com/remote/advancedcontainers/sharing-git-credentials)). Use a dev container only with repositories you trust, and never mount host secrets such as `~/.ssh` or cloud credential files into it.
+
+## Worked example
+
+1. On GitHub, open `.devcontainer/devcontainer.json` in your template copy:
+
+ ```json
+ {
+ "name": "Claude Code practice",
+ "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
+ "features": {
+ "ghcr.io/devcontainers/features/node:1": { "version": "lts" },
+ "ghcr.io/anthropics/devcontainer-features/claude-code:1.0": {}
+ },
+ "postCreateCommand": "sudo apt-get update && sudo apt-get install -y bubblewrap socat"
+ }
+ ```
+
+ The `:1.0` tag pins the feature's install script, not Claude Code: the feature installs the latest release, which then updates itself ([Add Claude Code to your dev container](https://code.claude.com/docs/en/devcontainer#add-claude-code-to-your-dev-container)). The `postCreateCommand` installs `bubblewrap` and `socat`, which the Bash sandbox needs on Linux ([Set up Linux and WSL2](https://code.claude.com/docs/en/sandboxing#set-up-linux-and-wsl2)).
+2. Select **Code**, then the **Codespaces** tab, and create a codespace on `main` ([Creating a codespace for a repository](https://docs.github.com/en/codespaces/developing-in-a-codespace/creating-a-codespace-for-a-repository)). It opens in the editor set in your Codespaces settings ([Setting your default editor for GitHub Codespaces](https://docs.github.com/en/codespaces/setting-your-user-preferences/setting-your-default-editor-for-github-codespaces)); steps 3 to 6 use VS Code, in the browser or the desktop app.
+3. In its terminal:
+
+ ```bash
+ echo "$CODESPACES"; whoami; claude --version
+ ```
+
+ It prints three lines: `true` (GitHub sets `CODESPACES` in every codespace, [Default environment variables for your codespace](https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace)), `vscode` (the image's non-root user, [Ubuntu image](https://github.com/devcontainers/images/tree/main/src/base-ubuntu)), and a version that can be newer than this page's stamp.
+4. Run `claude`, sign in, and trust the folder when it asks. If the browser shows a code instead of returning to the terminal, paste it at the `Paste code here if prompted` prompt ([Log in to Claude Code](https://code.claude.com/docs/en/authentication#log-in-to-claude-code)). Then ask:
+
+ ```text
+ Run uname -a and whoami, then tell me which machine you're running on.
+ ```
+
+ Approve the command if Claude asks. Claude describes a Linux container, not your computer; your wording will differ. Quit with `/exit`.
+5. Run `claude auth status --text`: you're signed in ([CLI commands](https://code.claude.com/docs/en/cli-reference#cli-commands)). Rebuild: open the Command Palette (`Ctrl+Shift+P`, or `Cmd+Shift+P` on a Mac), run **Codespaces: Rebuild Container**, and choose **Rebuild** ([Rebuilding the container in a codespace](https://docs.github.com/en/codespaces/developing-in-a-codespace/rebuilding-the-container-in-a-codespace)). When it reconnects:
+
+ ```bash
+ claude auth status --text; echo "exit $?"
+ ```
+
+ It ends with `exit 1`: not signed in. A rebuild keeps `/workspaces`, where your repository lives, and clears `~/.claude` ([Persisting data over a rebuild](https://docs.github.com/en/codespaces/developing-in-a-codespace/rebuilding-the-container-in-a-codespace#persisting-data-over-a-rebuild)).
+6. Stop the codespace: run **Codespaces: Stop Codespace** from the Command Palette, or choose **Stop codespace** from the **...** menu next to it on [github.com/codespaces](https://github.com/codespaces). Closing the browser tab doesn't stop it ([Stopping and starting a codespace](https://docs.github.com/en/codespaces/developing-in-a-codespace/stopping-and-starting-a-codespace)).
+
+## Your turn
+
+**Brief:** put one of your own repositories in the [reference container](https://code.claude.com/docs/en/devcontainer#try-the-reference-container), with its firewall on and Claude Code pinned. Keep your sign-in across a rebuild, and let Claude finish one small task unattended, then review the result on your computer.
+
+The docs' steps open Claude Code's own repository in the container; to use it with your project, you copy its `.devcontainer/` folder into your repository and adjust the Dockerfile for your project's tools ([Try the reference container](https://code.claude.com/docs/en/devcontainer#try-the-reference-container)). On a new branch, fetch the [three files](https://github.com/anthropics/claude-code/tree/d945a61bc6346abce607252d5667df8a3bf0461a/.devcontainer) at the commit this guide was checked against:
+
+```bash
+git switch -c try-devcontainer
+mkdir -p .devcontainer
+ref=d945a61bc6346abce607252d5667df8a3bf0461a
+for f in devcontainer.json Dockerfile init-firewall.sh; do
+ curl -fsSL "https://raw.githubusercontent.com/anthropics/claude-code/$ref/.devcontainer/$f" -o ".devcontainer/$f"
+done
+```
+
+**Acceptance criteria:**
+
+- You read all three files before the first build. `init-firewall.sh` runs as root each time the container starts: `devcontainer.json` runs it as the `postStartCommand` ([Dev Container metadata reference](https://containers.dev/implementors/json_reference/)), and the Dockerfile lets the `node` user run it with `sudo`.
+- Before the first build, you add `claude.ai` and `platform.claude.com` to the domains `init-firewall.sh` resolves, next to `api.anthropic.com`: signing in and refreshing the sign-in need them ([Network access requirements](https://code.claude.com/docs/en/network-config#network-access-requirements)). Hosts can share an address, and the script stops at the first `ipset add` that meets an address it already added, so in the same loop change `ipset add allowed-domains "$ip"` to `ipset add -exist allowed-domains "$ip"`: `-exist` ignores an entry that's already in the set ([ipset](https://ipset.netfilter.org/ipset.man.html)).
+- `devcontainer.json` pins Claude Code: the `CLAUDE_CODE_VERSION` build argument names a version you choose, such as `2.1.285`, in place of `latest`, and `containerEnv` adds `"DISABLE_AUTOUPDATER": "1"`. That's the docs' recipe: install a fixed version from the Dockerfile, and turn off auto-update ([Enforce organization policy](https://code.claude.com/docs/en/devcontainer#enforce-organization-policy)). The three files, with your changes, are committed on your branch.
+- **Dev Containers: Reopen in Container** builds and opens it. The build log's `npm warn EBADENGINE` lines are expected: the reference image runs Node.js 20 and the npm package requires 22 or later, but npm only warns, the install completes and `claude` still runs ([Install with npm](https://code.claude.com/docs/en/setup#install-with-npm)). In its terminal (`` Ctrl+` ``), `whoami` prints `node`, `claude --version` prints your version, `curl -sS --connect-timeout 5 https://example.com` fails, and `curl -sS --connect-timeout 5 https://api.github.com/zen` succeeds.
+- You sign in with `claude` once. After **Dev Containers: Rebuild Container**, `claude auth status` still exits with `0`: the reference mounts a named volume at `/home/node/.claude` and points `CLAUDE_CONFIG_DIR` at it, and Docker keeps a volume after its container is gone ([Volumes](https://docs.docker.com/engine/storage/volumes/)).
+- One unattended run finishes in the container's terminal, on a task that needs no tool the image lacks, such as `claude -p "Add a one-line summary of this repository to the top of README.md" --dangerously-skip-permissions --model sonnet --max-turns 10` ([CLI flags](https://code.claude.com/docs/en/cli-reference#cli-flags)).
+- In a terminal on your computer, after the checks in the first Watch out bullet, you save `git status --porcelain > .practice/a-dc-status.txt`, then read `git diff`, `.devcontainer/` included, before you commit or discard the run's change.
+
+When every item in the Check below is true, tear down:
+
+1. In the container's terminal, run `claude auth logout` ([CLI commands](https://code.claude.com/docs/en/cli-reference#cli-commands)). Until you sign out, the config volume holds your credentials, and the volume outlives the container.
+2. Close the VS Code window that's connected to the container. Closing it stops the container by default (`shutdownAction` in the [Dev Container metadata reference](https://containers.dev/implementors/json_reference/)).
+3. Remove the container: in VS Code's Remote Explorer, choose **Containers**, then right-click the container and remove it ([Managing containers](https://code.visualstudio.com/docs/devcontainers/containers#_managing-containers)), or run `docker rm <container>` ([docker container rm](https://docs.docker.com/reference/cli/docker/container/rm/)).
+4. Remove the two volumes whose names start with `claude-code-config-` and `claude-code-bashhistory-`: `docker volume ls` lists them, then `docker volume rm <name>` removes each. Docker won't remove a volume a container still uses, so this step comes after step 3 ([docker volume rm](https://docs.docker.com/reference/cli/docker/volume/rm/)).
+
+## Check
+
+You are done when all of these are true:
+
+- [ ] On your computer, `git ls-tree --name-only try-devcontainer .devcontainer/` lists the three files, and `git show try-devcontainer:.devcontainer/devcontainer.json | jq -r '.build.args.CLAUDE_CODE_VERSION, .containerEnv.DISABLE_AUTOUPDATER'` prints your version and `1`.
+- [ ] In the container, `whoami` prints `node`, `claude --version` prints your version, the `example.com` request fails and the `api.github.com/zen` one succeeds.
+- [ ] In the container, after a rebuild, `claude auth status >/dev/null; echo $?` prints `0`.
+- [ ] On your computer, `.practice/a-dc-status.txt` lists the file the unattended run changed.
+- [ ] Self-check (not tested): in the codespace, `claude auth status` exited with `1` after the rebuild, and you can name two things the container doesn't protect: anything readable or usable inside it, such as `~/.claude` and your forwarded Git credentials, and every file in the mounted project.
+
+If jq reports a parse error, remove any comment or trailing comma you added to `devcontainer.json`. If `example.com` answers or `api.github.com` doesn't, the firewall script didn't succeed: run `sudo /usr/local/bin/init-firewall.sh` in the container and read its error. `Element cannot be added to the set: it's already added` means the `-exist` change is missing. If `claude auth status` exits with `1` after the rebuild, the volume's `target` and `CLAUDE_CONFIG_DIR` in `containerEnv` must name the same path ([Persist authentication and settings across rebuilds](https://code.claude.com/docs/en/devcontainer#persist-authentication-and-settings-across-rebuilds)). If the status file is empty, the run changed nothing, committed its change (`git log -1` shows it), or stopped at `--max-turns`, which exits with an error ([CLI flags](https://code.claude.com/docs/en/cli-reference#cli-flags)): read what it printed, and give it a smaller task if it ran out of turns.
+
+## Watch out
+
+- With `--dangerously-skip-permissions`, Claude can also rewrite `.devcontainer/` and `.git/`: they're protected paths, but bypass mode writes protected paths without asking ([Protected paths](https://code.claude.com/docs/en/permission-modes#protected-paths)). Through the mount, the change lands on your computer: the next rebuild uses `.devcontainer/`, and git runs the hooks in `.git/hooks`, or in the folder `.git/config` names, during commands such as `git commit` ([githooks](https://git-scm.com/docs/githooks)). Before you rebuild or run git on your computer, read `.git/config` and list `.git/hooks`, then compare `.devcontainer/` with the commit you made (`git log --oneline`, then `git diff <your commit> -- .devcontainer`).
+- A codespace keeps running until you stop it or it times out, and a stopped one still uses storage ([Stopping and starting a codespace](https://docs.github.com/en/codespaces/developing-in-a-codespace/stopping-and-starting-a-codespace)). Delete it when you're done, from the **...** menu next to it on [github.com/codespaces](https://github.com/codespaces), or with `gh codespace delete` ([Deleting a codespace](https://docs.github.com/en/codespaces/developing-in-a-codespace/deleting-a-codespace)).
+- The firewall blocks outbound traffic its script doesn't allow, for everything in the container, Claude's commands included. When your project needs another host, such as PyPI or a private registry, add it to the script's list of domains and rebuild ([Dev containers](https://code.claude.com/docs/en/sandbox-environments#dev-containers)). [Network access requirements](https://code.claude.com/docs/en/network-config#network-access-requirements) lists the hosts Claude Code's own features use.
+
+## Go further
+
+- [Choose a sandbox environment](https://code.claude.com/docs/en/sandbox-environments): dev containers next to the Bash sandbox, other containers, virtual machines and cloud sessions.
+- [Enforce organization policy](https://code.claude.com/docs/en/devcontainer#enforce-organization-policy): managed settings built into the image, and why a file in the repository isn't an enforcement boundary.
+- [Explore the .claude directory](https://code.claude.com/docs/en/claude-directory): what the volume at `~/.claude` holds, including credentials, settings and session history.
+
+---
+
+<sub>Sources: [Development containers](https://code.claude.com/docs/en/devcontainer) · [Choose a sandbox environment](https://code.claude.com/docs/en/sandbox-environments) · [Choose a permission mode](https://code.claude.com/docs/en/permission-modes) · [Configure the sandboxed Bash tool](https://code.claude.com/docs/en/sandboxing) · [Authentication](https://code.claude.com/docs/en/authentication) · [Advanced setup](https://code.claude.com/docs/en/setup) · [CLI reference](https://code.claude.com/docs/en/cli-reference) · [Enterprise network configuration](https://code.claude.com/docs/en/network-config) · Claude Code: [reference dev container at d945a61](https://github.com/anthropics/claude-code/tree/d945a61bc6346abce607252d5667df8a3bf0461a/.devcontainer) · GitHub: [Creating a codespace for a repository](https://docs.github.com/en/codespaces/developing-in-a-codespace/creating-a-codespace-for-a-repository), [Setting your default editor for GitHub Codespaces](https://docs.github.com/en/codespaces/setting-your-user-preferences/setting-your-default-editor-for-github-codespaces), [Default environment variables for your codespace](https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace), [Rebuilding the container in a codespace](https://docs.github.com/en/codespaces/developing-in-a-codespace/rebuilding-the-container-in-a-codespace), [Stopping and starting a codespace](https://docs.github.com/en/codespaces/developing-in-a-codespace/stopping-and-starting-a-codespace), [Deleting a codespace](https://docs.github.com/en/codespaces/developing-in-a-codespace/deleting-a-codespace), [GitHub Codespaces billing](https://docs.github.com/en/billing/concepts/product-billing/github-codespaces) · VS Code: [Developing inside a Container](https://code.visualstudio.com/docs/devcontainers/containers), [Sharing Git credentials with your container](https://code.visualstudio.com/remote/advancedcontainers/sharing-git-credentials) · [Dev Container metadata reference](https://containers.dev/implementors/json_reference/) · Dev Container images: [Ubuntu](https://github.com/devcontainers/images/tree/main/src/base-ubuntu) · Docker: [Volumes](https://docs.docker.com/engine/storage/volumes/), [docker container rm](https://docs.docker.com/reference/cli/docker/container/rm/), [docker volume rm](https://docs.docker.com/reference/cli/docker/volume/rm/) · Git: [githooks](https://git-scm.com/docs/githooks) · [ipset](https://ipset.netfilter.org/ipset.man.html)</sub>
+
+<sub>Back to the [Advanced index](../README.md) · Topic: [Permissions and safety](../../topics/permissions-and-safety.md) · [Stuck on this lesson?](https://github.com/wesammustafa/Claude-Code-Everything-You-Need-to-Know/issues/new?template=lesson-feedback.yml&lesson=a-dev-containers)</sub>
diff --git a/docs/advanced/electives/goal-loop-routines.md b/docs/advanced/electives/goal-loop-routines.md
new file mode 100644
index 0000000..fcdfa1e
--- /dev/null
+++ b/docs/advanced/electives/goal-loop-routines.md
@@ -0,0 +1,117 @@
+# `/goal`, `/loop` and routines
+
+<sub>**Advanced** · Elective · about 20 minutes, plus run time · Needs: [Put bounds on autonomous runs](../07-bounded-runs.md) · Verified against Claude Code v2.1.285 (stable) on 2026-10-09</sub>
+
+> [!NOTE]
+> "Routines are in research preview. Behavior, limits, and the API surface may change." ([Automate work with routines](https://code.claude.com/docs/en/routines))
+
+## Goal
+
+By the end of this Elective you can keep Claude working without prompting each step: toward a condition with `/goal`, on an interval with `/loop`, and on a schedule in the cloud with a routine.
+
+## You need
+
+- Your copy of the practice template, with Node.js LTS, for the Worked example, and one of your own repositories for Your turn.
+- For the routine, steps 7 to 9 only: a Pro, Max, Team or Enterprise plan, signed in with `/login` ([Availability by subscription plan](https://code.claude.com/docs/en/feature-availability#availability-by-subscription-plan)). Routines need a Claude subscription, so with a Console API key or a cloud provider, skip those steps ([Feature availability](https://code.claude.com/docs/en/feature-availability#features-that-require-a-claude-subscription)). On Team and Enterprise, an Owner can turn routines off for everyone ([Automate work with routines](https://code.claude.com/docs/en/routines)).
+- Also for the routine: GitHub access for cloud sessions to your copy, through the Claude GitHub App or `/web-setup`; with the App, a private copy needs the App installed on it ([GitHub authentication options](https://code.claude.com/docs/en/claude-code-on-the-web#github-authentication-options)). On Team and Enterprise, either way needs an Owner first: the GitHub connector for the App's browser sign-in, or Quick setup for `/web-setup` ([Connect GitHub](https://code.claude.com/docs/en/web-quickstart#connect-github), [Quick setup for Team and Enterprise](https://code.claude.com/docs/en/claude-code-on-the-web#quick-setup-for-team-and-enterprise)).
+- Usage: moderate. A goal runs several turns, each loop run sends the session's whole context again ([Why usage climbs in a long session](https://code.claude.com/docs/en/costs#why-usage-climbs-in-a-long-session)), and a routine run is a full cloud session that draws on your plan ([Usage and limits](https://code.claude.com/docs/en/routines#usage-and-limits)). The steps keep each one small: Sonnet, a turn limit, a short loop and a routine that runs once. Cheap variant: skip the routine (steps 7 to 9).
+
+## The idea
+
+`/goal`, `/loop` and a routine each start Claude's next run without you ([Compare ways to keep a session running](https://code.claude.com/docs/en/goal#compare-ways-to-keep-a-session-running), [Compare scheduling options](https://code.claude.com/docs/en/scheduled-tasks#compare-scheduling-options)):
+
+| | Next run starts when | Stops when |
+|---|---|---|
+| `/goal` | A turn ends and a second model, the evaluator, judges your condition not yet met | It's judged met or impossible, a turn hits an error you must fix, or `/goal clear` |
+| `/loop` | An interval passes, while the session is idle | You cancel it, Claude ends a self-paced loop, or it expires |
+| Routine | A schedule, an API call or a GitHub event, in the cloud | You pause or delete it; a one-off turns itself off |
+
+The evaluator reads only the conversation, so your condition should name a check whose result shows in Claude's output, such as "`npm test` exits 0", say what must not change, and end with a turn limit ([Write an effective condition](https://code.claude.com/docs/en/goal#write-an-effective-condition)). Goals and loops keep the session's permission mode: in auto mode they run unattended, and in Manual mode Claude asks first ([Set a goal](https://code.claude.com/docs/en/goal#set-a-goal), [Compare scheduling options](https://code.claude.com/docs/en/scheduled-tasks#compare-scheduling-options)).
+
+> [!WARNING]
+> A routine runs as a full cloud session that doesn't stop for approval, apart from some artifact actions, and it acts as you: its commits and pull requests carry your GitHub user ([Create a routine](https://code.claude.com/docs/en/routines#create-a-routine)). It can use every tool of each connector it includes, writes included, without asking, and every connector on your claude.ai account is included by default ([Create from the web](https://code.claude.com/docs/en/routines#create-from-the-web), [Connectors](https://code.claude.com/docs/en/routines#connectors)). Remove the connectors a routine doesn't need, and keep its prompt to read-only work while you learn.
+
+## Worked example
+
+Work in your practice copy, on a new branch.
+
+1. Make the branch and the log folder, which git already ignores in the copy, then start Claude Code on Sonnet:
+
+ ```bash
+ git switch -c keep-working
+ mkdir -p .practice
+ claude --model sonnet
+ ```
+
+ **Windows:** `New-Item -ItemType Directory -Force .practice` replaces the `mkdir` line.
+
+ The status bar shows the permission mode ([Switch permission modes](https://code.claude.com/docs/en/permission-modes#switch-permission-modes)). If it shows `⏸ manual mode on`, approve each tool call as Claude asks; if it shows `⏵⏵ auto mode on`, the goal's turns and the loop's runs go ahead on their own.
+2. Set a goal. The link checker reports a link such as `setup.md?plain=1` as broken even when `setup.md` exists, because it strips only the `#` part of a link:
+
+ ```text
+ /goal npm test exits 0, a new test in test/links.test.js shows that a link such as setup.md?plain=1 to a file that exists is not reported as broken, no existing test changes, and the fix is committed; or stop after 8 turns
+ ```
+
+ Claude starts at once, and `◎ /goal active` shows how long the goal has run. After each turn the transcript shows the evaluator's verdict; press `Ctrl+O` for the reason behind it ([Set a goal](https://code.claude.com/docs/en/goal#set-a-goal)).
+3. When the evaluator judges the condition met, Claude Code clears the goal and records an achieved entry in the transcript ([How evaluation works](https://code.claude.com/docs/en/goal#how-evaluation-works)). Run `/goal`: it shows the achieved condition with its duration, turn count and token spend ([Check status](https://code.claude.com/docs/en/goal#check-status)). In a second terminal, `git log --oneline -1` shows the commit, and `npm test` passes. If `npm test` still fails or `git log` shows no new commit, the goal ended before the fix, for example at its turn limit or judged impossible, and `/goal` shows whether it's still active: ask Claude to finish the fix and commit it.
+4. Start a loop that logs the test results every minute:
+
+ ```text
+ /loop 1m run npm test and append one line to .practice/loop-log.txt with the time and the number of passing and failing tests. Don't change any other file.
+ ```
+
+ Claude schedules it and confirms the cadence and a job ID ([Run on a fixed interval](https://code.claude.com/docs/en/scheduled-tasks#run-on-a-fixed-interval)). Each run fires between your turns, never while Claude is mid-response ([How scheduled tasks run](https://code.claude.com/docs/en/scheduled-tasks#how-scheduled-tasks-run)).
+5. In your editor, not through Claude, break one test: in `test/config.test.js`, change the first test's `files: ['.']` to `files: ['docs']`. Wait until the log gains a line that shows a failure, then undo the change with `git restore test/config.test.js`.
+6. Ask Claude `cancel the npm test loop`, then `what scheduled tasks do I have?`: none are left ([Manage scheduled tasks](https://code.claude.com/docs/en/scheduled-tasks#manage-scheduled-tasks)). `cat .practice/loop-log.txt` shows a line for each run, at least one of them failing. Your wording will differ.
+7. Steps 7 to 9 need a subscription; without one, skip to step 10. Schedule a routine that runs once, in five minutes:
+
+ ```text
+ /schedule in 5 minutes, run npm test in this repository and reply with the number of passing and failing tests. Don't edit files, commit or push.
+ ```
+
+ Claude asks follow-up questions about the schedule, the repository and the prompt, and confirms the absolute time before it saves ([Create from the CLI](https://code.claude.com/docs/en/routines#create-from-the-cli), [Schedule a one-off run](https://code.claude.com/docs/en/routines#schedule-a-one-off-run)). Tell it to include no connectors; if it can't, remove them as soon as it saves, with `/schedule update` or the routine's **Edit** form at `claude.ai/code/routines` ([Connectors](https://code.claude.com/docs/en/routines#connectors)).\
+ If Claude adds a setup note about GitHub access, follow it before the run time; if the time passes first, edit the routine and set a new one-off time ([Repositories and branch permissions](https://code.claude.com/docs/en/routines#repositories-and-branch-permissions), [Edit and control routines](https://code.claude.com/docs/en/routines#edit-and-control-routines)). If Claude replies that you need to authenticate, no routine was saved; if `/schedule` isn't in the command menu, see [`/schedule` returns "Unknown command"](https://code.claude.com/docs/en/routines#schedule-returns-unknown-command).
+8. `/schedule list` shows the routine ([Manage routines from the CLI](https://code.claude.com/docs/en/routines#manage-routines-from-the-cli)). After it runs, open it at `claude.ai/code/routines`, open the run and read the transcript for the test counts ([View and interact with runs](https://code.claude.com/docs/en/routines#view-and-interact-with-runs)). The run cloned your default branch, so its count doesn't include the test you added on `keep-working` ([Repositories and branch permissions](https://code.claude.com/docs/en/routines#repositories-and-branch-permissions)). The one-off is now marked **Ran**.
+9. Delete the routine: open the menu next to its name and select **Delete** ([Edit and control routines](https://code.claude.com/docs/en/routines#edit-and-control-routines)).\
+ If you connected GitHub only for the routine, disconnect it at `claude.ai/customize/connectors`, which deletes the credential whether it came from the browser or from `/web-setup`; the `gh` token itself stays valid on GitHub ([Remove the `/web-setup` token](https://code.claude.com/docs/en/web-quickstart#remove-the-web-setup-token)). If you installed the Claude GitHub App only for the routine, also take your copy out of its repository access, and uninstall it only if nothing else of yours uses it ([Reviewing and modifying installed GitHub Apps](https://docs.github.com/en/apps/using-github-apps/reviewing-and-modifying-installed-github-apps)).
+10. `git switch -` takes your copy back to the branch you started on; `keep-working` keeps the fix.
+
+## Your turn
+
+In one of your own repositories, pick a chore whose end state a command can prove, such as a failing test or a lint error. Finish it with a goal. Then commit a `.claude/loop.md` that keeps watching it: the file replaces the built-in prompt of a `/loop` you start without a prompt of your own ([Customize the default prompt with loop.md](https://code.claude.com/docs/en/scheduled-tasks#customize-the-default-prompt-with-loop-md)). With a subscription, you can also have a one-off routine run the command in the cloud once your work is on the default branch, or name your branch in the routine's prompt ([Repositories and branch permissions](https://code.claude.com/docs/en/routines#repositories-and-branch-permissions)).
+
+It's done when:
+
+- Your condition names the command that proves the end state, one thing that must not change, and a turn limit.
+- The work is committed, and the command exits 0.
+- `.claude/loop.md` is committed. It says what to check, and to report in one line without changing any file. `/loop 10m` (an interval and no prompt) ran it at least twice, then you cancelled it ([Run the built-in maintenance prompt](https://code.claude.com/docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt)).
+- No scheduled task or routine is left: `what scheduled tasks do I have?` lists none, and any routine you made is deleted.
+
+## Check
+
+You are done when all of these are true:
+
+- [ ] In your repository, the goal's work is committed (`git log -1` shows it), and the command your condition named exits 0.
+- [ ] In your practice copy, `.practice/loop-log.txt` holds lines from at least two loop runs, at least one of them failing.
+- [ ] `.claude/loop.md` is committed in your repository (`git ls-files .claude/loop.md` prints it), and `git status --porcelain` prints nothing.
+- [ ] Self-check (not tested): your condition named the command, one thing that must not change and a turn limit; `/loop 10m` ran your `loop.md` at least twice before you cancelled it; `what scheduled tasks do I have?` lists none; and if you made a routine, you read its run's transcript and deleted it.
+
+If the command still fails, the goal ended before the work did, for example at its turn limit or judged impossible: press `Ctrl+O` to read the last verdict's reason ([How evaluation works](https://code.claude.com/docs/en/goal#how-evaluation-works)), then fix the cause or set a new goal; if `/goal` won't start, it says why, usually an untrusted folder or `disableAllHooks` ([Requirements](https://code.claude.com/docs/en/goal#requirements)). If no log line shows a failure, the loop didn't run while the test was broken: start the loop again as in step 4, break the test as in step 5, wait for a failing line, restore the file, then cancel the loop as in step 6. If `git ls-files` prints nothing, `git check-ignore -v .claude/loop.md` names the rule that hides the file: add it with `git add -f`, then commit.
+
+## Watch out
+
+- A loop fires even while you're away, sending the session's whole context each time, and keeps going until you cancel it or it expires ([Stop a loop](https://code.claude.com/docs/en/scheduled-tasks#stop-a-loop)). On a Pro, Max, Team or Enterprise plan, `/usage` lists your heaviest loops ([Plan usage breakdown](https://code.claude.com/docs/en/costs#plan-usage-breakdown)).
+- The evaluator can't confirm a condition that Claude's output can't show, such as "the code is clean". Name a command and its result ([How evaluation works](https://code.claude.com/docs/en/goal#how-evaluation-works)).
+- A green status in a routine's run list only means the session started and exited without an infrastructure error. Open the run and read the transcript to see whether the task worked ([View and interact with runs](https://code.claude.com/docs/en/routines#view-and-interact-with-runs)).
+
+## Go further
+
+- [Loop engineering: Getting started with loops](https://claude.com/resources/articles/getting-started-with-loops): Anthropic's Claude Code team on turn-based, goal-based, time-based and proactive loops, and when to use each.
+- [Prompt-based hooks](https://code.claude.com/docs/en/hooks-guide#prompt-based-hooks): the kind of Stop hook `/goal` wraps ([How evaluation works](https://code.claude.com/docs/en/goal#how-evaluation-works)), for a check you want in every session.
+- [Schedule recurring tasks in Claude Code Desktop](https://code.claude.com/docs/en/desktop-scheduled-tasks): scheduled tasks that run on your machine, with your local files, while the Desktop app is open.
+
+---
+
+<sub>Sources: [Keep Claude working toward a goal](https://code.claude.com/docs/en/goal) · [Run prompts on a schedule](https://code.claude.com/docs/en/scheduled-tasks) · [Automate work with routines](https://code.claude.com/docs/en/routines) · [Choose a permission mode](https://code.claude.com/docs/en/permission-modes) · [Manage costs effectively](https://code.claude.com/docs/en/costs) · [Feature availability](https://code.claude.com/docs/en/feature-availability) · [Use Claude Code in the cloud](https://code.claude.com/docs/en/claude-code-on-the-web) · [Get started with Claude Code in the cloud](https://code.claude.com/docs/en/web-quickstart) · [Reviewing and modifying installed GitHub Apps](https://docs.github.com/en/apps/using-github-apps/reviewing-and-modifying-installed-github-apps)</sub>
+
+<sub>Back to the [Advanced index](../README.md) · Topic: [Automation](../../topics/automation.md) · [Stuck on this lesson?](https://github.com/wesammustafa/Claude-Code-Everything-You-Need-to-Know/issues/new?template=lesson-feedback.yml&lesson=a-goal-loop)</sub>
diff --git a/docs/advanced/electives/publish-a-plugin.md b/docs/advanced/electives/publish-a-plugin.md
new file mode 100644
index 0000000..5dd6ce3
--- /dev/null
+++ b/docs/advanced/electives/publish-a-plugin.md
@@ -0,0 +1,145 @@
+# Testing and publishing a plugin
+
+<sub>**Advanced** · Elective · about 20 minutes, plus run time · Needs: [Share your setup with a team](../06-share-your-setup.md) · Verified against Claude Code v2.1.285 (stable) on 2026-10-09</sub>
+
+## Goal
+
+By the end of this Elective you can check a plugin's files with `claude plugin validate`, measure what it changes with `claude plugin eval`, and publish it in a marketplace that other people install and update from.
+
+## You need
+
+- The marketplace layout from [lesson 6](../06-share-your-setup.md): a marketplace that lists a plugin by a relative path.
+- Where to practice: a new folder outside your other repositories, which becomes its own private GitHub repository. Electives have no template check.
+- bash, `jq` and git 2.31 or later, on macOS, Linux or WSL 2. With an older git, `claude plugin eval` stops before running any case ([Requirements](https://code.claude.com/docs/en/plugin-evals#requirements)).
+- The GitHub CLI, signed in with `gh auth login`. Claude Code clones a private marketplace with the git credentials your machine already holds, SSH or HTTPS, and never prompts for one; for HTTPS, `gh auth setup-git` after that sign-in stores one it can use ([Grant access to a private marketplace](https://code.claude.com/docs/en/plugins/host-marketplace#grant-access-to-a-private-marketplace)).
+- Usage: moderate. Every eval run is a real model call on your account ([Test plugins with evals](https://code.claude.com/docs/en/plugin-evals)). The Worked example makes one run. Your turn's full run runs each case three times with the plugin and three times without it; its cheap variant runs each case once.
+
+## The idea
+
+Check a plugin two ways before you share it. `claude plugin validate` reads files: manifests and frontmatter; with `--strict`, a warning fails the run too ([Test and debug](https://code.claude.com/docs/en/plugins/create#test-and-debug)). `claude plugin eval` measures behavior: each case, a prompt plus graders (checks that score each run), runs in a fresh, isolated session with only your plugin loaded, three times by default (the with-arm), and as many times with no plugin (the without-arm). The difference between their scores, `WITH` and `W/OUT`, is `Δ`: what the plugin contributed ([How an eval run works](https://code.claude.com/docs/en/plugin-evals#how-an-eval-run-works)).
+
+The `regex`, `tool_used`, `tool_order` and `file_exists` graders cost nothing; `llm` and `baseline` call a judge model. Give each case one grader on the result and one on the steps, such as "the skill ran" ([Choose and weight graders](https://code.claude.com/docs/en/plugin-evals#grade-the-result)).
+
+Publishing is a `.claude-plugin/marketplace.json` in a git repository: once it's pushed, the plugin is published, with no submission form ([Publish and distribute a plugin](https://code.claude.com/docs/en/plugins/publish#publish-through-your-own-marketplace)). When a plugin sets a `version`, a user gets your next release only when you change it ([Release a new version](https://code.claude.com/docs/en/plugins/host-marketplace#release-a-new-version)).
+
+> [!WARNING]
+> Before you make a marketplace repository public, read every file in it: everyone can read a public repository ([About repositories](https://docs.github.com/en/repositories/creating-and-managing-repositories/about-repositories#about-repository-visibility)), and anyone who can clone it can install from it ([Control who can install](https://code.claude.com/docs/en/plugins/publish#control-who-can-install)). A hook or a stdio MCP server you add in a later version runs on the machine of everyone who updates to it, with their rights ([Plugin security and trust](https://code.claude.com/docs/en/plugins/security#understand-what-a-plugin-can-do)).
+
+## Worked example
+
+1. Create a repository with one plugin, `commit-helper`, under `plugins/`, the layout [Create a marketplace](https://code.claude.com/docs/en/plugins/create-marketplace#create-a-marketplace) uses. Its one skill drafts commit messages. In every file and command, replace `<you>` with your GitHub user name and `Your Name` with your name:
+
+ ```bash
+ mkdir -p claude-plugins/.claude-plugin claude-plugins/plugins/commit-helper/{.claude-plugin,skills/commit-message}
+ cd claude-plugins && git init
+ mkdir -p .practice && echo '.practice/' >> "$(git rev-parse --git-path info/exclude)"
+ echo '**/evals/results/' > .gitignore
+ echo '# commit-helper: drafts commit messages in a short, consistent format.' > plugins/commit-helper/README.md
+ ```
+
+ `.practice/` holds the file the Check reads, ignored without a commit as in [Beginner lesson 1](../../beginner/01-install-and-look-around.md#you-need). The `.gitignore` line keeps out the results each eval run writes under `evals/results/` ([Write and refine cases](https://code.claude.com/docs/en/plugin-evals#write-and-refine-cases)), and the release checklist asks for the README ([Prepare your plugin for release](https://code.claude.com/docs/en/plugins/publish#prepare-your-plugin-for-release)). Then save the plugin's manifest, with the fields that checklist asks for, as `plugins/commit-helper/.claude-plugin/plugin.json`:
+
+ ```json
+ {
+ "name": "commit-helper", "version": "1.0.0", "author": { "name": "Your Name" },
+ "description": "Drafts commit messages in a short, consistent format.",
+ "homepage": "https://github.com/<you>/claude-plugins", "repository": "https://github.com/<you>/claude-plugins"
+ }
+ ```
+
+ The skill, as `plugins/commit-helper/skills/commit-message/SKILL.md`:
+
+ ```markdown
+ ---
+ name: commit-message
+ description: Drafts a commit message for a described change. Use when the user asks for a commit message.
+ ---
+
+ Write a commit message for the change the user describes: a subject line in the imperative mood, at most 50 characters, with no trailing period; a blank line; then one sentence on why.
+ ```
+
+ And the marketplace, as `.claude-plugin/marketplace.json`. Keep the entry's `name` the same as the manifest's ([Keep the entry name and the manifest name the same](https://code.claude.com/docs/en/plugins/create-marketplace#keep-the-entry-name-and-the-manifest-name-the-same)):
+
+ ```json
+ {
+ "name": "<you>-plugins", "description": "Plugins from <you>", "owner": { "name": "Your Name" },
+ "plugins": [{ "name": "commit-helper", "source": "./plugins/commit-helper", "description": "Drafts commit messages." }]
+ }
+ ```
+
+2. Validate the plugin, then the marketplace: `claude plugin validate --strict ./plugins/commit-helper`, then `claude plugin validate --strict .`. Each run ends with `✔ Validation passed`. A marketplace run checks the marketplace file and the `plugin.json` of each plugin it lists by a relative path ([Problems that validation reports](https://code.claude.com/docs/en/plugins/create-marketplace#problems-that-validation-reports)), but doesn't open their skill files, so validate the plugin directory itself too ([Validate a directory](https://code.claude.com/docs/en/plugins/cli-reference#validate-a-directory)).
+3. Write one eval case. `claude plugin eval init --bare` writes a blank case: a `prompt.md` and one placeholder grader, `graders/criteria.md`, which expects a rubric for a judge model. It runs nothing ([Write a case manually](https://code.claude.com/docs/en/plugin-evals#write-a-case-manually)). Replace the rubric with two graders that cost nothing:
+
+ ```bash
+ cd plugins/commit-helper
+ claude plugin eval init --bare names-the-rename
+ cd evals/names-the-rename && rm graders/criteria.md
+ printf '%s\n' '---' 'max_turns: 10' 'allowed_tools: [Skill]' '---' '' 'Write me a commit message for this change: I renamed getUser to fetchUser and updated the three call sites.' > prompt.md
+ printf '%s\n' '---' 'type: tool_used' 'tool: Skill' "input_match: 'commit-message'" '---' > graders/skill-fired.md
+ printf '%s\n' '---' 'type: regex' "pattern: 'fetchUser'" '---' > graders/mentions-rename.md
+ cd ../..
+ ```
+
+ A run gets only the read-only tools its case lists, so `allowed_tools: [Skill]` is what lets Claude run your skill ([prompt.md frontmatter](https://code.claude.com/docs/en/plugin-evals#prompt-md-fields)). `skill-fired` passes when Claude called the `Skill` tool with `commit-message` in its input, that is, ran the skill; `mentions-rename` checks the reply ([Grader types](https://code.claude.com/docs/en/plugin-evals#grader-types)). Have a regex look for a fact the prompt gives, such as `fetchUser`: Claude writes the reply, so its wording varies. `evals/names-the-rename/graders/` now holds `mentions-rename.md` and `skill-fired.md`.
+4. Run the case once, with the plugin only, and keep the report on your machine: `claude plugin eval . --runs 1 --ablation none --no-publish` ([Command options](https://code.claude.com/docs/en/plugin-evals#command-options)). If it asks `Trust this plugin directory?`, answer `y`; inside a git repository, that trusts the whole repository, for interactive sessions too ([Trust the plugin directory](https://code.claude.com/docs/en/plugin-evals#trust-the-plugin-directory)). The summary table has `SCORE` and `PASS%` columns, and a `Report:` line gives the path of `report.html` under `evals/results/` ([Create your first eval suite](https://code.claude.com/docs/en/plugin-evals#create-your-first-eval-suite)). Your scores will differ.
+5. Publish. Back at the repository's root (`cd ../..`), run `git add -A && git status --short`, read each file it lists, then:
+
+ ```bash
+ git commit -m "Publish commit-helper 1.0.0"
+ gh repo create claude-plugins --private --source . --push
+ ```
+
+ `--source .` creates the GitHub repository from this one, and `--push` pushes your commit ([gh repo create](https://cli.github.com/manual/gh_repo_create)). The marketplace is now published to everyone who can clone the repository: you, for now. Making the repository public is what lets everyone install it.
+6. Install it as a user would, from GitHub:
+
+ ```bash
+ claude plugin marketplace add <you>/claude-plugins
+ claude plugin install commit-helper@<you>-plugins
+ claude plugin details commit-helper
+ ```
+
+ The add prints `✔ Successfully added marketplace: <you>-plugins (declared in user settings)`, the install prints `✔ Successfully installed plugin: commit-helper@<you>-plugins (scope: user)`, and the details' `Component inventory` reads `Skills (1) commit-message` ([Create a marketplace](https://code.claude.com/docs/en/plugins/create-marketplace#create-a-marketplace)). The marketplace's name comes from your `marketplace.json`, not from the repository ([Host your marketplace](https://code.claude.com/docs/en/plugins/host-marketplace#host-your-marketplace)). The plugin stays installed for you until the end of Your turn.
+
+## Your turn
+
+**Brief:** release `commit-helper` 1.0.1, gated by its evals, and update your installed copy.
+
+**Acceptance criteria:**
+
+- A second case, `ignores-unrelated`, has the same frontmatter as `names-the-rename`, so the skill could run, and sends a request the skill must leave alone, such as `Explain what a git rebase does.` A `tool_used` grader on `Skill` with `min: 0`, `max: 0` and `arm: both` checks that Claude didn't run the skill. `arm: both` is needed because a two-arm run otherwise leaves every `tool_used` grader on `Skill` out of the score ([Score against the no-plugin baseline](https://code.claude.com/docs/en/plugin-evals#compare-against-a-no-plugin-baseline)). A `regex` grader checks the reply, such as `pattern: 'rebase'` with `flags: i`.
+- The skill makes one change a grader can see, such as starting each subject with a type like `refactor:`, checked by a new `regex` grader in `names-the-rename`. `version` in `plugin.json` is `1.0.1`, and the marketplace entry sets no `version` of its own ([Release a new version](https://code.claude.com/docs/en/plugins/host-marketplace#release-a-new-version)).
+- Both strict validations pass, and one full run, `claude plugin eval . --threshold <score> --no-publish` from the plugin's folder, ends with every case at or above the threshold you chose, a score from 0 to 1 such as `0.8` ([Command options](https://code.claude.com/docs/en/plugin-evals#command-options)). Cheap variant: add `--runs 1 --ablation none`.
+- `evals/` is committed, `evals/results/` isn't, and the release is pushed.
+- `claude plugin update commit-helper@<you>-plugins` installs 1.0.1 and ends with `Restart to apply changes.` ([Plugin loading reference](https://code.claude.com/docs/en/plugins/loading#check-which-stage-a-plugin-reached)). If it says the plugin is already at the latest version, the new `version` isn't pushed yet.
+
+Then, from the repository's root, save the plugin list with `claude plugin list --json > .practice/a-publish-list.json` ([JSON output](https://code.claude.com/docs/en/plugins/cli-reference#json-output)), and only then run `claude plugin marketplace remove <you>-plugins --scope user`. Removing a marketplace from its last scope also uninstalls its plugins ([plugin marketplace remove](https://code.claude.com/docs/en/plugins/cli-reference#plugin-marketplace-remove)), so the saved list is what the Check below reads. Deleting the repository is optional: `gh repo delete <you>/claude-plugins --yes` needs the `delete_repo` scope, which `gh auth refresh -s delete_repo` adds ([gh repo delete](https://cli.github.com/manual/gh_repo_delete)).
+
+## Check
+
+You are done when all of these are true, from the repository's root:
+
+- [ ] `claude plugin validate --strict ./plugins/commit-helper` and `claude plugin validate --strict .` each end with `✔ Validation passed`.
+- [ ] `git ls-files plugins/commit-helper/evals` lists the files of two cases and nothing under `results/`.
+- [ ] The newest eval result covers both cases, and every case passed ([JSON result](https://code.claude.com/docs/en/plugin-evals#json-result)): `jq '.partial != true and .aggregates.casesTotal == 2 and .aggregates.casesPassed == .aggregates.casesTotal' "$(ls -d plugins/commit-helper/evals/results/*/ | tail -1)aggregate-result.json"` prints `true`.
+- [ ] `jq -r '.[] | select(.id == "commit-helper@<you>-plugins") | .version' .practice/a-publish-list.json` prints `1.0.1`.
+- [ ] Self-check (not tested): you can say what `Δ` measures, and why a two-arm run doesn't score "the skill ran".
+
+If a validation fails only with `--strict`, the lines above the verdict name a warning to fix, such as a missing `description` or `version` ([Output and exit codes](https://code.claude.com/docs/en/plugins/cli-reference#output-and-exit-codes)). If `results/` is listed, run `git rm -r --cached plugins/commit-helper/evals/results`, check the `.gitignore` line and commit. If the result prints `false`, run both cases again when the newest run had only one, or open its `report.html` to see which grader failed: without `--threshold`, any case below a perfect score fails ([The run exits 1 but the results look fine](https://code.claude.com/docs/en/plugin-evals#the-run-exits-1-but-the-results-look-fine)). If the version check prints nothing or `1.0.0`, check that `<you>` is replaced, push the new `version` if needed, add the marketplace, install the plugin again, and save the list before you remove the marketplace.
+
+## Watch out
+
+- `claude plugin eval` runs the plugin's skills, hooks and agents on your machine, as you, and a suite that passes says nothing about whether the plugin is safe. Pass `--allow-tools`, `--scaffold` or `--allow-real-servers` only for a plugin and suite you've read ([What a run can access](https://code.claude.com/docs/en/plugin-evals#security)).
+- Judge graders add model calls to every run, so keep them for what a free grader can't check. `--max-cost-usd` caps the run's list-price estimate, not your plan usage, and once you reach a usage limit mid-suite, later runs usually score 0 while the suite isn't marked `partial` ([Command options](https://code.claude.com/docs/en/plugin-evals#command-options), [Troubleshooting](https://code.claude.com/docs/en/plugin-evals#runs-fail-with-a-usage-limit-or-rate-limit-error-partway-through)).
+- Treat a plugin's `name` as permanent: users install, enable and configure it by `name@marketplace`, so a renamed plugin is a different plugin to every existing install. Change `displayName` for a new label ([Prepare your plugin for release](https://code.claude.com/docs/en/plugins/publish#prepare-your-plugin-for-release)). Some marketplace names are reserved, such as any starting with `claudeai-`; if the add refuses yours, pick another ([Reserved names](https://code.claude.com/docs/en/plugins/marketplace-reference#reserved-names)).
+
+## Go further
+
+- [Run evals in CI](https://code.claude.com/docs/en/plugin-evals#run-evals-in-ci): `--trust-plugin`, pinned models, `--json` and a cost ceiling, for a job like the one in [GitHub Actions](../05-github-actions.md).
+- [Submit to Anthropic's directory](https://code.claude.com/docs/en/plugins/publish#submit-to-anthropics-directory): list a plugin in the catalog people browse on claude.ai.
+- [Host and maintain a marketplace](https://code.claude.com/docs/en/plugins/host-marketplace): auto-update, release channels, and renaming or removing a plugin.
+
+---
+
+<sub>Sources: [Test plugins with evals](https://code.claude.com/docs/en/plugin-evals) · [Publish and distribute a plugin](https://code.claude.com/docs/en/plugins/publish) · [Create a Claude Code plugin](https://code.claude.com/docs/en/plugins/create) · [Create a marketplace](https://code.claude.com/docs/en/plugins/create-marketplace) · [Host and maintain a marketplace](https://code.claude.com/docs/en/plugins/host-marketplace) · [Plugin commands reference](https://code.claude.com/docs/en/plugins/cli-reference) · [Plugin loading reference](https://code.claude.com/docs/en/plugins/loading) · [Marketplace reference](https://code.claude.com/docs/en/plugins/marketplace-reference) · [Plugin security and trust](https://code.claude.com/docs/en/plugins/security) · GitHub: [About repositories](https://docs.github.com/en/repositories/creating-and-managing-repositories/about-repositories) · GitHub CLI manual: [gh repo create](https://cli.github.com/manual/gh_repo_create), [gh repo delete](https://cli.github.com/manual/gh_repo_delete)</sub>
+
+<sub>Back to the [Advanced index](../README.md) · Topic: [Plugins](../../topics/plugins.md) · [Stuck on this lesson?](https://github.com/wesammustafa/Claude-Code-Everything-You-Need-to-Know/issues/new?template=lesson-feedback.yml&lesson=a-publish-plugin)</sub>
diff --git a/docs/agent-teams.md b/docs/agent-teams.md
index 723f941..52b3026 100644
--- a/docs/agent-teams.md
+++ b/docs/agent-teams.md
@@ -1,355 +1,8 @@
-# Agent Teams — The Complete Guide
+<a id="agent-teams--the-complete-guide"></a>
+# Agent teams
-> [!NOTE]
-> From the previous edition, not yet re-verified. The guide is being rebuilt as lessons; this page keeps the earlier material reachable until they land.
+This page moved. Running an agent team is taught in the Advanced Elective [Agent teams](advanced/electives/agent-teams.md), and choosing between subagents, a dynamic workflow and a team in the Advanced lesson [Choose an orchestration pattern](advanced/02-orchestration-patterns.md).
-*~15 min read · [← Back to README](../README.md#agent-teams-experimental)*
+<a id="contents"></a><a id="enable-it"></a><a id="your-first-team"></a><a id="reuse-your-existing-agent-definitions"></a><a id="models-and-effort"></a><a id="display-modes"></a><a id="talking-to-teammates"></a><a id="plan-approval"></a><a id="the-shared-task-list"></a><a id="quality-gates-with-hooks"></a><a id="architecture"></a><a id="permissions"></a><a id="what-teammates-know"></a><a id="two-patterns-that-earn-their-cost"></a><a id="parallel-code-review-with-distinct-lenses"></a><a id="competing-hypotheses--the-scientific-debate"></a><a id="best-practices"></a><a id="troubleshooting"></a><a id="limitations"></a><a id="see-also"></a>Turning teams on, staffing a team from subagent definitions, the agent panel and the task list, permissions, costs and limits, with links to the official sections on display modes, plan approval and quality gates: the [Agent teams](advanced/electives/agent-teams.md) Elective. A team's architecture, and fixes for common problems: the official [Architecture](https://code.claude.com/docs/en/agent-teams#architecture) and [Troubleshooting](https://code.claude.com/docs/en/agent-teams#troubleshooting) sections.
-> ⚠️ **Experimental and disabled by default.** Without `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`, no team is set up at session start, no team directories are written, and Claude will not spawn or propose teammates. There are real [limitations](#limitations) around session resumption, task coordination, and shutdown.
-
-> **Mental model:** An agent team is **multiple full Claude Code sessions** coordinated by a lead, sharing a task list and a mailbox. The thing that separates it from subagents isn't parallelism — it's **communication**. Teammates message each other directly, and *you* can message any teammate directly without going through the lead.
-
----
-
-## Contents
-
-- [Teams vs subagents](#teams-vs-subagents)
-- [Enable it](#enable-it)
-- [Your first team](#your-first-team)
-- [Reuse your existing agent definitions](#reuse-your-existing-agent-definitions)
-- [Models and effort](#models-and-effort)
-- [Display modes](#display-modes)
-- [Talking to teammates](#talking-to-teammates)
-- [Plan approval](#plan-approval)
-- [The shared task list](#the-shared-task-list)
-- [Quality gates with hooks](#quality-gates-with-hooks)
-- [Architecture](#architecture)
-- [Permissions](#permissions)
-- [What teammates know](#what-teammates-know)
-- [Two patterns that earn their cost](#two-patterns-that-earn-their-cost)
-- [Best practices](#best-practices)
-- [Troubleshooting](#troubleshooting)
-- [Limitations](#limitations)
-
----
-
-## Teams vs subagents
-
-Both parallelize work. Pick based on **whether your workers need to talk to each other**:
-
-| | Subagents | Agent teams |
-|---|---|---|
-| **Context** | Own context window; results return to the caller | Own context window; fully independent |
-| **Communication** | Report back to the main agent only | Teammates message **each other** directly |
-| **Coordination** | Main agent manages all work | Shared task list with self-coordination |
-| **Best for** | Focused tasks where only the result matters | Work requiring discussion and disagreement |
-| **Token cost** | Lower — results summarized back | Higher — each teammate is a separate Claude instance |
-
-Teams add coordination overhead and use significantly more tokens. They work best when teammates can operate **independently**. For sequential work, same-file edits, or heavy dependency chains, a single session or [subagents](https://code.claude.com/docs/en/sub-agents) win. If the job is bigger than a handful of peers can coordinate, you probably want a [dynamic workflow](workflows.md) instead.
-
----
-
-## Enable it
-
-Either in your shell environment, or — the more durable option — in settings:
-
-```json
-{
- "env": {
- "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
- }
-}
-```
-
-```bash
-export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 # or add to ~/.zshrc
-```
-
----
-
-## Your first team
-
-Describe the task and the teammates you want in plain language. This example works because the three roles are genuinely independent — nobody waits on anybody:
-
-```text
-I'm designing a CLI tool that helps developers track TODO comments across
-their codebase. Spawn three teammates to explore this from different angles:
-one on UX, one on technical architecture, one playing devil's advocate.
-```
-
-Claude populates the shared task list, spawns a teammate per perspective, and synthesizes findings at the end.
-
-> ⚠️ **Claude may quietly use subagents instead.** Subagents appear in the *same* agent panel as teammates, so the panel alone doesn't prove a team formed. If you got subagents, ask again and explicitly request an agent team.
-
-Teammates are listed in the **agent panel** below your prompt input:
-
-| Key | Action |
-|---|---|
-| `↑` / `↓` | Select a teammate |
-| `Enter` | Open its transcript and message it directly |
-| `Esc` | Interrupt the selected teammate's current turn |
-| `x` | Stop the selected teammate |
-| `Ctrl+T` | Toggle the task list |
-
-**Idle rows hide — they aren't dead.** Once every agent in the panel is idle, idle rows disappear after 30 seconds and return on the teammate's next turn; the teammate stays running and addressable the whole time (v2.1.199+). When more than three are idle, the surplus collapses into a single `N idle agents` row — `Enter` expands it.
-
----
-
-## Reuse your existing agent definitions
-
-This is the highest-leverage thing most people miss: a teammate can be spawned **from a subagent definition** you already have — project, user, plugin, or CLI-defined.
-
-```text
-Spawn a teammate using the security-reviewer agent type to audit the auth module.
-```
-
-The teammate honors that definition's `tools` allowlist and `model`, and the definition's body is **appended** to the teammate's system prompt rather than replacing it. Team coordination tools (`SendMessage`, task management) stay available even when `tools` restricts everything else.
-
-So the subagents you define work in both directions: delegate to them as subagents, or staff a team with them. Define the role once.
-
-> ⚠️ The `skills` and `mcpServers` frontmatter fields are **not applied** when a definition runs as a teammate. Teammates load skills and MCP servers from your project and user settings, like a regular session.
-
----
-
-## Models and effort
-
-**Teammates do not inherit the lead's `/model` selection by default.** This trips up the common "deep lead, cheap teammates" plan, because you may already be getting something other than what you assumed.
-
-- Set **Default teammate model** in `/config`. Choose **Default (leader's model)** to have teammates follow the lead.
-- Or specify per spawn: `Spawn 4 teammates to refactor these modules in parallel. Use Sonnet for each teammate.`
-- Teammates **do** inherit the lead's [effort level](reference/effort-levels.md) (v2.1.186+ in split-pane mode).
-
-A teammate's model and fast mode are **fixed at spawn**, so `/model` and `/fast` only ever change the lead — even while you're viewing a teammate (v2.1.199 shows a notice saying so). `/effort` does apply to the viewed teammate's later turns.
-
----
-
-## Display modes
-
-| Mode | What you get | Requires |
-|---|---|---|
-| **`in-process`** *(default)* | All teammates in your main terminal, navigated with the agent panel | Nothing |
-| **Split panes** | One pane per teammate, all output visible at once, click to interact | tmux **or** iTerm2 + [`it2`](https://github.com/mkusaka/it2) |
-
-```json
-{ "teammateMode": "auto" }
-```
-
-```bash
-claude --teammate-mode auto # single session; experimental, not in --help
-```
-
-- `"auto"` — split panes when you're already inside tmux, or on iTerm2 with `it2` installed; falls back to in-process.
-- `"tmux"` — split panes, auto-detecting tmux vs iTerm2.
-- `"iterm2"` — iTerm2 native panes explicitly (v2.1.186+); needs `it2` plus **iTerm2 → Settings → General → Magic → Enable Python API**.
-
-> ℹ️ The default changed from `"auto"` to `"in-process"` in v2.1.179 — upgraded sessions that used to open split panes now stay in one terminal unless you set the mode.
->
-> ⚠️ Split panes are **not supported** in VS Code's integrated terminal, Windows Terminal, or Ghostty. `tmux` works best on macOS; `tmux -CC` in iTerm2 is the suggested entrypoint.
-
----
-
-## Talking to teammates
-
-Each teammate is a full, independent Claude Code session, so you can redirect one mid-flight instead of restarting the whole team.
-
-- **In-process:** select it in the agent panel, press `Enter`, type.
-- **Split panes:** click into its pane.
-
-While you're viewing a teammate, plain text and [skills](skills.md) go to *that teammate* — but built-in commands still run in the lead's session.
-
-**Shutting one down** — refer to it by name. The lead sends a shutdown request; the teammate can approve and exit gracefully, or reject with an explanation.
-
-```text
-Ask the researcher teammate to shut down
-```
-
-Names matter: the lead assigns every teammate a name at spawn, and any teammate can message any other by that name. **Tell the lead what to call each teammate** in your spawn instruction so you have predictable handles later.
-
----
-
-## Plan approval
-
-For risky work, make a teammate plan before it touches anything. The teammate stays in read-only plan mode until the lead approves.
-
-```text
-Spawn an architect teammate to refactor the authentication module.
-Require plan approval before they make any changes.
-```
-
-Rejected plans send feedback back; the teammate revises in plan mode and resubmits. **The lead approves autonomously** — it does not ask you. To influence it, give it criteria up front: *"only approve plans that include test coverage"*, *"reject plans that modify the database schema."*
-
----
-
-## The shared task list
-
-Tasks have three states — **pending**, **in progress**, **completed** — and can depend on other tasks. A pending task with unresolved dependencies can't be claimed until they complete, and dependents unblock automatically.
-
-- **Lead assigns:** tell the lead which task goes to which teammate.
-- **Self-claim:** after finishing, a teammate picks up the next unassigned, unblocked task itself.
-
-Claiming uses **file locking**, so two teammates racing for the same task isn't a problem.
-
----
-
-## Quality gates with hooks
-
-Three [hook](../README.md#hooks) events make team rules enforceable rather than advisory. **Exit code 2 blocks** in all three:
-
-| Hook | Fires when | Exit 2 |
-|---|---|---|
-| `TeammateIdle` | A teammate is about to go idle | Sends feedback and **keeps it working** |
-| `TaskCreated` | A task is being created | Prevents creation, sends feedback |
-| `TaskCompleted` | A task is being marked complete | Prevents completion, sends feedback |
-
-`TaskCompleted` + exit 2 is the practical one: gate "done" on your test suite actually passing, so a teammate can't declare victory on red.
-
-> ℹ️ The `team_name` field in these payloads carries a session-derived name and is **deprecated** since v2.1.178.
-
----
-
-## Architecture
-
-| Component | Role |
-|---|---|
-| **Team lead** | Your main session — spawns teammates, coordinates, synthesizes |
-| **Teammates** | Separate Claude Code instances, one task at a time |
-| **Task list** | Shared work items teammates claim and complete |
-| **Mailbox** | Message passing between agents |
-
-Teams are stored locally under a session-derived name — `session-` plus the first eight characters of the session ID:
-
-| Path | Lifetime |
-|---|---|
-| `~/.claude/teams/{team-name}/config.json` | Removed when the session ends |
-| `~/.claude/teams/{team-name}/inboxes/{agent-name}.json` | Per-agent mailbox |
-| `~/.claude/tasks/{team-name}/` | **Persists** locally, never uploaded — resumed sessions keep their tasks. Retention follows `cleanupPeriodDays` |
-
-> ⚠️ **Don't hand-edit or pre-author the team config.** It holds runtime state (session IDs, tmux pane IDs) and your changes are overwritten on the next state update. There is no project-level equivalent — a `.claude/teams/teams.json` in your project is just an ordinary file, not configuration. To define reusable roles, [use subagent definitions](#reuse-your-existing-agent-definitions).
-
-Teammates *can* read `config.json` to discover each other: its `members` array holds each name and agent ID, with the lead always carrying agent type `team-lead`.
-
-Mailbox entries are validated on read — malformed ones are reported and removed while valid messages still deliver. (Before v2.1.207 a single bad entry error-looped every second and blocked that mailbox until you deleted the file.)
-
----
-
-## Permissions
-
-- Teammates **start with the lead's permission settings**. If the lead runs `--dangerously-skip-permissions`, so does every teammate. You can change individual modes after spawning, but not per-teammate at spawn time.
-- **Teammate permission prompts surface in the lead session** — approve them there yourself.
-- A teammate **cannot consent on your behalf.** When one agent messages another via `SendMessage`, the receiver is told it came from another Claude session, not from you. A teammate denied an action can't relay it through a peer to get around the check, and in [auto mode](https://code.claude.com/docs/en/permission-modes) the classifier treats a relayed approval claim as untrusted input.
-- [Plan approval](#plan-approval) is the deliberate exception: the lead grants those without prompting you.
-
----
-
-## What teammates know
-
-On spawn, a teammate loads the same project context as a regular session — `CLAUDE.md`, MCP servers, skills — plus the lead's spawn prompt.
-
-**It does not get the lead's conversation history.** That's the single most common cause of a teammate doing the wrong thing. Put the specifics in the spawn prompt:
-
-```text
-Spawn a security reviewer teammate with the prompt: "Review the authentication
-module at src/auth/ for security vulnerabilities. Focus on token handling,
-session management, and input validation. The app uses JWT tokens stored in
-httpOnly cookies. Report any issues with severity ratings."
-```
-
-How information moves after that: messages deliver **automatically** (the lead doesn't poll), a finishing teammate notifies the lead on going idle, and everyone sees task status. As of v2.1.198 a teammate whose turn dies on an API error reports the failure with the error text instead of appearing to finish normally. To reach everyone, send one message per recipient.
-
----
-
-## Two patterns that earn their cost
-
-### Parallel code review with distinct lenses
-
-A single reviewer gravitates toward one class of issue at a time. Assign each teammate a different filter so they don't overlap:
-
-```text
-Spawn three teammates to review PR #142:
-- One focused on security implications
-- One checking performance impact
-- One validating test coverage
-Have them each review and report findings.
-```
-
-### Competing hypotheses — the scientific debate
-
-This is the pattern that justifies teams over subagents, because it needs **inter-agent communication**:
-
-```text
-Users report the app exits after one message instead of staying connected.
-Spawn 5 agent teammates to investigate different hypotheses. Have them talk to
-each other to try to disprove each other's theories, like a scientific
-debate. Update the findings doc with whatever consensus emerges.
-```
-
-The debate structure *is* the mechanism. Sequential investigation suffers from anchoring: once one theory gets explored, everything after it is biased toward that theory. With independent investigators actively trying to disprove each other, the surviving theory is far more likely to be the real root cause.
-
----
-
-## Best practices
-
-| ✅ Do | ❌ Don't |
-|---|---|
-| Start with **3–5 teammates** — the range that balances parallelism against coordination | Scale up before the work genuinely benefits; three focused teammates beat five scattered ones |
-| Aim for **5–6 tasks per teammate** so nobody idles and the lead can reassign | Size tasks so large that teammates run for ages without a check-in |
-| Give each teammate a **distinct, non-overlapping** slice | Let two teammates edit the same file — teams get no worktree isolation, so it's a straight overwrite |
-| Put task specifics in the **spawn prompt** | Assume teammates saw your conversation — they didn't |
-| Use **descriptive names** you can reference later | Use `agent1`, `agent2` |
-| **Start with research and review** while learning | Start with parallel implementation |
-| Pre-approve common operations in permission settings | Let teammate prompts pile up in the lead session |
-| Check in, redirect, and synthesize as findings arrive | Leave a team running unattended for long stretches |
-
-Two prompts worth keeping handy:
-
-```text
-Wait for your teammates to complete their tasks before proceeding
-```
-
-Use it when the lead starts implementing instead of delegating. And when the lead calls it done prematurely, just tell it to keep going.
-
----
-
-## Troubleshooting
-
-| Symptom | Fix |
-|---|---|
-| **Teammates never appear** | Check the agent panel below the input (`↑`/`↓`, then Enter). A vanished row is *hidden*, not stopped — message it by name to bring it back. Confirm the task was complex enough to warrant a team; ask explicitly for one |
-| **Split panes don't open** | `which tmux`. For iTerm2, verify `it2` is installed and the Python API is enabled |
-| **Too many permission prompts** | Pre-approve common operations in [permission settings](https://code.claude.com/docs/en/permissions) *before* spawning |
-| **A teammate stopped on an error** | Open its transcript, then either give it new instructions or spawn a replacement. As of v2.1.198, messaging a teammate that's waiting to retry a failed API request wakes it to retry immediately |
-| **A task looks stuck** | Task status can lag. Check whether the work is actually done, then update the status manually or tell the lead to nudge the teammate |
-| **Lead quits before work is done** | Tell it to keep going |
-| **Orphaned tmux session** | `tmux ls` then `tmux kill-session -t <name>` |
-
----
-
-## Limitations
-
-The honest list, as of v2.1.178+:
-
-- **No session resumption with in-process teammates.** `/resume` and `/rewind` don't restore them; the lead may try to message teammates that no longer exist. Tell it to spawn new ones.
-- **Task status can lag** — teammates sometimes fail to mark tasks complete, which blocks dependents.
-- **Shutdown can be slow** — teammates finish the current request or tool call first.
-- **One team per session.** No additional named teams, no sharing a team across sessions.
-- **No nested teams.** Teammates can't spawn teammates; only the lead manages the team.
-- **No background subagents from in-process teammates** — a teammate's background work can't outlive the lead's process, so `run_in_background` (or a definition with `background: true`) errors.
-- **Lead is fixed.** You can't promote a teammate or transfer leadership.
-- **Permissions are set at spawn.** Change individual modes afterward, but not per-teammate up front.
-- **No worktree isolation.** Unlike agent view, teams don't isolate teammates in worktrees — [partition the files yourself](#best-practices).
-
-> 💡 `CLAUDE.md` works normally: teammates read it from their working directory. It's the cleanest way to give every teammate the same project rules.
-
----
-
-## See also
-
-- [Official agent teams docs](https://code.claude.com/docs/en/agent-teams) — authoritative reference
-- [Run agents in parallel](https://code.claude.com/docs/en/agents) — subagents vs agent view vs teams vs workflows
-- [Dynamic Workflows](workflows.md) — when the job outgrows a handful of peers
-- [Subagents](../README.md#ai-agents): the lighter primitive
-- [Agent team token costs](https://code.claude.com/docs/en/costs#agent-team-token-costs)
-
----
-
-[← Back to README](../README.md#agent-teams-experimental) · [Dynamic Workflows](workflows.md) · [Skills](skills.md)
+<a id="teams-vs-subagents"></a>Choosing between subagents, a dynamic workflow and an agent team: [Choose an orchestration pattern](advanced/02-orchestration-patterns.md).
diff --git a/docs/reference/commands.md b/docs/reference/commands.md
index 8c6fda8..46558b2 100644
--- a/docs/reference/commands.md
+++ b/docs/reference/commands.md
@@ -48,7 +48,7 @@ Electives: `/statusline` ([The status line](../intermediate/electives/status-lin
- `claude plugin validate <dir>`: check a marketplace or a plugin folder before you share it; `--strict` also fails on warnings ([Plugin commands reference](https://code.claude.com/docs/en/plugins/cli-reference#plugin-validate)). [Share your setup with a team](../advanced/06-share-your-setup.md)
- `/usage`: the session's cost, your plan's usage limits and activity stats. [Put bounds on autonomous runs](../advanced/07-bounded-runs.md)
-Electives: `/background` (agent view); `/goal`, `/loop` and `/schedule` (`/goal`, `/loop` and routines).
+Electives: `claude agents` and `/background` ([Agent view](../advanced/electives/agent-view.md)); `/goal`, `/loop` and `/schedule` ([`/goal`, `/loop` and routines](../advanced/electives/goal-loop-routines.md)); `claude plugin eval` ([Testing and publishing a plugin](../advanced/electives/publish-a-plugin.md)).
<a id="custom-slash-commands-skills"></a>
## Your own commands
diff --git a/docs/reference/feature-map.md b/docs/reference/feature-map.md
index a94d574..b2a07f5 100644
--- a/docs/reference/feature-map.md
+++ b/docs/reference/feature-map.md
@@ -39,7 +39,7 @@ How to read it:
| [Sandbox](https://code.claude.com/docs/en/sandboxing); taught in [Permissions, settings scopes and the sandbox](../intermediate/04-permissions-and-sandbox.md) | – | Every provider |
| [Output styles](https://code.claude.com/docs/en/output-styles); taught in [the built-in teachers](../beginner/electives/built-in-teachers.md) | – | Every provider |
| [Status line](https://code.claude.com/docs/en/statusline); taught in [The status line](../intermediate/electives/status-line.md) | – | Every provider |
-| [`/goal`](https://code.claude.com/docs/en/goal) | – | Every provider |
+| [`/goal`](https://code.claude.com/docs/en/goal); taught in [`/goal`, `/loop` and routines](../advanced/electives/goal-loop-routines.md) | – | Every provider |
| [`/powerup`](https://code.claude.com/docs/en/commands); taught in [the built-in teachers](../beginner/electives/built-in-teachers.md) | – | The docs state no limit |
| [Fast mode](https://code.claude.com/docs/en/fast-mode); taught in [Fast mode](../intermediate/electives/fast-mode.md) | "Fast mode is in research preview." | A Claude subscription, paid for with usage credits (an Owner turns it on for Team and Enterprise), and Console organizations with access provisioned; not Claude Platform on AWS, Bedrock, Agent Platform or Foundry |
| [Advisor](https://code.claude.com/docs/en/advisor) | "The advisor tool is experimental and requires the Anthropic API." | A Claude subscription and the Console |
@@ -54,9 +54,9 @@ How to read it:
| [Agent hooks](https://code.claude.com/docs/en/hooks-guide#agent-based-hooks) | "Agent hooks are experimental." | As for hooks |
| [Subagents](https://code.claude.com/docs/en/sub-agents); taught in [Delegate to a custom subagent](../intermediate/06-subagents.md) | – | Every provider |
| [MCP](https://code.claude.com/docs/en/mcp); taught in [Connect a tool with MCP](../intermediate/07-mcp.md) | – | Every provider; claude.ai connectors only when you sign in with a Claude subscription |
-| [Plugins and marketplaces](https://code.claude.com/docs/en/plugins/overview); taught in [Install and manage plugins](../intermediate/08-plugins.md) and [Share your setup with a team](../advanced/06-share-your-setup.md) | – | Every provider |
+| [Plugins and marketplaces](https://code.claude.com/docs/en/plugins/overview); taught in [Install and manage plugins](../intermediate/08-plugins.md), [Share your setup with a team](../advanced/06-share-your-setup.md) and [Testing and publishing a plugin](../advanced/electives/publish-a-plugin.md) | – | Every provider |
| [Channels](https://code.claude.com/docs/en/channels) | "Channels are in research preview." | A Claude subscription (Team and Enterprise once an admin turns them on) and the Console; not Claude Platform on AWS, Bedrock, Agent Platform or Foundry |
-| [Dev containers](https://code.claude.com/docs/en/devcontainer) | – | Every provider |
+| [Dev containers](https://code.claude.com/docs/en/devcontainer); taught in [Dev containers](../advanced/electives/dev-containers.md) | – | Every provider |
## Parallel and unattended work
@@ -64,12 +64,12 @@ How to read it:
|---|---|---|
| [Worktrees](https://code.claude.com/docs/en/worktrees); taught in [Parallel sessions with worktrees](../advanced/01-parallel-sessions.md) | – | Every provider |
| [Dynamic workflows](https://code.claude.com/docs/en/workflows); taught in [Run and save a dynamic workflow](../advanced/03-dynamic-workflows.md) | – | Every provider; on Pro, turn them on in `/config` |
-| [Agent view](https://code.claude.com/docs/en/agent-view) | "Agent view is in research preview." | Every provider |
-| [Agent teams](https://code.claude.com/docs/en/agent-teams) | "Agent teams are experimental and disabled by default." | Every provider |
+| [Agent view](https://code.claude.com/docs/en/agent-view); taught in [Agent view](../advanced/electives/agent-view.md) | "Agent view is in research preview." | Every provider ([Settings and provider](https://code.claude.com/docs/en/agent-view#settings-and-provider)) |
+| [Agent teams](https://code.claude.com/docs/en/agent-teams); taught in [Agent teams](../advanced/electives/agent-teams.md) | "Agent teams are experimental and disabled by default." | Every provider |
| [Cross-session messaging](https://code.claude.com/docs/en/cross-session-messaging) | – | A Claude subscription; elsewhere between sessions on the same machine only |
| [Projects](https://code.claude.com/docs/en/claude-projects) | "Projects are in public beta on Pro and Max plans and rolling out gradually …" | Pro and Max; not yet Team or Enterprise |
-| [`/loop` and scheduled prompts](https://code.claude.com/docs/en/scheduled-tasks) | – | Every provider |
-| [Routines](https://code.claude.com/docs/en/routines) | "Routines are in research preview." | Pro, Max, Team and Enterprise |
+| [`/loop` and scheduled prompts](https://code.claude.com/docs/en/scheduled-tasks); taught in [`/goal`, `/loop` and routines](../advanced/electives/goal-loop-routines.md) | – | Every provider |
+| [Routines](https://code.claude.com/docs/en/routines); taught in [`/goal`, `/loop` and routines](../advanced/electives/goal-loop-routines.md) | "Routines are in research preview." | Pro, Max, Team and Enterprise |
| [Running Claude Code from scripts](https://code.claude.com/docs/en/headless); taught in [Script Claude Code with `claude -p`](../advanced/04-headless.md) and [Put bounds on autonomous runs](../advanced/07-bounded-runs.md) | – | Every provider |
| [GitHub Actions](https://code.claude.com/docs/en/github-actions); taught in [GitHub Actions](../advanced/05-github-actions.md) | – | A Claude subscription, the Console, Bedrock, Agent Platform and Foundry; not Claude Platform on AWS |
| [GitLab CI/CD](https://code.claude.com/docs/en/gitlab-ci-cd) | "Claude Code for GitLab CI/CD is currently in beta." | Every provider except Microsoft Foundry |
diff --git a/docs/topics/automation.md b/docs/topics/automation.md
index 9dd4001..605390f 100644
--- a/docs/topics/automation.md
+++ b/docs/topics/automation.md
@@ -8,8 +8,7 @@ Running Claude Code without a person at the keyboard: scripts, CI and schedules.
- Advanced: [Script Claude Code with `claude -p`](../advanced/04-headless.md)
- Advanced: [GitHub Actions](../advanced/05-github-actions.md)
-
-More of this topic's lessons and Electives are linked here as they are published.
+- Advanced Elective: [`/goal`, `/loop` and routines](../advanced/electives/goal-loop-routines.md)
## Official docs
diff --git a/docs/topics/permissions-and-safety.md b/docs/topics/permissions-and-safety.md
index ae427b1..6eefb2e 100644
--- a/docs/topics/permissions-and-safety.md
+++ b/docs/topics/permissions-and-safety.md
@@ -10,8 +10,7 @@ What Claude Code may do without asking, and how to keep it away from what it sho
- Beginner: [Your first change, from request to commit](../beginner/03-first-change.md)
- Intermediate: [Permissions, settings scopes and the sandbox](../intermediate/04-permissions-and-sandbox.md)
- Advanced: [Put bounds on autonomous runs](../advanced/07-bounded-runs.md)
-
-Later lessons on this topic are linked here in level order, with its Electives, as they are published.
+- Advanced Elective: [Dev containers](../advanced/electives/dev-containers.md)
## Official docs
diff --git a/docs/topics/plugins.md b/docs/topics/plugins.md
index 3259bee..750a224 100644
--- a/docs/topics/plugins.md
+++ b/docs/topics/plugins.md
@@ -8,17 +8,18 @@ Bundles of skills, agents, hooks and MCP servers that you install from a marketp
- Intermediate: [Install and manage plugins](../intermediate/08-plugins.md)
- Advanced: [Share your setup with a team](../advanced/06-share-your-setup.md)
-
-More of this topic's lessons and Electives are linked here as they are published.
+- Advanced Elective: [Testing and publishing a plugin](../advanced/electives/publish-a-plugin.md)
## Official docs
- [Plugins overview](https://code.claude.com/docs/en/plugins/overview)
- [Install and manage plugins](https://code.claude.com/docs/en/plugins/install)
- [Anthropic's marketplaces](https://code.claude.com/docs/en/plugins/anthropic-marketplaces)
+- [Test plugins with evals](https://code.claude.com/docs/en/plugin-evals)
+- [Publish and distribute a plugin](https://code.claude.com/docs/en/plugins/publish)
---
-<sub>Sources: [Plugins overview](https://code.claude.com/docs/en/plugins/overview) · [Install and manage plugins](https://code.claude.com/docs/en/plugins/install) · [Anthropic's marketplaces](https://code.claude.com/docs/en/plugins/anthropic-marketplaces)</sub>
+<sub>Sources: [Plugins overview](https://code.claude.com/docs/en/plugins/overview) · [Install and manage plugins](https://code.claude.com/docs/en/plugins/install) · [Anthropic's marketplaces](https://code.claude.com/docs/en/plugins/anthropic-marketplaces) · [Test plugins with evals](https://code.claude.com/docs/en/plugin-evals) · [Publish and distribute a plugin](https://code.claude.com/docs/en/plugins/publish)</sub>
<sub>Up: [Topics](README.md)</sub>
diff --git a/docs/topics/subagents-and-parallel-work.md b/docs/topics/subagents-and-parallel-work.md
index 856ca65..1384f21 100644
--- a/docs/topics/subagents-and-parallel-work.md
+++ b/docs/topics/subagents-and-parallel-work.md
@@ -10,19 +10,19 @@ Ways to split work across contexts and sessions: subagents, worktrees, dynamic w
- Advanced: [Parallel sessions with worktrees](../advanced/01-parallel-sessions.md)
- Advanced: [Choose an orchestration pattern](../advanced/02-orchestration-patterns.md)
- Advanced: [Run and save a dynamic workflow](../advanced/03-dynamic-workflows.md)
-
-More of this topic's lessons and Electives are linked here as they are published.
+- Advanced Electives: [Agent teams](../advanced/electives/agent-teams.md), [Agent view](../advanced/electives/agent-view.md)
## Official docs
- [Create custom subagents](https://code.claude.com/docs/en/sub-agents)
- [Run agents in parallel](https://code.claude.com/docs/en/agents)
+- [Manage multiple agents with agent view](https://code.claude.com/docs/en/agent-view)
- [Run parallel sessions with worktrees](https://code.claude.com/docs/en/worktrees)
- [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)
---
-<sub>Sources: [Create custom subagents](https://code.claude.com/docs/en/sub-agents) · [Run agents in parallel](https://code.claude.com/docs/en/agents) · [Run parallel sessions with worktrees](https://code.claude.com/docs/en/worktrees) · [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)</sub>
+<sub>Sources: [Create custom subagents](https://code.claude.com/docs/en/sub-agents) · [Run agents in parallel](https://code.claude.com/docs/en/agents) · [Manage multiple agents with agent view](https://code.claude.com/docs/en/agent-view) · [Run parallel sessions with worktrees](https://code.claude.com/docs/en/worktrees) · [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)</sub>
<sub>Up: [Topics](README.md)</sub>
diff --git a/examples/README.md b/examples/README.md
index 7f4be5d..d5b0134 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -20,3 +20,4 @@ Each example is listed here, with its lesson, platforms and test line, when the
- [`intermediate/06-subagents/`](intermediate/06-subagents/README.md): the read-only `code-reviewer` subagent, for [Delegate to a custom subagent](../docs/intermediate/06-subagents.md). Any platform. Tested in Claude Code v2.1.285 (stable) on macOS, 2026-10-06.
- [`intermediate/07-mcp/`](intermediate/07-mcp/README.md): Chrome DevTools MCP at project scope, pinned, with its data flows to Google and npm turned off, for [Connect a tool with MCP](../docs/intermediate/07-mcp.md). macOS, Linux and WSL 2, with Node.js and Chrome. Tested in Claude Code v2.1.285 (stable) on macOS, 2026-10-06.
- [`advanced/06-share-your-setup/`](advanced/06-share-your-setup/README.md): the `team-tools` marketplace, its `team-kit` plugin (the `onboard` skill and the read-only `config-reviewer` subagent) and the settings that share it, for [Share your setup with a team](../docs/advanced/06-share-your-setup.md). Any platform; its smoke test needs bash, jq and awk. Tested in Claude Code v2.1.285 (stable) on macOS, 2026-10-09.
+- [`advanced/electives/agent-teams/`](advanced/electives/agent-teams/README.md): the read-only `security-reviewer` and `test-reviewer` subagents, for the [Agent teams](../docs/advanced/electives/agent-teams.md) Elective. Any platform; its smoke test needs bash and awk. Tested in Claude Code v2.1.285 (stable) on macOS, 2026-10-09.