/ Mutation testing for your AI agents
Your agent writes tests that pass. This skill makes them catch bugs.
mutation-audit runs Reapr on your diff, writes one focused test per surviving mutant, and reruns until each one is killed. It never changes your production code.
Get started
Install the plugin in Claude Code
/plugin marketplace add reapr-corp/reapr/plugin install reapr@reaprOn Claude Code 2.1.275 or later, one command does both:
/plugin install reapr --marketplace reapr-corp/reaprSet up your repo
Checks rpr, your engine and its config, measures your baseline, and offers to add the CI job and the agent rule. It asks before every change.
/reapr:setupKill the survivors on your branch
Or just ask Claude to check the tests on your branch.
/reapr:mutation-audit
Using Cursor, Codex or Gemini CLI? Give your agent this prompt:
Install and set up the Reapr mutation-audit skill for this repo following https://reapr.dev/skill.md, then run it on my current branch.- mutant
reapr-core/src/diff.rs:34:25||became&&: survived, then killed by the new test- behavior
- An added line
++ b/fake.tsis read as a file header - new test
header_like_content_does_not_move_later_hunks_to_another_file- rerun
cargo mutants -f diff.rs: killed- score
- 89.51% to 94.65%
/ Results
Measured, not promised.
89.51% to 94.65%
Mutation score of Reapr's own Rust codebase after the skill's first run: 23 surviving mutants killed by 8 new tests, with no production code changed. Read the audit report in pull request #30.
21 of 21 vs 14 of 21
Rule checks passed in the skill's evals, with and without the skill. Without it, the agent wrote its own Stryker config when the repo had none and rewrote existing tests without asking. See the evals in pull request #14 and the eval definitions.
/ How it works
One survivor, one test, one rerun.
Find the survivor
rpr run --difflists every mutant on your diff that no test caught.Read the code and the intent
It states in one sentence the behavior the mutant changes, from the code, types, docs and callers.
Write one focused test
In your repo's framework and conventions, asserting the intended behavior.
Rerun until killed
It reruns Reapr and keeps the test only when the mutant is killed.
Equivalent mutants, which no test can kill, are reported to you instead of getting a forced test. When the intended behavior is ambiguous, it asks you instead of pinning what the code does now.
What it never does
- Change production code to kill a mutant. If a test shows the code is wrong, it reports the bug and stops.
- Lower a threshold, or change Reapr's flags to move the score.
- Edit your engine config, or invent one when the repo has none.
- Rewrite or delete an existing test without asking you.
What it needs
rpr, Reapr's CLI, on Linux (x86_64, aarch64). macOS and Windows are planned.- A mutation engine: StrykerJS with a config file (JavaScript, TypeScript) or cargo-mutants 26.2 to 27.x (Rust).
curl -LsSf https://github.com/reapr-corp/reapr/releases/latest/download/rpr-installer.sh | sh/ Other agents
Cursor, Codex, Gemini CLI and others
Install rpr, then give your agent the rules in AGENTS.md. It links the full workflow in SKILL.md.
Show AGENTS.md
# Reapr: instructions for coding agents
For any agent (Cursor, Codex, Copilot, Aider and others) asked to check, strengthen or review the tests of a
branch or pull request. Point the agent at this file or copy it into the agent's instructions.
The skill runs Reapr (`rpr run --diff <base> --json`, or `rpr run --all --json` for a whole-codebase audit) and
uses the surviving mutants as evidence: one focused test per survivor, confirmed killed by a second run. It flags
tests that cover the scope but kill nothing, then audits the code for edge cases that mutation operators do not
represent.
## Hard rules
- Never change production code, thresholds or engine config, and never create an engine config. If rpr, the
engine or a StrykerJS config is missing, follow Setup below (`npx stryker init` is the human's to run).
Rust projects use `--engine cargo-mutants`, whose config is optional; it has no thresholds, so only
`--min-score` (the human's choice) gates it.
- When the intended behavior is ambiguous (the code disagrees with docs, types, names, callers, specs or an
existing test, or nothing specifies it), ask the human. Do not write a test that pins the current behavior.
- A test is done only when a later `rpr` run (the same `--diff <base>` or `--all` command as the first) shows
it kills a mutant. Engine-only checks (`cargo mutants -f <file>`) are for iterating, not for the report.
Equivalent mutants are listed for the human with the input domain that makes them equivalent, not forced.
- Never delete tests; change existing tests only with the human's OK. One behavior per test, in the repo's
conventions, inside the diff scope. Rust tests go in the mutated package; commit them before re-running
`rpr --diff`, or the scope shifts.
- Do not change process-wide state (env vars, cwd, PATH) in tests; use a child process or a project-local fake.
- Generate one UUID v4 per session (`uuidgen` or `node -e 'console.log(crypto.randomUUID())'`) and prefix
every `rpr` command with `RPR_INVOKED_BY=mutation-audit RPR_SESSION_ID=<uuid>`. It only tags Reapr's
anonymous telemetry and changes nothing when `DO_NOT_TRACK` is set.
## Setup (first use)
Ask before every step that changes anything. 1. `rpr --version`, else offer the installer
(`curl -LsSf https://github.com/reapr-corp/reapr/releases/latest/download/rpr-installer.sh | sh`). 2. Detect
StrykerJS (package.json with vitest/jest, `stryker.*config*` files, per package in monorepos) or cargo-mutants
(`Cargo.toml`); both → `--engine`. 3. cargo-mutants installed (`cargo install --locked cargo-mutants`); for
StrykerJS a config must exist: never write one, ask the human to run `npx stryker init`, and stop until it
exists. 4. Baseline: `RPR_INVOKED_BY=setup RPR_SESSION_ID=<uuid> rpr run --all --json` per config; report score,
survivors per file and time. 5. Optionally, with consent, a `reapr-corp/run@v1` pull-request job and an agent
rule. Full steps: [skills/setup/SKILL.md](skills/setup/SKILL.md).
## Workflow
Follow the full workflow in [skills/mutation-audit/SKILL.md](skills/mutation-audit/SKILL.md). Ignore its YAML
header; where it says `/reapr:setup`, use the Setup section above. `${CLAUDE_SKILL_DIR}` in it means the
`skills/mutation-audit` folder next to this file./ FAQ
Frequently asked questions
- Does it work without Claude Code?
- Yes. Claude Code installs it as a plugin. Cursor, Codex, Gemini CLI and other agents can follow the same workflow: point them at AGENTS.md in the reapr repository, which has the hard rules and links the full SKILL.md.
- Does it send my code anywhere?
- No. The skill runs rpr and your own test suite on your machine. rpr sends one anonymous usage event per run, with counts and durations and never code, paths or names, and DO_NOT_TRACK=1 turns it off. Every property is listed at reapr.dev/telemetry.
- Does it change my Stryker or cargo-mutants config?
- No. It never edits or creates an engine config, never lowers a threshold and never changes Reapr's flags. It adds test files, and it changes an existing test only after you say yes.
- What if my repo has no Stryker config?
- The skill stops and tells you to create one with npx stryker init. It does not write one itself: the config decides the test runner, what is mutated and the thresholds, and those are your team's choices.
- Does it work with Rust?
- Yes. rpr supports cargo-mutants (26.2 to 27.x), and the skill runs it with the project's own .cargo/mutants.toml when there is one. On Reapr's own Rust code it raised the mutation score from 89.51% to 94.65% with 8 new tests.
Make your agent's tests catch bugs.
Free and open source (MIT). It runs on your machine, with your tests.
Install the plugin in Claude Code
/plugin marketplace add reapr-corp/reapr/plugin install reapr@reaprOn Claude Code 2.1.275 or later, one command does both:
/plugin install reapr --marketplace reapr-corp/reaprSet up your repo
Checks rpr, your engine and its config, measures your baseline, and offers to add the CI job and the agent rule. It asks before every change.
/reapr:setupKill the survivors on your branch
Or just ask Claude to check the tests on your branch.
/reapr:mutation-audit