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 examples: a team marketplace kit and two reviewer subagents (#92)

Wesam Abousaid62e21d34cfc3
diff --git a/.github/scripts/fixtures/marketplace-manifest-under-examples/fixture.json b/.github/scripts/fixtures/marketplace-manifest-under-examples/fixture.json
new file mode 100644
index 0000000..de78fb5
--- /dev/null
+++ b/.github/scripts/fixtures/marketplace-manifest-under-examples/fixture.json
@@ -0,0 +1,5 @@
+{
+ "rule": "inertness",
+ "expect": "fail",
+ "about": "A marketplace manifest left at .claude-plugin/marketplace.json under examples/, which would let that folder be added as a marketplace by its path. Generated, never committed."
+}
diff --git a/.github/scripts/fixtures/marketplace-manifest-under-examples/generate.mjs b/.github/scripts/fixtures/marketplace-manifest-under-examples/generate.mjs
new file mode 100644
index 0000000..f37573d
--- /dev/null
+++ b/.github/scripts/fixtures/marketplace-manifest-under-examples/generate.mjs
@@ -0,0 +1,13 @@
+// Generated rather than committed: a committed manifest under fixtures/ would
+// itself be a marketplace file that the inertness rule doesn't scan.
+import { mkdirSync, writeFileSync } from 'node:fs';
+import { join } from 'node:path';
+
+export default function generate(root) {
+ const dir = join(root, 'examples', 'advanced', '06-share-your-setup', '.claude-plugin');
+ mkdirSync(dir, { recursive: true });
+ writeFileSync(
+ join(dir, 'marketplace.json'),
+ '{ "name": "team-tools", "owner": { "name": "Your team" }, "plugins": [{ "name": "team-kit", "source": "./plugins/team-kit" }] }\n',
+ );
+}
diff --git a/.github/scripts/fixtures/marketplace-manifest-under-examples/tree/README.md b/.github/scripts/fixtures/marketplace-manifest-under-examples/tree/README.md
new file mode 100644
index 0000000..ca69e6d
--- /dev/null
+++ b/.github/scripts/fixtures/marketplace-manifest-under-examples/tree/README.md
@@ -0,0 +1 @@
+# Fixture
diff --git a/.github/scripts/fixtures/plugin-agent-missing-name/fixture.json b/.github/scripts/fixtures/plugin-agent-missing-name/fixture.json
new file mode 100644
index 0000000..beacce3
--- /dev/null
+++ b/.github/scripts/fixtures/plugin-agent-missing-name/fixture.json
@@ -0,0 +1,5 @@
+{
+ "rule": "static-validation",
+ "expect": "fail",
+ "about": "An agent inside an example marketplace's plugin whose frontmatter has a description but no name."
+}
diff --git a/.github/scripts/fixtures/plugin-agent-missing-name/tree/examples/advanced/06-share-your-setup/plugins/team-kit/agents/config-reviewer.md b/.github/scripts/fixtures/plugin-agent-missing-name/tree/examples/advanced/06-share-your-setup/plugins/team-kit/agents/config-reviewer.md
new file mode 100644
index 0000000..48a66af
--- /dev/null
+++ b/.github/scripts/fixtures/plugin-agent-missing-name/tree/examples/advanced/06-share-your-setup/plugins/team-kit/agents/config-reviewer.md
@@ -0,0 +1,6 @@
+---
+description: Reviews the shared Claude Code configuration
+tools: Read, Grep, Glob
+---
+
+Review the shared configuration.
diff --git a/.github/scripts/fixtures/plugin-folder-at-root/fixture.json b/.github/scripts/fixtures/plugin-folder-at-root/fixture.json
new file mode 100644
index 0000000..8628239
--- /dev/null
+++ b/.github/scripts/fixtures/plugin-folder-at-root/fixture.json
@@ -0,0 +1,5 @@
+{
+ "rule": "inertness",
+ "expect": "fail",
+ "about": "A .claude-plugin/ folder at the repository root, which an owner/repo marketplace add reads. Generated, never committed."
+}
diff --git a/.github/scripts/fixtures/plugin-folder-at-root/generate.mjs b/.github/scripts/fixtures/plugin-folder-at-root/generate.mjs
new file mode 100644
index 0000000..4c2a511
--- /dev/null
+++ b/.github/scripts/fixtures/plugin-folder-at-root/generate.mjs
@@ -0,0 +1,13 @@
+// Generated rather than committed: a committed manifest under fixtures/ would
+// itself be a marketplace file that the inertness rule doesn't scan.
+import { mkdirSync, writeFileSync } from 'node:fs';
+import { join } from 'node:path';
+
+export default function generate(root) {
+ const dir = join(root, '.claude-plugin');
+ mkdirSync(dir, { recursive: true });
+ writeFileSync(
+ join(dir, 'marketplace.json'),
+ '{ "name": "guide-tools", "owner": { "name": "Guide" }, "plugins": [{ "name": "team-kit", "source": "./examples/advanced/06-share-your-setup/plugins/team-kit" }] }\n',
+ );
+}
diff --git a/.github/scripts/fixtures/plugin-folder-at-root/tree/README.md b/.github/scripts/fixtures/plugin-folder-at-root/tree/README.md
new file mode 100644
index 0000000..ca69e6d
--- /dev/null
+++ b/.github/scripts/fixtures/plugin-folder-at-root/tree/README.md
@@ -0,0 +1 @@
+# Fixture
diff --git a/.github/scripts/fixtures/plugin-skill-missing-description/fixture.json b/.github/scripts/fixtures/plugin-skill-missing-description/fixture.json
new file mode 100644
index 0000000..4c3d213
--- /dev/null
+++ b/.github/scripts/fixtures/plugin-skill-missing-description/fixture.json
@@ -0,0 +1,5 @@
+{
+ "rule": "static-validation",
+ "expect": "fail",
+ "about": "A skill inside an example marketplace's plugin whose frontmatter has a name but no description."
+}
diff --git a/.github/scripts/fixtures/plugin-skill-missing-description/tree/examples/advanced/06-share-your-setup/plugins/team-kit/skills/onboard/SKILL.md b/.github/scripts/fixtures/plugin-skill-missing-description/tree/examples/advanced/06-share-your-setup/plugins/team-kit/skills/onboard/SKILL.md
new file mode 100644
index 0000000..f5c9047
--- /dev/null
+++ b/.github/scripts/fixtures/plugin-skill-missing-description/tree/examples/advanced/06-share-your-setup/plugins/team-kit/skills/onboard/SKILL.md
@@ -0,0 +1,5 @@
+---
+name: onboard
+---
+
+Explain the shared setup.
diff --git a/.github/scripts/fixtures/renamed-marketplace-under-examples/fixture.json b/.github/scripts/fixtures/renamed-marketplace-under-examples/fixture.json
new file mode 100644
index 0000000..d100e88
--- /dev/null
+++ b/.github/scripts/fixtures/renamed-marketplace-under-examples/fixture.json
@@ -0,0 +1,5 @@
+{
+ "rule": "inertness,static-validation",
+ "expect": "pass",
+ "about": "An example team marketplace whose manifest sits in dot-claude-plugin/, with a plugin that keeps its own .claude-plugin/plugin.json and a skill and an agent with valid frontmatter."
+}
diff --git a/.github/scripts/fixtures/renamed-marketplace-under-examples/tree/examples/advanced/06-share-your-setup/dot-claude-plugin/marketplace.json b/.github/scripts/fixtures/renamed-marketplace-under-examples/tree/examples/advanced/06-share-your-setup/dot-claude-plugin/marketplace.json
new file mode 100644
index 0000000..7334304
--- /dev/null
+++ b/.github/scripts/fixtures/renamed-marketplace-under-examples/tree/examples/advanced/06-share-your-setup/dot-claude-plugin/marketplace.json
@@ -0,0 +1,5 @@
+{
+ "name": "team-tools",
+ "owner": { "name": "Your team" },
+ "plugins": [{ "name": "team-kit", "source": "./plugins/team-kit" }]
+}
diff --git a/.github/scripts/fixtures/renamed-marketplace-under-examples/tree/examples/advanced/06-share-your-setup/plugins/team-kit/.claude-plugin/plugin.json b/.github/scripts/fixtures/renamed-marketplace-under-examples/tree/examples/advanced/06-share-your-setup/plugins/team-kit/.claude-plugin/plugin.json
new file mode 100644
index 0000000..4cf12ac
--- /dev/null
+++ b/.github/scripts/fixtures/renamed-marketplace-under-examples/tree/examples/advanced/06-share-your-setup/plugins/team-kit/.claude-plugin/plugin.json
@@ -0,0 +1 @@
+{ "name": "team-kit", "version": "0.1.0" }
diff --git a/.github/scripts/fixtures/renamed-marketplace-under-examples/tree/examples/advanced/06-share-your-setup/plugins/team-kit/agents/config-reviewer.md b/.github/scripts/fixtures/renamed-marketplace-under-examples/tree/examples/advanced/06-share-your-setup/plugins/team-kit/agents/config-reviewer.md
new file mode 100644
index 0000000..9a9885e
--- /dev/null
+++ b/.github/scripts/fixtures/renamed-marketplace-under-examples/tree/examples/advanced/06-share-your-setup/plugins/team-kit/agents/config-reviewer.md
@@ -0,0 +1,7 @@
+---
+name: config-reviewer
+description: Reviews the shared Claude Code configuration
+tools: Read, Grep, Glob
+---
+
+Review the shared configuration.
diff --git a/.github/scripts/fixtures/renamed-marketplace-under-examples/tree/examples/advanced/06-share-your-setup/plugins/team-kit/skills/onboard/SKILL.md b/.github/scripts/fixtures/renamed-marketplace-under-examples/tree/examples/advanced/06-share-your-setup/plugins/team-kit/skills/onboard/SKILL.md
new file mode 100644
index 0000000..b4c2042
--- /dev/null
+++ b/.github/scripts/fixtures/renamed-marketplace-under-examples/tree/examples/advanced/06-share-your-setup/plugins/team-kit/skills/onboard/SKILL.md
@@ -0,0 +1,6 @@
+---
+name: onboard
+description: Explains the team's shared Claude Code setup
+---
+
+Explain the shared setup.
diff --git a/.github/scripts/rules/inertness.mjs b/.github/scripts/rules/inertness.mjs
index 7fd6440..caff311 100644
--- a/.github/scripts/rules/inertness.mjs
+++ b/.github/scripts/rules/inertness.mjs
@@ -2,6 +2,14 @@
// no .claude/ folder, .mcp.json, CLAUDE.md, CLAUDE.local.md or AGENTS.md.
// Examples use dot-claude/, dot-mcp.json and CLAUDE.example.md instead. The
// folder is read from disk, so files git ignores are caught too.
+//
+// Nor can an example folder or the guide repository be added as a plugin
+// marketplace by its folder path or as owner/repo. A plugin's own
+// .claude-plugin/plugin.json may stay under examples/: Claude Code doesn't
+// scan a project's .claude/plugins/, and examples/ holds no .claude/skills/.
+// A marketplace manifest goes in dot-claude-plugin/ instead of .claude-plugin/,
+// and the root holds no .claude-plugin/ folder, which an owner/repo
+// marketplace add reads.
import { existsSync, readdirSync, statSync } from 'node:fs';
import { join } from 'node:path';
@@ -15,14 +23,22 @@ function walk(root, rel, out) {
for (const entry of readdirSync(join(root, rel))) {
const path = `${rel}/${entry}`;
if (LIVE.has(entry)) out.push(`${path}: Claude Code can load this; rename it to ${RENAME[entry]}`);
- else if (statSync(join(root, path)).isDirectory()) walk(root, path, out);
+ else if (statSync(join(root, path)).isDirectory()) {
+ if (entry === '.claude-plugin' && existsSync(join(root, path, 'marketplace.json'))) {
+ out.push(`${path}/marketplace.json: a marketplace manifest here lets this folder be added as a plugin marketplace by its path; rename the folder to dot-claude-plugin/`);
+ }
+ walk(root, path, out);
+ }
}
return out;
}
export function run(ctx) {
- if (!existsSync(join(ctx.root, 'examples'))) return { status: 'pass', summary: 'no examples/ folder' };
- const problems = walk(ctx.root, 'examples', []);
+ const problems = [];
+ if (existsSync(join(ctx.root, '.claude-plugin'))) {
+ problems.push('.claude-plugin/: an owner/repo marketplace add reads this folder at the repository root; keep marketplace examples under examples/, in dot-claude-plugin/');
+ }
+ if (existsSync(join(ctx.root, 'examples'))) walk(ctx.root, 'examples', problems);
if (problems.length) return { status: 'fail', problems };
- return { status: 'pass', summary: 'examples/ is inert' };
+ return { status: 'pass', summary: existsSync(join(ctx.root, 'examples')) ? 'examples/ is inert' : 'no examples/ folder' };
}
diff --git a/.github/scripts/rules/static-validation.mjs b/.github/scripts/rules/static-validation.mjs
index e11c3fb..0fd5807 100644
--- a/.github/scripts/rules/static-validation.mjs
+++ b/.github/scripts/rules/static-validation.mjs
@@ -7,7 +7,9 @@
// different answers on different Node versions);
// - shell scripts pass bash -n and shellcheck.
// This covers the live .claude/ folder and the inert dot-claude/ folders
-// under examples/ alike.
+// under examples/ alike, and the skills and agents of the plugins in an
+// example marketplace: examples/**/plugins/<name>/skills/<skill>/SKILL.md and
+// examples/**/plugins/<name>/agents/<agent>.md.
import { spawnSync } from 'node:child_process';
import { join } from 'node:path';
import { readText } from '../lib/tree.mjs';
@@ -16,8 +18,8 @@ import { frontmatter, parseYaml } from '../lib/yaml.mjs';
export const id = 'static-validation';
export const modes = ['pr', 'release'];
-const SKILL = /(^|\/)(\.claude|dot-claude)\/skills\/[^/]+\/SKILL\.md$/;
-const AGENT = /(^|\/)(\.claude|dot-claude)\/agents\/[^/]+\.md$/;
+const SKILL = /(^|\/)(\.claude|dot-claude)\/skills\/[^/]+\/SKILL\.md$|^examples\/(.+\/)?plugins\/[^/]+\/skills\/[^/]+\/SKILL\.md$/;
+const AGENT = /(^|\/)(\.claude|dot-claude)\/agents\/[^/]+\.md$|^examples\/(.+\/)?plugins\/[^/]+\/agents\/[^/]+\.md$/;
const WORKFLOW = /(^|\/)(\.claude|dot-claude)\/workflows\/[^/]+\.m?js$/;
const SHEBANG = /^#!\s*\/(usr\/)?bin\/(env\s+)?(ba)?sh\b/;
diff --git a/.github/scripts/test/harness.mjs b/.github/scripts/test/harness.mjs
index 78fa175..df44318 100644
--- a/.github/scripts/test/harness.mjs
+++ b/.github/scripts/test/harness.mjs
@@ -3,8 +3,8 @@
// A fixture folder holds fixture.json, tree/ (the head state), an optional
// base/ (the state before the change, for diff-scoped rules) and an optional
// generate.mjs. generate.mjs writes files that would be live Claude Code
-// config if they were committed (.claude/, CLAUDE.md, AGENTS.md, .mcp.json),
-// so they exist only in the temporary copy.
+// config if they were committed (.claude/, CLAUDE.md, AGENTS.md, .mcp.json,
+// a .claude-plugin/marketplace.json), so they exist only in the temporary copy.
import { cpSync, existsSync, mkdtempSync, readdirSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, dirname } from 'node:path';
diff --git a/AGENTS.md b/AGENTS.md
index 8537309..26b2503 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -35,7 +35,7 @@ Before you write or change one, fetch the Tier 1 source for its domain:
## Examples
-Learner examples live under `examples/<level>/<NN-lesson>/`, never at a path Claude Code loads on its own: use `dot-claude/`, `dot-mcp.json`, `CLAUDE.example.md` and `AGENTS.example.md`. Every executable example follows the [safety contract](CONTRIBUTING.md#adding-a-skill): (1) it runs only once copied into a project; (2) local only, with no network calls or keys, except the MCP lesson's pinned server; (3) it captures no transcripts and logs no tool input or output; (4) least privilege, with a `Read` deny rule for `.env` and no `Write`, `Edit` or broad `Bash(x:*)` allow rules; (5) a header block, including its test line; (6) a POSIX shell with only bash, jq, python3's standard library and git; (7) a smoke test that runs without Claude. The root `.claude/` is maintainer tooling: add nothing there.
+Learner examples live under `examples/<level>/<NN-lesson>/`, never at a path Claude Code loads on its own: use `dot-claude/`, `dot-mcp.json`, `CLAUDE.example.md` and `AGENTS.example.md`. A marketplace manifest goes in `dot-claude-plugin/`, so neither the example's folder nor the guide repository can be added as a marketplace by its folder path or as `owner/repo`; a plugin keeps its own `.claude-plugin/plugin.json`, since Claude Code doesn't scan `.claude/plugins/` and `examples/` holds no `.claude/skills/`. Every executable example follows the [safety contract](CONTRIBUTING.md#adding-a-skill): (1) it runs only once copied into a project; (2) local only, with no network calls or keys, except the MCP lesson's pinned server; (3) it captures no transcripts and logs no tool input or output; (4) least privilege, with a `Read` deny rule for `.env` and no `Write`, `Edit` or broad `Bash(x:*)` allow rules; (5) a header block, including its test line; (6) a POSIX shell with only bash, jq, python3's standard library and git; (7) a smoke test that runs without Claude. The root `.claude/` is maintainer tooling: add nothing there.
## Listings
diff --git a/CLAUDE.md b/CLAUDE.md
index 68ef1b1..51420b3 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -3,4 +3,4 @@
## Claude Code notes
- When you edit this guide, load the bundled `/claude-api` skill before you state a model fact, then confirm the fact on its Tier 1 source from the table in `AGENTS.md`. The guide states no prices or plan limits.
-- This repo's root `.claude/` holds no hooks and no allow rules: only a deny rule for reading `.env` files, a skill and a workflow ([SECURITY.md](SECURITY.md)). `examples/` is inert until copied; review every file before copying it. Never add a `.claude/`, `CLAUDE.md`, `AGENTS.md` or `.mcp.json` under `examples/`.
+- This repo's root `.claude/` holds no hooks and no allow rules: only a deny rule for reading `.env` files, a skill and a workflow ([SECURITY.md](SECURITY.md)). `examples/` is inert until copied; review every file before copying it. Never add a `.claude/`, `CLAUDE.md`, `AGENTS.md`, `.mcp.json` or `.claude-plugin/marketplace.json` under `examples/`: a marketplace manifest goes in `dot-claude-plugin/`, so neither the example's folder nor this repo can be added as a plugin marketplace by its folder path or as `owner/repo`.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c588f82..7118945 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -220,7 +220,7 @@ It needs Node.js LTS, git, Ruby (for YAML), jq (for the examples' smoke tests),
| `images` | An image lacks alt text, a Mermaid block lacks its accessibility lines, or a file under `assets/` breaks the naming, reference or size rules |
| `lesson-lint` | A lesson or Elective breaks the [lesson anatomy](#lessons) |
| `static-validation` | JSON, YAML, skill or agent frontmatter, a workflow script or a shell script does not parse or lint |
-| `inertness` | `examples/` holds a path Claude Code can load on its own |
+| `inertness` | `examples/` holds a path Claude Code can load on its own, or a marketplace manifest not renamed to `dot-claude-plugin/`, or the repository root holds a `.claude-plugin/` folder |
| `smoke-tests` | An example's `test.sh` fails (only when the change touches `examples/`) |
Each rule has known-bad fixtures under `.github/scripts/fixtures/`, one folder per case: `fixture.json` names the rule and the expected result, `tree/` holds the files, `base/` the state before a change, and `generate.mjs` writes anything that would be live Claude Code config if committed. If you change a rule, run the self-test too:
@@ -343,7 +343,7 @@ This keeps inbound links from social posts working even after restructures.
## Adding a skill
-Learner examples go under `examples/<level>/<NN-lesson>/` (an Elective's under `examples/<level>/electives/<name>/`), in the folder of the lesson that uses them. Each folder mirrors the project layout, but nothing in it may sit at a path Claude Code discovers on its own: use `dot-claude/` for `.claude/`, `dot-mcp.json` for `.mcp.json`, and `CLAUDE.example.md` and `AGENTS.example.md` for `CLAUDE.md` and `AGENTS.md`. A skill goes in `dot-claude/skills/<name>/SKILL.md`, which means "copy to `.claude/skills/<name>/SKILL.md` in your project", where Claude Code loads project skills. A real `.claude/` folder there would not stay inert: Claude Code loads skills from a nested `.claude/skills/` once Claude works on files in that folder ([Skills](https://code.claude.com/docs/en/skills#where-skills-live)).
+Learner examples go under `examples/<level>/<NN-lesson>/` (an Elective's under `examples/<level>/electives/<name>/`), in the folder of the lesson that uses them. Each folder mirrors the project layout, but nothing in it may sit at a path Claude Code discovers on its own: use `dot-claude/` for `.claude/`, `dot-mcp.json` for `.mcp.json`, and `CLAUDE.example.md` and `AGENTS.example.md` for `CLAUDE.md` and `AGENTS.md`. A skill goes in `dot-claude/skills/<name>/SKILL.md`, which means "copy to `.claude/skills/<name>/SKILL.md` in your project", where Claude Code loads project skills. A real `.claude/` folder there would not stay inert: Claude Code loads skills from a nested `.claude/skills/` once Claude works on files in that folder ([Skills](https://code.claude.com/docs/en/skills#where-skills-live)). A plugin keeps its own `.claude-plugin/plugin.json`, because Claude Code doesn't discover a plugin under `examples/` on its own: it doesn't scan a project's `.claude/plugins/` directory, and `examples/` holds no `.claude/skills/` ([Plugin loading reference](https://code.claude.com/docs/en/plugins/loading#plugins-shared-through-a-repository)). A marketplace manifest goes in `dot-claude-plugin/marketplace.json`, which means "copy to `.claude-plugin/marketplace.json`", so neither the example's folder nor the guide repository can be added as a marketplace by its folder path or as `owner/repo` ([Marketplace reference](https://code.claude.com/docs/en/plugins/marketplace-reference#marketplace-file)).
Every executable example (hook, script, workflow, settings snippet, skill with `allowed-tools`, plugin) meets this safety contract:
@@ -363,4 +363,4 @@ The root `.claude/` is reserved for maintainer tooling. Do not add skills or oth
By contributing, you agree your contributions are licensed under the MIT license (see [`LICENSE`](LICENSE)).
-Sources: [Extend Claude with skills](https://code.claude.com/docs/en/skills), [Advanced setup](https://code.claude.com/docs/en/setup), [Environment variables](https://code.claude.com/docs/en/env-vars), [Settings](https://code.claude.com/docs/en/settings), [Output styles](https://code.claude.com/docs/en/output-styles), [Your first day in Claude Code](https://support.claude.com/en/articles/14552382-your-first-day-in-claude-code), [The MCP Registry](https://modelcontextprotocol.io/registry/about), [official plugin `marketplace.json`](https://github.com/anthropics/claude-plugins-official/blob/main/.claude-plugin/marketplace.json), [Basic writing and formatting syntax](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax), [Disabling and enabling a workflow](https://docs.github.com/en/actions/how-tos/manage-workflow-runs/disable-and-enable-workflows), [REST API endpoints for repository traffic](https://docs.github.com/en/rest/metrics/traffic)
+Sources: [Extend Claude with skills](https://code.claude.com/docs/en/skills), [Plugin loading reference](https://code.claude.com/docs/en/plugins/loading), [Marketplace reference](https://code.claude.com/docs/en/plugins/marketplace-reference), [Advanced setup](https://code.claude.com/docs/en/setup), [Environment variables](https://code.claude.com/docs/en/env-vars), [Settings](https://code.claude.com/docs/en/settings), [Output styles](https://code.claude.com/docs/en/output-styles), [Your first day in Claude Code](https://support.claude.com/en/articles/14552382-your-first-day-in-claude-code), [The MCP Registry](https://modelcontextprotocol.io/registry/about), [official plugin `marketplace.json`](https://github.com/anthropics/claude-plugins-official/blob/main/.claude-plugin/marketplace.json), [Basic writing and formatting syntax](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax), [Disabling and enabling a workflow](https://docs.github.com/en/actions/how-tos/manage-workflow-runs/disable-and-enable-workflows), [REST API endpoints for repository traffic](https://docs.github.com/en/rest/metrics/traffic)
diff --git a/examples/README.md b/examples/README.md
index f5cdded..c90d911 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -6,7 +6,8 @@ Nothing here runs on its own. Files that Claude Code would load from a project c
- `dot-claude/` becomes `.claude/` in your project;
- `dot-mcp.json` becomes `.mcp.json`;
-- `CLAUDE.example.md` becomes `CLAUDE.md`, and `AGENTS.example.md` becomes `AGENTS.md`.
+- `CLAUDE.example.md` becomes `CLAUDE.md`, and `AGENTS.example.md` becomes `AGENTS.md`;
+- `dot-claude-plugin/` becomes `.claude-plugin/` in a copied marketplace folder. Its marketplace manifest is renamed so neither the marketplace's folder nor this guide's repository can be added as a plugin marketplace by its folder path or as `owner/repo` ([Marketplace reference](https://code.claude.com/docs/en/plugins/marketplace-reference#marketplace-file)). A plugin keeps its own `.claude-plugin/plugin.json`, because Claude Code doesn't discover a plugin here on its own: it doesn't scan a project's `.claude/plugins/` directory, and nothing here sits in a `.claude/skills/` folder ([Plugin loading reference](https://code.claude.com/docs/en/plugins/loading#plugins-shared-through-a-repository)).
Every executable example follows the guide's [safety contract](../CONTRIBUTING.md#adding-a-skill). Its header says what it does, when it runs, how to remove it, and whether it was tested in a Claude Code session at this edition's version. Review each file before you copy it into a project.
diff --git a/examples/advanced/06-share-your-setup/README.md b/examples/advanced/06-share-your-setup/README.md
new file mode 100644
index 0000000..6e45498
--- /dev/null
+++ b/examples/advanced/06-share-your-setup/README.md
@@ -0,0 +1,69 @@
+# Team marketplace for Advanced lesson 6
+
+`team-tools`, a demo team marketplace for the Advanced lesson "Share your setup with a team". It lists one plugin, `team-kit`, made of a skill, `onboard`, that tells Claude to read files only, and a read-only subagent, `config-reviewer`. Committed to your repository with the settings below, it loads for each teammate who clones the repository and trusts the folder, with no install command ([Manage Claude Code plugins for your organization](https://code.claude.com/docs/en/plugins/org#require-plugins-per-repository)).
+
+## Copy it
+
+From your repository's root, copy this folder as `team-marketplace/`, then give the marketplace file its real folder name. Claude Code reads a marketplace from `.claude-plugin/marketplace.json` ([Create a marketplace](https://code.claude.com/docs/en/plugins/create-marketplace)); this guide ships the file in `dot-claude-plugin/`, so neither this folder nor the guide's repository can be added as a marketplace by its folder path or as `owner/repo`.
+
+```bash
+cp -R <path-to-this-folder> team-marketplace
+mv team-marketplace/dot-claude-plugin team-marketplace/.claude-plugin
+```
+
+Register only your copy as a marketplace: never this folder, the path to its `dot-claude-plugin/marketplace.json`, the guide's repository or a raw file URL from it.
+
+## Validate it
+
+```bash
+claude plugin validate ./team-marketplace
+claude plugin validate ./team-marketplace/plugins/team-kit --strict
+```
+
+The first run checks the marketplace file and its entries. The second checks the plugin's manifest and opens its skill and agent files, which a marketplace run doesn't; `--strict` fails on warnings too ([Plugin commands reference](https://code.claude.com/docs/en/plugins/cli-reference#validate-a-directory)). Each run ends with `Validation passed` and exits 0.
+
+## Share it with the team
+
+Merge `settings.snippet.json` into your repository's `.claude/settings.json`, beside the keys already there. If the file already has a `permissions` deny list, add the rule to it instead of replacing it. Write the marketplace path relative to the repository root, as here:
+
+```json
+"permissions": { "deny": ["Read(.env)"] },
+"extraKnownMarketplaces": {
+ "team-tools": { "source": { "source": "directory", "path": "./team-marketplace" } }
+},
+"enabledPlugins": { "team-kit@team-tools": true }
+```
+
+Then commit `team-marketplace/` and `.claude/settings.json`.
+
+`settings.snippet.json`:
+- **What:** declares the `team-tools` marketplace by a relative `directory` path and turns on `team-kit@team-tools`, plus a `Read(.env)` deny rule. A relative path resolves against the repository's main checkout, so each clone finds its own copy and its worktrees share it ([Manage Claude Code plugins for your organization](https://code.claude.com/docs/en/plugins/org#require-plugins-per-repository)).
+- **When:** Claude Code registers the marketplace only after a teammate accepts the workspace trust dialog for the folder; in a folder they haven't trusted, including a `-p` run there, it ignores the entry without a message ([All settings](https://code.claude.com/docs/en/settings-reference#extraknownmarketplaces)). A plugin the marketplace lists by a relative path then loads from the marketplace folder, with no install record ([Plugin loading reference](https://code.claude.com/docs/en/plugins/loading#enabled-in-project-settings-but-not-installed)).
+- **Side effects:** none of its own; the plugin's are below.
+- **Requires:** Claude Code, and this folder copied to `team-marketplace/` at the repository root. Platforms: any.
+- **Remove:** see [Remove it](#remove-it).
+
+`dot-claude-plugin/marketplace.json` and `plugins/team-kit/.claude-plugin/plugin.json`:
+- **What:** a marketplace, `team-tools`, that lists `team-kit` by the relative path `./plugins/team-kit`, and the plugin's manifest, `team-kit` at version `0.1.0`. The entry name and the manifest name are the same, as the docs ask ([Create a marketplace](https://code.claude.com/docs/en/plugins/create-marketplace#keep-the-entry-name-and-the-manifest-name-the-same)).
+- **When:** in a session where the plugin is enabled, `/team-kit:onboard` runs the skill ([Add components to a plugin](https://code.claude.com/docs/en/plugins/components#skills)), and `@agent-team-kit:config-reviewer` runs the subagent ([Create custom subagents](https://code.claude.com/docs/en/sub-agents#invoke-subagents-explicitly)). Claude can also use either one when your request matches its description.
+- **Side effects:** none. The plugin has no hooks, monitors, MCP or LSP servers or `bin/` folder, so nothing in it runs code, and its skill pre-approves no tools with `allowed-tools`; its skill and subagent enter Claude's context as instructions ([Plugin security and trust](https://code.claude.com/docs/en/plugins/security#understand-what-a-plugin-can-do)). The subagent's only tools are Read, Grep and Glob. The skill and the subagent carry their own header blocks, as comments at the top of their frontmatter.
+- **Requires:** Claude Code. Platforms: any; `test.sh` needs bash, jq and awk (macOS, Linux and WSL 2).
+- **Remove:** see [Remove it](#remove-it).
+
+To try the plugin yourself before you commit anything, load it for one session with `claude --plugin-dir ./team-marketplace/plugins/team-kit`; nothing is written to your settings for it ([Create a Claude Code plugin](https://code.claude.com/docs/en/plugins/create#develop-without-a-marketplace)).
+
+> [!WARNING]
+> A team plugin runs with each teammate's own rights. A plugin can execute arbitrary code on your machine with your user privileges, and its hooks and MCP servers run outside the sandbox ([Plugin security and trust](https://code.claude.com/docs/en/plugins/security)). This one carries neither, but anyone who can change `team-marketplace/` can add them, so review changes to that folder as you review code.
+
+## Remove it
+
+1. At the repository root, run `claude plugin marketplace remove team-tools --scope project`. It removes the marketplace from `.claude/settings.json`, and when no other settings scope declares it, Claude Code also deletes its cache and uninstalls any plugin you installed from it ([Plugin commands reference](https://code.claude.com/docs/en/plugins/cli-reference#plugin-marketplace-remove)).
+2. Delete the `team-kit@team-tools` entry under `enabledPlugins` in `.claude/settings.json` and the `team-marketplace/` folder, then commit.
+
+To turn the plugin off for yourself alone, set `"team-kit@team-tools": false` in `.claude/settings.local.json` ([All settings](https://code.claude.com/docs/en/settings-reference#enabledplugins)).
+
+Smoke test, without Claude: `bash test.sh`, from this folder or from your copy. It checks the files as shipped: once you add or move in your own components, or add a hook, MCP server or `bin/` folder, it may fail on purpose.
+
+Tested in Claude Code v2.1.285 (stable) on macOS, 2026-10-09
+
+Sources: [Manage Claude Code plugins for your organization](https://code.claude.com/docs/en/plugins/org), [Create a marketplace](https://code.claude.com/docs/en/plugins/create-marketplace), [Plugin commands reference](https://code.claude.com/docs/en/plugins/cli-reference), [All settings](https://code.claude.com/docs/en/settings-reference), [Plugin loading reference](https://code.claude.com/docs/en/plugins/loading), [Add components to a plugin](https://code.claude.com/docs/en/plugins/components), [Create custom subagents](https://code.claude.com/docs/en/sub-agents), [Plugin security and trust](https://code.claude.com/docs/en/plugins/security), [Create a Claude Code plugin](https://code.claude.com/docs/en/plugins/create)
diff --git a/examples/advanced/06-share-your-setup/dot-claude-plugin/marketplace.json b/examples/advanced/06-share-your-setup/dot-claude-plugin/marketplace.json
new file mode 100644
index 0000000..47b52da
--- /dev/null
+++ b/examples/advanced/06-share-your-setup/dot-claude-plugin/marketplace.json
@@ -0,0 +1,14 @@
+{
+ "name": "team-tools",
+ "description": "A demo team marketplace from the Claude Code guide. Copy it into your own repository to share the team-kit plugin with everyone who clones it.",
+ "owner": {
+ "name": "Your team"
+ },
+ "plugins": [
+ {
+ "name": "team-kit",
+ "source": "./plugins/team-kit",
+ "description": "The team's shared Claude Code skills and subagents"
+ }
+ ]
+}
diff --git a/examples/advanced/06-share-your-setup/plugins/team-kit/.claude-plugin/plugin.json b/examples/advanced/06-share-your-setup/plugins/team-kit/.claude-plugin/plugin.json
new file mode 100644
index 0000000..04872ce
--- /dev/null
+++ b/examples/advanced/06-share-your-setup/plugins/team-kit/.claude-plugin/plugin.json
@@ -0,0 +1,8 @@
+{
+ "name": "team-kit",
+ "version": "0.1.0",
+ "description": "A team's shared Claude Code setup: an onboarding skill and a read-only reviewer for the shared configuration",
+ "author": {
+ "name": "Your team"
+ }
+}
diff --git a/examples/advanced/06-share-your-setup/plugins/team-kit/agents/config-reviewer.md b/examples/advanced/06-share-your-setup/plugins/team-kit/agents/config-reviewer.md
new file mode 100644
index 0000000..ca1f45d
--- /dev/null
+++ b/examples/advanced/06-share-your-setup/plugins/team-kit/agents/config-reviewer.md
@@ -0,0 +1,25 @@
+---
+# What: a plugin subagent that reviews a repository's shared Claude Code configuration and reports problems by severity. It can't edit files.
+# Runs: when Claude delegates a configuration review to it, or when you ask for it by name ("Use the team-kit:config-reviewer agent to ...", or @agent-team-kit:config-reviewer), in a session where the team-kit plugin is enabled.
+# Side effects: none. Its only tools are Read, Grep and Glob: it can read and search files, and can't edit them or run commands.
+# Requires: Claude Code. Platforms: any.
+# Remove: delete agents/config-reviewer.md from the team-kit plugin, or turn the plugin off.
+# Tested in Claude Code v2.1.285 (stable) on macOS, 2026-10-09
+name: config-reviewer
+description: Reviews the repository's shared Claude Code configuration (.claude/settings.json, CLAUDE.md, .claude/rules/, .mcp.json and the team marketplace) for allow rules that are too broad, secrets, personal settings that reached the repository and broken references, and reports findings by severity. Use before committing a change to the shared setup. Read-only.
+tools: Read, Grep, Glob
+model: inherit
+---
+
+You review a repository's shared Claude Code configuration. You never change files: you report what you find, and the main conversation decides what to fix.
+
+1. Read the shared files that exist: `.claude/settings.json`, `CLAUDE.md`, the files in `.claude/rules/`, `.mcp.json`, and each marketplace that `.claude/settings.json` declares by a local path, with the `plugin.json` and components of each plugin it lists. If your task names other files, read those too.
+2. Check for:
+ - permissions: allow rules broader than the team needs, such as a bare `Bash`, `Write` or `Edit`, or a `Bash` rule with a wildcard over a whole command family; and a missing `Read` deny rule for `.env`;
+ - secrets: keys, tokens or passwords in any of these files;
+ - personal settings in the repository: a `CLAUDE.local.md` that `.gitignore` doesn't list, or a path that exists only on one person's machine, such as one under a home folder;
+ - plugins: an `enabledPlugins` entry set to `true` whose marketplace no `extraKnownMarketplaces` entry declares, other than `claude-plugins-official` and the `@inline`, `@skills-dir` and `@synced` ids, which take no marketplace; a marketplace path that isn't relative; a marketplace entry whose relative-path `source` contains `..`; or an entry name that differs from the `name` in its plugin's `plugin.json`;
+ - hooks: a hook command that names a script missing from the repository.
+3. Report findings grouped as Must fix, Should fix and Consider. For each one give the file and line, the problem, and a concrete fix. If you find nothing, say so and say what you checked.
+
+Keep the report short: no praise and no summary of the files.
diff --git a/examples/advanced/06-share-your-setup/plugins/team-kit/skills/onboard/SKILL.md b/examples/advanced/06-share-your-setup/plugins/team-kit/skills/onboard/SKILL.md
new file mode 100644
index 0000000..2457bd0
--- /dev/null
+++ b/examples/advanced/06-share-your-setup/plugins/team-kit/skills/onboard/SKILL.md
@@ -0,0 +1,23 @@
+---
+# What: a plugin skill that explains a repository's shared Claude Code setup to a new teammate: what is committed and shared, what stays personal, and what the team-kit plugin adds.
+# Runs: when you type /team-kit:onboard, or when Claude matches your request to the description, in a session where the team-kit plugin is enabled.
+# Side effects: none intended. It tells Claude to read files only and change none; it pre-approves no tools, so each tool call follows your permission settings.
+# Requires: Claude Code. Platforms: any.
+# Remove: delete this skill's folder, skills/onboard/, from the team-kit plugin, or turn the plugin off.
+# Tested in Claude Code v2.1.285 (stable) on macOS, 2026-10-09
+name: onboard
+description: Explains this repository's shared Claude Code setup to a new teammate, covering what is committed and shared, what stays personal, and what the team-kit plugin adds. Use when someone asks how the team's Claude Code setup works or what they get by cloning the repository.
+---
+
+Explain this repository's shared Claude Code setup to a teammate who has just cloned it. Read files only; don't change any.
+
+1. Read the shared setup, skipping any file that doesn't exist:
+ - `.claude/settings.json`: permissions, hooks, and the marketplaces and plugins it turns on;
+ - `CLAUDE.md` and the files in `.claude/rules/`: the project's instructions to Claude;
+ - `.claude/skills/` and `.claude/agents/`: project skills and subagents;
+ - `.mcp.json`: project MCP servers;
+ - each marketplace that `.claude/settings.json` declares by a local path, and the skills and agents of the plugins it lists.
+2. Name the personal files, which each teammate keeps out of the repository: `.claude/settings.local.json`, `CLAUDE.local.md` and the user folder `~/.claude/`. Don't open them. Say whether the repository's `.gitignore` lists the first two.
+3. Report in three short sections: Shared with the team, Personal to you, and Added by team-kit. Give each file one line on what it does for the teammate. If a file you expected is missing, say so rather than guess what it would hold.
+
+Keep the report short and concrete: file names and what each one changes, no general advice.
diff --git a/examples/advanced/06-share-your-setup/settings.snippet.json b/examples/advanced/06-share-your-setup/settings.snippet.json
new file mode 100644
index 0000000..256c852
--- /dev/null
+++ b/examples/advanced/06-share-your-setup/settings.snippet.json
@@ -0,0 +1,13 @@
+{
+ "permissions": {
+ "deny": ["Read(.env)"]
+ },
+ "extraKnownMarketplaces": {
+ "team-tools": {
+ "source": { "source": "directory", "path": "./team-marketplace" }
+ }
+ },
+ "enabledPlugins": {
+ "team-kit@team-tools": true
+ }
+}
diff --git a/examples/advanced/06-share-your-setup/test.sh b/examples/advanced/06-share-your-setup/test.sh
new file mode 100644
index 0000000..8f149f9
--- /dev/null
+++ b/examples/advanced/06-share-your-setup/test.sh
@@ -0,0 +1,122 @@
+#!/usr/bin/env bash
+# Smoke test for the Advanced lesson 6 team marketplace, without Claude: the
+# marketplace file and each plugin manifest parse and follow the naming and
+# path rules from the plugin docs, the settings snippet declares the
+# marketplace by a relative path, turns its plugins on and denies Read(.env),
+# and each skill and subagent opens with valid frontmatter and a header test
+# line, pre-approves no tools and stays read-only.
+# It finds the marketplace file in dot-claude-plugin/, as this guide ships it,
+# or in .claude-plugin/, as in your copy. The last check is for the starter as
+# shipped: once you add a hook, MCP server or bin/ folder to your copy, it fails.
+# Run: bash test.sh (needs bash, jq and awk). Reads files only.
+set -euo pipefail
+cd "$(dirname "$0")"
+
+fail() { echo "FAIL: $*" >&2; exit 1; }
+# The frontmatter block: the lines between the opening --- on line 1 and the next ---.
+frontmatter() { awk 'NR == 1 { if ($0 != "---") exit 1; next } /^---$/ { exit } { print }' "$1"; }
+field() { frontmatter "$1" | awk -v key="$2" 'index($0, key ": ") == 1 { print substr($0, length(key) + 3) }'; }
+has_key() { frontmatter "$1" | grep -q "^$2:"; }
+lower() { tr '[:upper:]' '[:lower:]' <<<"$1"; }
+
+# Reserved marketplace names, copied in full from
+# https://code.claude.com/docs/en/plugins/marketplace-reference#reserved-names
+# on 2026-10-06. Names starting with claudeai- are reserved too (below).
+reserved=" claude-code-marketplace claude-code-plugins claude-plugins-official anthropic-marketplace
+ anthropic-plugins agent-skills anthropic-agent-skills life-sciences knowledge-work-plugins
+ claude-for-legal claude-for-financial-services financial-services-plugins first-party-plugins
+ claude-tag-plugins claude-community claude-plugins-community healthcare anthropic-plugin-directory
+ claude-plugin-directory inline builtin skills-dir synced claude-plugin-test npm pip uv cargo github gh "
+reserved=$(tr -s ' \n' ' ' <<<"$reserved")
+
+if [ -f .claude-plugin/marketplace.json ]; then
+ market=.claude-plugin/marketplace.json
+elif [ -f dot-claude-plugin/marketplace.json ]; then
+ market=dot-claude-plugin/marketplace.json
+else
+ fail "no marketplace file at .claude-plugin/marketplace.json or dot-claude-plugin/marketplace.json"
+fi
+
+# The marketplace file: required fields and a name Claude Code accepts.
+jq -e . "$market" > /dev/null || fail "$market is not valid JSON"
+name=$(jq -r '.name // ""' "$market")
+[[ "$name" =~ ^[A-Za-z0-9][A-Za-z0-9._-]*$ ]] || fail "marketplace name '$name' must use letters, digits, '.', '_' and '-' and start with a letter or digit"
+[[ "$name" != *..* ]] || fail "marketplace name '$name' contains '..'"
+# Compare case-insensitively, and catch another spelling of a reserved name:
+# a trailing dot, or a dot in place of a hyphen.
+spelled=$(lower "$name")
+spelled=${spelled%.}
+spelled=${spelled//./-}
+[[ "$reserved" != *" $spelled "* ]] || fail "marketplace name '$name' is reserved"
+[[ "$spelled" != claudeai-* ]] || fail "marketplace names starting with claudeai- are reserved"
+[ -n "$(jq -r '.owner.name // ""' "$market")" ] || fail "$market: owner.name is required"
+[ -n "$(jq -r '.description // ""' "$market")" ] || fail "$market: no description, which validation warns about"
+jq -e '.plugins | type == "array" and length > 0' "$market" > /dev/null || fail "$market lists no plugins"
+
+# The settings snippet: valid JSON, the .env deny rule, no allow rules, and the
+# marketplace declared by a relative directory path with its plugins turned on.
+snippet=settings.snippet.json
+jq -e . "$snippet" > /dev/null || fail "$snippet is not valid JSON"
+jq -e '.permissions.deny | index("Read(.env)")' "$snippet" > /dev/null || fail "$snippet has no Read(.env) deny rule"
+jq -e '(.permissions.allow // []) | length == 0' "$snippet" > /dev/null || fail "$snippet should add no allow rules"
+[ "$(jq -r --arg m "$name" '.extraKnownMarketplaces[$m].source.source // ""' "$snippet")" = directory ] ||
+ fail "$snippet does not declare '$name' as a directory marketplace"
+path=$(jq -r --arg m "$name" '.extraKnownMarketplaces[$m].source.path // ""' "$snippet")
+[[ "$path" == ./* && "$path" != *..* ]] || fail "$snippet: write the marketplace path relative to the repository root, such as ./team-marketplace, not '$path'"
+
+# Each plugin entry, its manifest, and its components.
+while IFS= read -r entry; do
+ [[ "$entry" =~ ^[A-Za-z0-9][A-Za-z0-9._-]*$ ]] || fail "plugin entry name '$entry' must use letters, digits, '.', '_' and '-'"
+ src=$(jq -r --arg e "$entry" '.plugins[] | select(.name == $e) | .source | strings' "$market")
+ [[ "$src" == ./* ]] || fail "$entry: source '$src' must be a relative path that starts with ./"
+ [[ "$src" != *..* ]] || fail "$entry: source '$src' contains '..'"
+ [[ "$src" != *\\* ]] || fail "$entry: source '$src' contains a backslash; use forward slashes"
+ plugin=${src#./}
+ manifest="$plugin/.claude-plugin/plugin.json"
+ [ -f "$manifest" ] || fail "$entry: no $manifest"
+ jq -e . "$manifest" > /dev/null || fail "$manifest is not valid JSON"
+ [ "$(jq -r '.name // ""' "$manifest")" = "$entry" ] || fail "$manifest: name must equal the marketplace entry name, $entry"
+ for key in description version author.name; do
+ [ -n "$(jq -r ".$key // \"\"" "$manifest")" ] || fail "$manifest: no $key, which --strict validation fails"
+ done
+ # A plugin name that passes or reads as one of Anthropic's own fails --strict validation.
+ [[ "$(lower "$entry")" != cc-plugin-* ]] || fail "plugin name '$entry' starts with cc-plugin-"
+ for word in $(lower "$entry" | tr -s '._-' ' '); do
+ case "$word" in claude | anthropic | anthropics) fail "plugin name '$entry' uses '$word', which fails plugin validation under --strict" ;; esac
+ done
+ [ "$(jq -r --arg id "$entry@$name" '.enabledPlugins[$id] // false' "$snippet")" = true ] || fail "$snippet does not turn on $entry@$name"
+
+ for skill in "$plugin"/skills/*/SKILL.md; do
+ [ -f "$skill" ] || continue
+ frontmatter "$skill" > /dev/null || fail "$skill does not start with ---"
+ [ -n "$(field "$skill" description)" ] || fail "$skill: no description"
+ frontmatter "$skill" | grep -q '^# Not yet tested\|^# Tested in Claude Code' || fail "$skill: no test line in its header"
+ ! has_key "$skill" allowed-tools || fail "$skill pre-approves tools with allowed-tools"
+ done
+
+ for agent in "$plugin"/agents/*.md; do
+ [ -f "$agent" ] || continue
+ frontmatter "$agent" > /dev/null || fail "$agent does not start with ---"
+ stem=$(basename "$agent" .md)
+ [ "$(field "$agent" name)" = "$stem" ] || fail "$agent: name must be $stem"
+ [ -n "$(field "$agent" description)" ] || fail "$agent: no description"
+ frontmatter "$agent" | grep -q '^# Not yet tested\|^# Tested in Claude Code' || fail "$agent: no test line in its header"
+ tools=$(field "$agent" tools)
+ [ -n "$tools" ] || fail "$agent: no single-line tools list, so it would inherit every tool"
+ while read -r tool; do
+ case "${tool%%(*}" in
+ Edit | Write | NotebookEdit | Bash | PowerShell | Monitor) fail "$agent can use $tool" ;;
+ esac
+ done < <(tr ',' '\n' <<<"$tools")
+ for key in hooks mcpServers permissionMode; do
+ ! has_key "$agent" "$key" || fail "$agent sets $key, which a plugin subagent ignores"
+ done
+ done
+
+ # The starter as shipped runs no code of its own.
+ for item in hooks .mcp.json .lsp.json bin monitors; do
+ [ ! -e "$plugin/$item" ] || fail "$plugin/$item: the starter plugin ships no hooks, MCP or LSP servers, bin/ or monitors/"
+ done
+done < <(jq -r '.plugins[].name' "$market")
+
+echo "PASS: Advanced lesson 6 team marketplace"
diff --git a/examples/advanced/electives/agent-teams/README.md b/examples/advanced/electives/agent-teams/README.md
new file mode 100644
index 0000000..3b6bb07
--- /dev/null
+++ b/examples/advanced/electives/agent-teams/README.md
@@ -0,0 +1,51 @@
+# Reviewer subagents for the agent teams Elective
+
+> [!NOTE]
+> Agent teams are experimental and disabled by default.
+
+Two read-only subagents for the Advanced Elective "Agent teams": `security-reviewer`, which looks for injection, unsafe input handling, exposed secrets and missing access checks, and `test-reviewer`, which looks for changed behavior without a test, tests that can't fail and missing edge cases. Each reports findings by severity. Their only tools are Read, Grep and Glob, so they can read and search files but can't edit them or run commands ([Create custom subagents](https://code.claude.com/docs/en/sub-agents#available-tools)). Without a shell they can't run `git diff`, so name the changed files in your prompt, or save the diff to a file first and name that file. Both run on Sonnet (`model: sonnet`).
+
+Copy them into `.claude/agents/` in your project:
+
+```bash
+mkdir -p .claude/agents
+cp <path-to-this-folder>/dot-claude/agents/*.md .claude/agents/
+```
+
+If `.claude/agents/` didn't exist when your session started, restart Claude Code so it sees the new folder ([Create custom subagents](https://code.claude.com/docs/en/sub-agents#write-subagent-files)). To confirm both loaded, run `/context`, which lists custom subagents with the source each loaded from ([Debug your configuration](https://code.claude.com/docs/en/debug-your-config)), or type `@` and find them in the typeahead.
+
+Each file's header block, as comments at the top of its frontmatter, says what it does, when it runs, its side effects, platforms, how to remove it, and its test line. In short:
+- **What:** two project subagents that review code changes, each through one lens, and change no files.
+- **Runs:** when Claude delegates a review to one of them, when you ask for one by name, or as a teammate's role when agent teams are on and a spawn prompt names its agent type.
+- **Side effects:** none. Read, Grep and Glob only.
+- **Requires:** Claude Code; for teammates, agent teams turned on and an interactive session. Platforms: any; `test.sh` needs bash and awk.
+- **Remove:** delete `.claude/agents/security-reviewer.md` and `.claude/agents/test-reviewer.md`.
+
+## As teammates
+
+Agent teams need `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` set to `1`, in your shell or under `env` in settings, and an interactive session: with `-p`, Claude doesn't spawn teammates ([Orchestrate teams of Claude Code sessions](https://code.claude.com/docs/en/agent-teams#enable-agent-teams)). For one session:
+
+```bash
+CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 claude
+```
+
+Then name the agent types in your spawn prompt, as the docs do:
+
+```text
+Spawn two teammates using the security-reviewer and test-reviewer agent types to review the changes in <the changed files, or your saved diff>. Have them each report findings.
+```
+
+Each teammate is limited to its definition's `tools` (an in-process teammate also gets the message and task tools Claude Code adds) and runs on its definition's `model` unless your spawn prompt names another; the docs list how the body and the other fields apply ([Use subagent definitions for teammates](https://code.claude.com/docs/en/agent-teams#use-subagent-definitions-for-teammates)).
+
+> [!WARNING]
+> While agent teams are on, a subagent that Claude names launches as a teammate, so a team can form when you didn't ask for one ([Enable agent teams](https://code.claude.com/docs/en/agent-teams#enable-agent-teams)). Teammates start with your permission mode, except `dontAsk`, and their permission prompts appear in your session for you to answer. If you run with `--dangerously-skip-permissions`, every teammate does too ([Permissions](https://code.claude.com/docs/en/agent-teams#permissions)).
+
+## As subagents, the cheap variant
+
+Agent teams use significantly more tokens than a single session ([Token usage](https://code.claude.com/docs/en/agent-teams#token-usage)). The same two files work as ordinary subagents in one session with agent teams off: ask `Use the security-reviewer agent to review <files>`, then the same for `test-reviewer`. Keep the variable unset for this, because with agent teams on, a subagent that Claude names launches as a teammate.
+
+Smoke test, without Claude: `bash test.sh`.
+
+Tested in Claude Code v2.1.285 (stable) on macOS, 2026-10-09
+
+Sources: [Orchestrate teams of Claude Code sessions](https://code.claude.com/docs/en/agent-teams), [Create custom subagents](https://code.claude.com/docs/en/sub-agents), [Debug your configuration](https://code.claude.com/docs/en/debug-your-config)
diff --git a/examples/advanced/electives/agent-teams/dot-claude/agents/security-reviewer.md b/examples/advanced/electives/agent-teams/dot-claude/agents/security-reviewer.md
new file mode 100644
index 0000000..1a7d57e
--- /dev/null
+++ b/examples/advanced/electives/agent-teams/dot-claude/agents/security-reviewer.md
@@ -0,0 +1,25 @@
+---
+# What: a project subagent that reviews code changes for security problems and reports findings by severity. It can't edit files.
+# Runs: when Claude delegates a security review to it, when you ask for it by name ("Use the security-reviewer agent to ..."), or as a teammate's role when agent teams are on and a spawn prompt names its agent type.
+# Side effects: none. Its only tools are Read, Grep and Glob: it can read and search files, and can't edit them or run commands.
+# Requires: Claude Code. Platforms: any.
+# Remove: delete .claude/agents/security-reviewer.md.
+# Tested in Claude Code v2.1.285 (stable) on macOS, 2026-10-09
+name: security-reviewer
+description: Reviews code changes for security problems (injection, unsafe input handling, exposed secrets, and missing authentication or authorization checks) and reports findings by severity. Use after changing code that handles input, credentials or access. Read-only; give it the changed files or a saved diff to review.
+tools: Read, Grep, Glob
+model: sonnet
+---
+
+You review code changes for security problems only. You never change files: you report what you find, and whoever gave you the task decides what to fix.
+
+1. Find the changes: the files or the saved diff named in your task. If your task names neither, say so and stop; you can't run git to find them.
+2. Read each changed file around the change, and follow the data it handles back to where it comes from and on to where it goes.
+3. Check for:
+ - injection: input that reaches a shell command, a database query, a file path or an HTML page without validation or escaping;
+ - input handling: missing checks on size, type or range, and error messages that reveal internal details;
+ - secrets: keys, tokens or passwords in code, configuration, tests or log output;
+ - authentication and authorization: an action that skips the check that should guard it, or trusts a value the caller controls.
+4. Report findings grouped as Must fix, Should fix and Consider. For each one give the file and line, the problem, how someone could exploit it, and a concrete fix. If you find nothing, say so and say what you checked.
+
+Leave test coverage, style and performance to other reviewers. Keep the report short: no praise and no summary of the diff.
diff --git a/examples/advanced/electives/agent-teams/dot-claude/agents/test-reviewer.md b/examples/advanced/electives/agent-teams/dot-claude/agents/test-reviewer.md
new file mode 100644
index 0000000..36edc18
--- /dev/null
+++ b/examples/advanced/electives/agent-teams/dot-claude/agents/test-reviewer.md
@@ -0,0 +1,24 @@
+---
+# What: a project subagent that reviews whether code changes are tested and reports gaps by severity. It can't edit files or run the tests.
+# Runs: when Claude delegates a test review to it, when you ask for it by name ("Use the test-reviewer agent to ..."), or as a teammate's role when agent teams are on and a spawn prompt names its agent type.
+# Side effects: none. Its only tools are Read, Grep and Glob: it can read and search files, and can't edit them or run commands.
+# Requires: Claude Code. Platforms: any.
+# Remove: delete .claude/agents/test-reviewer.md.
+# Tested in Claude Code v2.1.285 (stable) on macOS, 2026-10-09
+name: test-reviewer
+description: Reviews whether code changes are tested (changed behavior without a test, tests that can't fail, and missing edge cases) and reports gaps by severity. Use after changing code, before committing. Read-only; give it the changed files or a saved diff to review.
+tools: Read, Grep, Glob
+model: sonnet
+---
+
+You review the tests for code changes only. You never change files and can't run the tests: you report what you find, and whoever gave you the task decides what to fix.
+
+1. Find the changes: the files or the saved diff named in your task. If your task names neither, say so and stop; you can't run git to find them.
+2. For each changed behavior, find the tests that cover it: search the test files for the changed functions, routes and file names.
+3. Check for:
+ - changed behavior without a test, including a fixed bug with no test that would have caught it;
+ - tests that can't fail: no assertion, an assertion on a value the test set itself, or a mock that replaces the code under test;
+ - missing edge cases: empty, zero and very large inputs, error paths, and the boundaries the change touches.
+4. Report gaps grouped as Must fix, Should fix and Consider. For each one give the file and line, the gap, and the test to add, described in one line. If the coverage looks complete, say so and say what you checked.
+
+Leave security, style and performance to other reviewers. Keep the report short: no praise and no summary of the diff.
diff --git a/examples/advanced/electives/agent-teams/test.sh b/examples/advanced/electives/agent-teams/test.sh
new file mode 100644
index 0000000..c6318ed
--- /dev/null
+++ b/examples/advanced/electives/agent-teams/test.sh
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+# Smoke test for the agent teams Elective's reviewer subagents, without Claude:
+# each file opens with frontmatter that has the name and description Claude Code
+# requires, with the name matching its file name, and a header test line; its single-line
+# tools list leaves out Edit, Write, NotebookEdit, Bash, PowerShell and
+# Monitor; and it sets no hooks, mcpServers or permissionMode.
+# Run: bash test.sh (needs bash and awk). Reads files only.
+set -euo pipefail
+cd "$(dirname "$0")"
+
+fail() { echo "FAIL: $*" >&2; exit 1; }
+# The frontmatter block: the lines between the opening --- on line 1 and the next ---.
+frontmatter() { awk 'NR == 1 { if ($0 != "---") exit 1; next } /^---$/ { exit } { print }' "$1"; }
+field() { frontmatter "$1" | awk -v key="$2" 'index($0, key ": ") == 1 { print substr($0, length(key) + 3) }'; }
+has_key() { frontmatter "$1" | grep -q "^$2:"; }
+
+for name in security-reviewer test-reviewer; do
+ [ -f "dot-claude/agents/$name.md" ] || fail "dot-claude/agents/$name.md is missing"
+done
+
+for agent in dot-claude/agents/*.md; do
+ frontmatter "$agent" > /dev/null || fail "$agent does not start with ---"
+ stem=$(basename "$agent" .md)
+ name=$(field "$agent" name)
+ [ -n "$name" ] || fail "$agent: no name, so Claude Code would skip it"
+ [[ "$name" != *:* ]] || fail "$agent: a name with ':' is not loaded"
+ [ "$name" = "$stem" ] || fail "$agent: name is $name, expected $stem"
+ [ -n "$(field "$agent" description)" ] || fail "$agent: no description, so Claude Code would skip it"
+ frontmatter "$agent" | grep -q '^# Not yet tested\|^# Tested in Claude Code' || fail "$agent: no test line in its header"
+ tools=$(field "$agent" tools)
+ [ -n "$tools" ] || fail "$agent: no single-line tools list, so it would inherit every tool"
+ while read -r tool; do
+ case "${tool%%(*}" in
+ Edit | Write | NotebookEdit | Bash | PowerShell | Monitor) fail "$agent can use $tool" ;;
+ esac
+ done < <(tr ',' '\n' <<<"$tools")
+ for key in hooks mcpServers permissionMode; do
+ ! has_key "$agent" "$key" || fail "$agent sets $key; the reviewers stay read-only with no extra setup"
+ done
+done
+
+echo "PASS: agent teams reviewer subagents"