mutation-check
Skill17 starsChanged 14 days agoMITView on GitHub
Use when asked to strengthen tests or check their ability to detect defects, or when a specific concern suggests an incorrect implementation could still pass. Introduces small deliberate defects in relevant code and checks which ones the tests detect. Writing a test alone does not require a mutation check.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- trailofbits/cooptheir own version, first seen Nov 5, 2026
- scoobydont-666/shared-claude-skillstheir own version, first seen Nov 1, 2026
- ArthurC02/SkillHubtheir own version, first seen Oct 31, 2026
- hidevinliu/red-green-modetheir own version, first seen Aug 1, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- trailofbits/coop★ 808same name
- hidevinliu/red-green-mode★ 11same name
- ArthurC02/SkillHub★ 1same name
- scoobydont-666/shared-claude-skills★ 1same 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 repository32 other files it gives its agents.
- AGENTS.mdAGENTS.md
- aboutSkill
- answerSkill
- attack-testsSkill
- audit-experimentSkill
- bugSkill
- ci-watchSkill
- commitSkill
- contextSkill
- delegateSkill
- documentSkill
- evalSkill
- featureSkill
- impact-mapSkill
- implement-workSkill
- mrSkill
- perfSkill
- previewSkill
- refactorSkill
- requestSkill
- review-diffSkill
- reviewSkill
- run-experimentSkill
- screen-designSkill
- screen-paritySkill
- setupSkill
- sibling-path-mapSkill
- specSkill
- sweepSkill
- test-hardeningSkill
- verify-workSkill
- work-graphSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
0
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
- Very specific: line 12
Run node <tools>/mutation-check.mjs --file <source> --tests <test files> --test-cmd "<single-test command with {tests}>" [--base <base>] …
“Common” is measured: kept by at least 6 in 10 of the 3 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
Mutation check
Apply the common work contract within this task’s scope. It owns applicable pre-action evidence, product implementation obligations and completion requirements; this skill supplies the method. Current common guidance already delivered or read may be reused.
Choose the relevant code and tests from the suspected coverage gap, such as a boundary condition, branch or failure path. Before a refactor, use it when the existing tests' ability to protect behavior is uncertain, regardless of change size. A reproduced bug that fails before the fix and passes after does not by itself require another mutation run. Follow explicit mutation requirements in assigned attack-test or test-hardening work; ordinary test writing does not require this extra step.
Run node <tools>/mutation-check.mjs --file <source> --tests <test files> --test-cmd "<single-test command with {tests}>" [--base <base>] [--limit 20] (the tools folder is in the task's "[haechi] Repo facts" block, or two levels above this skill's folder; the single-test command is in the same block). Add --json for machine-readable output.
Which lines it mutates: by default the lines of --file changed against --base (default HEAD), so a committed file with no new edits gets no mutants. After committing, pass --base <the commit before the change>. To harden tests of existing code, pass --lines 1-<last line> (or a range) and use the same lines for the before and after runs.
It changes one changed line at a time — flips a comparison, swaps && and ||, flips a boolean, shifts a number by one, drops a call — runs the tests, and restores the file. It refuses to run when the tests already fail. It runs the tests once per mutant, so give the shell a long enough timeout or run it in the background; if a run is killed anyway, the next run restores the file before it starts.
Killed means the command failed with the mutant in place. An assertion failure, parse error, import error or runner failure can all produce that status. It does not independently prove an assertion caught the changed behavior. Failed runs include the last 4,000 characters of combined output, the exit code, signal and any spawn error in both text and JSON reports. Read that evidence before counting a killed mutant as test coverage. The tool does not parse runner output or count executed tests.
For each survived mutant decide:
- A real gap — the change alters behavior a user could observe and no test noticed. Strengthen an assertion or add a case that kills it.
- An equivalent mutant — the change cannot alter behavior (for example
>=versus>where that boundary value can never arrive). Write down why and leave it.
Each new test must kill a different mutant or cover a different path. Never weaken a test, never edit the source to make a mutant die, and do not chase equivalent mutants. Report mutants killed, survived and equivalent, before and after your changes.
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.

