mutation-testing
Skill68 starsChanged 5 months agoMITView on GitHub
Perform mutation testing on the codebase. Introduces deliberate bugs one at a time, checks whether the test suite catches each one, and reports on test suite gaps. Optionally implements missing tests.
17 other projects use a version of this.
Adopted by
Most recently taken up by
- dmoka/skillstheir own version, first seen Oct 5, 2026
- jonmumm/skillstheir own version, first seen Oct 4, 2026
- Lixiuxiu559/AgentForgetheir own version, first seen Sep 29, 2026
- Hakkadaikon/hymmetheir own version, first seen Sep 9, 2026
- Amplicode/spring-skillstheir own version, first seen Sep 2, 2026
- auralshin/coding-skillstheir own version, first seen Aug 27, 2026
Other versions17 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 17
- rshankras/claude-code-apple-skills★ 777same name
- jvm-skills/jvm-skills★ 140same name
- Amplicode/spring-skills★ 126same name
- mixpanel/mixpanel-headless★ 18same name
- tae0y/python-project-template★ 14same name
- kao273183/qa-claude-skill★ 8same name
- aks-builds/quality-skills★ 5same name
- CodySwannGT/lisa★ 4same name
- shangyiy/life-kit★ 4same name
- vmobifystudio/app-dev-team★ 4same name
7 more not listed
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 repository27 other files it gives its agents.
- 8-bit-video-genSkill
- anki-connectSkill
- explainSkill
- formatting-notion-pagesSkill
- github-replySkill
- goal-rider-authorSkill
- here-nowSkill
- hermes-workflows-creatingSkill
- high-signal-chart-workflowSkill
- impeccableSkill
- loreSkill
- magazine-explainerSkill
- marimo-pairSkill
- pre-mortemSkill
- project-planningSkill
- prompt-refinementSkill
- remotion-videoSkill
- researchSkill
- resend-emailSkill
- ship-itSkill
- thread-postmortemSkill
- try-exceptSkill
- verified-frontendSkill
- wikipedia-discoverySkill
- writing-revisionSkill
- writing-styleSkill
- youtube-watch-later-gist-summariesSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
25 rules. 0 are common, 15 are distinctive, and 10 are very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
15
Distinctive
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
If the user names specific files or directories, restrict mutations to those.
- Very specific: line 26
If no argument is given, look at the project's source layout and use AskUserQuestion to agree on a starting scope.
- Distinctive: line 29
Test files themselves are out of scope for mutation.
- Distinctive: line 38
Clean working tree: Run git status on the files in scope.
- Very specific: line 42
Find the test runner: Look for pytest.ini, pyproject.toml [tool.pytest], setup.cfg [tool:pytest], tox.ini, a Makefile test target, or a …
- Distinctive: line 47
Map the code: Read the files in scope. Build a mental model of each module's structure and data flow so you can choose mutations that are …
- Distinctive: line 55
Choose mutations: Read the file and identify 3–8 candidate mutations using the catalogue below.
- Very specific: line 76
Never leave a mutation in place: After each test run, revert immediately.
- Very specific: line 77
If something goes wrong and you're unsure of the file state, run git diff <file> to check, and git checkout -- <file> to restore.
- Very specific: line 80
Use TaskCreate to track progress across files when there are more than a handful.
- Distinctive: line 90
Remove or comment out a line that modifies state — an assignment, a method call that updates an object, an append to a list, a cache write, …
- Very specific: line 145
Remove a guard clause (if bad_input: return/raise) to see whether the suite has a test for the guarded condition.
- Distinctive: line 195
When a mutation is killed, briefly rate the diagnostic quality of the failure:
- Distinctive: line 210
After completing all mutations for the scope, produce a summary table:
- Distinctive: line 233
After presenting the report, ask the user whether they'd like you to implement the recommended tests.
- Very specific: line 236
Locate the right test file: Follow the project's existing test layout.
- Very specific: line 237
If the project puts tests in tests/test_<module>.py, follow that pattern.
- Distinctive: line 238
Don't create new test files when an existing one covers the same module.
- Distinctive: line 243
Verify: Run the test suite to confirm your new tests pass on the unmodified code.
- Distinctive: line 246
Don't over-test: If a single well-designed test would catch multiple survived mutations, write one test, not several.
- Distinctive: line 252
Always revert: After every test run, revert the mutation before doing anything else.
- Very specific: line 255
Verify the revert: Run git diff <file> after reverting to confirm the file is clean.
- Distinctive: line 257
Don't mutate test files: Only mutate production code.
- Very specific: line 263
Ask when uncertain: If you're unsure whether a mutation is meaningful or whether a test failure constitutes "catching" it, use …
- Distinctive: line 265
Respect the user's time: If the test suite is slow, ask whether they want to run the full suite or a relevant subset for each mutation.
“Common” is measured: kept by at least 6 in 10 of the 14 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
Project: honnibal/claude-skills. "Claude skills I'm experimenting with. Please review carefully before use."
License: MIT License. Full license text is in
LICENSEalongside this file.Snapshot: Frozen copy of
mutation-testing.md.txtas of 2026-05-22. The maintained version lives upstream and may have evolved since this snapshot.
Mutation Testing
You are now in mutation testing mode. Your job is to assess the strength of the project's test suite by introducing deliberate bugs (mutations) into the source code, one at a time, and checking whether any test fails. A mutation that the tests don't catch reveals a gap in coverage.
Scope
$ARGUMENTS
- If the user names specific files or directories, restrict mutations to those.
- If no argument is given, look at the project's source layout and use
AskUserQuestionto agree on a starting scope. Don't try to mutate everything at once — pick a module or package and work through it. - Test files themselves are out of scope for mutation. Only mutate production code.
- Prioritise code that has meaningful logic (branching, arithmetic, state changes) over boilerplate, config, or trivial accessors.
Pre-flight
Before mutating anything:
- Clean working tree. Run
git statuson the files in scope. If there are uncommitted changes to any file you plan to mutate, stop and ask the user to commit or stash first. You need a clean baseline so every mutation can be reverted cleanly withgit checkout -- <file>. - Find the test runner. Look for
pytest.ini,pyproject.toml [tool.pytest],setup.cfg [tool:pytest],tox.ini, aMakefiletest target, or atests/directory. Ask the user if you can't determine how to run tests. Confirm that the test suite passes on the unmodified code before starting — if it doesn't, stop and tell the user. - Map the code. Read the files in scope. Build a mental model of each module's structure and data flow so you can choose mutations that are meaningful rather than trivially dead.
Workflow
Work through the files in scope one at a time. For each file:
- Choose mutations. Read the file and identify 3–8 candidate mutations using the catalogue below. Prefer mutations that test interesting behaviour — a bug a real developer might introduce — over mechanical operator swaps on dead code. For each candidate, write a one-line description of what the mutation does and what behaviour it should break.
- Apply, test, revert. For each mutation:
a. Apply the mutation using
Edit. Change as little as possible — usually a single line. b. Run the test suite (or the relevant subset if the suite is large). Use a timeout — if the tests hang, that still counts as "caught" (the mutation broke something). c. Record the result:- Killed — a test failed. Note which test, and briefly assess how helpful the failure message is. Would a developer reading this failure immediately understand what went wrong, or would they have to dig?
- Survived — no test failed. This is a gap. Note what behaviour is
untested.
d. Revert the mutation:
git checkout -- <file>. Confirm the file is back to its original state before moving on.
- Never leave a mutation in place. After each test run, revert immediately.
If something goes wrong and you're unsure of the file state, run
git diff <file>to check, andgit checkout -- <file>to restore.
Use TaskCreate to track progress across files when there are more than a
handful.
Mutation Catalogue
Choose mutations from these categories, ordered roughly from most to least likely to reveal meaningful test gaps.
1. Delete or skip a side effect
Remove or comment out a line that modifies state — an assignment, a method call that updates an object, an append to a list, a cache write, a database call. This tests whether the suite verifies that the side effect actually happened.
# Original
self.count += 1
results.append(item)
# Mutation: delete the line entirely2. Negate or invert a condition
Flip a boolean condition: if x → if not x, x > 0 → x <= 0,
x and y → x or y, x is None → x is not None.
# Original
if user.is_active and user.has_permission:
# Mutation
if user.is_active or user.has_permission:3. Change a boundary or comparison
Off-by-one and boundary errors: < → <=, >= → >, == 0 → == 1,
range(n) → range(n - 1).
# Original
if retry_count < max_retries:
# Mutation
if retry_count <= max_retries:4. Swap or hardcode a return value
Replace a computed return value with a constant, or swap two return paths in a conditional. This tests whether callers actually use and verify the return value.
# Original
return calculated_score
# Mutation
return 05. Delete an early return or guard clause
Remove a guard clause (if bad_input: return/raise) to see whether the
suite has a test for the guarded condition.
# Original
def process(items):
if not items:
return []
...
# Mutation — delete the guard
def process(items):
...6. Change an operator
Swap arithmetic or string operators: + → -, * → /, // → /,
+ → `` (concatenation removed). Use sparingly — only when the operation
has a testable effect on output.
7. Modify a default argument or constant
Change a default parameter value, a class constant, or a module-level constant. This tests whether any test exercises the default path.
# Original
def connect(host, port=5432):
# Mutation
def connect(host, port=5433):8. Swap the order of arguments or operands
Reverse argument order in an internal call, or swap operands around a non-commutative operator. This tests whether the suite is sensitive to argument semantics rather than just arity.
# Original
result = divide(numerator, denominator)
# Mutation
result = divide(denominator, numerator)Assessing test failures
When a mutation is killed, briefly rate the diagnostic quality of the failure:
- Clear — the test name and failure message immediately point to the bug. A developer would fix this in minutes.
- Indirect — a test failed, but the failure message describes a symptom rather than the root cause. A developer would need to investigate. Consider whether a more targeted test would help.
- Cascading — many tests failed, making it hard to locate the root cause. This suggests the code under test is a dependency of many things but may lack focused unit tests of its own.
Record the rating alongside the mutation result.
Reporting
After completing all mutations for the scope, produce a summary table:
| # | File | Mutation | Result | Diagnostic | Notes |
|---|----------------|------------------------------|----------|------------|---------------------|
| 1 | pipeline.py | Negate active check | Killed | Clear | test_inactive_user |
| 2 | pipeline.py | Delete cache write | Survived | — | No cache test |
| 3 | scoring.py | Return 0 instead of score | Killed | Indirect | Assertion on rank |Then provide:
- Mutation score: killed / total (e.g. 6/8 = 75%).
- Uncaught mutations: list each survived mutation with a sentence explaining what behaviour is untested and why it matters.
- Diagnostic quality: note any killed mutations where the failure message was indirect or cascading, and suggest how the test could be improved.
- Recommended tests: for each survived mutation, describe a test that would catch it. Group these by theme if several gaps point to the same missing test area.
Implementing missing tests
After presenting the report, ask the user whether they'd like you to implement the recommended tests. If yes:
- Locate the right test file. Follow the project's existing test layout.
If the project puts tests in
tests/test_<module>.py, follow that pattern. Don't create new test files when an existing one covers the same module. - Write focused tests. Each test should target one survived mutation. Name
the test to describe the behaviour it verifies, not the mutation it catches.
For example:
test_cache_is_populated_after_first_call, nottest_mutation_2. - Verify. Run the test suite to confirm your new tests pass on the unmodified code. Then re-apply each corresponding mutation and confirm the new test catches it.
- Don't over-test. If a single well-designed test would catch multiple survived mutations, write one test, not several. Aim for tests that verify real behaviour rather than just satisfying the mutation score.
Critical Rules
- Always revert. After every test run, revert the mutation before doing anything else. Never stack mutations. Never leave mutated code in the working tree.
- Verify the revert. Run
git diff <file>after reverting to confirm the file is clean. If it's not, rungit checkout -- <file>again. - Don't mutate test files. Only mutate production code.
- Don't mutate imports, type annotations, or docstrings. These rarely reveal meaningful test gaps and produce noise.
- Keep it targeted. 3–8 mutations per file is enough. Prefer quality over quantity — a well-chosen mutation that reveals a real gap is worth more than ten trivial operator swaps.
- Ask when uncertain. If you're unsure whether a mutation is meaningful or
whether a test failure constitutes "catching" it, use
AskUserQuestion. - Respect the user's time. If the test suite is slow, ask whether they want to run the full suite or a relevant subset for each mutation.
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.

