Test Design
Role: orchestrator. This command dispatches the two test review agents as
sub-agents and the test-design-advisor skill, then aggregates one report. It
does not review files itself — it coordinates.
This command is executed under orchestrator direction. Dispatch each agent with
its model:/effort: frontmatter as declared — the harness resolves both
fields natively before dispatch, per Model/Effort Resolution in
agents/orchestrator.md (ADR 0026).
Orchestrator constraints
- Advisory only. Aggregate findings and recommendations. Do not edit
production code or write test files. Hand actionable fixes to /apply-fixes
or /build.
- Dispatch in parallel.
test-reviewandtest-smell-revieware
independent — spawn them in one batch for context isolation; each returns
structured JSON, not file dumps.
- No double-reporting. Apply
knowledge/test-review-division-of-labor.md:
when the same line appears in both test-review and test-smell-review,
keep the design-level framing and drop the duplicate — record every such
drop in the report's ### Suppressed duplicates section (see step 6).
For test-smell-review and test-design-advisor, no de-duplication is
required: per the "test-smell-review ↔ test-design-advisor — remedy
division" section of the knowledge doc, the smell agent cites the remedy
family (via remedyFamily) and the advisor names the specific remedy
pattern and refactor sequence — smell rows and advisor rows join
structurally on remedyFamily, not by prose match. Test-double and drift
overlap between cd-test-architecture and test-smell-review follows the
"test-smell-review ↔ cd-test-architecture" section of the same doc (keep
the test-smell-review row).
- Be concise. One aggregated report. Issue messages one sentence;
recommendations map to a concrete next edit.
- MinimumCD vocabulary. Layer labels in the aggregated report use the
MinimumCD six test types (static analysis / unit / component / contract /
integration / E2E) from knowledge/cd-test-architecture.md. Prefer
"contract test" over "narrow integration test"; if you must use the
alias, gloss it once: `contract test (also called narrow integration
test)`. Define each test type on first use (one-line gloss inline or
a "Test type definitions used in this report" block at the top).
- No target-shape tables. Per
knowledge/cd-test-architecture.md#the-pyramid-is-a-cost-heuristic-not-a-target-shape,
do not emit "current shape vs recommended shape" tables or per-layer target
counts; the aggregated report carries the advisor's per-behavior placement
table, not a silhouette target.
- E2E justification gate. Forward the advisor's four-condition E2E verdict
verbatim (the gate is canonical in
knowledge/cd-test-architecture.md#the-e2e-justification-gate). Never
recommend E2E in the rollup without it.
Parse Arguments
Arguments: $ARGUMENTS
Optional:
--path <dir>: target directory (default: current working directory)--since <ref>: target files changed since a git ref (git diff --name-only <ref>...HEAD)--architecture: also runSkill(cd-test-architecture --yes). Default on only when Step 1 resolved the target to the whole application (no--path, no--since, no uncommitted changes), because that skill assesses the whole application; this flag forces it on for a narrower scope.--no-architecture: never run the architecture step./test-healthpasses it because it already rancd-test-architecture.--advise: also run the test-design-advisor skill for forward-looking design (default on when the target has untested production code or few/no test files, or when the target resolves to a single production file — via--path <file>or a--sincediff that touches exactly one production file; this is the path for forward-design on a single unit — thetest-design-advisorskill has no user-facing slash command)
Steps
1. Determine target files
Same auto-scope logic as /code-review: uncommitted changes if present, else
all source files; honor --since and --path. Identify test files and the
production code they cover.
Single-file → auto---advise. If the resolved target is exactly one
production file (--path <file> pointing at a production source file, or a
--since diff whose production set has one file), set --advise on for this
run and record it in the report header. This is the entry path for
forward-design on a single unit (the test-design-advisor worker skill has
no user-facing slash command).
2. Dispatch review agents (parallel)
Spawn both as sub-agents in one batch:
test-review— tactical quality gate (assertions, hygiene, non-determinism mechanics, testability blockers)test-smell-review— xUnit smells, test-double selection, pyramid-layer placement
Each returns its standard JSON (status/issues/summary). If no test files
exist, both skip — proceed to Step 4 with --advise.
3. Score the in-scope tests (Farley Score)
Using the file set already resolved in Step 1 (Step 1 is the single
scope-resolution authority in this skill), invoke Skill(farley-score ...)
to produce the Farley Score, rating, and distribution. Label the score with
the scope it was computed over:
- No
--path/ no--since→ every test file in the repository (test-file
indicators in knowledge/test-file-indicators.md); label all tests.
--path <dir>→ tests under<dir>or covering production code under
<dir>; label under <dir>.
--since <ref>→ tests touched in the diff plus tests covering production
files touched in the diff; label changed since <ref>.
--path <dir>and--since <ref>together → tests under<dir>that are
also touched (directly or via covered production code) since <ref> — the
intersection of both sets; label under <dir>, changed since <ref>.
- Empty in-scope test set → skip the score and print
no in-scope test files
in the report instead of a number.
4. Run the advisor (when applicable)
If --advise is set (or auto-triggered), use the Skill tool (Skill(test-design-advisor ...)) on the production code to produce testability assessment, pyramid
placement, double strategy, and a behavior-preserving refactor sequence for
any untestable units.
4b. Run the architecture assessment (when applicable)
Skip when --no-architecture is set. Otherwise, if --architecture is set, or Step 1 resolved the target to the whole application, run Skill(cd-test-architecture <target> --yes), passing the resolved target (and --component <name> when --path names one component). --yes skips its interactive build-vs-document ask. Put its findings under the report's ### Architecture section; cite its report path, do not restate it.
Split with test-health: both skills call cd-test-architecture. test-design is code-level (per-file and per-unit findings plus this application-level view); test-health is strategy-level (suite shape, quadrants, maturity). Run standalone, test-design runs it; /test-health suppresses that with --no-architecture.
5. Aggregate and de-duplicate
Merge findings. Resolve overlaps per constraint 3. Group by file. Rank:
behavior/project smells and testability blockers first (they undermine the
whole suite), then fragile/obscure smells, then suggestions.
6. Report
Produce one report (chat for a small target; .dev-team-reports/test-design-<date>.md
for a module):
## Test Design Review — <target>
**Health**: <pass|attention|critical> **Test files**: N **Findings**: N
**Farley Score (<scope>)**: <score> (<rating>) — Exemplary N · Good N · Adequate N · Poor N
`<scope>` is the label produced by Step 3; render it verbatim. Concrete
forms: `Farley Score (all tests)`, `Farley Score (under <dir>)`,
`Farley Score (changed since <ref>)`, `Farley Score (under <dir>, changed since <ref>)`.
When the in-scope set was empty, replace the whole line with
`**Farley Score**: no in-scope test files`.
### Test type definitions used in this report
<one-line glosses for MinimumCD terms appearing below; verbatim from
`knowledge/cd-test-architecture.md` § The Six Test Types — at minimum
the terms actually used in the report>
### Findings (by severity)
| File:line | Smell / Issue | Severity | Source | Suggested fix |
### Design recommendations (advisor)
<testability table · pyramid placement (per-behavior, two-direction
justification, NO target counts) · double strategy · refactor sequence ·
E2E justification (only when E2E is recommended)>
### Architecture
<Only when Step 4b ran. Summary of `cd-test-architecture` findings: CD-fitness gaps, provider-side contract gaps, target architecture, report path. Omit the section otherwise.>
### Suppressed duplicates
<Every drop constraint 3 performed at aggregation time. Each entry cites the
finding's `file:line`, what was dropped (which agent's finding, keyed by
smell/message), and the reason (e.g. "mechanics duplicate of Assertion
Roulette owned by test-smell-review"). test-smell-review ↔ test-design-advisor
overlaps are never listed here — they are joined structurally on
`remedyFamily`, not dropped. Emit `_None._` when nothing was dropped.>
### Next steps
- Mechanical fixes → /apply-fixes
- Refactor sequence → /plan or /build
Surface only what's actionable. If everything is clean, say so in one line.
Do NOT include a "current shape vs recommended shape" table — see Orchestrator
constraint #6.
Integration
test-health also delegates to cd-test-architecture, at strategy level. Run standalone, this skill runs it for the code-level report; /test-health passes --no-architecture to avoid a second run.
For tests that span several deployables (entangled workflows, E2E selection across repos, cross-layer overlap), flag the seam → system-test-design and defer to that skill. This skill works at per-file and per-unit altitude; Step 4b cites the application-level view from cd-test-architecture.