/test-skills:test-reducefrom Test Skills
Radically 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.
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.
Deleting tests is easy. Deleting tests safely is the job. Every reduction here is backed by evidence a reviewer can check, and it moves in reversible stages:
consolidate → demote → delete
Each stage ends with a re-measurement showing that no killed mutant (and no history mutant, meaning a real past bug) went uncaught.
The ordering follows the evidence. Kill-set-preserving reduction loses nothing measurable (Shi et al. 2014), but real regressions have slipped past reduced suites (up to 52% of failed builds in Shi et al. 2018). Tests therefore spend a probation window in the nightly tier before they are deleted (ADR-0003).
T=${CLAUDE_SKILL_DIR}/../test-audit/scripts/tmx.py.
.tmx/matrix.json and .tmx/plan.json from test-audit, at
this commit, and tmx.py verify --rerun passes.
--extra-mutants). Operators alone are not enough there. If not, run test-audit first; at minimum
run steps 1 and 3–4 of its workflow.curve to show whether the certified cut reaches it. Never cross it by
dropping kills without their explicit OK.Resolve each path's level from the policy (see
../test-constitution/references/rigor-profiles.md). Honor the strictest level the tests
touch, meaning the source they cover:
| Level | Reduction rules |
|---|---|
| R1–R2 | Certificate over kills; probation of 0–3 days. At R1 the tests may simply be deleted, since nothing is kept. |
| R3 | Certificate over kills plus history mutants; probation of 14 days / 20 runs. |
| R4 | Certificate over kills and lines (analyze --lines); history mutants required; probation of 30 days / 30 runs; a human reviews the deletion PR. |
| R5 | Only with an assurance-case update showing that every requirement and hazard keeps its verification. Tests traced to requirements are --keep-protected unless the claim moves that requirement to another test. An independent approval is required. The agent prepares the change; it never merges it. |
Start from the clone clusters (.tmx/clones.json) and the duplicate / subsumed
groups in the plan. For each cluster, pick one form:
references/consolidation.md for patterns.Rewrite behavior-coupled tests while you are there:
Delete tautologies and no-assertion tests outright. They are provably zero-signal (Article IV), so no probation is needed. Say so in the log.
After each batch, re-measure and compare:
$T collect-pytest --src PKG --tests tests -o .tmx/after.json [same flags as the audit]
$T compare .tmx/matrix.json .tmx/after.json # exit 3 = something is no longer killed
If anything is lost, the consolidation dropped a behavior. Restore the row or assertion that killed it. Never "fix" this by weakening the mutant set.
The tests a table replaces are gone in the same commit: compare with 0 lost is their
certificate. Parking the originals in probation adds caution, which is fine if the user wants
it. It is not stage 2, though, and it cuts nothing from what the PR tier runs.
This is where the radical cut happens, so do not stop after consolidation. Consolidation removes copy-paste. It still leaves rows and tests whose kills other tests also make. On a typical agent-bloated suite, consolidation roughly halves the count, and this stage halves it again.
Re-run analyze on the consolidated matrix, then verify. Demote what it removes:
$T analyze .tmx/after.json -o .tmx/plan2.json $(sed 's/^/--keep /' testing/protected.txt) # exact protected ids
$T verify .tmx/plan2.json .tmx/after.json --rerun # empirical: the retained suite alone catches each one
$T probation add --plan .tmx/plan2.json # writes .test-probation.json (refuses uncovered/empty plans)
$T probation install --conftest conftest.py # pytest hook; marks listed tests `probation`
Demote everything the certificate removes by default, boundary and money cases included. Demotion is not deletion. A probation test still runs every night, and it is deleted only after a clean window. If it ever fails, it comes straight back. So "this is an important boundary" is a reason to keep it on probation, not in the PR tier. The PR tier is guarded by what the certificate keeps, and that already kills every mutant the demoted case kills.
To keep a certified-redundant case in the PR tier anyway, pass --keep <id> and name the
reason in the report. A good reason is a behavior the mutant set cannot express, such as a
spec boundary with no mutant that separates it, or a user-facing contract someone asked to
keep visible. A good reason is not "it's money code": the rigor level already covers that
through the probation window and the line certificate.
pytest -m "not probation". Speed improves immediately.$T probation record --junit nightly.xml.For JS/TS and other runners, follow references/probation-other-runners.md: a
tag/grep-based exclusion from the same list.
$T probation status --days 14 --min-runs 20
$T probation prune --days 14 --min-runs 20 # removes whole test functions via AST
Use the window from test-policy.toml [probation]. Shorten it only if the user
explicitly accepts the risk, and record that in the report. prune deletes only whole
functions. A parametrized function with some cases due is reported under
partial_tables; edit those rows by hand.
compare it against the
original audit matrix. That compare is the end-to-end evidence: zero lost
obligations.$T baseline --matrix .tmx/final.json --junit junit.xml;max_tests in test-policy.toml to the new count plus headroom, as an
amendment with its reason..tmx/findings.json (kind: "reduction") and publish the report
(references/report.md):
test: consolidate 14 coupon-expiry tests into 1 table (compare: 0 lost)test: demote 96 certified-redundant tests to probation (plan2 verify: VALID)test: delete 96 tests after 14-day probation (0 failures in 20 nightly runs)--lines choice or the protected list between the
audit and the final compare. Changing any of them resets the comparison, and the report
must say so.newly_killed > 0), report it. It usually means an
assertion got stronger, which is a good outcome worth showing.references/consolidation.md: table vs property vs merge, with before/after examples
in pytest, Hypothesis, Jest/Vitest and fast-check, plus the oracle rules.references/probation-other-runners.md: probation lists for Jest, Vitest, Go, Cargo
and JUnit5.references/report.md: the reduction report contract.What SKILL.md sets; muted values are Claude Code's defaults
6 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-auditUse 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.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-skills