Test Health
Role: worker. This command produces a strategic test-health report — it does
not edit code or tests; fixes go to /apply-fixes, refactors to /plan /
/build.
Overview
An advisory, project-wide skill: it produces the strategic-health view of a test suite that a team needs periodically — the suite's shape vs. its architecture, Agile Testing Quadrant coverage, coverage + mutation health rolled up to ROI, flaky-test management, and automation maturity — then an ordered improvement plan. It complements, and does not duplicate, cd-test-architecture: that skill owns the CD-determinism + pipeline-placement assessment, which this skill delegates to rather than re-deriving.
Grounded in: knowledge/testing-quadrants.md, knowledge/test-pyramid.md (shapes + shape↔architecture fit), knowledge/test-automation-maturity.md, knowledge/test-smells.md (project smells / flakiness), and knowledge/test-automation-principles.md (the goals/principles that frame why a project smell hurts — e.g. Developers Not Writing Tests, Frequent Debugging → lost Defect Localization). It calls the cd-test-architecture, /test-design, and mutation-testing skills (and, with --repos, system-test-design) and folds their results into the strategic rollup.
Constraints
- Advisory only. Write a report; do not edit code or tests. Hand fixes to
/apply-fixes, refactors to/plan//build. - Delegate, don't re-derive. The architecture/pipeline section comes from
cd-test-architecture— summarize its output, never restate or contradict its CD-determinism findings. - Strategic altitude. This is a suite-level diagnostic. Per-file findings belong to
test-review/test-smell-review; per-unit design belongs totest-design-advisor. Point to them; don't reproduce them. - No scoring reinvention. Quantitative quality scoring and per-file design findings come from
/test-design(Farley Score + test-review / test-smell-review) — consume them; summarize the themes and link to its report, don't re-derive or reproduce the per-file table. - Be concise. One report; findings as tables, each item mapped to a concrete next move. No restating the knowledge files — cite them.
Parse Arguments
Target repo/subtree path (default: cwd). Detect the test runner, coverage tool, and CI config from manifests and .github//.gitlab-ci.yml/etc.
Optional:
--path <dir>: audit only this subtree (default: cwd).--repos <path>...: two or more related repository paths (the first is the entry repo). Passes them tosystem-test-designin Step 4. Without it the run stays single-repo and Step 4 does not invokesystem-test-design.--pdf: also render the report to a sibling PDF (Step 9).--no-mutation: skip themutation-testinginvocation in Step 5 and
render the report's mutation column as not enabled for this run. Everything
else in Step 5 (the /test-design dispatch and its roll-up) is unchanged.
Default off — an unflagged /test-health runs mutation ROI exactly as
before, because mutation health is a real part of the standalone strategic
audit. The flag exists for a caller that has already decided mutation work is
out of scope for its run and would otherwise pay for a measurement it then
discards: /test-improve Phase 1 passes it when phase-0.md recorded
mutation mode off (#1961). A skip is not a waiver and not a failure —
the target was never in scope for this run.
Steps
1. Trivial-suite short-circuit
If the suite is tiny (few test files), shows no shape pathology, and follows clear conventions, stop here and return a one-paragraph summary ("suite is small and healthy; nothing structural to fix; revisit when it grows") instead of the full diagnostic.
2. Derive the test shape + architecture fit
Inventory tests by layer (unit / integration / component / contract / E2E). Derive the actual shape and compare it to the shape the architecture should produce, using the Other shapes + Shape ↔ architecture fit tables in test-pyramid.md. Report the mismatch (e.g. tall pyramid over thin-glue code, or ice-cream cone), not the silhouette alone.
Graph-assisted inventory. Prefer CodeGraph/Repowise over raw Grep for mapping test files to the architecture layers they exercise — see