/prune-tests:prune-tests [optional path]from prune-tests
Reads test suites and classifies tests as keep, rewrite, or delete based on whether they guard real behavior. Includes break-it checks to confirm dead tests.
Ships in prune-tests. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A test earns its place when it is anchored: it depends on intended behaviour, so it changes only when that behaviour changes and goes red only when it regresses. Prune every test that is not anchored.
This is the 80/20 pass: the test, the code under it and its callers, plus a break on each close call and on every deletion.
Scope. Use the path given. With none, take the whole suite; over about 30 test files or 5,000 lines, propose one package or directory and confirm it before reading.
Baseline. Run the suite for that scope and record the pass count. If it is already red, stop and report: a red suite cannot tell a broken test from a pruned one.
Classify. Read every test in scope and give it one verdict from the categories below: keep, rewrite or delete. Done when every test has a verdict and a category.
Break-it check on each close call:
git log --reverse -S'<test name>' --format='%h %s' -- <file>, first line) - is a fix or names a ticket;Break the production line its call reaches, so that only its case changes, the way its assertion would notice - an edge moved (> to >=), its one member dropped from a set or range, a failure swallowed into an empty result, a configured value hard-coded, the bug its origin or ticket names. A break runs real code: a broken guard in front of a client the test does not stub reaches live services on whatever credentials the code finds, so break it only where the client is stubbed. Script the breaks: apply one, check the diff reaches the test's own input, run the scoped suite and any outside partner, then reverse just that edit - git checkout would drop this prune's edits. A crash that reddens unrelated tests is no break.
Prune.
Verify. Run the scoped suite again: green, with the count of test ids the runner executes for the scope (parametrised cases expanded) down by exactly what the ledger removes. Then attack every deletion with the step-4 script, aiming the break only that test would catch (its own value, member or call, or its origin's bug - not the line's general behaviour) at the unpruned tree:
If the prune touched code outside the test files in scope, also run everything that can reach it, the type-check included. Run the repo's coverage gate too, where it has one.
Report in these sections, writing "none" in an empty one:
The past - it guards code that is gone or will never run again (a backfill already applied, a flag that is permanently off), or never runs itself: skipped, commented out or never collected, unless the skip is a decision.
Nothing - no plausible change to the production code can make it fail.
toBeDefined, truthy, not.toThrow) on code that cannot return nothing or throw.x >= 0, x < 1000), or an expected set that admits every outcome (exit in (0, 1)).A check on a fixture, list, sample or helper that other tests rely on is not Nothing: when it breaks, those tests pass while testing nothing. Nor is a check over a registry or repo data that is empty today.
The implementation - it changes whenever the code does, even when behaviour did not.
A copy - another test already guards the same behaviour.
The partner counts only if it goes red on every regression the copy catches and survives this prune itself (of two tests that name each other, delete one). It must:
Where the guarding assertion is incidental to the partner's subject, add a comment beside it naming what it guards, so a later prune keeps it.
Keep the one at the higher seam, closest to what a caller sees; at the same seam, the one with an independent expected value, then the easier to read. Delete the rest. Except: a lower function with production callers besides that seam is a seam of its own, so its tests are not copies; and where a layer adds no branch of its own for a rule (a command line, a route, a wrapper method, a loader that only gathers the service's inputs), keep the layer's wiring tests (any that alone go red when the layer hard-codes what it forwards) and the rule tests at the service - layer tests that re-check those rules are copies.
A test holding two implementations equal (two copies of a pattern, a port and its source) is no copy of either side's tests.
A partner outside the scope counts as a guard when the checks that run on a change to the code under the rule run it too. Where the outside one is the weaker copy, list it rather than widening the scope.
Table-driven cases count as one only when a step-4 break shows their values interchangeable: no break changes one case's result without the others' (another interpreter, flag order or sibling flag is its own case until a break says otherwise). Keep the boundaries and one ordinary case on each side. Each member of a set a condition admits (status in (warning, critical, missing)) is a boundary, and so is each lookalike the condition must not admit (--forced beside --force, a /users/settings route beside /users/:id). Failures of the same call that fall straight into the same catch (a rejected fetch, a throwing parse) count as one; another call's failure is its own case, as is a failure with its own branch. A case per entry of a lookup table guards that entry; keep each, unless a partner guards it.
Decisions. A skip or expected-fail with a comment or ticket, a platform guard, a skip-list entry, or a snapshot the repo keeps on purpose to flag changes is a decision, not waste: leave it and list it. A comment or ticket explaining an ordinary test is not; judge the test.
Follow-ups. When a rewrite needs more than the test itself - a seam that does not exist, a new fixture - keep the test as it is and list it as a follow-up.
What SKILL.md sets; muted values are Claude Code's defaults
opushighnpx claudepluginhub henkisdabro/wookstar-claude-plugins --plugin prune-testsOther plugins' skills for the same job