agent-templates 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADOPTING.md +57 -57
- package/CLAUDE.md +128 -125
- package/LICENSE +21 -21
- package/README.md +32 -32
- package/package.json +32 -32
- package/patterns/three-agent-architect-builder-reviewer/README.md +164 -153
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/agents/architect.md +31 -31
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/agents/builder.md +25 -25
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/agents/reviewer.md +33 -33
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/agents/triage.md +31 -31
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/breakdown-prd.md +18 -18
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/nightly-issues.md +14 -14
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/review-ticket.md +14 -14
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/start-all.md +17 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/start-milestone.md +15 -15
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/verify-delivery.md +20 -20
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/hooks/guard-main-session-writes.mjs +53 -53
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/scripts/milestone-dag.mjs +94 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/scripts/publish-tickets.mjs +263 -263
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/settings.json +15 -15
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/workflows/nightly-issues.js +141 -139
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/workflows/run-milestone.js +225 -223
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/workflows/start-all.js +120 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/INSTALL.md +65 -65
- package/patterns/three-agent-architect-builder-reviewer/scaffold/claude-md-snippet.md +38 -37
- package/scripts/adopt.mjs +207 -177
- package/scripts/build-site.mjs +366 -264
- package/scripts/cli.mjs +52 -52
- package/templates/pattern-README.template.md +65 -65
- package/templates/ticket.template.md +104 -104
- package/templates/tracker/github/ISSUE_TEMPLATE/bug-report.md +28 -28
- package/templates/tracker/github/ISSUE_TEMPLATE/decision-record.md +25 -25
- package/templates/tracker/github/ISSUE_TEMPLATE/task.md +36 -36
- package/templates/tracker/github/PULL_REQUEST_TEMPLATE.md +54 -54
- package/templates/tracker/gitlab/issue_templates/bug-report.md +23 -23
- package/templates/tracker/gitlab/issue_templates/decision-record.md +20 -20
- package/templates/tracker/gitlab/issue_templates/task.md +31 -31
- package/templates/tracker/gitlab/merge_request_templates/default.md +55 -55
package/ADOPTING.md
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
# Adopting a pattern
|
|
2
|
-
|
|
3
|
-
How to apply a pattern from this catalog to a **new** project (even a folder holding nothing but a `PRD.md`) or an **existing** one.
|
|
4
|
-
|
|
5
|
-
## 0. Pick the pattern
|
|
6
|
-
|
|
7
|
-
Check the index in [README.md](README.md), then the pattern's own §1 **When to use / when not to use** — take the "not" side seriously. Check the pattern's expiry trigger (metadata table); do not copy an expired model/effort table without re-verifying it.
|
|
8
|
-
|
|
9
|
-
## 1. Install — one command
|
|
10
|
-
|
|
11
|
-
From the public npm registry (anonymous, works for anyone):
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
npx agent-templates@latest adopt three-agent-architect-builder-reviewer C:\path\to\your-project
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Pin an exact version for reproducibility (`npx agent-templates@0.1.0 …`) — a published version is a verified snapshot of the catalog's recommendations. Alternatives: `npx github:Ruihang2017/agent-templates …` (tracks the repo, no release needed; npx caches git installs — `--prefer-online` picks up updates), or from a checkout: `node scripts/adopt.mjs three-agent-architect-builder-reviewer <target-dir>`.
|
|
18
|
-
|
|
19
|
-
Idempotent (re-runs skip what exists; `--force` overwrites). It installs the scaffold `.claude/` (agents with pinned model/effort, stage commands, write guard, workflows, publish script), the universal `templates/ticket.template.md`, the platform tracker templates (`--platform gh|glab`, autodetected from the origin remote) into `.github/` or `.gitlab/`, creates `docs/prd|adr|plans/`, copies a root `PRD.md` to `docs/PRD.md`, and seeds or appends `CLAUDE.md` from the pattern snippet (marker-checked, never duplicated).
|
|
20
|
-
|
|
21
|
-
## 2. New project from a bare PRD.md — end to end
|
|
22
|
-
|
|
23
|
-
Preconditions: git repo + remote, authenticated tracker CLI (`gh auth login` / `glab auth login`), Node ≥ 18, Claude Code.
|
|
24
|
-
|
|
25
|
-
1. `git init`, create the remote (e.g. `gh repo create`), commit `PRD.md`.
|
|
26
|
-
2. Run `adopt.mjs` (above) — then commit the scaffolding.
|
|
27
|
-
3. Review `CLAUDE.md`: add your project facts and non-negotiables above the pipeline section; keep **Operating mode: `supervised`** for now. Fill the **Constraint check** section of `.github/PULL_REQUEST_TEMPLATE.md` (or the GitLab MR template) from those non-negotiables.
|
|
28
|
-
4. In Claude Code, in the project: **`/breakdown-prd`** — the Architect decomposes `docs/PRD.md` into `docs/prd/breakdown-plan.md` + sub-PRDs + template-compliant tickets (disjoint file-scopes, dependency DAG), then stops.
|
|
29
|
-
5. **Gate 1 — your product judgment moment.** Review the breakdown: module boundaries, non-goals, the DAG, open questions. Edit/ask until right. Then sign off by running **`/start-milestone docs/prd/00-<module> supervised`** — tickets publish as tracker issues and the pipeline runs the first ticket to a CLEAR verdict, then stops for your merge. Re-run to continue (closed issues are skipped automatically).
|
|
30
|
-
6. **Graduate**: when the supervised runs hold, flip `CLAUDE.md` to `Operating mode: autonomous` — from then on, one `/start-milestone` runs the whole module: plan → build → fresh-context review (bounce-capped) → merge on CLEAR → issue closed → Definition-of-Done verified, with no per-ticket approvals.
|
|
31
|
-
7. **Gate 2**: when the PRD's tasks are done, you smoke-test the result. That is your only test duty — the agents own unit/integration/E2E throughout.
|
|
32
|
-
8. Optional: arm the **nightly sweep** (pattern `INSTALL.md` § Nightly sweep) — overnight issue triage/fix/report while the machine is on.
|
|
33
|
-
|
|
34
|
-
## 3. Existing project
|
|
35
|
-
|
|
36
|
-
Same `adopt.mjs` run — skip-existing protects your files. The differences:
|
|
37
|
-
|
|
38
|
-
- `CLAUDE.md` gets the snippet **appended**: read the merged result once and resolve contradictions with your existing rules (the pipeline rules assume no agent judges its own work).
|
|
39
|
-
- An existing `.claude/settings.json` is kept; merge the scaffold's `hooks.PreToolUse` (write guard) and `permissions.allow` entries by hand.
|
|
40
|
-
- Formalize `docs/PRD.md` for the area you will pipeline first — it can cover a single module; you do not need to spec the whole codebase to start.
|
|
41
|
-
- Retrofit gradually: run one small module through `supervised` mode end to end before trusting `autonomous`. Your existing test suite becomes the Builder/Reviewer suite from day one.
|
|
42
|
-
|
|
43
|
-
## 4. Distributing the catalog
|
|
44
|
-
|
|
45
|
-
The repo is public, so distribution has two tiers:
|
|
46
|
-
|
|
47
|
-
1. **npx from git — works for everyone, today, zero infra.** The `npx github:…` command above needs no credentials and no publishing. Pin `#main` or a tag for reproducibility.
|
|
48
|
-
2. **Public npm — the release tier (LIVE).** Published as [`agent-templates`](https://www.npmjs.com/package/agent-templates) (MIT, maintainer decision 2026-07-17, issue #15). Anonymous installs, semver pinning that pairs with the catalog's expiry discipline (a published version = a verified snapshot of the recommendations), and a natural companion to a future GitHub Pages catalog site.
|
|
49
|
-
|
|
50
|
-
**Why not GitHub Packages:** its npm registry requires an access token **even to install public packages** — "You need an access token to publish, install, and delete private, internal, and public packages" (GitHub docs, *Working with the npm registry*, verified live 2026-07-17) — and it supports scoped names only. That defeats frictionless public sharing; it remains the right choice only for private-org registries, which this catalog no longer needs.
|
|
51
|
-
|
|
52
|
-
## 5. Day-2 operations
|
|
53
|
-
|
|
54
|
-
- `/verify-delivery <ticket>` after every merge (automatic in autonomous mode) — delivery is verified, never assumed.
|
|
55
|
-
- Nightly sweep for open issues; hand-written issues follow the installed templates so triage can convert them.
|
|
56
|
-
- **Pattern-level problems go upstream**: if the pipeline itself misbehaves, file an issue on this catalog (templates provided) — its own nightly sweep triages pattern-tweak requests.
|
|
57
|
-
- Re-verify the pattern's model/effort table when its expiry triggers (successor model or +6 months).
|
|
1
|
+
# Adopting a pattern
|
|
2
|
+
|
|
3
|
+
How to apply a pattern from this catalog to a **new** project (even a folder holding nothing but a `PRD.md`) or an **existing** one.
|
|
4
|
+
|
|
5
|
+
## 0. Pick the pattern
|
|
6
|
+
|
|
7
|
+
Check the index in [README.md](README.md), then the pattern's own §1 **When to use / when not to use** — take the "not" side seriously. Check the pattern's expiry trigger (metadata table); do not copy an expired model/effort table without re-verifying it.
|
|
8
|
+
|
|
9
|
+
## 1. Install — one command
|
|
10
|
+
|
|
11
|
+
From the public npm registry (anonymous, works for anyone):
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
npx agent-templates@latest adopt three-agent-architect-builder-reviewer C:\path\to\your-project
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Pin an exact version for reproducibility (`npx agent-templates@0.1.0 …`) — a published version is a verified snapshot of the catalog's recommendations. Alternatives: `npx github:Ruihang2017/agent-templates …` (tracks the repo, no release needed; npx caches git installs — `--prefer-online` picks up updates), or from a checkout: `node scripts/adopt.mjs three-agent-architect-builder-reviewer <target-dir>`.
|
|
18
|
+
|
|
19
|
+
Idempotent (re-runs skip what exists; `--force` overwrites). It installs the scaffold `.claude/` (agents with pinned model/effort, stage commands, write guard, workflows, publish script), the universal `templates/ticket.template.md`, the platform tracker templates (`--platform gh|glab`, autodetected from the origin remote) into `.github/` or `.gitlab/`, creates `docs/prd|adr|plans/`, copies a root `PRD.md` to `docs/PRD.md`, and seeds or appends `CLAUDE.md` from the pattern snippet (marker-checked, never duplicated).
|
|
20
|
+
|
|
21
|
+
## 2. New project from a bare PRD.md — end to end
|
|
22
|
+
|
|
23
|
+
Preconditions: git repo + remote, authenticated tracker CLI (`gh auth login` / `glab auth login`), Node ≥ 18, Claude Code.
|
|
24
|
+
|
|
25
|
+
1. `git init`, create the remote (e.g. `gh repo create`), commit `PRD.md`.
|
|
26
|
+
2. Run `adopt.mjs` (above) — then commit the scaffolding.
|
|
27
|
+
3. Review `CLAUDE.md`: add your project facts and non-negotiables above the pipeline section; keep **Operating mode: `supervised`** for now. Fill the **Constraint check** section of `.github/PULL_REQUEST_TEMPLATE.md` (or the GitLab MR template) from those non-negotiables.
|
|
28
|
+
4. In Claude Code, in the project: **`/breakdown-prd`** — the Architect decomposes `docs/PRD.md` into `docs/prd/breakdown-plan.md` + sub-PRDs + template-compliant tickets (disjoint file-scopes, dependency DAG), then stops.
|
|
29
|
+
5. **Gate 1 — your product judgment moment.** Review the breakdown: module boundaries, non-goals, the DAG, open questions. Edit/ask until right. Then sign off by running **`/start-milestone docs/prd/00-<module> supervised`** — tickets publish as tracker issues and the pipeline runs the first ticket to a CLEAR verdict, then stops for your merge. Re-run to continue (closed issues are skipped automatically).
|
|
30
|
+
6. **Graduate**: when the supervised runs hold, flip `CLAUDE.md` to `Operating mode: autonomous` — from then on, one `/start-milestone` runs the whole module: plan → build → fresh-context review (bounce-capped) → merge on CLEAR → issue closed → Definition-of-Done verified, with no per-ticket approvals.
|
|
31
|
+
7. **Gate 2**: when the PRD's tasks are done, you smoke-test the result. That is your only test duty — the agents own unit/integration/E2E throughout.
|
|
32
|
+
8. Optional: arm the **nightly sweep** (pattern `INSTALL.md` § Nightly sweep) — overnight issue triage/fix/report while the machine is on.
|
|
33
|
+
|
|
34
|
+
## 3. Existing project
|
|
35
|
+
|
|
36
|
+
Same `adopt.mjs` run — skip-existing protects your files. The differences:
|
|
37
|
+
|
|
38
|
+
- `CLAUDE.md` gets the snippet **appended**: read the merged result once and resolve contradictions with your existing rules (the pipeline rules assume no agent judges its own work).
|
|
39
|
+
- An existing `.claude/settings.json` is kept; merge the scaffold's `hooks.PreToolUse` (write guard) and `permissions.allow` entries by hand.
|
|
40
|
+
- Formalize `docs/PRD.md` for the area you will pipeline first — it can cover a single module; you do not need to spec the whole codebase to start.
|
|
41
|
+
- Retrofit gradually: run one small module through `supervised` mode end to end before trusting `autonomous`. Your existing test suite becomes the Builder/Reviewer suite from day one.
|
|
42
|
+
|
|
43
|
+
## 4. Distributing the catalog
|
|
44
|
+
|
|
45
|
+
The repo is public, so distribution has two tiers:
|
|
46
|
+
|
|
47
|
+
1. **npx from git — works for everyone, today, zero infra.** The `npx github:…` command above needs no credentials and no publishing. Pin `#main` or a tag for reproducibility.
|
|
48
|
+
2. **Public npm — the release tier (LIVE).** Published as [`agent-templates`](https://www.npmjs.com/package/agent-templates) (MIT, maintainer decision 2026-07-17, issue #15). Anonymous installs, semver pinning that pairs with the catalog's expiry discipline (a published version = a verified snapshot of the recommendations), and a natural companion to a future GitHub Pages catalog site.
|
|
49
|
+
|
|
50
|
+
**Why not GitHub Packages:** its npm registry requires an access token **even to install public packages** — "You need an access token to publish, install, and delete private, internal, and public packages" (GitHub docs, *Working with the npm registry*, verified live 2026-07-17) — and it supports scoped names only. That defeats frictionless public sharing; it remains the right choice only for private-org registries, which this catalog no longer needs.
|
|
51
|
+
|
|
52
|
+
## 5. Day-2 operations
|
|
53
|
+
|
|
54
|
+
- `/verify-delivery <ticket>` after every merge (automatic in autonomous mode) — delivery is verified, never assumed.
|
|
55
|
+
- Nightly sweep for open issues; hand-written issues follow the installed templates so triage can convert them.
|
|
56
|
+
- **Pattern-level problems go upstream**: if the pipeline itself misbehaves, file an issue on this catalog (templates provided) — its own nightly sweep triages pattern-tweak requests.
|
|
57
|
+
- Re-verify the pattern's model/effort table when its expiry triggers (successor model or +6 months).
|
package/CLAUDE.md
CHANGED
|
@@ -1,125 +1,128 @@
|
|
|
1
|
-
# agent-templates — Operating Manual
|
|
2
|
-
|
|
3
|
-
> Auto-loaded into every session in this repo. Conversation with the user may be in Chinese; **every file committed to this repo MUST be in English** (docs, scaffolding, comments, identifiers).
|
|
4
|
-
|
|
5
|
-
## What this repo is
|
|
6
|
-
|
|
7
|
-
A library/catalog of the multi-agent development architecture patterns this team reuses across projects. Each pattern is a **self-contained, reusable unit**: a design write-up plus actual working scaffolding (CLAUDE.md snippets, subagent definitions, slash commands) that a new project copies directly instead of redesigning the architecture from scratch.
|
|
8
|
-
|
|
9
|
-
This repo ships documentation, scaffolding, and a testbed. The only application code is the testbed's toy target app.
|
|
10
|
-
|
|
11
|
-
**Target operating model** (what patterns are hardened toward): for a project that fits a pattern, humans decide at exactly two gates — upstream (master PRD → sub-PRDs → generated tickets, signed off before the pipeline starts) and downstream (a smoke test of the delivered work). Between those gates the multi-agent workflow runs autonomously. Consequences for this repo: not every project fits every pattern ("when not to use" is a required section, take it seriously), and role boundaries are enforced mechanically wherever possible — hooks and permission config over prose exhortation, because prose alone has already been observed to fail.
|
|
12
|
-
|
|
13
|
-
**Testing policy** (`[team-policy]`, 2026-07-17, binding on every pattern): the agents own the whole test pyramid — unit, integration, and E2E — run manually or wired into the pipeline as fits the project. The human's only test duty is the final smoke test once the PRD's tasks are all done (Gate 2).
|
|
14
|
-
|
|
15
|
-
## Layout
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
CLAUDE.md # this file — the operating manual
|
|
19
|
-
README.md # human-facing pattern index
|
|
20
|
-
ADOPTING.md # how users apply a pattern to new/existing projects
|
|
21
|
-
LICENSE # MIT (scaffold-output carve-out noted in README § License)
|
|
22
|
-
package.json # published npm package `agent-templates` (bin + files whitelist)
|
|
23
|
-
scripts/
|
|
24
|
-
cli.mjs # npx entry point: list · adopt (dispatches to adopt.mjs)
|
|
25
|
-
adopt.mjs # one-command pattern installer (idempotent; E2E-tested)
|
|
26
|
-
build-site.mjs # generates the GitHub Pages catalog page from pattern data (never hand-edit output)
|
|
27
|
-
templates/ # UNIVERSAL — shared by all patterns and by this repo itself
|
|
28
|
-
pattern-README.template.md # mandatory starting point for every new pattern
|
|
29
|
-
ticket.template.md # the ticket format (field-proven: fx / PIL-15 / FND-9 standard)
|
|
30
|
-
tracker/ # tracker-native templates: github/ + gitlab/ — issues (bug-report,
|
|
31
|
-
# task, decision-record) and the PR/MR template
|
|
32
|
-
patterns/<pattern-name>/ # kebab-case; one directory per pattern
|
|
33
|
-
README.md # the write-up — MUST follow the schema below
|
|
34
|
-
scaffold/ # drop-in files a target repo copies, then adapts
|
|
35
|
-
testbed/ # E2E for the pattern chain (see testbed/README.md)
|
|
36
|
-
e2e/run-e2e.mjs # Level 0: deterministic, zero-token — the merge gate for scaffold changes
|
|
37
|
-
app/ # Level 1: tiny real target project for live pipeline rehearsals
|
|
38
|
-
.claude/ # self-hosted pattern machinery — byte-synced scaffold copies (see "How this repo develops itself")
|
|
39
|
-
.github/ISSUE_TEMPLATE/ # issue templates (from the scaffold) — pattern-tweak requests from other projects land here
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Worked example — `patterns/three-agent-architect-builder-reviewer/` is the canonical entry; **every future pattern must match its format**:
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
patterns/three-agent-architect-builder-reviewer/
|
|
46
|
-
├── README.md # schema-compliant write-up (the format reference)
|
|
47
|
-
└── scaffold/
|
|
48
|
-
├── INSTALL.md # how to drop the scaffold into a target repo
|
|
49
|
-
├── claude-md-snippet.md # block to append to the target repo's CLAUDE.md
|
|
50
|
-
└── .claude/
|
|
51
|
-
├── settings.json # PreToolUse write guard wiring
|
|
52
|
-
├── hooks/
|
|
53
|
-
│ └── guard-main-session-writes.mjs
|
|
54
|
-
├── scripts/
|
|
55
|
-
│
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
│
|
|
59
|
-
├──
|
|
60
|
-
│
|
|
61
|
-
|
|
62
|
-
│ ├──
|
|
63
|
-
│
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
├──
|
|
68
|
-
├──
|
|
69
|
-
├──
|
|
70
|
-
├──
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
|
80
|
-
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
|
97
|
-
|
|
98
|
-
| `[
|
|
99
|
-
| `[
|
|
100
|
-
| `[
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
1
|
+
# agent-templates — Operating Manual
|
|
2
|
+
|
|
3
|
+
> Auto-loaded into every session in this repo. Conversation with the user may be in Chinese; **every file committed to this repo MUST be in English** (docs, scaffolding, comments, identifiers).
|
|
4
|
+
|
|
5
|
+
## What this repo is
|
|
6
|
+
|
|
7
|
+
A library/catalog of the multi-agent development architecture patterns this team reuses across projects. Each pattern is a **self-contained, reusable unit**: a design write-up plus actual working scaffolding (CLAUDE.md snippets, subagent definitions, slash commands) that a new project copies directly instead of redesigning the architecture from scratch.
|
|
8
|
+
|
|
9
|
+
This repo ships documentation, scaffolding, and a testbed. The only application code is the testbed's toy target app.
|
|
10
|
+
|
|
11
|
+
**Target operating model** (what patterns are hardened toward): for a project that fits a pattern, humans decide at exactly two gates — upstream (master PRD → sub-PRDs → generated tickets, signed off before the pipeline starts) and downstream (a smoke test of the delivered work). Between those gates the multi-agent workflow runs autonomously. Consequences for this repo: not every project fits every pattern ("when not to use" is a required section, take it seriously), and role boundaries are enforced mechanically wherever possible — hooks and permission config over prose exhortation, because prose alone has already been observed to fail.
|
|
12
|
+
|
|
13
|
+
**Testing policy** (`[team-policy]`, 2026-07-17, binding on every pattern): the agents own the whole test pyramid — unit, integration, and E2E — run manually or wired into the pipeline as fits the project. The human's only test duty is the final smoke test once the PRD's tasks are all done (Gate 2).
|
|
14
|
+
|
|
15
|
+
## Layout
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
CLAUDE.md # this file — the operating manual
|
|
19
|
+
README.md # human-facing pattern index
|
|
20
|
+
ADOPTING.md # how users apply a pattern to new/existing projects
|
|
21
|
+
LICENSE # MIT (scaffold-output carve-out noted in README § License)
|
|
22
|
+
package.json # published npm package `agent-templates` (bin + files whitelist)
|
|
23
|
+
scripts/
|
|
24
|
+
cli.mjs # npx entry point: list · adopt (dispatches to adopt.mjs)
|
|
25
|
+
adopt.mjs # one-command pattern installer (idempotent; E2E-tested)
|
|
26
|
+
build-site.mjs # generates the GitHub Pages catalog page from pattern data (never hand-edit output)
|
|
27
|
+
templates/ # UNIVERSAL — shared by all patterns and by this repo itself
|
|
28
|
+
pattern-README.template.md # mandatory starting point for every new pattern
|
|
29
|
+
ticket.template.md # the ticket format (field-proven: fx / PIL-15 / FND-9 standard)
|
|
30
|
+
tracker/ # tracker-native templates: github/ + gitlab/ — issues (bug-report,
|
|
31
|
+
# task, decision-record) and the PR/MR template
|
|
32
|
+
patterns/<pattern-name>/ # kebab-case; one directory per pattern
|
|
33
|
+
README.md # the write-up — MUST follow the schema below
|
|
34
|
+
scaffold/ # drop-in files a target repo copies, then adapts
|
|
35
|
+
testbed/ # E2E for the pattern chain (see testbed/README.md)
|
|
36
|
+
e2e/run-e2e.mjs # Level 0: deterministic, zero-token — the merge gate for scaffold changes
|
|
37
|
+
app/ # Level 1: tiny real target project for live pipeline rehearsals
|
|
38
|
+
.claude/ # self-hosted pattern machinery — byte-synced scaffold copies (see "How this repo develops itself")
|
|
39
|
+
.github/ISSUE_TEMPLATE/ # issue templates (from the scaffold) — pattern-tweak requests from other projects land here
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Worked example — `patterns/three-agent-architect-builder-reviewer/` is the canonical entry; **every future pattern must match its format**:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
patterns/three-agent-architect-builder-reviewer/
|
|
46
|
+
├── README.md # schema-compliant write-up (the format reference)
|
|
47
|
+
└── scaffold/
|
|
48
|
+
├── INSTALL.md # how to drop the scaffold into a target repo
|
|
49
|
+
├── claude-md-snippet.md # block to append to the target repo's CLAUDE.md
|
|
50
|
+
└── .claude/
|
|
51
|
+
├── settings.json # PreToolUse write guard wiring
|
|
52
|
+
├── hooks/
|
|
53
|
+
│ └── guard-main-session-writes.mjs
|
|
54
|
+
├── scripts/
|
|
55
|
+
│ ├── publish-tickets.mjs
|
|
56
|
+
│ └── milestone-dag.mjs
|
|
57
|
+
├── workflows/
|
|
58
|
+
│ ├── run-milestone.js
|
|
59
|
+
│ ├── start-all.js
|
|
60
|
+
│ └── nightly-issues.js
|
|
61
|
+
├── agents/
|
|
62
|
+
│ ├── architect.md
|
|
63
|
+
│ ├── builder.md
|
|
64
|
+
│ ├── reviewer.md
|
|
65
|
+
│ └── triage.md
|
|
66
|
+
└── commands/
|
|
67
|
+
├── breakdown-prd.md
|
|
68
|
+
├── plan-ticket.md
|
|
69
|
+
├── build-ticket.md
|
|
70
|
+
├── review-ticket.md
|
|
71
|
+
├── verify-delivery.md
|
|
72
|
+
├── start-milestone.md
|
|
73
|
+
├── start-all.md
|
|
74
|
+
└── nightly-issues.md
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Pattern README schema (all sections required, in this order)
|
|
78
|
+
|
|
79
|
+
| Section | Must contain |
|
|
80
|
+
|---|---|
|
|
81
|
+
| Metadata table (under the title) | Pattern name · status (`proposed` / `trialed` / `adopted` / `deprecated`) · as-of date · expiry trigger · sign-off |
|
|
82
|
+
| 1. When to use / when not to use | Concrete task shapes, both directions — not adjectives |
|
|
83
|
+
| 2. Agent roles & boundaries | Per agent: what it does / what it must never do; who judges whom |
|
|
84
|
+
| 3. Model + effort assignment | Table: role · model · effort · reasoning · source label per claim. Heading carries the as-of date |
|
|
85
|
+
| 4. Known failure modes / pitfalls | Symptom · the specific context/harness it was observed in · mitigation · date recorded. "None recorded yet" is a valid honest entry; an invented one is not |
|
|
86
|
+
| 5. Upstream / downstream integration | How work enters (master PRD → sub-PRD → ticket, ADRs), what leaves (PR, review verdict, docs), and the **human gates** — where humans decide, and where they must not be needed |
|
|
87
|
+
| 6. Scaffold | What is in `scaffold/` and how to install it |
|
|
88
|
+
| 7. Provenance & change log | Dated entries: what changed, on what basis, by whom |
|
|
89
|
+
|
|
90
|
+
Status glossary: `proposed` = drafted, not signed off · `trialed` = signed off as the team standard, awaiting its first real-ticket run · `adopted` = has run ≥ 1 real ticket in a real project, named in the provenance log · `deprecated` = superseded, kept for history.
|
|
91
|
+
|
|
92
|
+
Upstream docs convention assumed by patterns (exemplar: `fx-eye-tracking`): `docs/PRD.md` (master PRD) → `docs/prd/<module>/README.md` (sub-PRDs) → `docs/prd/<module>/tickets/*.md` (tickets = future issue bodies), plus `docs/adr/` for hard-to-reverse decisions.
|
|
93
|
+
|
|
94
|
+
## Source labels (mandatory on every model/effort claim)
|
|
95
|
+
|
|
96
|
+
| Label | Meaning |
|
|
97
|
+
|---|---|
|
|
98
|
+
| `[official]` | Anthropic docs / system card / model page — verifiable at a URL today |
|
|
99
|
+
| `[vendor-benchmark]` | Anthropic-reported benchmark number |
|
|
100
|
+
| `[third-party]` | External benchmark or report — name the source |
|
|
101
|
+
| `[internal]` | Our own observation — name the harness, project, and date |
|
|
102
|
+
| `[unverified]` | Unverified third-party data / needs testing |
|
|
103
|
+
| `[team-policy]` | A deliberate team decision — a choice, not a capability claim |
|
|
104
|
+
|
|
105
|
+
## Adding a new pattern
|
|
106
|
+
|
|
107
|
+
1. Copy `templates/pattern-README.template.md` → `patterns/<kebab-name>/README.md`. Fill every section; delete none.
|
|
108
|
+
2. Build `scaffold/` with actually-runnable files. Verify every config key (agent/command frontmatter, settings) against current Claude Code docs at write time — not from memory.
|
|
109
|
+
3. `node testbed/e2e/run-e2e.mjs` must be green before merging any scaffold change; when you add scaffold surface (new files, new orchestration logic), extend the E2E suites to cover it.
|
|
110
|
+
4. Open a PR. Status starts at `proposed`.
|
|
111
|
+
5. Sign-off to merge: the repo maintainer (Horace Hou) approves schema compliance and grounding. Promotion to `adopted` additionally requires the pattern having run on ≥1 real ticket in a real project, named in the provenance log.
|
|
112
|
+
6. Any later change to a model/effort recommendation updates the table **and** the as-of date **and** adds a provenance-log entry — in the same commit.
|
|
113
|
+
|
|
114
|
+
## How this repo develops itself
|
|
115
|
+
|
|
116
|
+
1. **Issues are the decision record; commits are only the change record.** Every unit of work starts as a GitHub issue stating what + why (use the universal templates — work items follow `task`/`bug-report`, records follow `decision-record`). The work lands via a PR referencing it (`Closes #N`), written against `.github/PULL_REQUEST_TEMPLATE.md` (byte-synced from `templates/tracker/github/`). **No direct merges to main.** Bootstrap exception: the rounds merged on 2026-07-17 before this rule existed are backfilled as `decision-record` issues #1–#4.
|
|
117
|
+
2. **Self-hosted nightly sweep.** This repo runs the pattern's own `/nightly-issues`: other projects file pattern-tweak requests here (templates in `.github/ISSUE_TEMPLATE/`), and the sweep triages — and where fixable, fixes — them overnight. The machinery at `.claude/` (four agents, two workflows, `nightly-issues` + `verify-delivery` commands) is a **byte-synced copy of the scaffold**, enforced by the E2E integrity suite: change the scaffold first, then re-copy.
|
|
118
|
+
3. **This repo's test suite** is `node testbed/e2e/run-e2e.mjs` — the Builder/Reviewer run it exactly like any project's tests.
|
|
119
|
+
4. The scaffold's main-session write guard is **not installed here** — interactive doc-editing with the maintainer is this repo's norm. Revisit if orchestrator role leakage appears in this repo's own pipeline runs.
|
|
120
|
+
5. Labels in use: `decision-record` · `triage:invalid` · `nightly:escalated` · `needs-human`.
|
|
121
|
+
|
|
122
|
+
## Grounding rules — binding on every agent working in this repo, including Claude
|
|
123
|
+
|
|
124
|
+
1. **No training-data impressions.** Every model/effort recommendation must be grounded in currently verifiable official documentation (link it), or be explicitly labeled `[unverified]` — "unverified third-party data / needs testing". If you cannot verify it right now, label it; never launder a hunch into a recommendation.
|
|
125
|
+
2. **Official conclusions ≠ harness observations.** Keep "conclusion from official docs / system cards" and "phenomenon observed under one specific benchmark harness" visibly distinct (use the source labels). A single-harness observation is never written up as a general conclusion — scope it with harness, conditions, and date.
|
|
126
|
+
3. **As-of dates move with recommendations.** Model capability and effort behavior change across versions; every recommendation is traceable, expirable, and updatable — never a permanent conclusion. Whenever a recommendation changes, its as-of date changes in the same commit.
|
|
127
|
+
4. **Staleness (default policy, maintainer-adjustable):** a model/effort table expires when a successor to any listed model ships, or 6 months after its as-of date, whichever comes first. Expired ≠ wrong — it means "re-verify before citing or copying into a new project".
|
|
128
|
+
5. **English only** in committed files; Chinese is for conversation, never for the repo.
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Horace Hou
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Horace Hou
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
# agent-templates
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/agent-templates) · **[Catalog site →](https://ruihang2017.github.io/agent-templates/)**
|
|
4
|
-
|
|
5
|
-
Catalog of reusable multi-agent development architecture patterns. Each entry is a design write-up plus drop-in scaffolding (subagent definitions, slash commands, CLAUDE.md snippets) so a new project reuses a proven pattern instead of redesigning one.
|
|
6
|
-
|
|
7
|
-
## Quickstart — from a bare `PRD.md` to a running pipeline
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
cd path\to\my-project # contains PRD.md; git init + remote done; gh/glab authenticated
|
|
11
|
-
npx agent-templates@latest adopt three-agent-architect-builder-reviewer .
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
(Also works: `npx github:Ruihang2017/agent-templates …` for the unreleased latest, or `node scripts/adopt.mjs …` from a checkout.)
|
|
15
|
-
|
|
16
|
-
1. Review `CLAUDE.md`: add project facts, keep **Operating mode: `supervised`**; fill the PR template's Constraint check from your non-negotiables.
|
|
17
|
-
2. In Claude Code, inside the project: **`/breakdown-prd`** — the Architect turns `docs/PRD.md` into sub-PRDs + tickets, then stops for your review.
|
|
18
|
-
3. **Gate 1** — review the breakdown, then **`/start-milestone docs/prd/00-<module> supervised`**: tickets publish as tracker issues; each ticket runs plan → build → fresh-context review to CLEAR, pausing for your merge.
|
|
19
|
-
4. When it holds, flip to `autonomous` — whole milestones run hands-off. **Gate 2** = your smoke test at the end. Full guide: [ADOPTING.md](ADOPTING.md).
|
|
20
|
-
|
|
21
|
-
| Pattern | Status | As of | Summary |
|
|
22
|
-
|---|---|---|---|
|
|
23
|
-
| [three-agent-architect-builder-reviewer](patterns/three-agent-architect-builder-reviewer/README.md) | trialed | 2026-07-17 | Architect plans → Builder implements → independent Reviewer (fresh context, different model tier) clears or bounces; `/start-milestone` runs a whole module autonomously |
|
|
24
|
-
|
|
25
|
-
- **Applying a pattern to your project** (new — even a bare `PRD.md` — or existing): [ADOPTING.md](ADOPTING.md) — one command: `node scripts/adopt.mjs <pattern> <target-dir>`
|
|
26
|
-
- Operating manual, pattern schema, grounding rules: [CLAUDE.md](CLAUDE.md)
|
|
27
|
-
- Adding a pattern: start from [templates/pattern-README.template.md](templates/pattern-README.template.md), process in [CLAUDE.md](CLAUDE.md) § "Adding a new pattern"
|
|
28
|
-
- E2E testing for the pattern chain: [testbed/README.md](testbed/README.md) — `node testbed/e2e/run-e2e.mjs` is the merge gate for scaffold changes
|
|
29
|
-
|
|
30
|
-
## License
|
|
31
|
-
|
|
32
|
-
MIT — see [LICENSE](LICENSE). Carve-out: files installed **into your project** by `adopt.mjs` (the scaffold, templates, and anything generated from them) may be used in your projects without attribution.
|
|
1
|
+
# agent-templates
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/agent-templates) · **[Catalog site →](https://ruihang2017.github.io/agent-templates/)**
|
|
4
|
+
|
|
5
|
+
Catalog of reusable multi-agent development architecture patterns. Each entry is a design write-up plus drop-in scaffolding (subagent definitions, slash commands, CLAUDE.md snippets) so a new project reuses a proven pattern instead of redesigning one.
|
|
6
|
+
|
|
7
|
+
## Quickstart — from a bare `PRD.md` to a running pipeline
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
cd path\to\my-project # contains PRD.md; git init + remote done; gh/glab authenticated
|
|
11
|
+
npx agent-templates@latest adopt three-agent-architect-builder-reviewer .
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
(Also works: `npx github:Ruihang2017/agent-templates …` for the unreleased latest, or `node scripts/adopt.mjs …` from a checkout.)
|
|
15
|
+
|
|
16
|
+
1. Review `CLAUDE.md`: add project facts, keep **Operating mode: `supervised`**; fill the PR template's Constraint check from your non-negotiables.
|
|
17
|
+
2. In Claude Code, inside the project: **`/breakdown-prd`** — the Architect turns `docs/PRD.md` into sub-PRDs + tickets, then stops for your review.
|
|
18
|
+
3. **Gate 1** — review the breakdown, then **`/start-milestone docs/prd/00-<module> supervised`**: tickets publish as tracker issues; each ticket runs plan → build → fresh-context review to CLEAR, pausing for your merge.
|
|
19
|
+
4. When it holds, flip to `autonomous` — whole milestones run hands-off. **Gate 2** = your smoke test at the end. Full guide: [ADOPTING.md](ADOPTING.md).
|
|
20
|
+
|
|
21
|
+
| Pattern | Status | As of | Summary |
|
|
22
|
+
|---|---|---|---|
|
|
23
|
+
| [three-agent-architect-builder-reviewer](patterns/three-agent-architect-builder-reviewer/README.md) | trialed | 2026-07-17 | Architect plans → Builder implements → independent Reviewer (fresh context, different model tier) clears or bounces; `/start-milestone` runs a whole module autonomously |
|
|
24
|
+
|
|
25
|
+
- **Applying a pattern to your project** (new — even a bare `PRD.md` — or existing): [ADOPTING.md](ADOPTING.md) — one command: `node scripts/adopt.mjs <pattern> <target-dir>`
|
|
26
|
+
- Operating manual, pattern schema, grounding rules: [CLAUDE.md](CLAUDE.md)
|
|
27
|
+
- Adding a pattern: start from [templates/pattern-README.template.md](templates/pattern-README.template.md), process in [CLAUDE.md](CLAUDE.md) § "Adding a new pattern"
|
|
28
|
+
- E2E testing for the pattern chain: [testbed/README.md](testbed/README.md) — `node testbed/e2e/run-e2e.mjs` is the merge gate for scaffold changes
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
MIT — see [LICENSE](LICENSE). Carve-out: files installed **into your project** by `adopt.mjs` (the scaffold, templates, and anything generated from them) may be used in your projects without attribution.
|
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "agent-templates",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "Catalog of multi-agent development architecture patterns - design write-ups plus drop-in scaffolding (agents, slash commands, workflows, templates).",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"author": "Horace Hou",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"bin": {
|
|
9
|
-
"agent-templates": "scripts/cli.mjs"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"scripts/",
|
|
13
|
-
"patterns/",
|
|
14
|
-
"templates/",
|
|
15
|
-
"ADOPTING.md",
|
|
16
|
-
"CLAUDE.md"
|
|
17
|
-
],
|
|
18
|
-
"repository": {
|
|
19
|
-
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/Ruihang2017/agent-templates.git"
|
|
21
|
-
},
|
|
22
|
-
"homepage": "https://github.com/Ruihang2017/agent-templates#readme",
|
|
23
|
-
"bugs": {
|
|
24
|
-
"url": "https://github.com/Ruihang2017/agent-templates/issues"
|
|
25
|
-
},
|
|
26
|
-
"engines": {
|
|
27
|
-
"node": ">=18"
|
|
28
|
-
},
|
|
29
|
-
"scripts": {
|
|
30
|
-
"test": "node testbed/e2e/run-e2e.mjs"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-templates",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Catalog of multi-agent development architecture patterns - design write-ups plus drop-in scaffolding (agents, slash commands, workflows, templates).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Horace Hou",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"agent-templates": "scripts/cli.mjs"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"scripts/",
|
|
13
|
+
"patterns/",
|
|
14
|
+
"templates/",
|
|
15
|
+
"ADOPTING.md",
|
|
16
|
+
"CLAUDE.md"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/Ruihang2017/agent-templates.git"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/Ruihang2017/agent-templates#readme",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/Ruihang2017/agent-templates/issues"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"test": "node testbed/e2e/run-e2e.mjs"
|
|
31
|
+
}
|
|
32
|
+
}
|