create-command-center 0.0.0-stage → 0.3.0

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.
Files changed (67) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE.agent-skills +21 -0
  3. package/README.md +62 -2
  4. package/RELEASING.md +29 -0
  5. package/UPSTREAM.md +13 -0
  6. package/bin/create-command-center.mjs +34 -0
  7. package/installer/build-parsers.mjs +21 -0
  8. package/installer/install.mjs +103 -0
  9. package/installer/template/AGENTS.md +9 -0
  10. package/installer/template/README.md +13 -0
  11. package/installer/template/gitignore +5 -0
  12. package/installer/template/repos/index.md +5 -0
  13. package/package.json +41 -4
  14. package/references/accessibility-checklist.md +160 -0
  15. package/references/definition-of-done.md +67 -0
  16. package/references/observability-checklist.md +92 -0
  17. package/references/orchestration-patterns.md +370 -0
  18. package/references/performance-checklist.md +239 -0
  19. package/references/security-checklist.md +250 -0
  20. package/references/testing-patterns.md +236 -0
  21. package/skills/accessibility-engineering/SKILL.md +133 -0
  22. package/skills/accessibility-engineering/scripts/audit-a11y.sh +233 -0
  23. package/skills/api-and-interface-design/SKILL.md +369 -0
  24. package/skills/browser-testing-with-devtools/SKILL.md +319 -0
  25. package/skills/cc/SKILL.md +26 -0
  26. package/skills/cc/assets/config.md +28 -0
  27. package/skills/cc/assets/progress.md +23 -0
  28. package/skills/cc/references/jobs.md +30 -0
  29. package/skills/cc/references/registration.md +63 -0
  30. package/skills/cc/scripts/checks.mjs +109 -0
  31. package/skills/cc/scripts/errors.mjs +3 -0
  32. package/skills/cc/scripts/home.mjs +60 -0
  33. package/skills/cc/scripts/init.mjs +499 -0
  34. package/skills/cc/scripts/inspection.mjs +315 -0
  35. package/skills/cc/scripts/vendor/LICENSE.parsers.txt +70 -0
  36. package/skills/cc/scripts/vendor/parsers.mjs +9951 -0
  37. package/skills/ci-cd-and-automation/SKILL.md +395 -0
  38. package/skills/code-review-and-quality/SKILL.md +402 -0
  39. package/skills/code-simplification/SKILL.md +331 -0
  40. package/skills/constraint-driven-development/SKILL.md +319 -0
  41. package/skills/constraint-driven-development/references/floor-guard.md +182 -0
  42. package/skills/constraint-driven-development/scripts/quality-gate.mjs +45 -0
  43. package/skills/context-engineering/SKILL.md +353 -0
  44. package/skills/debugging-and-error-recovery/SKILL.md +300 -0
  45. package/skills/deprecation-and-migration/SKILL.md +252 -0
  46. package/skills/documentation-and-adrs/SKILL.md +320 -0
  47. package/skills/doubt-driven-development/SKILL.md +245 -0
  48. package/skills/frontend-ui-engineering/SKILL.md +346 -0
  49. package/skills/git-workflow-and-versioning/SKILL.md +355 -0
  50. package/skills/idea-refine/SKILL.md +195 -0
  51. package/skills/idea-refine/examples.md +238 -0
  52. package/skills/idea-refine/frameworks.md +99 -0
  53. package/skills/idea-refine/refinement-criteria.md +113 -0
  54. package/skills/idea-refine/scripts/idea-refine.sh +15 -0
  55. package/skills/incremental-implementation/SKILL.md +249 -0
  56. package/skills/interview-me/SKILL.md +235 -0
  57. package/skills/observability-and-instrumentation/SKILL.md +238 -0
  58. package/skills/performance-optimization/SKILL.md +267 -0
  59. package/skills/performance-optimization/references/optimization-patterns.md +250 -0
  60. package/skills/planning-and-task-breakdown/SKILL.md +259 -0
  61. package/skills/security-and-hardening/SKILL.md +216 -0
  62. package/skills/security-and-hardening/references/hardening-patterns.md +333 -0
  63. package/skills/shipping-and-launch/SKILL.md +336 -0
  64. package/skills/source-driven-development/SKILL.md +217 -0
  65. package/skills/spec-driven-development/SKILL.md +307 -0
  66. package/skills/test-driven-development/SKILL.md +400 -0
  67. package/skills/using-agent-skills/SKILL.md +194 -0
