mutation-test
Skill9 starsChanged 4 months agoMITView on GitHub
Applies small logic mutations to a sprint's changed logic files and asserts the test suite fails on each — a surviving mutant is a test that cannot fail. Use when asked to mutation-test, check whether tests have teeth, or find tests that pass no matter what the code does. Advisory, not a close gate.
- Deletes or force-pushes
5 other projects use a version of this.
Adopted by
Most recently taken up by
- AlvaroVFon/skillstheir own version, first seen Oct 3, 2026
- greglas75/zuvotheir own version, first seen Sep 6, 2026
- LunarCommand/claude-skillstheir own version, first seen Sep 4, 2026
- squall-chua/skillstheir own version, first seen Aug 9, 2026
- nwiizo/ccswarmtheir own version, first seen Apr 17, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- nwiizo/ccswarm★ 153same name
- greglas75/zuvo★ 8same name
- AlvaroVFon/skills★ 2same name
- squall-chua/skills★ 2same name
- LunarCommand/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 repository22 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ai-auditSkill
- bulk-readSkill
- canon-slidesSkill
- captureSkill
- context-checkSkill
- context-doctorSkill
- dead-code-cleanupSkill
- doc-auditSkill
- learnings-sweepSkill
- mikadoSkill
- output-validatorSkill
- promote-learningsSkill
- pr-reviewSkill
- repo-auditSkill
- repo-workflow-auditSkill
- sdlc-auditSkill
- skill-evalSkill
- skill-exportSkill
- sprintSkill
- wrapupSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
4
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
- Distinctive: line 66
Never leave a mutation in place between iterations.
- Very specific: line 69
End-of-run guarantee: After the last mutation, verify the tree is clean: git status --porcelain on the mutated files must be empty.
- Distinctive: line 91
If zero mutants survive, say so — that is a passing signal, not a no-op.
- Distinctive: line 113
If a mutation's kill can't be reproduced, treat it as survived and flag the flake.
- Distinctive: line 114
Never commit a mutation: If the session is interrupted mid-loop, the working tree may hold a live mutation — run git status and restore …
“Common” is measured: kept by at least 6 in 10 of the 5 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
Operationalizes canon's thesis that "the tests pass" is a claim that needs its own evidence. Break the code on purpose: flip a boolean, negate a conditional, delete a statement — then run the suite. If nothing fails, the test was decoration. A surviving mutant is a test that cannot fail.
This is advisory, not a gate. It reports surviving mutants; it never blocks sprint complete.
It complements, does not replace, the fresh-context evaluator: the evaluator checks acceptance
criteria against the code; mutation-test checks whether the tests protecting that code have teeth.
Run isolated, on changed logic files only
- Dispatch as a fresh subagent (
subagent_type: "general-purpose"). Mutating source in the main session dirties the tree that session will commit — never do that inline. The subagent mutates and restores within its own turn. Not"Plan"— the reviewer/evaluator gates usePlanbecause they want its harness-level Edit/Write restriction (it keeps those adversarial reviews honest: a subagent that can't touch code can't quietly "fix" what it's supposed to be grading). This skill's own loop is the opposite: it requires write access to mutate and restore files, soPlancan't run it at all — aPlan-dispatched run can only report that it's blocked, never a real mutant count (reproduced live in canont-cdeb). Safety here comes from the tight, explicit mutation-set scope and the End-of-run guarantee below (a cleangit status --porcelaincheck), not from restricting the subagent's tools. - Scope = the sprint diff. Target set is
git diff --name-only $(git merge-base HEAD origin/main) HEAD. Checkgit merge-base's exit status, not whether the output is empty — a failed base resolution must mean "run nothing," not "mutate everything." If it fails or the diff is empty, report "no changed files to mutation-test" and stop. - Logic files only (allowlist posture). From that set, keep only production logic files. Skip docs/markdown, config, generated files, and test files themselves — mutating a test proves nothing. On any doubt about whether a file is logic-bearing, skip it — never mutate an unrecognized shape. If nothing survives the filter, report "no logic files changed" and stop.
Mutation set
Apply these one at a time, one mutation per run of the suite. This is the default set — do not expand it into a menu:
- Flip a boolean/comparison operator —
==↔!=,<↔>=,<=↔>,&&↔||,true↔false. - Negate a conditional — wrap an
iftest in a logical negation. - Swap an arithmetic operator —
+↔-,*↔/. - Replace a return value — return a default/zero/empty value instead of the computed one.
- Delete a statement — remove one side-effecting line.
Mutate only logic-bearing lines in the changed hunks. A handful of high-value mutations per file beats exhaustive coverage — this is a signal, not a certifier.
The loop (follow exactly)
For each candidate mutation, in order — this sequence is fragile; a skipped restore corrupts the working tree:
- Save the target file's original bytes (copy to a scratch location, or note the exact hunk).
- Apply one mutation.
- Run the suite (the project's own command — e.g.
npm test,pytest,./scripts/test.sh). - Record the outcome: suite fails → mutant killed (good); suite passes → mutant survived (a test that cannot fail — report it).
- Restore the original bytes unconditionally — whether step 3 passed, failed, or errored. Never leave a mutation in place between iterations.
- Move to the next mutation.
End-of-run guarantee. After the last mutation, verify the tree is clean:
git status --porcelain on the mutated files must be empty. If anything is dirty, restore it with
git checkout -- <file> before reporting. Do not finish on a dirty tree.
Report
Advisory output — surface to the user, and when running inside a sprint also write
.tickets/<id>/mutation-report.md:
# Mutation Report
| File:line | Mutation | Suite result | Verdict |
|---|---|---|---|
| src/foo.js:42 | `==` → `!=` | passed | SURVIVED — test cannot fail |
| src/foo.js:55 | deleted return | failed | killed |
Surviving mutants: N. Each is a place where the code can be broken and no test complains —
state the expectation independently (see README's "test that could not fail" example) so the
check can fail. Advisory only; does not block close.If zero mutants survive, say so — that is a passing signal, not a no-op.
Promotion path (out of scope here)
This skill ships advisory-first by design. Promoting it to a close gate is deliberately
deferred: do it only once the false-positive rate is known from real runs, and only for
logic-bearing changes — gated by a structural path check (the close-gate model tier once
used a docs-only allowlist for this; skills/sprint/reference/complete.md retired it in
t-4b5a, so any promotion would need its own). Until then, no tools/sprint
_gate_* function references this skill.
Gotchas
- Stale bytecode = false "survived". Mutating a compiled/cached-language file (Python
__pycache__/*.pyc, and similar) then restoring the source can leave the test runner executing the old compiled bytecode — the mutation never actually ran, so a real hole looks "killed" or a killed mutant looks "survived." Clear the cache between mutation and re-run (find . -name '__pycache__' -type d -prune -exec rm -rf {} +for Python), or run the suite in a mode that recompiles from source. Verify the mutation is actually live before trusting the verdict. - Slow suites. A full suite per mutation is expensive. Prefer running only the tests covering the mutated file when the project supports targeted runs; fall back to the full suite otherwise.
- Flaky tests produce false kills (a mutant "killed" by flakiness, not by a real assertion). If a mutation's kill can't be reproduced, treat it as survived and flag the flake.
- Never commit a mutation. If the session is interrupted mid-loop, the working tree may hold a
live mutation — run
git statusand restore before any commit.
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.

