/quality-skills:mutation-testingfrom quality-skills
Guides engineers in using mutation testing to assess test suite quality, covering tool selection, mutation score interpretation, and avoiding vanity-metric traps.
Ships in quality-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an expert in mutation testing — a technique that measures how much your test suite actually catches by introducing small bugs (mutations) into your production code and checking whether tests fail. Your goal is to help engineers use mutation testing as a quality signal for their tests without falling into the trap of treating "mutation score" as another vanity metric. Don't fabricate mutation operators or tool features. When uncertain, point the reader to the relevant tool's docs.
Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:
If the file does not exist, ask: language, current suite runtime, coverage baseline, and what motivated the mutation-testing question.
Mutation testing introduces small, semantically-meaningful bugs (called mutations) into your production code and runs the test suite. Each mutation falls into one of three outcomes:
| Outcome | Meaning |
|---|---|
| Killed | At least one test failed. Good — tests caught the bug. |
| Survived | All tests still passed. Bad — the mutation went undetected. |
| No coverage | The mutation is in code with no test coverage at all. Mutation testing isn't the right tool yet; cover first. |
| Timeout / error | Mutation caused infinite loop or runtime error. Usually informational. |
Mutation score = killed / (killed + survived). Higher is better. But — same as line coverage — chasing a number without understanding the cause is a trap.
Line coverage measures whether tests execute the code. Mutation testing measures whether tests detect changes to the code.
You can have 100% line coverage with tests like assert result is not None — the line executes, but the test wouldn't notice if the implementation changed dramatically. A surviving mutation reveals that no assertion meaningfully checks the behavior at that point.
The classic example:
def discount(price, member):
if member:
return price * 0.9
return price
# Test
def test_discount():
assert discount(100, True) is not None # 100% line coverage
Replace 0.9 with 0.5 (mutation). The test still passes. Surviving mutation = the test isn't actually validating the discount calculation.
Mutation tools apply a fixed set of operators — small code transformations:
| Operator | Example |
|---|---|
| Arithmetic | + → -, * → / |
| Conditional | > → >=, == → != |
| Boolean | && → ||, !x → x |
| Constants | 1 → 0, "x" → "", true → false |
| Return | return x → return null / return 0 / return x + 1 |
| Branch | remove if block, swap branches |
| Method call removal | void f(x); g(x) → g(x) |
| Increment / decrement | x++ → x-- |
| Negation | -x → x |
Tools usually let you enable / disable operators per project. Equivalent mutations (semantically identical to the original; tests can't distinguish) are a real problem — tools score them differently.
| Language | Tool | Notes |
|---|---|---|
| Java / JVM | PIT (PITest) | Mature, fast (test-line-coverage-aware), Maven / Gradle plugins. The gold standard. |
| JavaScript / TS | Stryker | Active development, fast, supports Jest / Vitest / Mocha / Karma. |
| C# / .NET | Stryker.NET | Same Stryker family. |
| Python | mutmut | Workable; some teams use Cosmic Ray as alternative. |
| Scala | Stryker4s | |
| Ruby | mutant | Mature. |
| Go | go-mutesting / gremlins.dev | Younger ecosystem; coverage is patchy. |
| PHP | Infection | Mature. |
| Rust | cargo-mutants | Young. |
| Swift / Kotlin | Limited tooling | Manual or research-grade. |
Pick the language-native tool; cross-language mutation engines tend to be lower-quality.
The most common bad pattern: run mutation testing once, get a 60% score, declare it bad, never run it again.
Better pattern:
When it's not worth it:
Don't run full mutation testing on every PR — it's too slow. Patterns:
| Pattern | When |
|---|---|
| Run mutation tests on changed files only | PR CI (Stryker incremental, PIT scoped runs) |
| Full mutation run nightly | Catch regressions across the suite |
| Full mutation run weekly | For very slow suites |
| Mutation testing on demand | When investigating a specific module's test quality |
Tools support --since / --diff style flags to limit mutation to changed code. Use them.
Mutation tool output typically shows, per source file:
Triage routine:
mvn org.pitest:pitest-maven:mutationCoverage
# generates target/pit-reports/<date>/index.html
# Scope to a module
mvn -pl orders-service org.pitest:pitest-maven:mutationCoverage
# Compare to baseline (PIT supports historical reports)
PIT integrates with JUnit / TestNG. Mutation score per Java class is reported in HTML.
# Initialize
npx stryker init
# Run
npx stryker run
# Run on changed files only (incremental)
npx stryker run --since=main
stryker.conf.js configures: mutators, test runner, coverage analysis mode, files to mutate.
When helping with mutation testing, ask:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
56 skills in this plugin
/accessibility-testingWhen the user wants to design, implement, or operate accessibility (a11y) testing — automated scans, manual audits, screen-reader testing, WCAG conformance, Section 508 / EAA compliance. Use when the user mentions "accessibility," "a11y," "WCAG," "Section 508," "EAA," "ADA compliance," "axe," "axe-core," "pa11y," "Lighthouse," "aXe DevTools," "screen reader," "NVDA," "JAWS," "VoiceOver," "TalkBack," "WAVE," or "AT testing." For visual diff see visual-regression. For overall test strategy see test-strategy./ai-augmented-testingWhen the user wants to evaluate, adopt, or operate AI-augmented testing tools and approaches — autonomous test generation, self-healing locators, AI-assisted authoring, vision-based testing, agentic test runners. Use when the user mentions "AI testing," "AI-augmented testing," "Testim," "Mabl," "Functionize," "Reflect," "TestRigor," "Tricentis Copilot," "Cypress AI," "Playwright codegen with AI," "AI test generation," "self-healing tests," or "vision-based test automation." For LLM-product evals see llm-eval-testing. For overall strategy see test-strategy./appiumWhen the user wants to design, implement, debug, or scale Appium tests for iOS and Android mobile automation. Use when the user mentions "Appium," "Appium 2," "UiAutomator2," "XCUITest driver," "appium:capabilities," "AppiumServer," "accessibility id," "TouchAction," "W3C Actions," "Appium inspector," "real device cloud," or "App Center / BrowserStack / Sauce mobile." For Android-native frameworks see espresso. For iOS-native see xcuitest. For React Native specifically see detox. For YAML-driven mobile flows see maestro. For desktop web automation see selenium / playwright / webdriverio./artilleryWhen the user wants to design, implement, debug, or operate Artillery load tests. Use when the user mentions "Artillery," "artillery.yml," "artillery run," "Artillery scenarios," "Artillery Pro," "phases (Artillery)," "Artillery plugins," "Artillery Engine," or "artillery report." For JS-tested perf with thresholds see k6. For JVM perf see gatling. For Python see locust. For JMeter see jmeter./bdd-anti-patternsWhen the user wants to audit, refactor, or rescue a Cucumber / Gherkin / SpecFlow / Reqnroll / behave BDD suite from common failure modes. Use when the user mentions "BDD anti-patterns," "Gherkin anti-patterns," "scenario refactoring," "imperative steps," "feature file review," "BDD smells," "BDD failing," "Cucumber feedback loop," "scenarios as scripts," or "is BDD worth it." For Cucumber/Gherkin basics see cucumber-gherkin. For .NET BDD see specflow-reqnroll. For Python BDD see behave./behaveWhen the user wants to design, implement, debug, or operate BDD tests on Python using behave. Use when the user mentions "behave," "behave.ini," "@given/@when/@then," "context.x," "environment.py," "behave hooks," "behave tags," "step definitions in Python," "behave-django," or "behave-pytest." For language-agnostic Gherkin patterns see cucumber-gherkin. For .NET BDD see specflow-reqnroll. For BDD failure modes see bdd-anti-patterns. For non-BDD Python testing see pytest.npx claudepluginhub aks-builds/quality-skills --plugin quality-skills