@@ -0,0 +1,92 @@
1
+ # Observability Checklist
2
+
3
+ Quick reference for instrumenting production code. Use alongside the `observability-and-instrumentation` skill.
4
+
5
+ ## Table of Contents
6
+
7
+ - [On-Call Questions (Start Here)](#on-call-questions-start-here)
8
+ - [Structured Logging](#structured-logging)
9
+ - [Metrics](#metrics)
10
+ - [Distributed Tracing](#distributed-tracing)
11
+ - [Alerting](#alerting)
12
+ - [Dashboards](#dashboards)
13
+ - [Verify the Telemetry](#verify-the-telemetry)
14
+ - [Pre-Launch Gate](#pre-launch-gate)
15
+
16
+ ## On-Call Questions (Start Here)
17
+
18
+ Telemetry without a question is noise. Before instrumenting anything:
19
+
20
+ - [ ] 2–4 questions an on-call engineer will ask about this feature are written down
21
+ - [ ] Every signal below maps to one of those questions
22
+ - [ ] Each question is matched to the right signal type: metrics say **that** something is wrong, traces say **where**, logs say **why**
23
+
24
+ ## Structured Logging
25
+
26
+ - [ ] Logs are structured (JSON) with stable event names — not free-form strings
27
+ - [ ] Every log line carries a correlation/request ID, generated or accepted at the system boundary
28
+ - [ ] Correlation ID is propagated on every outbound call and async boundary (HTTP headers, queue metadata)
29
+ - [ ] Any log stream written by more than one entry point (scheduler, replay endpoint, manual run) carries an entry-point field, set where the run starts and propagated alongside the correlation ID
30
+ - [ ] Log levels are consistent: `error` = invariant broken, someone may act; `warn` = degraded but handled; `info` = significant business event; `debug` = off in production
31
+ - [ ] No secrets, tokens, passwords, or unredacted PII in any log line (hard rule from `security-and-hardening`)
32
+ - [ ] Fields are allowlisted — no whole request/response bodies, no auth headers
33
+ - [ ] External service calls logged with metadata only: endpoint, status, latency, attempt count, sanitized identifiers
34
+ - [ ] Actual log output spot-checked: structured fields, not `[object Object]`
35
+
36
+ ## Metrics
37
+
38
+ - [ ] **RED** instrumented for every endpoint and every external dependency: Rate, Errors, Duration
39
+ - [ ] **USE** instrumented for every resource (queues, pools, hosts): Utilization, Saturation, Errors
40
+ - [ ] Latency is a histogram; p50/p95/p99 queryable — never an average
41
+ - [ ] All labels come from small, fixed sets (route template, status class, provider name)
42
+ - [ ] No unbounded label values: no user IDs, tenant IDs, emails, raw URLs, request IDs, or error message text
43
+ - [ ] Status codes grouped by class (`5xx`, not `503`)
44
+ - [ ] Queue depth and processing duration tracked for every worker/queue
45
+
46
+ ## Distributed Tracing
47
+
48
+ - [ ] OpenTelemetry (or equivalent) initialized at service startup, before other imports
49
+ - [ ] Auto-instrumentation enabled for HTTP, gRPC, and DB clients
50
+ - [ ] Trace context propagated on every outbound call (W3C `traceparent`/`tracestate`) and extracted from every inbound request
51
+ - [ ] Context survives async boundaries — queue messages carry trace metadata
52
+ - [ ] Manual spans only around meaningful internal units of work, with the attributes on-call will filter by
53
+ - [ ] No secrets or PII as span attributes
54
+ - [ ] Head-based sampling at a low default rate; 100% of errors kept if tail sampling is available
55
+
56
+ ## Alerting
57
+
58
+ - [ ] Every alert is symptom-based (error rate, p99 latency, queue age) — causes (CPU, disk, restarts) go to dashboards, not pagers
59
+ - [ ] Every alert is actionable; "ignore it, it self-heals" alerts are deleted
60
+ - [ ] Every alert links to a runbook — minimum three lines: what it means, first query to run, escalation path
61
+ - [ ] Thresholds and durations justified by an SLO or historical data, not guesses
62
+ - [ ] Two severities only: **page** (user-facing, act now) and **ticket** (degradation, act this week)
63
+ - [ ] Each new alert test-fired once: it reached the right channel and the runbook link works
64
+ - [ ] No alerts that fire daily and get acknowledged without action
65
+
66
+ ## Dashboards
67
+
68
+ - [ ] Service health dashboard exists: error rate, latency p99, traffic, saturation
69
+ - [ ] Dependency health panel shows per-service error rates and latency
70
+ - [ ] Dashboard answers the on-call questions from the top of this checklist — not "everything except the answer"
71
+ - [ ] Default time range is sensible (1h–6h, not 30d)
72
+
73
+ ## Verify the Telemetry
74
+
75
+ Instrumentation is code; it can be wrong:
76
+
77
+ - [ ] Forced an error in staging → found it in the logs by correlation ID
78
+ - [ ] Sent test traffic → metric series appear with expected labels and sane values
79
+ - [ ] Followed one request end-to-end in the tracing UI → no broken spans
80
+ - [ ] An induced failure was diagnosed from telemetry alone, without reading the source
81
+
82
+ ## Pre-Launch Gate
83
+
84
+ Before a feature ships to production, all of the following are true:
85
+
86
+ - [ ] Structured logs flowing to the log aggregator
87
+ - [ ] RED metrics visible in dashboards for every new endpoint and dependency
88
+ - [ ] At least one symptom-based alert configured, with runbook, test-fired
89
+ - [ ] A request can be traced across every service it touches
90
+ - [ ] On-call knows where the runbooks are
91
+
92
+ For launch-day monitoring sequence and rollback triggers, see the `shipping-and-launch` skill.
@@ -0,0 +1,370 @@
1
+ # Orchestration Patterns
2
+
3
+ Reference catalog of agent orchestration patterns this repo endorses, plus anti-patterns to avoid. Read this before adding a new slash command that coordinates multiple personas, or before introducing a new persona that "wraps" existing ones.
4
+
5
+ The governing rule: **the user (or a slash command) is the orchestrator. Personas do not invoke other personas.** Skills are mandatory hops inside a persona's workflow.
6
+
7
+ ---
8
+
9
+ ## Endorsed patterns
10
+
11
+ ### 1. Direct invocation (no orchestration)
12
+
13
+ Single persona, single perspective, single artifact. The default and the cheapest option.
14
+
15
+ ```
16
+ user → code-reviewer → report → user
17
+ ```
18
+
19
+ **Use when:** the work is one perspective on one artifact and you can describe it in one sentence.
20
+
21
+ **Examples:**
22
+ - "Review this PR" → `code-reviewer`
23
+ - "Find security issues in `auth.ts`" → `security-auditor`
24
+ - "What tests are missing for the checkout flow?" → `test-engineer`
25
+
26
+ **Cost:** one round trip. The baseline you should always compare orchestrated patterns against.
27
+
28
+ ---
29
+
30
+ ### 2. Single-persona slash command
31
+
32
+ A slash command that wraps one persona with the project's skills. Saves the user from re-explaining the workflow every time.
33
+
34
+ ```
35
+ /review → code-reviewer (with code-review-and-quality skill) → report
36
+ ```
37
+
38
+ **Use when:** the same single-persona invocation happens repeatedly with the same setup.
39
+
40
+ **Examples in this repo:** `/review`, `/test`, `/code-simplify`.
41
+
42
+ **Cost:** same as direct invocation. The slash command is just a saved prompt.
43
+
44
+ **Anti-signal:** if the slash command's body is mostly "decide which persona to call," delete it and let the user call the persona directly.
45
+
46
+ ---
47
+
48
+ ### 3. Parallel fan-out with merge
49
+
50
+ Multiple personas operate on the same input concurrently, each producing an independent report. A merge step (in the main agent's context) synthesizes them into a single decision.
51
+
52
+ ```
53
+ ┌─→ code-reviewer ─┐
54
+ /ship → fan out ───┼─→ security-auditor ─┤→ merge → go/no-go + rollback
55
+ └─→ test-engineer ─┘
56
+ ```
57
+
58
+ **Use when:**
59
+ - The sub-tasks are genuinely independent (no shared mutable state, no ordering dependency)
60
+ - Each sub-agent benefits from its own context window
61
+ - The merge step is small enough to stay in the main context
62
+ - Wall-clock latency matters
63
+
64
+ **Examples in this repo:** `/ship`.
65
+
66
+ **Cost:** N parallel sub-agent contexts + one merge turn. Higher than direct invocation, but faster wall-clock and produces better reports because each sub-agent stays focused on its single perspective.
67
+
68
+ **Validation checklist before adopting this pattern:**
69
+ - [ ] Can I run all sub-agents at the same time without ordering issues?
70
+ - [ ] Does each persona produce a different *kind* of finding, not just the same finding from a different angle?
71
+ - [ ] Will the merge step fit in the main agent's remaining context?
72
+ - [ ] Is the user's wait time long enough that parallelism is actually noticeable?
73
+
74
+ If any answer is "no," fall back to direct invocation or a single-persona command.
75
+
76
+ ---
77
+
78
+ ### 4. Sequential pipeline as user-driven slash commands
79
+
80
+ The user runs slash commands in a defined order, carrying context (or commit history) between them. There is no orchestrator agent — the user IS the orchestrator.
81
+
82
+ ```
83
+ user runs: /spec → /plan → /build → /test → /review → /ship
84
+ ```
85
+
86
+ **Use when:** the workflow has dependencies (each step needs the previous step's output) and human judgment between steps adds value.
87
+
88
+ **Examples in this repo:** the entire DEFINE → PLAN → BUILD → VERIFY → REVIEW → SHIP lifecycle.
89
+
90
+ **Cost:** one sub-agent context per step. Free for the orchestration layer because there is no orchestrator agent.
91
+
92
+ **Why not automate it:** an LLM "lifecycle orchestrator" would (a) lose nuance between steps because it has to summarize for hand-off, (b) skip the human checkpoints that catch wrong-direction work early, and (c) double the token cost via paraphrasing turns.
93
+
94
+ ---
95
+
96
+ ### 5. Research isolation (context preservation)
97
+
98
+ When a task requires reading large amounts of material that shouldn't pollute the main context, spawn a research sub-agent that returns only a digest.
99
+
100
+ ```
101
+ main agent → research sub-agent (reads 50 files) → digest → main agent continues
102
+ ```
103
+
104
+ **Use when:**
105
+ - The main session needs to stay focused on a downstream task
106
+ - The investigation result is much smaller than the input it consumes
107
+ - The decision quality benefits from the main agent having room to think after
108
+
109
+ **Examples:** "Find every call site of this deprecated API across the monorepo," "Summarize what these 30 ADRs say about caching."
110
+
111
+ **Cost:** one isolated sub-agent context. Worth it any time the alternative is loading hundreds of files into the main context.
112
+
113
+ **On Claude Code, use the built-in `Explore` subagent** rather than defining a custom research persona. `Explore` runs on Haiku, is denied write/edit tools, and is purpose-built for this pattern. Define a custom research subagent only when `Explore` doesn't fit (e.g. you need a domain-specific system prompt the model wouldn't infer).
114
+
115
+ ---
116
+
117
+ ## Claude Code compatibility
118
+
119
+ This catalog is harness-agnostic, but most readers will run it on Claude Code. Here's how each pattern maps onto Claude Code's primitives — and where the platform enforces our rules for us.
120
+
121
+ ### Where personas live
122
+
123
+ Plugin subagents go in `agents/` at the plugin root. This repo is a plugin (`.claude-plugin/plugin.json`), so `agents/code-reviewer.md`, `agents/security-auditor.md`, and `agents/test-engineer.md` are auto-discovered when the plugin is enabled. No path configuration needed.
124
+
125
+ ### Subagents vs. Agent Teams
126
+
127
+ Claude Code has two parallelism primitives. Pattern 3 (parallel fan-out with merge) maps to **subagents**. If you need teammates that talk to each other, use **Agent Teams** instead.
128
+
129
+ | | Subagents | Agent Teams |
130
+ |--|-----------|-------------|
131
+ | Coordination | Main agent fans out, sub-agents only report back | Teammates message each other, share a task list |
132
+ | Context | Own context window per subagent | Own context window per teammate |
133
+ | When to use | Independent tasks producing reports | Collaborative work needing discussion |
134
+ | Status | Stable | Experimental — requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` |
135
+ | Cost | Lower | Higher — each teammate is a separate Claude instance |
136
+
137
+ **The personas in this repo work in both modes.** When spawned as subagents (e.g. by `/ship`), they report findings to the main session. When spawned as teammates (`Spawn a teammate using the security-auditor agent type…`), they can challenge each other's findings directly. The persona definition is the same; only the spawning context changes.
138
+
139
+ One subtlety: the `skills` and `mcpServers` frontmatter fields in a persona are honored when it runs as a subagent but **ignored when it runs as a teammate** — teammates load skills and MCP servers from your project and user settings, the same as a regular session. If a persona depends on a specific skill or MCP server being loaded, configure it at the session level so it's available in both modes.
140
+
141
+ ### Platform-enforced rules
142
+
143
+ Two rules in this catalog aren't just convention — Claude Code enforces them:
144
+
145
+ - **"Subagents cannot spawn other subagents"** (verbatim from the docs). Anti-pattern B (persona-calls-persona) and Anti-pattern D (deep persona trees) cannot exist on Claude Code by construction.
146
+ - **"No nested teams"** — teammates cannot spawn their own teams. Same anti-patterns blocked at the team level.
147
+
148
+ This means you can adopt the patterns in this catalog without worrying about contributors accidentally building the anti-patterns. They'll just fail to load.
149
+
150
+ ### Built-in subagents to know about
151
+
152
+ Before defining a custom subagent, check whether one of these covers the role:
153
+
154
+ | Built-in | Purpose |
155
+ |----------|---------|
156
+ | `Explore` | Read-only codebase search and analysis. Use this for Pattern 5 (research isolation). |
157
+ | `Plan` | Read-only research during plan mode. |
158
+ | `general-purpose` | Multi-step tasks needing both exploration and modification. |
159
+
160
+ Don't redefine these. Layer your specialist personas (code-reviewer, security-auditor, test-engineer) on top of them.
161
+
162
+ ### Frontmatter restrictions for plugin agents
163
+
164
+ Plugin subagents do **not** support the `hooks`, `mcpServers`, or `permissionMode` frontmatter fields — these are silently ignored. If a future persona needs any of those, the user must copy the file into `.claude/agents/` or `~/.claude/agents/` instead.
165
+
166
+ The fields that DO work in plugin agents are: `name`, `description`, `tools`, `disallowedTools`, `model`, `maxTurns`, `skills`, `memory`, `background`, `effort`, `isolation`, `color`, `initialPrompt`. Use `model` per-persona if you want to optimize cost (e.g. Haiku for `test-engineer` coverage scans, Sonnet for `code-reviewer`, Opus for `security-auditor`).
167
+
168
+ ### Spawning multiple subagents in parallel
169
+
170
+ In Claude Code, parallel fan-out (Pattern 3) requires issuing **multiple Agent tool calls in a single assistant turn**. Sequential turns serialize execution. `/ship` calls this out explicitly. Any new orchestrator command should do the same.
171
+
172
+ ---
173
+
174
+ ## Worked example: Agent Teams for competing-hypothesis debugging
175
+
176
+ This example shows when to reach for **Agent Teams** instead of `/ship`'s subagent fan-out. The two patterns look similar from a distance — both spawn the same three personas — but the value comes from a different place.
177
+
178
+ ### The scenario
179
+
180
+ > *Checkout occasionally hangs for ~30 seconds before completing. It happens roughly once every 50 sessions. No errors in logs. Started after last week's release.*
181
+
182
+ Plausible root causes (mutually exclusive, all fit the symptoms):
183
+
184
+ 1. A race condition in the new payment-confirmation flow
185
+ 2. An auth check that occasionally falls through to a slow synchronous network call
186
+ 3. A missing index on a query that scales with cart size
187
+ 4. A flaky third-party API where the SDK retries silently before timing out
188
+
189
+ A single agent will pick the first plausible theory and stop investigating. A `/ship`-style subagent fan-out would have each persona report independently — but their reports never meet, so nothing rules out the wrong theories.
190
+
191
+ This is exactly the case the Agent Teams docs describe: *"With multiple independent investigators actively trying to disprove each other, the theory that survives is much more likely to be the actual root cause."*
192
+
193
+ ### Why this is *not* a `/ship` job
194
+
195
+ | | `/ship` (subagents) | Agent Teams |
196
+ |--|--------------------|-------------|
197
+ | Sub-agents see | The same diff, different lenses | A shared task list, each other's messages |
198
+ | Output | Three independent reports → one merge | Adversarial debate → consensus root cause |
199
+ | Right when | You want a verdict on a known artifact | You want to *find* the artifact among hypotheses |
200
+
201
+ `/ship` is a verdict; Agent Teams is an investigation.
202
+
203
+ ### Setup (one-time, per-environment)
204
+
205
+ Agent Teams is experimental. In `~/.claude/settings.json`:
206
+
207
+ ```json
208
+ {
209
+ "env": {
210
+ "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
211
+ }
212
+ }
213
+ ```
214
+
215
+ Requires Claude Code v2.1.32 or later. The personas in this repo are picked up automatically — no team-config files to author by hand.
216
+
217
+ ### The trigger prompt
218
+
219
+ Type into the lead session, in natural language:
220
+
221
+ ```
222
+ Users report checkout hangs for ~30 seconds intermittently after last
223
+ week's release. No errors in logs.
224
+
225
+ Create an agent team to debug this with competing hypotheses. Spawn
226
+ three teammates using the existing agent types:
227
+
228
+ - code-reviewer — investigate race conditions and blocking calls
229
+ in the checkout code path
230
+ - security-auditor — investigate auth checks, session handling,
231
+ and any synchronous network calls added recently
232
+ - test-engineer — propose tests that would distinguish between the
233
+ hypotheses and check coverage gaps in checkout
234
+
235
+ Have them message each other directly to challenge each other's
236
+ theories. Update findings as consensus emerges. Only converge when
237
+ two teammates agree they can disprove the others'.
238
+ ```
239
+
240
+ The lead spawns three teammates referencing the existing persona names. The persona body is **appended** to each teammate's system prompt as additional instructions (on top of the team-coordination instructions the lead installs); the trigger prompt above becomes their task.
241
+
242
+ ### What happens
243
+
244
+ 1. Each teammate runs in its own context window, exploring the codebase from its own lens.
245
+ 2. Teammates use `message` to send findings to each other directly. The lead doesn't have to relay.
246
+ 3. The shared task list shows who's investigating what — visible at any time with `Ctrl+T` (in-process mode) or in a tmux pane (split mode).
247
+ 4. When `code-reviewer` finds a `Promise.all` that should be sequential, it messages `security-auditor` to confirm the auth call isn't part of the race. `security-auditor` checks and replies — either confirming the race is the real issue or producing counter-evidence.
248
+ 5. `test-engineer` proposes a focused integration test for whichever theory is winning, which the team uses to verify before declaring consensus.
249
+ 6. The lead synthesizes the converged finding and presents it to you.
250
+
251
+ You can interrupt at any teammate by cycling with `Shift+Down` and typing — useful for redirecting an investigator who's gone down a wrong path.
252
+
253
+ ### When to clean up
254
+
255
+ When the investigation lands on a root cause, tell the lead:
256
+
257
+ ```
258
+ Clean up the team
259
+ ```
260
+
261
+ Always cleanup through the lead, not a teammate (per the docs: teammates lack full team context for cleanup).
262
+
263
+ ### Cost expectation
264
+
265
+ Three Sonnet teammates running for ~10–15 minutes of investigation costs noticeably more than the same three personas spawned as subagents by `/ship`. The justification is *quality of conclusion* — for production debugging where the wrong fix is expensive, the extra tokens are a bargain. For a routine PR review, stick with `/ship`.
266
+
267
+ ### Anti-pattern in this scenario
268
+
269
+ Do **not** rebuild this as a `/debug` slash command that fans out subagents. Subagents can't message each other — you'd lose the adversarial debate that makes the pattern work. If a workflow keeps coming up, document the trigger prompt above as a snippet rather than wrapping it in a slash command that misuses subagents.
270
+
271
+ ### When *not* to use Agent Teams
272
+
273
+ - Production-bound verdict on a known diff → use `/ship` (subagents).
274
+ - One specialist perspective on one artifact → direct persona invocation.
275
+ - Sequential lifecycle (spec → plan → build) → user-driven slash commands (Pattern 4).
276
+ - Read-heavy research with a small digest → built-in `Explore` subagent.
277
+
278
+ Reach for Agent Teams only when teammates **need** to challenge each other to produce the right answer.
279
+
280
+ ---
281
+
282
+ ## Anti-patterns
283
+
284
+ ### A. Router persona ("meta-orchestrator")
285
+
286
+ A persona whose job is to decide which other persona to call.
287
+
288
+ ```
289
+ /work → router-persona → "this needs a review" → code-reviewer → router (paraphrases) → user
290
+ ```
291
+
292
+ **Why it fails:**
293
+ - Pure routing layer with no domain value
294
+ - Adds two paraphrasing hops → information loss + roughly 2× token cost
295
+ - The user already knew they wanted a review; they could have called `/review` directly
296
+ - Replicates the work that slash commands and intent mapping in `AGENTS.md` already do
297
+
298
+ **What to do instead:** add or refine slash commands. Document intent → command mapping in `AGENTS.md`.
299
+
300
+ ---
301
+
302
+ ### B. Persona that calls another persona
303
+
304
+ A `code-reviewer` that internally invokes `security-auditor` when it sees auth code.
305
+
306
+ **Why it fails:**
307
+ - Personas were designed to produce a single perspective; chaining them defeats that
308
+ - The summary the calling persona passes loses context the called persona needs
309
+ - Failure modes multiply (which persona's output format wins? whose rules apply?)
310
+ - Hides cost from the user
311
+
312
+ **What to do instead:** have the calling persona *recommend* a follow-up audit in its report. The user or a slash command runs the second pass.
313
+
314
+ ---
315
+
316
+ ### C. Sequential orchestrator that paraphrases
317
+
318
+ An agent that calls `/spec`, then `/plan`, then `/build`, etc. on the user's behalf.
319
+
320
+ **Why it fails:**
321
+ - Loses the human checkpoints that catch wrong-direction work
322
+ - Each hand-off summarizes context — accumulated drift over a long pipeline
323
+ - Doubles token cost: orchestrator turn + sub-agent turn for every step
324
+ - Removes user agency at exactly the points where judgment matters most
325
+
326
+ **What to do instead:** keep the user as the orchestrator. Document the recommended sequence in `README.md` and let users invoke it.
327
+
328
+ ---
329
+
330
+ ### D. Deep persona trees
331
+
332
+ `/ship` calls a `pre-ship-coordinator` that calls a `quality-coordinator` that calls `code-reviewer`.
333
+
334
+ **Why it fails:**
335
+ - Each layer adds latency and tokens with no decision value
336
+ - Debugging becomes a multi-level investigation
337
+ - The leaf personas lose context to multiple summarization steps
338
+
339
+ **What to do instead:** keep the orchestration depth at most 1 (slash command → personas). The merge happens in the main agent.
340
+
341
+ ---
342
+
343
+ ## Decision flow
344
+
345
+ When considering a new orchestrated workflow, walk this flow:
346
+
347
+ ```
348
+ Is the work one perspective on one artifact?
349
+ ├── Yes → Direct invocation. Stop.
350
+ └── No → Will the same composition repeat?
351
+ ├── No → Direct invocation, ad hoc. Stop.
352
+ └── Yes → Are sub-tasks independent?
353
+ ├── No → Sequential slash commands run by user (Pattern 4).
354
+ └── Yes → Parallel fan-out with merge (Pattern 3).
355
+ Validate against the checklist above.
356
+ If any check fails → fall back to single-persona command (Pattern 2).
357
+ ```
358
+
359
+ ---
360
+
361
+ ## When to add a new pattern to this catalog
362
+
363
+ Add a new entry only after:
364
+
365
+ 1. You've used the pattern at least twice in real work
366
+ 2. You can name a concrete artifact in this repo that demonstrates it
367
+ 3. You can explain why an existing pattern wouldn't have worked
368
+ 4. You can describe its anti-pattern shadow (what people will mistakenly build instead)
369
+
370
+ Premature catalog entries become aspirational documentation that no one follows.