mutation-testing
Skill18 starsChanged 7 months agoMITView on GitHub
Evaluate Python test suite quality using mutmut to introduce code mutations and verify tests catch them. Use for mutation testing, test quality assessment, mutant detection, and test effectiveness analysis.
- Installs packages
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
- hugobowne/show-us-your-agent-skills★ 68same 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 repository17 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- skill-creatorSkill
- speckit-analyzeSkill
- speckit-checklistSkill
- speckit-clarifySkill
- speckit-constitutionSkill
- speckit-git-commitSkill
- speckit-git-featureSkill
- speckit-git-initializeSkill
- speckit-git-remoteSkill
- speckit-git-validateSkill
- speckit-implementSkill
- speckit-planSkill
- speckit-specifySkill
- speckit-tasksSkill
- speckit-taskstoissuesSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Killed: Test fails when mutation introduced (good)
- Distinctive: line 14
Survived: Test passes despite mutation (test gap)
- Distinctive: line 119
When a mutant survives, add tests for:
- Distinctive: line 121
Boundary conditions: Test at exact threshold values
- Distinctive: line 122
Return values: Verify actual results, not just truthiness
- Distinctive: line 170
Test boundaries and edge cases thoroughly
- Distinctive: line 171
Verify actual values, not just code execution
“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
Mutation Testing with mutmut
Mutation testing assesses test suite quality by introducing small changes (mutations) to source code and verifying that tests fail. If tests don't catch a mutation, it indicates gaps in test coverage or quality.
Key Concepts
- Mutant: Modified version of code with small change
- Killed: Test fails when mutation introduced (good)
- Survived: Test passes despite mutation (test gap)
- Mutation Score: Percentage of mutants killed
Quick Start
# Install
pip install mutmut
# Run mutation testing
mutmut run
# View results
mutmut results
# Inspect specific mutant
mutmut show 1
# Apply mutation to see the change
mutmut apply 1
# Reset applied mutations
mutmut apply 0Configuration
# setup.cfg or pyproject.toml [tool.mutmut]
[mutmut]
paths_to_mutate=src/
backup=False
runner=python -m pytest -x
tests_dir=tests/
dict_synonyms=Struct, NamedStructExample: Weak vs Strong Tests
# src/validators.py
def is_valid_order(order: dict) -> bool:
if not order:
return False
if not order.get("items"):
return False
if order.get("total", 0) <= 0:
return False
return True
def calculate_discount(total: float, tier: str) -> float:
if tier == "gold":
return total * 0.2
elif tier == "silver":
return total * 0.1
return 0.0# ❌ Weak tests - mutations survive
def test_order_basic():
order = {"items": ["a"], "total": 10}
assert is_valid_order(order) == True # Only tests happy path
# ✅ Strong tests - kill mutations
def test_order_null():
assert is_valid_order(None) == False
assert is_valid_order({}) == False
def test_order_empty_items():
assert is_valid_order({"items": [], "total": 10}) == False
def test_order_zero_total():
assert is_valid_order({"items": ["a"], "total": 0}) == False
def test_order_negative_total():
assert is_valid_order({"items": ["a"], "total": -5}) == False
def test_order_valid():
assert is_valid_order({"items": ["a"], "total": 10}) == True
def test_discount_gold():
assert calculate_discount(100, "gold") == 20.0
def test_discount_silver():
assert calculate_discount(100, "silver") == 10.0
def test_discount_none():
assert calculate_discount(100, "bronze") == 0.0Common Mutation Operators
| Original | Mutations |
> | >=, <, == |
< | <=, >, == |
== | != |
and | or |
+ | - |
return True | return False |
return x | return x + 1 |
Improving Mutation Score
When a mutant survives, add tests for:
- Boundary conditions: Test at exact threshold values
- Return values: Verify actual results, not just truthiness
- All branches: Cover each conditional path
- Edge cases: Empty, None, negative, zero
# Mutant survives: >= changed to >
def is_adult(age: int) -> bool:
return age >= 18
# ❌ Weak: age=25 won't catch >= to > mutation
def test_adult_weak():
assert is_adult(25) == True
# ✅ Strong: tests boundary
def test_adult_exactly_18():
assert is_adult(18) == True
def test_not_adult_17():
assert is_adult(17) == FalseCI Integration
# .github/workflows/mutation.yml
name: Mutation Testing
on:
pull_request:
paths: ['src/**']
jobs:
mutation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: pip install mutmut pytest
- run: mutmut run --CI
- run: mutmut resultsBest Practices
- Target critical business logic, not all code
- Aim for 80%+ mutation score on important modules
- Review survived mutants to improve tests
- Test boundaries and edge cases thoroughly
- Verify actual values, not just code execution
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.

