Prunes low-value tests across a suite to a measured target while holding coverage. Works with Vitest, Jest, c8, pytest-cov, go test -cover.
Ships in mblode-agent-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.
Tests earn their place by catching a credible regression that nothing else catches. Agents write a test for every small change, and most of those re-assert the source, replay a stronger test through a mock, or pin a private call shape. Coverage barely moves when they go; maintenance cost and suite time do.
tidy), making CI faster by splitting or sharding (ci-speedup), or writing tests for untested code.| Mode | When | Done means |
|---|---|---|
| Audit | A focused sweep of named files or a directory | A handful of high-confidence candidates with full evidence, deleted in one coherent batch with validation green |
| Campaign | A subsystem's or repo's whole test surface, or any request with a target ("remove 20%") | The target is met or the ledger shows why it cannot be, coverage held within tolerance, and the preservation review passed. Read references/campaign.md first |
An open-ended "clean up the tests" stops after a few obvious deletions, because every remaining candidate looks defensible in isolation. Audit and Campaign need a number to work against. When the user gave one, use it. When they did not, propose one and proceed on it rather than waiting:
Remove the least useful 20% of test declarations in
<scope>, keeping line and branch coverage within 2 percentage points of the baseline and every retained test green.
Measure the baseline first (references/coverage.md), then keep deleting in order of lowest value until the target is met or the coverage budget is spent. Stopping short is a valid result only with a ledger showing that the remaining candidates each guard a named contract. The target is a floor on effort, not permission to cut uncertain tests: the retention bar below still wins over the number.
What an audit or campaign hunts for:
toHaveBeenCalledWith on an internal) duplicated at a real boundaryTwo more finding kinds. Neither is a removal candidate on that fact alone, and a move or an unskip is not a deletion toward the target.
routes/posts.test.ts that never touches the route and only calls lib/slug.ts. Move it to the canonical owner's suite, as "Edit shape" says for retained regressions.it.skip('prorates refunds on downgrade'), xit, @pytest.mark.skip, or t.Skip(). Unskip it and run it first; never remove it on sight. If it passes, leave it enabled and judge it like any other test. If it fails, treat it as a possible product bug under the retention bar: reproduce it and fix the owner. A conditional skip with a real platform or environment reason is not a finding.Keep a test when it independently enforces a public API, protocol, config, migration, storage, security, platform, default value, generated cross-language, package, release, or architecture contract. Also keep:
Static or slow is not a reason to delete. A test that resembles implementation may still be the only proof of a contract; show otherwise before removing it.
Before judging, read the complete test, the production owner, its callers and callees, sibling implementations, overlapping tests, and the history that explains why the test exists. Record for each deletion:
A missing field means the candidate is not ready. Prefer a few high-confidence deletions over a long speculative list; do not convert uncertain candidates into deletions to reach the number.
Delete in coherent owner-boundary batches. With each batch, delete the test-only exports, globals, wrappers, reset hooks, and dead production paths it unlocks instead of keeping aliases. Move retained regressions to their canonical owner and fold duplicated setup into shared fixtures. Aim for net-negative production lines as well as test lines. Do not add replacement tests that restate the same implementation.
git diff --numstat with production and tooling lines separate from test lines.Running tests and coverage locally, and deleting tests and test-only seams in the working tree, are the task: do them without asking. Commit, push, or open a PR only when asked. A test that meets the retention bar stays; deleting one anyway is the user's call, as is changing coverage thresholds or CI gates.
AGENTS.md, drawn from the patterns this audit actually found, so agents stop writing themA prune regrows within weeks when agents keep adding a test per change. Two signals stop it:
git ls-files. A suite where tests plus support pass about half of all lines is a campaign candidate; OpenClaw peaked at 69% before its prune (OpenClaw, 2026).AGENTS.md gate: over it, offset by deleting or consolidating tests elsewhere, or state why in the PR body. Report it as a CI warning, not a failure; a blocking cap teaches agents to cram assertions into fewer lines.references/coverage.md).| File | Read when |
|---|---|
references/campaign.md | Campaign mode, or any target-driven prune larger than one directory |
references/coverage.md | Measuring the baseline, per-file and per-test coverage, the budget check, and mutation spot checks |
Maintenance only: evals/evals.json holds scenarios for changing this skill; it never loads during a task.
tidy: gates a test the moment a diff adds or changes it, and reviews the rest of the diff alongside it. This skill only sweeps or campaign-prunes the existing suite; "audit these tests in my PR" routes to tidy, not here.Adapted from OpenClaw's test-audit skill (openclaw/openclaw, MIT). Provenance lives in the repository's maintenance notes.
evals/evals.json (opens in a new tab)evals/fixtures/billing-junk-sweep/base/package.json (opens in a new tab)evals/fixtures/billing-junk-sweep/base/src/billing/currency.test.ts (opens in a new tab)evals/fixtures/billing-junk-sweep/base/src/billing/currency.ts (opens in a new tab)evals/fixtures/billing-junk-sweep/base/src/billing/plans.ts (opens in a new tab)evals/fixtures/billing-junk-sweep/base/src/billing/proration.test.ts (opens in a new tab)evals/fixtures/billing-junk-sweep/base/src/billing/proration.ts (opens in a new tab)evals/fixtures/billing-junk-sweep/base/src/billing/webhooks.test.ts (opens in a new tab)evals/fixtures/billing-junk-sweep/base/src/billing/webhooks.ts (opens in a new tab)evals/fixtures/billing-junk-sweep/base/tsconfig.json (opens in a new tab)evals/fixtures/billing-junk-sweep/fixture.json (opens in a new tab)evals/fixtures/freight-api-prune/base/package.json (opens in a new tab)evals/fixtures/freight-api-prune/base/packages/api/package.json (opens in a new tab)evals/fixtures/freight-api-prune/base/packages/api/src/quote.test.ts (opens in a new tab)evals/fixtures/freight-api-prune/base/packages/api/src/quote.ts (opens in a new tab)evals/fixtures/freight-api-prune/base/packages/api/src/rates.test.ts (opens in a new tab)evals/fixtures/freight-api-prune/base/packages/api/src/rates.ts (opens in a new tab)evals/fixtures/freight-api-prune/base/packages/api/src/tracking.test.ts (opens in a new tab)evals/fixtures/freight-api-prune/base/packages/api/src/tracking.ts (opens in a new tab)evals/fixtures/freight-api-prune/base/tsconfig.json (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
/mblode-agent-skills:test-auditfrom mblode-agent-skills
mblode-agent-skills@cascade-code-general-misc-4 is listed by joshuarweaver/cascade-code-general-misc-4 — review the source before installing
npx claudepluginhub joshuarweaver/cascade-code-general-misc-4 --plugin mblode-agent-skills30 skills in this plugin
/agent-ready-repoFor a codebase: makes it safe for agents to work in by building the guardrails, AGENTS.md, verification and laws they need, or audits a repo against the catalogue and fixes the top gap. Use when asked to "make this repo agent-friendly", "set up a repo for agents", "audit this for agents", or "agents keep making the same mistake". For a public website or docs site use agent-ready-site./agent-ready-siteFor a public website or docs site: implements agent-readiness from Mintlify Agent Score, AFDocs, Is Agentic, Is It Agent Ready, or url-discovery-bench reports, or from server logs of agents 404ing on guessed URLs. Use when asked to "make our site agent-ready", "improve Agent Score", "fix llms.txt coverage", "agents keep 404ing on our docs", or when a pasted scorecard is the brief. For a codebase's guardrails, AGENTS.md and verification use agent-ready-repo./agent-skills-creatorCreates and improves portable Agent Skills with a validator, routing scenarios, and evidence-based keep, cut, merge, or retire decisions. Use when asked to "write a skill", "update all skills", "audit my SKILL.md", "remove redundant instructions", or fix skill triggering./agents-mdAudits and edits agent instruction files, verifies repository commands, and migrates repositories to AGENTS.md as the single shared source. Use when asked to "improve my AGENTS.md", "migrate CLAUDE.md to AGENTS.md", or make instructions work across agents./app-verificationBuilds and maintains a repo's own verification harness (verify CLI, doctor, worktree isolation, feature map, seed data) and a reproduce-first bug handoff. Use when asked to "build a verification harness", "add a doctor command", "prove every feature still works", or "reproduce this bug report"./autoshipRuns a changesets npm release through the version PR, CI publish, and registry verification. Use when asked to "release this package", "autoship", "merge Version Packages", or diagnose a release that did not publish.Other plugins' skills for the same job