mutation-test
Skill1 starsChanged 3 months agoMITView on GitHub
Mutation-test the Python lines a diff touched with cosmic-ray, and fail on any surviving mutant — a line the tests execute but never check. Use when hardening agent-written code before a PR, when a contract Verifier needs proof the tests actually assert something, when asked whether tests are meaningful rather than just covering, or when running a "hardener" stage.
- Installs packages
9 other projects use a version of this.
Adopted by
Most recently taken up by
- Termherd/termherdtheir own version, first seen Nov 8, 2026
- paureis/pau-skillstheir own version, first seen Nov 8, 2026
- lancy69/skillstheir own version, first seen Nov 1, 2026
- sunitghub/canon-skillstheir own version, first seen Oct 22, 2026
- takayoshitoyoda05/claude-ml-templatetheir own version, first seen Oct 20, 2026
- greglas75/zuvotheir own version, first seen Oct 16, 2026
Used with
Projects with it also use skill-eval and brainstorm.
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.
SaluteYBSkillskill-eval
Evaluate, tune, and regression-check AgentSkills. Use when creating a new skill or improving an existing one and you need structured should-trigger, should-not-trigger, boundary-case, and execution-quality examples. Also use when auditing overlapping skills and sharpening trigger descriptions before release.
Also in 3 projects that use this
nicolasestremSkillbrainstorm
Structured idea generation and solution exploration with systematic analysis.
Also in 3 projects that use this
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- me2resh/apexyard★ 542same name
- sunitghub/canon-skills★ 9same name
- greglas75/zuvo★ 7same name
- AlvaroVFon/skills★ 2same name
- paureis/pau-skills★ 2same name
- squall-chua/skills★ 2same name
- Termherd/termherd★ 2same name
- takayoshitoyoda05/claude-ml-template★ 1same name
- lancy69/skills★ 0same 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 repository39 other files it gives its agents.
- arch-mapSkill
- ask-meSkill
- autodevSkill
- codebase-designSkill
- code-reviewSkill
- context-barSkill
- contractSkill
- copilot-reviewSkill
- crapSkill
- deep-research-consolidateSkill
- deep-research-promptSkill
- domain-modelingSkill
- drop-reviewSkill
- fleet-reviewSkill
- framing-decisionsSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- herdrSkill
- implementSkill
- mergedSkill
- meta-analysisSkill
- obsidian-vaultSkill
- paper-outlineSkill
- probeSkill
- prSkill
- setup-matt-pocock-skillsSkill
- show-meSkill
- slack-askSkill
- slack-notifySkill
- sparSkill
- sync-matt-pocock-skillsSkill
- tddSkill
- to-specSkill
- triageSkill
- writing-for-agentsSkill
- writing-git-commitsSkill
- writing-great-skillsSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 61
Run it. For each SURVIVED row, read the diff: it is a behavior change the tests accepted.
- Distinctive: line 62
Write the assertion that would have failed on it — usually a specific expected value, a boundary case, or a check on the branch not taken.
- Distinctive: line 66
Never pass the gate by:
- Very specific: line 84
Compiled modules are refused: When a .so/.pyd for the same module sits beside the .py (Cython builds of plain .py files do this), Python …
“Common” is measured: kept by at least 6 in 10 of the 8 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 test
Coverage says a line ran. A mutation test says whether any test would notice if the line were
wrong. The tool flips one thing at a time (+ to -, > to >=, True to False, a
constant), reruns the tests, and records whether they fail ("killed") or still pass ("survived").
A survivor is a line whose behavior no assertion pins down.
This skill wraps cosmic-ray and mutates only the lines a diff changed. Each mutant costs one full run of the test command, so whole-module runs are a survey, not a gate: one 540-line module in a mid-size repo yields 575 mutants against 26 for a small diff.
Run it
From inside the repo, in the environment the tests run in (cosmic-ray must be importable there;
pip install 'cosmic-ray>=8.7,<9'):
python ~/.claude/skills/mutation-test/bin/mutation-test --diff <base> \
--test-command 'pytest path/to/the_tests.py -x -q -p no:cacheprovider'--diff <base>compares the working tree against<base>, usually the branch's merge-base with main. Untracked new files count as changed in full. Test files are never mutated.--test-commandis a shell command. Give it only the tests that cover the changed files: every mutant reruns it. Turn off parallel runners for it (-n 0under pytest-xdist): startup dominates a single file's run.- The tool mutates files in place and restores them, so run it in your own worktree with no other process editing it. It checks every target byte-for-byte afterwards and restores any it finds changed.
| Exit | Meaning |
| 0 | every mutant killed (or nothing in scope) |
| 1 | at least one survived: each printed as SURVIVED file:line operator plus its diff |
| 2 | cannot judge: red baseline, compiled module shadowing a target, more than --max-mutants, a mutant run that crashed, another run already mutating the same tree, or cosmic-ray missing |
Other flags: --timeout S per test run (a timeout counts as killed), --max-mutants N
(default 200), --json, --exclude GLOB (added to the test-file exclusions, which always apply), and trailing paths to narrow the scope (or, without
--diff, to mutate whole files).
Before the first run: a green baseline
The tool runs the test command once, unmutated, and refuses (exit 2) if it fails: on a red baseline every mutant would count as killed. Tests that fail for environmental reasons (a missing binary, local settings) must be deselected in the command, not fixed by the gate:
--test-command 'pytest pkg/level_test.py -x -q -n 0 --deselect pkg/level_test.py::TestLevel::test_needs_onedmin'The hardener loop
As a contract Verifier, the command plus exits 0 is the whole check. The loop:
- Run it. For each
SURVIVEDrow, read the diff: it is a behavior change the tests accepted. - Write the assertion that would have failed on it — usually a specific expected value, a boundary case, or a check on the branch not taken.
- Rerun until it exits 0.
Never pass the gate by:
- deleting the code the survivor lives in only to make it disappear,
- weakening the test command to fewer tests than cover the change,
- raising
--timeoutso slow mutants count as killed, or lowering it so all of them do, - deselecting tests that fail because of the mutant rather than the environment.
Some survivors are equivalent mutants: a change with no observable effect (x * 1 vs x, a
reordered independent assignment). If no test could ever tell them apart, stop and report the row
with why it is equivalent rather than contort a test around it.
Because a deterministic check decides acceptance, the loop does not need a strong model: a free-tier one can run it.
Limits
- Python only, one process (cosmic-ray's local distributor). Cost is roughly mutants × one test run; on a repo whose single test file takes 8 s, 26 mutants took under 4 minutes.
- Compiled modules are refused. When a
.so/.pydfor the same module sits beside the.py(Cython builds of plain.pyfiles do this), Python imports the compiled one and mutating the source changes nothing: every mutant would survive. The tool exits 2 naming the file. Narrow the paths to the pure-Python modules. - Any non-zero exit of the test command counts as a kill — including an import error. The green baseline guards the common case; a mutant that breaks imports is still killed, which is correct.
- A pure deletion (lines removed, none added) scopes the line just before the cut.
- One run per tree. Mutants are written into the source in place, so a second run started mid-run would snapshot a mutant as the original and write it back afterwards. A surviving mutant left that way is a bug the suite cannot see. The second run exits 2. Agent harnesses that background long commands (codex does) make this easy to hit: wait for the first run.
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.

