/test-skills:test-auditfrom Test Skills
Use this skill to diagnose the health of a whole existing test suite and its CI, and to report how lean it could be without losing fault detection. It builds a per-test mutation kill matrix, certifies a minimal subset, and flags duplicate, subsumed and zero-signal tests, clone clusters, test smells, flakiness and CI tiering problems. Use it when the concern is the suite as a whole: it's bloated, slow, brittle, untrusted or agent-grown; the user wants to know how many tests they really need; they doubt their coverage or mutation score; or they want it checked against a test constitution. Vague complaints like "CI takes forever" count. Do not use it for narrow questions about specific named tests, such as whether one test is flaky or whether a given property test subsumes certain example tests. Also skip it for writing new tests, explaining concepts, or carrying out deletions and consolidation, which belong to test-reduce. This skill only measures and recommends.
Ships in Test Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Agent-grown test suites fail in a recognizable way. Every change adds tests, nothing removes them, and the suite fills with copies, mocks of internals and assertions that cannot fail. CI slows and flakes, refactors break hundreds of tests, and the extra thousand tests catch almost nothing the core hundred would not.
This skill measures that precisely. The deliverable is a report that says:
It does not delete anything. That is test-reduce, and it starts from this report.
tmxscripts/tmx.py is stdlib-only Python 3.9+. Siblings reach it at
${CLAUDE_SKILL_DIR}/../test-audit/scripts/tmx.py. Set T=${CLAUDE_SKILL_DIR}/scripts/tmx.py.
| Command | What it gives you |
|---|---|
collect-pytest --src PKG --tests tests -o .tmx/matrix.json | Per-test coverage, then a kill matrix: every mutant of PKG, run against only the tests that cover its line, in throwaway copies. Run it with the project's interpreter (pytest + coverage). |
faults faults.json --cmd "<test cmd writing {junit}>" [--matrix m.json] | Domain faults for any language: text patches applied in throwaway copies, run with any JUnit-writing command, merged into the matrix with exact attribution (a fault that breaks compilation is an error, never a kill). |
import-stryker mutation.json -o .tmx/matrix.json | The same matrix for JS/TS/C#/Scala from Stryker (coverageAnalysis: "perTest", json reporter). |
score .tmx/matrix.json --survivors | Mutation score, zero-kill tests, surviving mutants. |
analyze .tmx/matrix.json -o .tmx/plan.json [--csv keep.csv] | Smallest subset preserving every kill (weighted set cover), reasons per removed test, trade-off curve, certificate; --csv writes the per-test keep/remove table for the user. |
verify .tmx/plan.json .tmx/matrix.json [--rerun] | Independent check of the certificate (exit 3 if invalid). --rerun also replays every obligation's mutant against the retained suite alone. Use it for any plan that will be acted on. |
smells tests/ --src PKG -o .tmx/smells.json | Static smells, each tagged with the constitution article it breaks. |
clones tests/ -o .tmx/clones.json | Structurally identical tests: parametrize or property candidates, with their literal rows. |
gate --policy test-policy.toml ... | The constitution's machine checks (see test-ci). |
For other languages without Stryker, see references/languages.md. The fallback is
static smells/clones plus JUnit counts, which gives a partial audit, labelled as such.
TEST-CONSTITUTION.md / test-policy.toml exist. Run the suite
once with a JUnit report, and record count, wall time and skips. It must be green: a
kill matrix needs a passing baseline. If it is red, stop and report the failures.smells and clones, and read the top clusters.
These findings stand on their own even if mutation is too slow.mutants × (pytest startup + covering tests' time) / jobs. For big suites:
Cheap first pass: --operators extreme (one mutant per function) finds
pseudo-tested functions and zero-signal tests fast.
Sampling: --per-line 1 puts at most one mutant on each line, the way Google
does it at scale.
Real faults: --history 20 adds up to 20 real faults by reverting past fix
commits that still apply (see ADR-0002). Always include these when the repo has
git history.
Reproducibility: --seed N fixes the per-line sample. The collector records the
seed in the matrix and writes a mutant-set digest, which collect-pytest, score
and analyze print beside the score, so two builds of the same commit and seed are
comparable. The digest covers the mutant set itself (file, line, operator,
description), not the rendered mutant bodies, so it is stable across Python
versions; a different digest means the set moved and the scores are not comparable.
Imported Stryker/PIT matrices carry no digest, and score prints null for them.
Scope: restrict --src to one package at a time when the suite is huge. Say so
in the report.
Domain faults for critical code: --extra-mutants faults.json (pytest collector), or
tmx faults faults.json --cmd ... for any language (for example Vitest with
--reporter=junit --outputFile={junit}, merged into an imported Stryker matrix). Each takes a list of
{"file", "find", "replace", "desc"} entries. The operators cover comparisons,
arithmetic (including // vs /), constants up and down, numeric strings,
raise deletion, min/max/sum/any/all swaps and rounding modes. They do not
know your domain.
In the benchmark, a plan certified on operators alone would have let 12 hand-written money faults through (a wrong regional tax rate, compounding order, sum vs max). For R4 and R5 tiers, write the plausible domain faults (the rate table, the order of rules, the rounding boundary) before trusting a reduction.
analyze, then verify --rerun. Add --lines if the team also
wants coverage preserved (it costs slightly more tests). Protect tests the constitution
marks protected (the exact ids in testing/protected.txt, such as regressions for real bugs) with one --keep <id> each.
Then read plan.json:
remove reasons: zero-signal (kills nothing), duplicate, subsumed (by one
retained test), and jointly-covered.curve: how few tests reach 80, 90 and 95% of the kills.optimal / lower_bound: whether the subset is provably minimal for this matrix.score --survivors. Surviving mutants in critical code are
missing tests. Triage the top ones:
x < lo → x <= lo inside a
clamp that returns lo);references/ci-review.md:
../test-constitution/references/rigor-profiles.md):
../test-constitution/assets/TEST-CONSTITUTION.md and recommend
adopting them..tmx/findings.json and publish the report (references/report.md). Offer
the next steps:test-reduce to apply the plan;test-constitution if there is no constitution;test-ci for the pipeline;coverage-proof where a property or model could replace a cluster.test-reduce demotes to probation before deleting.--src, such as a config file or a template, can look zero-signal while doing
real work. Check what it touches before calling it dead.score shows. Never round
them up.mock-heavy in an adapter test at a network boundary
is correct. The smell list is for review.references/report.md: the findings.json shape and the report contract (verdict strip,
reduction projection, weakness list, CI findings, compliance table, re-run commands).references/ci-review.md: the CI checklist with the sources behind each item.references/languages.md: matrices for JS/TS (Stryker), Java (PIT), Rust (cargo-mutants),
Go, and JUnit-only audits.references/interpreting.md: equivalent-mutant triage, pseudo-tested functions, zero-kill
tests that still matter, and history mutants.references/ci-review.md (opens in a new tab)references/interpreting.md (opens in a new tab)references/languages.md (opens in a new tab)references/report.md (opens in a new tab)scripts/tmx.py (opens in a new tab)scripts/tmx/__init__.py (opens in a new tab)scripts/tmx/cli.py (opens in a new tab)scripts/tmx/cover.py (opens in a new tab)scripts/tmx/covering.py (opens in a new tab)scripts/tmx/faults.py (opens in a new tab)scripts/tmx/gate.py (opens in a new tab)scripts/tmx/importers.py (opens in a new tab)scripts/tmx/matrix.py (opens in a new tab)scripts/tmx/mutate_py.py (opens in a new tab)scripts/tmx/oracle.py (opens in a new tab)scripts/tmx/probation.py (opens in a new tab)scripts/tmx/pycollect.py (opens in a new tab)scripts/tmx/rigor.py (opens in a new tab)scripts/tmx/smells.py (opens in a new tab)scripts/tmx_pytest_plugin.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
test-skills@opum is listed by opum-ai/opum-marketplace — review the source before installing
npx claudepluginhub opum-ai/opum-marketplace --plugin test-skills6 skills in this plugin
/coverage-proofTurn "are these tests enough?" and "can these tests go?" into stated, machine-checked claims - mutation kill-set certificates, partition and t-way covering-array completeness under an explicit uniformity hypothesis, property subsumption (one property replacing a table of examples), bounded-exhaustive checks under the small-scope hypothesis, differential tests against a reference model, confidence bounds for random testing, and TLA+/Lean proofs via proof-skills - then retire the example tests each claim subsumes, keeping one conformance test. Use this skill whenever the user asks to prove test adequacy, justify deleting tests mathematically, know how many tests a function really needs, replace many example tests with a property or model, get "provable coverage", or produce R4/R5 (Strict / High-Assurance) verification evidence - even if they just ask "is this enough?". It works on a named unit or cluster of tests; for auditing a whole suite use test-audit, and to cut or demote tests use test-reduce./test-ciDesign or fix a CI test pipeline that stays fast and trustworthy as the suite and the agent-driven change rate grow - PR vs nightly tiers under a time budget, affected-test selection, sharding, flake quarantine with an expiry, no retry-until-green, the test-constitution gate with a budget ratchet, diff-scoped mutation testing on PRs and full mutation nightly, probation runs, and rigor-level approvals. Use this skill whenever the user asks to speed up CI, restructure test jobs, add or fix a test gate, handle flaky tests, add mutation testing to CI, enforce test budgets or a test policy in GitHub Actions/GitLab/other CI, or says CI is slow, red for no reason, or can't keep up with agent PRs./test-constitutionSet up (or amend) a project's test constitution - governance rules agreed up front that keep an agent-driven test suite adequate but lean - test budgets, risk-tiered adequacy by mutation score instead of 100% coverage, marginal-value admission of new tests, the Red-Green-Refactor-Prune TDD cycle, flake quarantine, certified deletion - as TEST-CONSTITUTION.md plus a machine-enforced test-policy.toml, an agent-instructions block in CLAUDE.md/AGENTS.md, and a CI gate. Use this skill whenever the user wants testing rules, standards, a testing policy, guardrails, or governance for humans or agents; says agents write too many or low-value tests and wants that to stop going forward; wants a coverage policy or test budget; or is starting a new project and wants to set testing up right. For measuring an existing suite use test-audit; for planning tests for one feature use test-plan./test-planPlan and write the smallest test set that adequately verifies a new feature, bug fix or module - derive behaviors from the spec, model input partitions and boundaries, choose property vs parametrized table vs single example, size a test budget, then run TDD as Red-Green-Refactor-Prune so scaffolding tests never pile up - at the rigor level the change requires (R1 Minimal to R5 High-Assurance). Use this skill whenever the user asks to write tests for new code, do TDD, "add tests for this feature", implement something from a spec with tests, decide how many or which tests a change needs, or wants test-first development that does not bloat the suite - including when an agent is about to add tests as part of any feature work in a repo with a TEST-CONSTITUTION.md. For shrinking an existing suite use test-reduce; for suite-wide measurement use test-audit./test-reduceRadically shrink an existing test suite without losing fault detection - consolidate copy-paste tests into parametrized tables and properties, demote certified-redundant tests to a nightly probation tier, delete them after probation, and prove at every step (mutation kill-set certificate, before/after matrix compare) that nothing the suite used to catch is lost. Use this skill whenever the user wants to cut, prune, slim, deduplicate, consolidate or clean up tests, get a bloated suite (hundreds or thousands of agent-written tests) back under budget, bring a project into compliance with its test constitution, or act on a test-audit report - including "delete the useless tests", "we have 3000 tests and CI takes 40 minutes", or "make the suite maintainable again". Starts with test-audit if no current audit exists.