mutation-testing

Inject AST-based mutations into Go code and report killed, survived, and timed-out tests.

19|3|Updated Aug 5, 2025
One-click install
npx skills add https://github.com/Roasbeef/claude-files --skill mutation-testing-roasbeef
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mutation-testing
Source: https://github.com/Roasbeef/claude-files/tree/main/skills/mutation-testing
Command: npx skills add https://github.com/Roasbeef/claude-files --skill mutation-testing-roasbeef

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill addresses the critical problem of insufficient test coverage and weak test assertions, even in codebases with high line coverage. It reveals if your tests truly verify behavior or merely execute code, helping you find and fix gaps before bugs reach production.

Core Features & Use Cases

  • Intelligent Mutation Generation: Creates deliberate, small code changes (mutations) using Go AST analysis.
  • Test Suite Validation: Runs your existing tests against these mutations to see if they "kill" (fail) the mutants, indicating effective tests.
  • Gap Identification & Remediation: Pinpoints surviving mutants, analyzes why tests failed to catch them, and suggests targeted test improvements.
  • Use Case: After writing new tests for a critical financial calculation, use this Skill to ensure the tests are robust enough to catch subtle off-by-one errors or incorrect arithmetic operations, providing confidence in the code's reliability.

Quick Start

To generate mutations for a Go file named 'wallet.go' and save them to 'mutations.json': ~/.claude/skills/mutation-testing/scripts/generate-mutations.sh --file wallet.go --output mutations.json Then, to run tests against a specific mutation (e.g., M0) in the './internal/wallet' package: ~/.claude/skills/mutation-testing/scripts/run-mutation-test.sh --mutation-file mutations.json --mutation-id M0 --package ./internal/wallet --output results/M0.json

Frequently Asked Questions about mutation-testing

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

FAQPage Schema
How do I know if my test suite actually catches bugs?

Mutation testing reveals test quality by injecting deliberate code changes (mutations) and checking if your tests fail against them. If tests pass despite mutations, you've found gaps in coverage or assertions that need strengthening.

Can I run mutation testing on my Go project?

Yes. This Skill generates mutations using Go's AST parser, runs your test suite against each mutation, and reports which tests caught defects (killed mutations) versus which survived, giving you a mutation score for Go code.

What's the difference between line coverage and mutation testing?

Line coverage shows which code executed; mutation testing verifies tests actually validate behavior by checking if they detect intentional bugs. High line coverage can mask weak assertions—mutation testing catches that gap.

How do I identify which tests are missing?

Run mutations against your test suite to see which ones survive (tests didn't catch them). Analyze survived mutations to pinpoint logic gaps, edge cases, or assertions your tests don't cover, then write targeted tests to kill those mutants.

When should I use mutation testing in my workflow?

Use mutation testing after writing new tests for critical code—financial calculations, complex algorithms, security logic—or during PR reviews to validate test quality before merging, ensuring bugs won't slip through weak assertions.

Does mutation testing work with CI/CD pipelines?

Yes. Mutation testing integrates into CI/CD workflows to validate test effectiveness on every commit. Generate mutations, run tests, report mutation scores, and block merges if quality thresholds aren't met, automating test gap detection.