add-mutation-testing

Add PIT mutation testing to a Spring Boot 4 Gradle/Kotlin project.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/dprice-dev/claude-java-skills --skill add-mutation-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-mutation-testing
Source: https://github.com/dprice-dev/claude-java-skills/tree/main/.claude/skills/add-mutation-testing
Command: npx skills add https://github.com/dprice-dev/claude-java-skills --skill add-mutation-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of unit tests that may only execute code paths without actually detecting behavioral bugs, by adding PIT mutation testing so you can measure whether assertions kill meaningful code mutations.

Core Features & Use Cases

  • PIT mutation testing setup for Spring Boot 4: Adds the Gradle PIT plugin and a pinned, Gradle-9-compatible configuration to run ./gradlew pitest.
  • Spec-aware exclusions: Excludes generated OpenAPI api.* and dto.* packages when present to keep the report focused on meaningful logic.
  • Survivor-driven quality improvement: Interprets surviving mutants as actionable gaps in assertions and verification, with guidance for killing mutants or documenting true equivalence.
  • On-demand workflow: Ensures PIT is not wired into tasks.check so CI is not slowed by expensive mutation runs.

Quick Start

Add PIT to your existing Spring Boot 4 project by running the pitest steps to insert the PIT plugin and configuration into build.gradle.kts, then verify with ./gradlew pitest.

Frequently Asked Questions about add-mutation-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add mutation testing to a Spring Boot 4 Gradle project?

Mutation testing is added by configuring the PIT Gradle plugin with pinned versions and a targetClasses pattern in build.gradle.kts, then running the on-demand pitest task to validate unit tests against injected code changes.

Why do I have surviving mutants in my unit tests and how do I fix them?

Surviving mutants indicate gaps in unit test assertions where injected code changes go undetected. You fix them by adding stronger assertions to kill mutants or documenting true equivalence if the mutation does not alter behavior.

Does PIT mutation testing work with Gradle Kotlin DSL?

PIT mutation testing is fully compatible with Gradle Kotlin DSL, requiring a pinned PIT plugin configuration in build.gradle.kts along with a targetClasses pattern for your project package.

How do I exclude generated OpenAPI code from PIT mutation testing reports?

Generated OpenAPI code is excluded from PIT mutation testing by adding explicit excludedClasses for the api.* and dto.* packages, keeping the mutation report focused on meaningful business logic.

Will adding PIT mutation testing slow down my CI pipeline?

PIT mutation testing will not slow down your CI pipeline because the pitest task is configured as an on-demand workflow that is explicitly excluded from the standard tasks.check execution.

What is mutation testing versus line coverage for measuring unit test quality?

Mutation testing measures unit test quality by injecting code changes to verify tests detect behavioral bugs, whereas line coverage only confirms code paths are executed without validating assertions.