mutation-testing

Detect weak tests and compute mutation scores with mutmut or cosmic-ray.

Updated Sep 8, 2025
One-click install
npx skills add https://github.com/randalmurphal/claude-config --skill mutation-testing-randalmurphal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mutation-testing
Source: https://github.com/randalmurphal/claude-config/tree/main/skills/mutation-testing
Command: npx skills add https://github.com/randalmurphal/claude-config --skill mutation-testing-randalmurphal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Validate test suite effectiveness using mutation testing with mutmut or cosmic-ray to detect weak tests, calculate mutation scores, and improve coverage. Use when validating test effectiveness, achieving high test quality, or detecting tests that pass but don't validate behavior.

Core Features & Use Cases

  • Mutant Generation & Scoring: Identify weak tests via mutation scores.
  • Tool Comparisons: mutmut vs cosmic-ray.
  • CI/CD Integration: Incorporate mutation testing into pipelines.

Quick Start

Install mutmut, run mutmut run, view mutmut results, and iteratively fix tests to increase mutation score.

Frequently Asked Questions about mutation-testing

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

FAQPage Schema
How do I detect weak tests in my Python codebase?

Mutation testing detects weak tests by introducing intentional code changes (mutants) and checking if your tests catch them. Install mutmut, run `mutmut run` on your Python project, then review `mutmut results` to identify tests that fail to catch mutations, revealing gaps in test coverage.

What is mutation testing and how does it improve test quality?

Mutation testing modifies your code with operators like arithmetic, boolean, and comparison changes to verify tests validate actual behavior. By computing a mutation score—the percentage of mutants killed by tests—you measure test effectiveness and identify areas where tests pass but don't truly validate logic.

Can I run mutation testing in CI/CD pipelines?

Yes, mutation testing integrates into CI/CD workflows. Use mutmut or cosmic-ray to run mutations on specific modules or files as part of your pipeline, generate mutation scores, and fail builds if scores fall below your quality threshold, enforcing test quality standards across commits.

Should I use mutmut or cosmic-ray for mutation testing?

Both tools detect weak tests through mutation testing. Mutmut is lighter and faster for unit tests; cosmic-ray offers broader mutation operators and supports integration tests. Choose based on your codebase size, test scope, and performance requirements.

What types of tests does mutation testing work with?

Mutation testing works with unit and integration tests. It runs mutations on your code and executes test commands to measure how many mutants are caught, providing actionable recommendations to strengthen tests across both test levels.

How do I increase my mutation score?

After running mutation testing and reviewing results, fix tests that don't catch mutants by adding assertions that validate specific behavior changes. Iteratively re-run `mutmut run` and `mutmut results` until your mutation score reaches your quality target.