prune-tests
Skill5 starsChanged 10 days agoMITView on GitHub
Delete low-signal tests (tests that restate the code, always pass, or break on every refactor) one test area at a time, keeping coverage, and open one PR per area. Every run takes an area no earlier run touched.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- shuymn/skillstheir own version, first seen Nov 1, 2026
- BarganConstantin/agent-skillstheir own version, first seen Nov 1, 2026
- jackharrhy/skillstheir own version, first seen Oct 25, 2026
- TzolkinB/skillstheir own version, first seen Oct 22, 2026
- jonmumm/skillstheir own version, first seen Oct 21, 2026
- vosslab/vosslab-skillstheir own version, first seen Oct 15, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- vosslab/vosslab-skills★ 5same name
- BarganConstantin/agent-skills★ 4same name
- jonmumm/skills★ 2same name
- TzolkinB/skills★ 2same name
- jackharrhy/skills★ 1same name
- shuymn/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository57 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- architecture-satisfactionSkill
- autopilotSkill
- browser-testSkill
- chatter-scoutSkill
- closeoutSkill
- codebase-designSkill
- code-reviewSkill
- code-smells-auditSkill
- commitSkill
- dependency-auditSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- fix-ci-failuresSkill
- fix-github-issuesSkill
- fix-nightwatch-issuesSkill
- fix-posthog-issuesSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- harness-toolsSkill
- housekeeperSkill
- implementSkill
- implement-specSkill
- improve-codebase-architectureSkill
- laravel-herd-worktreesSkill
- panelSkill
- prototypeSkill
- prSkill
- releaseSkill
- repository-cleanupSkill
- researchSkill
- resolve-review-commentsSkill
- resolving-merge-conflictsSkill
- retroSkill
- run-afterSkill
- scratch-cleanupSkill
- scratch-statusSkill
- setupSkill
- sweepSkill
- tddSkill
- teachSkill
- to-questionnaireSkill
- to-specSkill
- to-ticketsSkill
- triage-github-prSkill
- triageSkill
- ui-designSkill
- upgrade-planSkill
- verifySkill
- wait-whatSkill
- wayfinderSkill
- which-skillSkill
- wizardSkill
- writing-for-agentsSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 3 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
Areas: every other token. A path restricts cycles to tests under it.
- Distinctive: line 31
Read AGENTS.md / CLAUDE.md and the rule files they point to.
- Very specific: line 47
Run the area's tests. A failing test is never deleted.
- Distinctive: line 64
Run the area and the whole suite.
- Distinctive: line 67
Target: remove at least 20% of the area's tests.
- Very specific: line 71
Follow sweep's references/submit.md with prune-tests/<area> for sweep/<topic> and --prefix prune-tests on every ledger run.
- Very specific: line 73
Run cycles one after another, each from a fresh fetch and ledger.
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Prune Tests
Each cycle takes one test area (a test directory, or the tests for one module), deletes every test in it that would not catch a real bug a stronger test misses, proves coverage held, and opens one PR. One cycle, one area, one PR.
The goal is a smaller suite that protects behavior, not a large suite that protects coverage numbers. A test stays only when it passes the value gate in tdd's testing best practices. That file is the one source for what a good test is. Read it before the first cycle.
Invoking this skill gives the same authority as sweep, per cycle: a branch and worktree, commits, pushing that branch, and opening and labeling its PR. It does not authorize merging or pushing to the default branch.
Every run finds new ground
Runs repeat on the same repo, and earlier PRs stay open for days. Treat earlier work as sweep does: an open, merged, or declined prune-tests/* PR rules out its files. It never ends the run. Move on to the next area.
The keep rule beats the quota. A test that passes the value gate stays, however short of the target the cycle falls. An area whose tests all earn their place ends with no PR and a report of what was examined. That is a correct result.
Arguments
Parse these before any discovery. On invalid input, stop and report it.
- Count: one whole number from 1 to 10. Without a count, run 1 cycle. Treat a count above 10 as 10, and say so.
- Areas: every other token. A path restricts cycles to tests under it. Any other word is a product area (
billing): confirm by search that it names real code, otherwise stop and report it. With no areas, every test qualifies.
1. Load context and known work
- Read
AGENTS.md/CLAUDE.mdand the rule files they point to. Find the test runner, how the repo runs coverage, and its test layers (unit, integration, feature, E2E). git fetch origin. Resolve the default branch.- Save the ledger, then query it by path, never whole (
<scratch>is the session scratchpad, otherwise$TMPDIR):
Query it the waybash <this-skill-dir>/../sweep/scripts/known-work.sh --prefix prune-tests > <scratch>/known-work.jsonsweep's step 1 shows.
2. Pick one area
Rank the in-scope test files by smell density: mock-heavy setups, assertion-free tests, snapshot or copy assertions, tests named after methods rather than rules, many tests on one small class, unit tests for code a feature test already drives. Take the densest area that no ledger PR touches (an open PR on any of its files covers it). Keep the area reviewable: up to about 40 test files.
3. Baseline
Work in a worktree from the fetched base, per sweep's step 3.1, with the branch prune-tests/<area> (not in taken_branches).
- Run the area's tests. A failing test is never deleted. Write it to
.scratch/prune-tests/findings/<YYYY-MM-DD>-<topic>.mdin the main checkout as a possible product bug, and leave it alone. - Measure coverage of the area's production owners (the code its tests exercise). Run the full suite, or, when that is too slow, the area plus every test file that names an owner. Use the same test set again in step 5. Record the number and the command. Without a coverage driver, say so and record covered lines from the runner's own output, or the owners' line list, instead.
The baseline is done when you have the test count, the pass/fail list, and the coverage number with its command.
4. Audit every test
Give every test in the area a disposition from the value gate: Keep, Rewrite, Move, or Delete, with one line of evidence. A Delete names its reason. When it duplicates a stronger test, it names that test by file:line. Read each test and its production owner. A test's name is not evidence. Before you mark a test Delete because it asserts presentation, run git log on it: a test that a fix commit added guards that bug, and it stays.
Fan the audit out when the area has more than about 10 files. In Claude Code, dispatch the leek-skills:test-auditor agent, one per batch of about 8 files, in parallel. In other harnesses, dispatch the same brief and wait per harness-tools, one per batch, all at once. Otherwise audit inline. The brief: the batch, the area's other test layers to search for stronger tests, and the value gate file. Check each returned Delete yourself before acting on it. A Delete whose stronger test you cannot find becomes a Keep.
The audit is done when every test in the area has a checked disposition.
5. Prune and verify
- Delete each Delete. Remove what only those tests kept alive: fixtures, helpers, test-only exports or wrappers in production code. Record each production line removed.
- Rewrite only when it is small and stays in the area (a circular oracle becomes a literal, a mock of an owned class becomes the real class). Break the behavior it claims in production code, watch it go red, then restore the code. Note a larger rewrite or any Move as a findings file instead.
- Run the area and the whole suite. Every test that passed at baseline still passes.
- Measure coverage again with the same command. It must stay within 2 percentage points of the baseline. If it falls further, find the lines that lost coverage first. A real branch that a deleted test hit only by accident gets its own test now. For the rest, restore deleted tests, the weakest-reasoned first, until it holds. A restored test is a sign that the test protected something; say so in the PR.
Target: remove at least 20% of the area's tests. When the value gate keeps more, the PR says why per kept group, never "they looked fine".
6. Submit and finish
Follow sweep's references/submit.md with prune-tests/<area> for sweep/<topic> and --prefix prune-tests on every ledger run. The PR's label is test. The body adds a table of removed tests, each with its reason, plus coverage before and after, with the command, and production lines removed.
Run cycles one after another, each from a fresh fetch and ledger. Clean up per sweep's Clean up, with .scratch/prune-tests/findings/ kept.
At the end, check the repo's AGENTS.md for the rules in references/agents-rules.md. If no rule of that kind is there and no ledger PR adds one, open one more PR, prune-tests/agents-rules, that adds them. It does not count toward the cycle count.
Report one entry per cycle: the PR link, tests removed and kept (with the kept reasons), production lines removed, coverage before and after, checks, findings files, and anything you were unsure about. For a cycle with no PR, say what it examined and why nothing qualified. Start each entry with ✅ PR opened or ⚠️ no PR.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

