mcpField
P
prune-tests

prune-tests

github.com/riffingonsoftwareTesting & quality084 installsUpdated today
Repository

About prune-tests

prune-tests is a skill for reducing test-suite cost without weakening meaningful protection. It helps developers classify tests by the contracts, shipped bugs, and critical invariants they uniquely cover, then remove or consolidate redundant tests and report the changes.

Key features

  1. 01Classifies tests by protected behavior
  2. 02Investigates unclear test coverage
  3. 03Keeps, consolidates, or deletes tests
  4. 04Reruns tests after changes
  5. 05Reports removals and runtime savings

Use cases

  1. 01Trimming a costly full test suite
  2. 02Reviewing tests affected by a code diff
  3. 03Removing duplicate or obsolete coverage

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/riffingonsoftware/agent-skills --skill prune-tests

After installing, type/prune-testsin Claude Code to confirm it loaded.

Details

From the project README

Prune tests

Reduce test-suite cost without weakening meaningful protection.

Keep

Keep a test only when it uniquely protects:

  • A contract another repo, service, or user relies on.
  • A shipped bug that could recur.
  • A critical security, permissions, compatibility, concurrency, migration, protocol, or data-loss invariant, with one test per invariant, not one per branch that enforces it.

Also keep every test the repository's instructions require.

A contract sits at an API, CLI, protocol, workflow, or artifact boundary. A bug shipped if it reached the default branch or users. Tests that cover private mechanics, duplicate stronger coverage, enumerate equivalent cases, preserve dead behavior, test framework or type guarantees, restate the code as assertions, or depend on structure rather than behavior do not qualify. Coverage percentage is not a reason to keep a test.

Scope

Default to the whole suite. When a caller scopes the run to a diff, consider only tests the diff adds or changes and tests that cover code it changes or removes.

Workflow

  1. Run the in-scope tests and record their runtime. If any fail, stop and report the failures.
  2. Group every in-scope test by what it protects under Keep. Put tests that protect nothing in one group.
  3. Investigate each group whose protection is unclear. Search the history for the fix that added it, read the code it covers and that code's callers, and temporarily break the behavior it asserts to see whether another test also fails. Treat a bug as shipped only if the history shows it reached the default branch or users.
  4. Classify each group as keep, consolidate (merge into one test with the same protection), or delete. Delete a group when you cannot name what it uniquely protects. Finish when every group has a class.
  5. Apply the changes one group at a time; do not alter production behavior.
  6. Rerun the in-scope tests and every test that used a fixture you removed. Finish when they pass.

Report the tests, fixtures, and lines removed, the runtime saved, and the reason for each deletion and consolidation.

Comments

Markdown supported