Skip to main content
skill CX Codex

mutation-testing · proffesor-for-testing — Claude Code skill: what it does, how to install

Skill runs mutation testing: mutates code (operators, boundaries, logic), runs tests, and counts surviving mutants — weak spots in your test suite.

MIT 122 installs ★ 533 updated 2026-10-25

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add proffesor-for-testing/agentic-qe --skill mutation-testing -a claude-code
Open on GitHub

What mutation-testing does

100% coverage does not mean good tests. This skill introduces mutations into code — changes >= to >, + to -, removes statements — and checks if tests catch the bug. A surviving mutant means a weak test: missing boundary checks or no assertions. Inside are instructions for Stryker, examples of test fixes, and sub-agent fleets that generate missing test cases.

The metric is mutation score: killed mutants / all mutants. Target threshold is 80%. The skill recommends starting with critical paths (payments, auth) because runs on files over 500 lines hit timeouts. Stryker requires explicit --testRunner jest if the project has two runners. Default --concurrency equals CPU count, which causes OOM in containers — set it to 2.

What it helps with

  • verify that tests catch real bugs
  • find weak assertions and missing boundary values
  • get a test quality metric before release
  • generate missing test cases for surviving mutants

Example prompts for the agent

  • Run mutation testing on src/payment.ts with an 80% target threshold
  • Check the mutation score for the auth module and generate tests for surviving mutants
  • Run Stryker on critical paths and show where boundary checks are missing

How to install mutation-testing

1Skills CLI (Vercel)

npx skills add proffesor-for-testing/agentic-qe --skill mutation-testing -a claude-code

2Manually: put the files in place

~/.claude/skills/mutation-testing/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/mutation-testing/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about mutation-testing

How to install mutation-testing in Claude Code?

Run npx skills add proffesor-for-testing/agentic-qe --skill mutation-testing -a claude-code, and the skill will land in ~/.claude/skills/mutation-testing/SKILL.md.

What does mutation-testing do?

Introduces mutations into code (changes operators, removes lines), runs tests, and calculates mutation score — the percentage of killed mutants. Surviving mutants reveal weak tests.

What does mutation-testing require to work?

Stryker (@stryker-mutator/core and a runner for your framework) and existing tests. Without tests, mutation score will be zero.

Source text

SKILL.md · MIT
---
name: mutation-testing
description: "Test quality validation through mutation testing, assessing test suite effectiveness by introducing code mutations and measuring kill rate. Use when evaluating test quality, identifying weak tests, or proving tests actually catch bugs."
category: specialized-testing
priority: high
tokenEstimate: 900
agents: [qe-test-generator, qe-coverage-analyzer, qe-quality-analyzer, qe-mutation-tester]
implementation_status: optimized
optimization_version: 1.0
last_optimized: 2025-12-02
dependencies: []
quick_reference_card: true
tags: [mutation, stryker, test-quality, kill-rate, assertions, effectiveness]
# ADR-056 Trust Tier 3 Validation
trust_tier: 3
validation:
  schema_path: schemas/output.json
  validator_path: scripts/validate-config.json
  eval_path: evals/mutation-testing.yaml
---

# Mutation Testing

<default_to_action>
When validating test quality or improving test effectiveness:
1. MUTATE code (change + to -, >= to >, remove statements)
2. RUN tests against each mutant
3. VERIFY tests catch mutations (kill mutants)
4. IDENTIFY surviving mutants (tests need improvement)
5. STRENGTHEN tests to kill surviving mutants

**Quick Mutation Metrics:**
- Mutation Score = Killed / (Killed + Survived)
- Target: > 80% mutation score
- Surviving mutants = weak tests

**Critical Success Factors:**
- High coverage ≠ good tests (100% coverage, 0% assertions)
- Mutation testing proves tests actually catch bugs
- Focus on critical code paths first
</default_to_action>

## Quick Reference Card

### When to Use
- Evaluating test suite quality
- Finding gaps in test assertions
- Proving tests catch bugs
- Before critical releases

### Mutation Score Interpretation
| Score | Interpretation |
|-------|----------------|
| **90%+** | Excellent test quality |
| **80-90%** | Good, minor improvements |
| **60-80%** | Needs attention |
| **< 60%** | Significant gaps |

