agentleFS
MammadovEshginMammadovEshgin/clean-code-skill/skills/test-audit/SKILL.md

test-audit

Skill1 starsChanged 2 months agoMITView on GitHub

Audit the tests in a scope. Delete tests that cannot fail, rewrite tests coupled to the implementation at the public seam, add the seam tests callers depend on, and prove the suite bites with mutation probes. Scope is a path or git range; empty means the tests the uncommitted diff touches or should have.

80 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use chips, redo and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • udecodeSkill

    chips

    Run the project's suggested-task ledger, the chips. /chips alone brings this session's open tasks up to date: it applies what the ledger helper says, settles stale and split tasks, cards what can start and reports the board, and /chips all also takes the ship-list tasks and the ones no live session owns, and merges duplicate tasks across the board. Use for /chips, /chips offer, start or drop, \"what chips are open\", \"suggest a task for X\", \"update the chips\", \"clean up the chips\", \"which chips are stale\", \"is this chip still worth doing\", \"merge duplicate chips\", at the last hand-back of a run that offered a task, and whenever pstack would file a tracked issue, a follow-up, a reflect Backlog item or an out-of-band PR.

    Also in 3 projects that use this

  • Scylla23Skill

    redo

    Re-run the last routed task one model tier up (haiku → sonnet → opus → fable). User-invoked escalation when the previous result missed. Pass --dry-run to preview without running.

    Also in 3 projects that use this

  • Aetheria-Labs1Skill

    plan-page

    Plan one storefront page from strategy through final copy, section order, proof, offers, template direction, responsive layout, and production asset requirements. Stops at an approved execution-ready specification.

    Also in 3 projects that use this

  • SocialKit-APISkill

    video-transcripts

    Extract transcripts from social videos through SocialKit across YouTube, TikTok, Instagram, Facebook, X/Twitter, LinkedIn, and direct video file URLs. Use when the user asks to transcribe, get captions or subtitles, pull the spoken text, or read what a video says, including one video or many at once. Returns full text plus timestamped segments. Not for posting, private accounts, or unrelated website scraping.

    Also in 3 projects that use this

  • clawdbotSkill

    pr-simplify

    Simplify your own change to its smallest complete fix. Use before opening a PR, before pushing large repairs to one, or when asked to shrink a PR or clean up slop.

    Also in 3 projects that use this

  • spitoglouSkill

    technical-documentation

    Create and improve technical documentation including architecture designs, PRDs, API docs, code explanations, and visual diagrams. Use when asked to document systems, explain codebases, create design documents, write PRDs, generate Mermaid/PlantUML diagrams, review architecture, write user stories, or create pull request descriptions. Triggers include "document this", "create a design doc", "explain this code", "write a PRD", "create a diagram", "architecture overview", "user story for", "PR description".

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 77 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every added test went red once: Before it is kept, the behaviour it protects was broken (a probe from step 4, or the line removed and …

    line 20
  2. Distinctive:

    No mutant survives in the tree: Every probe is reverted; git status after a probe equals git status before it.

    line 21
  3. Distinctive:

    Read every test and give it a verdict: keep, rewrite, merge, or delete.

    line 35
  4. Very specific:

    Use a mutation tool when the repo has one: StrykerJS (npx stryker run --mutate "<scope>/"), mutmut (mutmut run --paths-to-mutate <scope>), …

    line 56

“Common” is measured: kept by at least 6 in 10 of the 77 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.

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

Test Audit

A suite is measured by one thing: it goes red when the code is wrong. A test that cannot go red is dead code with a runtime cost, and a test that goes red on a refactor cements the implementation. This skill removes both, writes the tests a caller would want, and then proves the result by breaking the code on purpose.

Scope: $ARGUMENTS. Empty means the tests that the uncommitted diff touches, plus the seams the diff changed that have no test. A path means every test in it and every public seam in it. A git range means the same for the changed files.

The rules and examples are in ${CLAUDE_SKILL_DIR}/../clean-code/TESTS.md; read "Which tests to write", "Anti-patterns", and "Mutation probes". When a caller hands over a change record (target, check commands, baseline), use it and skip the matching parts of step 1.

Hard rules

  1. Production behaviour stays. This skill edits tests. The one production change allowed is the smallest seam change that lets a test reach the interface (a dependency accepted as a parameter instead of constructed inside), behaviour unchanged, named in the report.
  2. Every deletion names what remains. The test that still covers the behaviour, or the reason no coverage is needed (trivial code, framework behaviour).
  3. Every added test went red once. Before it is kept, the behaviour it protects was broken (a probe from step 4, or the line removed and restored) and the test failed.
  4. No mutant survives in the tree. Every probe is reverted; git status after a probe equals git status before it.

Process

1. Inventory

  • List the test files in scope and, for each, the seam it crosses (the public interface a caller would use). List the public seams in scope with no test.
  • Identify the runner and the focused command. Run the suite: baseline N/N and wall time.
  • Coverage, if the runner has it (--coverage, pytest --cov, go test -cover, cargo llvm-cov), is a hint about where to look, never a target.

Done when every test file maps to a seam and every seam has its test files, or "none".

2. Classify every test

Read every test and give it a verdict: keep, rewrite, merge, or delete. Write a row only for rewrite, merge, and delete, with the tell; keeps are counted, not listed.

VerdictTells
deletetautological (the expected value is computed the way the code computes it, or the test reads an artifact and asserts it contains itself); asserts that an internal collaborator was called (a call to an external boundary that is the contract stays); tests the framework, the language, or a library; tests trivial code no caller depends on as a contract; duplicates another test with cosmetic input changes; has no assertion; skipped or commented out without a ticket; snapshots output nobody reads
rewritereaches past the interface (private state, spies on internals, verifies through a side channel); mocks an own module (vi.mock, jest.mock, monkeypatch on project code) instead of injecting through the seam; depends on real time, sleep, ordering, or state left by another test; named for the mechanism instead of the behaviour
mergeseveral tests whose inputs belong to the same class; one table-driven test with one row per distinct class
keepone behaviour at a seam, an expected value from an independent source, one reason to fail

Done when every test in scope has a verdict and every non-keep verdict has a row.

3. Act

  • Apply the rows: delete, rewrite at the seam, merge. Where a rewrite needs a dependency injected, make that one change (rule 1).
  • Add what is missing, per seam: the behaviour the seam exists for; the edge cases the spec names (empty, boundary, invalid input at a boundary); the error mode callers depend on; a regression test for every bug the history names (git log --grep fix -- <scope>) that has none. Choose the level where the behaviour is observable (unit, integration, end-to-end, contract, property). Name each test as a capability. Expected values come from a known literal or the spec.
  • Run the suite.

Done when the suite is green and every row in step 2 has been applied.

4. Prove the suite bites

Use a mutation tool when the repo has one: StrykerJS (npx stryker run --mutate "<scope>/**"), mutmut (mutmut run --paths-to-mutate <scope>), cargo-mutants (cargo mutants -f <file>), gremlins (gremlins unleash <package>), pytest-gremlins (pytest --gremlins). Read the survivors.

Without a tool, probe by hand. For each production module in scope (in /finish, the functions the change touched; cap twelve probes), three mutants, one at a time:

  1. Negate one condition.
  2. Shift one boundary by one (< to <=, n to n - 1).
  3. Return a constant, an empty collection, or null from the function.

Procedure per mutant: copy the file beside itself as <file>.probe, apply the mutant, run the focused tests, restore with mv <file>.probe <file>, confirm git status is unchanged. A mutant that no test kills is a survivor: untested behaviour (write the test named for that behaviour, apply the mutant again, watch the test fail, restore) or dead code (report it for /deslop).

Done when every mutant was killed, or its survival is listed with the behaviour it exposed.

5. Finish

Full suite; runtime before and after; git status shows no .probe files and no mutants.

Report

## Test Audit Report
Scope       <path or range> · <T test files> · <S seams>
Tests       <before N> → <after M> · deleted <n> · rewritten <n> · merged <n> · added <n>
Probes      killed <k>/<m> via <stryker | mutmut | cargo-mutants | gremlins | manual> · survivors <n>
Runtime     <before>s → <after>s
Gates       typecheck <pass|fail|n/a> · suite <M/M>
Verdict     <suite bites | survivors: <behaviours> | needs decision: ...>

Below the block: each deletion with the coverage that remains; each survivor with the behaviour it exposed; each seam change made in production code. Nothing else.

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.