mutation-testing
Skill665 starsChanged 6 months agoMITView on GitHub
Run mutant, read mutation reports, fix alive mutations, and verify coverage. Use when running mutation testing, responding to alive mutations, or improving test quality. Triggers: "mutation testing", "mutant", "alive mutation", "mutation coverage". WHEN NOT: Writing tests from scratch (use rspec-agent), fixing failing tests, or general code review.
34 other projects use a version of this.
Adopted by
Most recently taken up by
- naomiaro/waveform-playlisttheir own version, first seen Nov 16, 2026
- KPISTOLAS/claude-skillstheir own version, first seen Nov 16, 2026
- fabioc-aloha/Alex_ACT_ONEtheir own version, first seen Nov 15, 2026
- bartoszkobylinski/lovsportheir own version, first seen Nov 15, 2026
- camunda/camundatheir own version, first seen Nov 8, 2026
- DnsQueen/orcinus-skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use domain-modeling and grilling.
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.
GoogleSkilldomain-modeling
Build and sharpen a project's domain model. Use when the user wants to pin down domain terminology or a ubiquitous language, record an architectural decision, or when another skill needs to maintain the domain model.
Also in 3 projects that use this
GoogleSkillgrilling
Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
Also in 3 projects that use this
Other versions34 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 34
- metabase/metabase★ 50ksame name
- recharts/recharts★ 28ksame name
- camunda/camunda★ 4.4ksame name
- naomiaro/waveform-playlist★ 1.7ksame name
- proffesor-for-testing/agentic-qe★ 524same name
- s3s-project/s3s★ 315same name
- jvm-skills/jvm-skills★ 140same name
- Amplicode/spring-skills★ 126same name
- GGGODLIN/gggodlin-cc-harness★ 74same name
- Integralist/agent-skills★ 29same name
24 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 repository43 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude_37signals/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- accessibility-reviewSkill
- action-cable-patternsSkill
- active-storage-setupSkill
- api-versioningSkill
- authentication-flowSkill
- behavioral-guidelinesSkill
- caching-strategiesSkill
- code-reviewSkill
- codex-reviewSkill
- dependabot-reviewSkill
- extraction-timingSkill
- friction-reviewSkill
- i18n-patternsSkill
- performance-optimizationSkill
- postgres-patternsSkill
- rails-architectureSkill
- rails-concernSkill
- security-auditSkill
- solid-queue-setupSkill
- accessibility-reviewSkill
- action-cable-patternsSkill
- active-storage-setupSkill
- api-versioningSkill
- authentication-flowSkill
- behavioral-guidelinesSkill
- caching-strategiesSkill
- code-reviewSkill
- codex-reviewSkill
- dependabot-reviewSkill
- extraction-timingSkill
- friction-reviewSkill
- i18n-patternsSkill
- mutation-testingSkill
- performance-optimizationSkill
- postgres-patternsSkill
- rails-architectureSkill
- rails-concernSkill
- security-auditSkill
- solid-queue-setupSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. 0 are common, 19 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 31 edited versions we read keep these.
19
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 83
Always present both options so the user can choose.
- Distinctive: line 97
When the subject is known, scope the run to avoid testing unrelated subjects:
- Very specific: line 103
If the command succeeds, coverage is 100% — done.
- Very specific: line 104
If it fails, find the evil: line in the output — it has the subject name, file path, and line number.
- Distinctive: line 110
Read the source file and existing spec file for the subject.
- Distinctive: line 111
Ask: "Is the mutated code acceptable for all valid inputs?"
- Distinctive: line 115
Add a test: when the mutated code is wrong but tests do not prove it.
- Distinctive: line 116
Simplify the code: when the mutated code is correct for all valid inputs.
- Distinctive: line 118
Do not change both code and tests in the same commit.
- Distinctive: line 132
Follow the project's conventional commits format.
- Distinctive: line 142
Add a test when the mutated code is wrong but the existing tests do not prove it.
- Distinctive: line 146
Only one value of a boolean/flag is tested — add the other.
- Distinctive: line 166
Before accepting a simplification, verify the mutation preserves behavior across the method's full input domain and all call sites.
- Distinctive: line 171
Do not rewrite code to eliminate a mutation axis without first ensuring the expression has test coverage.
- Distinctive: line 175
Add test coverage for the expression.
- Distinctive: line 177
Verify 100% mutation coverage on the subject.
- Distinctive: line 181
When the original and mutated code produce the same result for all inputs, the mutation is equivalent.
- Distinctive: line 183
Ask: does the mutated form use a more constrained primitive?
- Very specific: line 194
Add the subject to the ignore list in config/mutant.yml with an inline comment explaining why it is unkillable.
- Distinctive: line 196
Do not commit code or test changes for this subject.
- Distinctive: line 200
Every ignored subject must have a comment.
- Distinctive: line 206
When adding mutant to a project with no ignore list, run mutant once to find all alive subjects, then seed the ignore list so burn-down can …
- Very specific: line 217
Add each subject to the ignore list in config/mutant.yml with # legacy baseline.
“Common” is measured: kept by at least 6 in 10 of the 31 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 Testing with Mutant
When to Activate
- The user asks to run mutation testing.
- The user has alive mutations to fix.
- The user asks to verify mutation coverage on a subject.
When Not to Use
- The task does not involve mutation testing.
Inputs
- Alive mutation output to act on (paste the
evil:block). - Optional: subject expression to scope the run.
Outputs (Fixed Order)
- Mutation results (alive count, coverage percentage).
- Clear action for each alive mutation: add test or simplify code.
Reading Mutation Output
An alive mutation looks like:
evil:YourClass#method:YourClass#method:lib/your_class.rb:42:abc12
@@ -1,3 +1,3 @@
def method
- @value >= threshold
+ @value > threshold
endevilmeans no test killed this mutation.- The diff shows original (
-) and mutated (+) code.
Reporting Format (BLUF)
Lead with the verdict — bottom line up front:
If unkillable:
Unkillable. Both forms are equivalent because [reason]. Add to ignore list.
If killable:
Killable.
Option A — add test:
(test diff)Option B — simplify code:
(source diff)
Always present both options so the user can choose. Include evidence: if you cannot think of a test that would kill the mutation, say so — that is valuable signal toward unkillable.
Usage
1. Run Mutant
bundle exec mutant run --fail-fastWhen the subject is known, scope the run to avoid testing unrelated subjects:
bundle exec mutant run --fail-fast 'Entities::CreateService#call'If the command succeeds, coverage is 100% — done.
If it fails, find the evil: line in the output — it has the subject
name, file path, and line number. The diff block immediately after shows
the original and mutated code.
2. Investigate
Read the source file and existing spec file for the subject. Ask: "Is the mutated code acceptable for all valid inputs?"
3. Decide and Act
- Add a test when the mutated code is wrong but tests do not prove it.
- Simplify the code when the mutated code is correct for all valid inputs.
Do not change both code and tests in the same commit. If both need changing, commit the test first, then simplify the code in a second commit.
4. Re-run and Verify
Re-run mutant (step 1) until 100%. If the same mutation survives after 2 attempts, evaluate whether it is unkillable.
bundle exec rspec # full suite must pass5. Commit
Follow the project's conventional commits format. The commit body must explain which mutation survived, why the test kills it or why the simplification is correct.
Fixing Alive Mutations
When to Add a Test
Add a test when the mutated code is wrong but the existing tests do not prove it. The test must pass with the original code and fail with the mutated code. Common reasons a test is missing:
- Only one value of a boolean/flag is tested — add the other.
- A collection has one element, so
nextandbreakbehave the same — add a test with multiple elements. - Two objects return the same value in test data, hiding which one the code actually uses — add test data where they differ.
- A method has a default parameter, and all tests pass the argument explicitly — add a test that omits the argument.
When to Simplify Code
Simplify when the mutated code is correct for all valid inputs. Apply the mutation's change directly to the source code — do not restructure or rewrite, just accept the mutated form.
Mutant encodes the principle of least power: use the most constrained primitive that satisfies the requirement. When Ruby offers multiple methods that overlap in behavior but differ in power, mutant replaces the more powerful one with the less powerful one. If tests still pass, you did not need the extra power — accept the simpler form.
Before accepting a simplification, verify the mutation preserves behavior across the method's full input domain and all call sites.
Simplification Trap: Syntax Rewriting
Do not rewrite code to eliminate a mutation axis without first ensuring the expression has test coverage. Changing syntax may make the mutation disappear without proving the code is correct. The correct sequence:
- Add test coverage for the expression.
- Apply the simplification mutant suggests.
- Verify 100% mutation coverage on the subject.
When a Mutation Is Equivalent
When the original and mutated code produce the same result for all inputs, the mutation is equivalent. Equivalent does NOT mean unkillable. Ask: does the mutated form use a more constrained primitive? If yes, it IS the simplification — apply it to the source.
Examples: method → public_method (restricts to public API),
kind_of? → instance_of? (restricts to exact class).
A mutation is only unkillable when you cannot add a test AND you cannot apply the mutation to the source.
When a Mutation Is Unkillable
- Add the subject to the
ignorelist inconfig/mutant.ymlwith an inline comment explaining why it is unkillable. - Do not commit code or test changes for this subject.
- Report: which mutation survived, why it is equivalent, and what you tried before concluding it is unkillable.
Every ignored subject must have a comment. No uncommented entries.
Prepare a Legacy Project (First-Time Setup)
When adding mutant to a project with no ignore list, run mutant once to find all alive subjects, then seed the ignore list so burn-down can start from a passing baseline:
bundle exec mutant run 2>&1 \
| sed -n 's/^evil:\([A-Za-z][A-Za-z0-9_:]*[#.][^:]*\):.*/\1/p' \
| LC_ALL=C sort -u \
|| trueAdd each subject to the ignore list in config/mutant.yml with
# legacy baseline. Then remove one subject at a time and work through
its alive mutations. Commit each fix with the ignore list removal included.
Checklist
- Each alive mutation has a clear action: add test or simplify code.
- New tests fail against the mutated code, not just pass against the original.
- Full RSpec suite passes after each change (
bundle exec rspec). - Each commit touches one subject only.
- Unkillable mutations are in the ignore list with a comment.
- Report: which mutation survived, which option was chosen, and why.
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.