### Common Mutation Operators
| Category | Original | Mutant |
|----------|----------|--------|
| **Arithmetic** | `a + b` | `a - b` |
| **Relational** | `x >= 18` | `x > 18` |
| **Logical** | `a && b` | `a \|\| b` |
| **Conditional** | `if (x)` | `if (true)` |
| **Statement** | `return x` | *(removed)* |

---

## How Mutation Testing Works

```javascript
// Original code
function isAdult(age) {
  return age >= 18; // ← Mutant: change >= to >
}

// Strong test (catches mutation)
test('18 is adult', () => {
  expect(isAdult(18)).toBe(true); // Kills mutant!
});

// Weak test (mutation survives)
test('19 is adult', () => {
  expect(isAdult(19)).toBe(true); // Doesn't catch >= vs >
});
// Surviving mutant → Test needs boundary value
```

---

## Using Stryker

```bash
# Install
npm install --save-dev @stryker-mutator/core @stryker-mutator/jest-runner

# Initialize
npx stryker init
```

**Configuration:**
```json
{
  "packageManager": "npm",
  "reporters": ["html", "clear-text", "progress"],
  "testRunner": "jest",
  "coverageAnalysis": "perTest",
  "mutate": [
    "src/**/*.ts",
    "!src/**/*.spec.ts"
  ],
  "thresholds": {
    "high": 90,
    "low": 70,
    "break": 60
  }
}
```

**Run:**
```bash
npx stryker run
```

**Output:**
```
Mutation Score: 87.3%
Killed: 124
Survived: 18
No Coverage: 3
Timeout: 1
```

---

## Fixing Surviving Mutants

```javascript
// Surviving mutant: >= changed to >
function calculateDiscount(quantity) {
  if (quantity >= 10) { // Mutant survives!
    return 0.1;
  }
  return 0;
}

// Original weak test
test('large order gets discount', () => {
  expect(calculateDiscount(15)).toBe(0.1); // Doesn't test boundary
});

// Fixed: Add boundary test
test('exactly 10 gets discount', () => {
  expect(calculateDiscount(10)).toBe(0.1); // Kills mutant!
});

test('9 does not get discount', () => {
  expect(calculateDiscount(9)).toBe(0); // Tests below boundary
});
```

---

## Agent-Driven Mutation Testing

```typescript
// Analyze mutation score and generate fixes
await Task("Mutation Analysis", {
  targetFile: 'src/payment.ts',
  generateMissingTests: true,
  minScore: 80
}, "qe-test-generator");

// Returns:
// {
//   mutationScore: 0.65,
//   survivedMutations: [
//     { line: 45, operator: '>=', mutant: '>', killedBy: null }
//   ],
//   generatedTests: [
//     'test for boundary at line 45'
//   ]
// }

// Coverage + mutation correlation
await Task("Coverage Quality Analysis", {
  coverageData: coverageReport,
  mutationData: mutationReport,
  identifyWeakCoverage: true
}, "qe-coverage-analyzer");
```

---

## Agent Coordination Hints

### Memory Namespace
```
aqe/mutation-testing/
├── mutation-results/*   - Stryker reports
├── surviving/*          - Surviving mutants
├── generated-tests/*    - Tests to kill mutants
└── trends/*             - Mutation score over time
```

### Fleet Coordination
```typescript
const mutationFleet = await FleetManager.coordinate({
  strategy: 'mutation-testing',
  agents: [
    'qe-test-generator',     // Generate tests for survivors
    'qe-coverage-analyzer',  // Coverage correlation
    'qe-quality-analyzer'    // Quality assessment
  ],
  topology: 'sequential'
});
```

---

## Related Skills
- [tdd-london-chicago](../tdd-london-chicago/) - Write effective tests first
- [test-design-techniques](../test-design-techniques/) - Boundary value analysis
- [quality-metrics](../quality-metrics/) - Measure test effectiveness

---

## Remember

**High code coverage ≠ good tests.** 100% coverage but weak assertions = useless. Mutation testing proves tests actually catch bugs.

**Focus on critical paths first.** Don't mutation test everything - prioritize payment, authentication, data integrity code.

**With Agents:** Agents run mutation analysis, identify surviving mutants, and generate missing test cases to kill them. Automated improvement of test quality.

## Run History

After each mutation test run, append results to `run-history.json` in this skill directory:
```bash
node -e "
const fs = require('fs');
const h = JSON.parse(fs.readFileSync('.claude/skills/mutation-testing/run-history.json'));
h.runs.push({date: new Date().toISOString().split('T')[0], mutation_score_pct: SCORE, killed: KILLED, survived: SURVIVED});
fs.writeFileSync('.claude/skills/mutation-testing/run-history.json', JSON.stringify(h, null, 2));
"
```
Read `run-history.json` before each run to track score improvements over time.

