agentleFS
jelbirtjelbirt/LLM-Skill-Build/prune-test-suite/SKILL.md

prune-test-suite

Skill1 starsChanged 3 months agoApache-2.0View on GitHub

Review the test suite for relevance against current source code, pruning stale tests and adding missing coverage

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 10 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Import paths within the test (e.g., import { foo } from '../utils')

    line 23
  2. Distinctive:

    Do not modify any source file.

    line 31
  3. Distinctive:

    Read the test file in full.

    line 38
  4. Distinctive:

    Read every source file listed for that test.

    line 39
  5. Very specific:

    Check each of the following for every test or describe block:

    line 47
  6. Distinctive:

    If logic requires a database client, HTTP call, framework hook, or rendering context to execute, it does not qualify — skip it.

    line 69
  7. Distinctive:

    Write a numbered list of concrete changes.

    line 76
  8. Distinctive:

    Do not apply changes yet. Print the list, then stop and ask the user to confirm before proceeding.

    line 81
  9. Distinctive:

    Only after the user has confirmed the change list (or pre-approved auto-apply):

    line 91
  10. Very specific:

    DELETE: Remove the individual it(...) / test(...) block.

    line 93
  11. Very specific:

    ADD: Add new test blocks inside an appropriate describe, or create a new describe if none fits.

    line 96
  12. Distinctive:

    Do not add test infrastructure (new configs, new packages, new scripts) unless the project has no test runner at all — in that case, ask …

    line 104
  13. Distinctive:

    If a test file uses inline simulation functions (re-implementing source logic inside the test rather than importing it), verify those …

    line 109
  14. Very specific:

    If a source function depends on Date.now() or new Date(), use a fixed reference date in the test and document the assumption in a comment.

    line 111
  15. Distinctive:

    After applying all changes for all test files, print a summary table:

    line 120

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: prune-test-suite

Review and prune the test suite for this project. For each test file, verify its logic against the current production source, then apply all necessary changes.


Step 0 — Discover scope

  1. Find all test files in this project:
    glob **/*.test.{ts,tsx,js,jsx} **/*.spec.{ts,tsx,js,jsx} **/__tests__/**/*.{ts,tsx,js,jsx}
    Exclude node_modules, dist, .next, and build output directories.
  2. For each test file, determine which source file(s) it mirrors by examining:
    • Import paths within the test (e.g., import { foo } from '../utils')
    • Inline simulation functions that replicate logic from a source file (match function names, regex patterns, or constants against the codebase via grep)
    • File naming conventions (e.g., foo.test.ts tests foo.ts)
  3. Build a scope table mapping each test file to its source file(s). Print the table before proceeding.

Do not modify any source file. Do not touch node_modules, dist directories, or generated files.


Step 1 — Read both files

For each row in the scope table:

  • Read the test file in full.
  • Read every source file listed for that test.

Complete Steps 1-4 for each test file before moving to the next.


Step 2 — Audit

Check each of the following for every test or describe block:

  1. Logic match — Does the test's logic (imported or inlined) exactly match the corresponding production code? Flag any line in the test that copies a constant, regex, branch condition, function body, or message string that differs from the current source.
  2. Stale behaviour — Does the test assert something the source no longer does? (e.g., a branch that was removed, a string that changed, a parameter that was renamed, a function signature that was updated.)
  3. Dead test — Does the test import or reference a symbol, function, or type that no longer exists in the source? Does it test a code path that was deleted?
  4. Missing coverage — Does the source contain pure, deterministic logic that has no corresponding test? Count logic as "pure" only if it can be exercised without mocking external services, databases, network calls, or framework internals. Examples:

    • Regex patterns and validation functions
    • Date/string/number formatting or parsing
    • State machine transitions and boundary arithmetic
    • Pure transform/filter/map logic
    • Error message construction

    If logic requires a database client, HTTP call, framework hook, or rendering context to execute, it does not qualify — skip it.


Step 3 — Produce a change list

Write a numbered list of concrete changes. Each item must specify:

  • The action: DELETE test / UPDATE test / ADD test
  • The file, describe block, and it(...) name affected
  • One sentence explaining why

Do not apply changes yet. Print the list, then stop and ask the user to confirm before proceeding. This list can include test deletions, which are only recoverable through git history, not through this skill - do not apply any change until the user approves the list, or has explicitly pre-approved auto-apply for this session.


Step 4 — Apply changes

Only after the user has confirmed the change list (or pre-approved auto-apply):

  • DELETE: Remove the individual it(...) / test(...) block. If an entire describe block becomes empty, remove it too.
  • UPDATE: Edit only the specific lines that are wrong. Do not rewrite surrounding tests.
  • ADD: Add new test blocks inside an appropriate describe, or create a new describe if none fits. Follow the style and conventions of the existing test file (import patterns, assertion style, naming conventions). Do not introduce new testing libraries or dependencies.

Constraints

  • Do not add test infrastructure (new configs, new packages, new scripts) unless the project has no test runner at all — in that case, ask before proceeding.
  • Preserve every test that is still correct. Do not rewrite passing tests for style.
  • Match the exact regex literal, exact error message string, and exact arithmetic from the source. Copy character-for-character; do not paraphrase.
  • If a test file uses inline simulation functions (re-implementing source logic inside the test rather than importing it), verify those inline functions match the source exactly.
  • If a source function depends on Date.now() or new Date(), use a fixed reference date in the test and document the assumption in a comment.
  • Edit the minimum number of lines necessary. If a diff would exceed 20 lines for a single test update, explain why before proceeding.

Output

After applying all changes for all test files, print a summary table:

Test fileTests deletedTests updatedTests addedNotes
...............

Then run the project's test suite using whatever test command is configured (check package.json scripts for test, test:unit, etc.). Report whether all tests pass. If any fail, read the failure output, fix the cause, and re-run until the suite is green.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.