/qa-mutation-testing:pitest-mutationfrom qa-mutation-testing
Sets up PIT mutation testing for Java/Kotlin JVM projects with Maven or Gradle. Detects tests that pass despite seeded faults, revealing gaps in assertion quality.
Ships in qa-mutation-testing. 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.
Per pit-home:
"PIT is a mutation testing system for Java and JVM applications. It automatically introduces faults into code, then runs tests to see if they catch these modifications."
"Faults (or mutations) are automatically seeded into your code, then your tests are run. If your tests fail then the mutation is killed, if your tests pass then the mutation lived." (pit-home)
Per pit-home, PIT differentiates on speed: "analyzes in minutes rather than days" vs older mutation tools.
pitest-maven (or info.solidsoft.pitest Gradle) plugin, including pitest-junit5-plugin for JUnit 5 suites.targetClasses at production packages and targetTests at the matching test packages - never mutate test code.mutationThreshold and coverageThreshold to the current baseline and request HTML + XML outputFormats.mvn pitest:mutationCoverage (or ./gradlew pitest) and open target/pit-reports/<timestamp>/index.html.-DwithHistory for PR runs so only changed code is re-mutated.target/pit-reports/ as an artifact.<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.17.0</version>
<configuration>
<targetClasses>
<param>com.example.checkout.*</param>
</targetClasses>
<targetTests>
<param>com.example.checkout.*Test</param>
</targetTests>
<mutationThreshold>75</mutationThreshold>
<coverageThreshold>80</coverageThreshold>
<outputFormats>
<format>HTML</format>
<format>XML</format>
</outputFormats>
</configuration>
<dependencies>
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-junit5-plugin</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
</plugin>
For JUnit 5, the pitest-junit5-plugin is required; for JUnit 4
the default plugin works.
mvn pitest:mutationCoverage
Reports land at target/pit-reports/<timestamp>/. The
index.html shows per-class mutation coverage.
plugins {
id 'java'
id 'info.solidsoft.pitest' version '1.15.0'
}
pitest {
targetClasses = ['com.example.checkout.*']
targetTests = ['com.example.checkout.*Test']
mutationThreshold = 75
coverageThreshold = 80
outputFormats = ['HTML', 'XML']
junit5PluginVersion = '1.2.1'
}
// Run via:
// ./gradlew pitest
PIT's default mutator set covers conditional, arithmetic, return
value, void method calls, and constructor calls. Activate
additional mutator sets via <mutators>:
<mutators>
<mutator>STRONGER</mutator> <!-- All default + extra -->
<mutator>DEFAULTS</mutator> <!-- Default set -->
<mutator>ALL</mutator> <!-- Everything -->
</mutators>
Per pit-home, reports "combine line coverage with mutation coverage data."
pitmp-maven-plugin for incremental runsFor PRs, only mutate changed code:
mvn pitest:mutationCoverage -DwithHistory
withHistory reads / writes a history file in target/; subsequent
runs only mutate code different from the cached history. For PR
runs, combine with git diff to scope further:
mvn pitest:mutationCoverage \
-Dfeatures='+gitci(level[1])' \
-Dpitmp.git.diff.target=origin/main
(The pitmp-maven-plugin extension adds git-diff-based scoping;
not in core PIT.)
- uses: actions/setup-java@v4
with: { distribution: temurin, java-version: '21' }
- name: Mutation testing (full)
if: github.event_name == 'schedule' # weekly cron
run: mvn pitest:mutationCoverage
- name: Mutation testing (incremental, PR)
if: github.event_name == 'pull_request'
run: mvn pitest:mutationCoverage -DwithHistory
- uses: actions/upload-artifact@v4
if: always()
with:
name: pit-reports
path: target/pit-reports/
The XML output (mutations.xml) is machine-parseable for
dashboards.
PIT works with Kotlin via standard Maven/Gradle Kotlin plugins; mutators apply to compiled bytecode. Per pit-home, "ArcMutate, from the same team, extends PIT with Kotlin support, Spring integration, and Git analysis" - for richer Kotlin / Spring support, evaluate ArcMutate (commercial).
CheckoutService in com.example.checkout has a free-shipping rule and green JUnit 5 tests.
targetClasses = com.example.checkout.*, targetTests = com.example.checkout.*Test, mutationThreshold = 75.mvn pitest:mutationCoverage writes target/pit-reports/<timestamp>/index.html and fails the build below the 75 threshold.index.html flags a survivor: the free-shipping boundary total >= 50 mutated to total > 50, uncaught because no test uses total == 50.total == 50 boundary; mvn pitest:mutationCoverage now kills the mutant and clears the threshold.-DwithHistory so later runs only re-mutate changed classes.Anti-patterns (mutating everything per PR, mutationThreshold: 100, mixed Maven/Gradle config, missing JUnit 5 plugin, targeting test classes, the ALL mutator set) and PIT's limitations (bytecode-level equivalent mutants, build-tool coupling, commercial Kotlin / Spring extras, per-class scope) are catalogued in references/pitest-pitfalls.md.
stryker-mutation,
stryker-net-mutation,
mutmut-mutation,
mull-mutation - per-language
siblings.evals/hundred-percent-mandate-three-weeks-before-the-audit/criteria.json (opens in a new tab)evals/hundred-percent-mandate-three-weeks-before-the-audit/task.md (opens in a new tab)evals/kotlin-module-the-director-wants-at-java-parity/criteria.json (opens in a new tab)evals/kotlin-module-the-director-wants-at-java-parity/task.md (opens in a new tab)evals/mutation-gate-reports-zero-after-the-junit5-migration/criteria.json (opens in a new tab)evals/mutation-gate-reports-zero-after-the-junit5-migration/task.md (opens in a new tab)evals/three-hour-pr-job-the-team-has-stopped-waiting-for/criteria.json (opens in a new tab)evals/three-hour-pr-job-the-team-has-stopped-waiting-for/task.md (opens in a new tab)evals/two-build-files-two-scores-before-the-release-tag/criteria.json (opens in a new tab)evals/two-build-files-two-scores-before-the-release-tag/task.md (opens in a new tab)references/pitest-pitfalls.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
6 skills in this plugin
/mull-mutationUse for any question about mutation testing in C or C++, or when a C/C++ suite has high coverage but bugs still ship: sets up Mull for Clang builds (version-matched package, -fpass-plugin flags, CMake, mull-runner, mutators, path filters) and runs it in GitHub Actions. Other languages: stryker-mutation, stryker-net-mutation, pitest-mutation, mutmut-mutation./mutant-survival-triageUse when a mutation testing run (StrykerJS, PIT, mutmut or Mull) has surviving mutants, a low mutation score, or a large report to work through: classifies each survivor (missing case, weak assertion, equivalent, unreachable, flaky), drafts the test or assertion that kills it, and states the mutation score with its formula. Does not rewrite tests automatically./mutmut-mutationUse when a Python pytest or unittest suite needs mutation testing to show whether the tests catch bugs. Sets up mutmut: mutmut run, results and browse, applying survivors, pragma: no mutate suppressions and pyproject.toml config./stryker-mutationUse when a JavaScript or TypeScript suite has high coverage but bugs still slip through, and the team wants mutation testing to find weak tests. Sets up StrykerJS: the Jest, Vitest, Mocha or Karma runner, stryker.conf.json, thresholds and incremental runs on pull requests./stryker-net-mutationUse for any question about mutation testing in .NET or C#, or when a .NET suite passes with good coverage but may assert nothing: sets up Stryker.NET (dotnet-stryker tool, project and solution scoping, xUnit, NUnit or MSTest, stryker-config.json thresholds) and runs it in CI. Has a worked example and mutator levels.npx claudepluginhub testland/qa --plugin qa-mutation-testingOther plugins' skills for the same job