## Skill Composition

- **Before mutation testing** → Run `/qe-test-generation` to ensure tests exist
- **After mutation results** → Use `/qe-coverage-analysis` to prioritize improvement areas
- **Quality gate** → Feed results into `/qe-quality-assessment` for ship/no-ship decision

## Gotchas

- Stryker requires `--testRunner jest` explicitly if both jest and vitest are installed
- Mutating `>=` to `>` in date comparisons rarely gets killed — add boundary tests
- Running on files >500 LOC will timeout; use `--mutate` to target specific functions
- `--concurrency` defaults to CPU count which OOMs in containers — set to 2

© proffesor-for-testing · MIT · proffesor-for-testing/agentic-qe

Similar skills

All skills for Testing and QA →

mutation-testing by other authors comes first.

mutation-testing trailofbits Walks the agent through mutation testing: setting up a mewt or muton campaign, reading surviving mutants, hunting bugs in untested code. CX Codex +1 4,900installs mutation-testing secondsky mutation-testing mutates your code and reruns the tests to see which ones notice. Surviving mutants point at assertions that would let a real bug through. CX Codex +1 468installs mutation-testing metabase Runs mutation testing for a Clojure namespace, writes tests for surviving mutations, and opens draft PRs linked to Linear issues. CX Codex +1 ★ 50,467repo stars add-mutation-testing davila7 add-mutation-testing is a Claude Code command that configures mutation testing and CI integration. It can target a named language or detect one from the project files. CX Codex +1 172installs mutation-tester rohitg00 mutation-tester is a Claude Code plugin that checks test quality by injecting bugs into code and seeing whether tests catch them. ★ 2,858repo stars antithesis-mutation-testing antithesishq antithesis-mutation-testing — a skill for Claude Code, Codex, Cursor and other agents that checks whether your Antithesis property catalog can actually catch bugs. CX Codex +1 169installs test-anti-patterns dotnet test-anti-patterns scans test files for anti-patterns: assertions that verify nothing, swallowed exceptions, order-dependent tests, magic values. Works across languages, ranks findings by severity. CX Codex +1 5,600installs assertion-quality dotnet assertion-quality is a Claude Code skill that reviews assertions in existing tests. It activates for requests about shallow, trivial, or overly similar checks. CX Codex +1 4,700installs body-horror-style https://github.com/arjun988 The body-horror-style Claude Code skill guides body-horror art direction in Blender. It activates for work involving mutation, grotesque anatomy, and unsettling flesh materials. CX Codex +1 500installs

From the same set73

The whole set →
n8n-integration-testing-patterns n8n-integration-testing-patterns is a Claude Code skill for testing API contracts, authentication flows, and rate limits in n8n integrations. CX Codex +1 124installs tdd-london-chicago tdd-london-chicago — a skill for choosing London or Chicago TDD, using mocks or real objects, and moving through the Red–Green–Refactor cycle. CX Codex +1 124installs qe-chaos-resilience qe-chaos-resilience — a skill for Claude Code, Codex, Cursor and other agents that injects controlled faults into distributed systems and checks recovery behavior. Runs during circuit breaker, failover, and retry logic validation. CX Codex +1 123installs consultancy-practices consultancy-practices is a Claude Code skill that applies software quality consulting practices: it identifies client pain, prioritizes work by impact and effort, and transfers knowledge. CX Codex +1 122installs qe-code-intelligence qe-code-intelligence builds a semantic code index, dependency graphs and knowledge graphs. Helps understand unfamiliar codebases, trace call chains, and find code by meaning rather than keywords. CX Codex +1 122installs qe-test-execution qe-test-execution orchestrates Jest, Vitest, and Playwright suites using the aqe CLI with parallel workers, affected-test selection, and flaky test retries. CX Codex +1 122installs qe-learning-optimization qe-learning-optimization optimizes QE agents through transfer learning across test frameworks, Bayesian hyperparameter tuning, and A/B experiments. CX Codex +1 121installs qe-security-compliance qe-security-compliance runs code security audits, dependency vulnerability scans, secret detection, and compliance checks for OWASP and SOC2. CX Codex +1 120installs

Project sponsors

Companies that keep this analytics open