Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Agent Skill

Mutation testing (Trail of Bits)

Sets up mutation testing campaigns with Trail of Bits' mewt or muton, reads surviving mutants and hunts the bugs that weak tests let through.

name: mutation-testingBy Trail of BitsChecked
View source on GitHub
Bookmark

Bookmarks are kept in your free account, so you can find this page again on any device.

Sign in to bookmark

Install

Commands are pinned to commit 149d7b2, the version we read, wherever the install method supports it.

npx skills

Terminal
npx skills add trailofbits/skills@149d7b21f4067765b82e67029730b42d228ef4b4 --skill mutation-testing -a claude-code

Copies the skill into .claude/skills/ in this project, pinned to the reviewed commit.

Plugin marketplace

Claude Code prompt
/plugin marketplace add trailofbits/skills
/plugin install mutation-testing@trailofbits

Run inside Claude Code. Installs the whole mutation-testing plugin from its default branch, not the pinned commit.

What it does

Mutation testing changes your code in small ways (flip a comparison, delete a line, swap a constant) and runs the tests against each change. A mutant the tests do not catch points at code your tests do not really check, and sometimes at a real bug. This skill drives Trail of Bits’ mewt tool (and its sibling muton) and helps with the hard parts. A routing section sends the agent to one of three workflows: configuring and scoping a campaign so it finishes in reasonable time, hunting bugs in the code that surviving mutants expose, or turning results into a formal report. References cover equivalent mutants (changes that cannot alter behaviour, so no test could catch them), severity tiers, optimisation and blockchain targets such as Solidity, Move, Cairo and Solana Rust.

When to use it

You have a test suite with decent line coverage and want to know whether it would actually catch bugs, especially for security-sensitive code, parsers or smart contracts. Its bug-hunter workflow treats surviving mutants as leads for a code review, not just a score to push up.

When to skip it

Projects with few tests: fix coverage first. Large codebases without scoping, because a campaign runs your tests once per mutant and can take hours; the configuration workflow exists to keep that in check. The skill also does not trigger for general testing questions with no mutation context, by design.

Try it

Set up a mewt campaign for src/auth/ only, estimate how long it will take,
and trim it if it's over an hour. When it finishes, list the uncaught
mutants by severity, mark the ones you think are equivalent, and say which
look like real bugs.

What it can touch

Bundles scripts
No
Pre-approved tools
Read Write Bash Grep
Needs
mewt or muton installed
Client-specific fields
None, spec fields only

Its instructions steer what your agent does, and it may have changed since the commit we read. How to check a skill.

allowed-tools pre-approves Read Write Bash Grep, so in clients that honour it the agent can run campaigns and write files without asking. mewt writes a config and a results database in your project and runs your test suite many times. Install mewt or muton yourself first. Content is licensed CC-BY-SA-4.0.

At commit 149d7b2 the SKILL.md is 109 lines long. Alongside it:

  • agents/ (1 entry)
  • assets/ (1 entry)
  • references/ (6 entries)
  • workflows/ (3 entries)

Alternatives

Property-based testing from the same repository strengthens tests across a whole input space, which kills many mutants at once. TDD helps write tests that would have caught them in the first place.

SKILL.md

The file exactly as published at the reviewed commit, reproduced under its CC-BY-SA-4.0 licence.

plugins/mutation-testing/skills/mutation-testing/SKILL.md
---
name: mutation-testing
description: "Configures mewt or muton campaigns, analyzes surviving mutants, and investigates bugs exposed by testing gaps. Use when setting up mutation testing, reviewing campaign results, identifying equivalent mutants, or finding bugs from surviving mutations."
allowed-tools: Read Write Bash Grep

---

# Mutation Testing (mewt/muton)

Routes to the right mutation testing workflow and loads the references that workflow needs.

> **Note**: muton and mewt share identical interfaces. Examples use `mewt`; substitute `muton` and its file names (`muton.toml`, `muton.sqlite`) for muton projects.

`mewt --help` and `mewt <subcommand> --help` are the source of truth for command-line behavior. Examples below reflect the mewt 4.x API; run `--help` when a flag looks unfamiliar or a command fails.

## When to Use

Use this skill when the user:
- Mentions "mewt", "muton", or "mutation testing"
- Wants to configure, scope, or speed up a mutation testing campaign
- Wants to analyze mutation results — surviving/uncaught mutants, equivalent mutants, kill rate
- Wants to use mutation results to find bugs in the source code

## When NOT to Use

Do not use this skill when the user asks about tests or line coverage without any mutation testing context.

---

## Routing

Pick the workflow, then load it together with the references listed for it. Workflows and references do not load each other — that decision belongs here.

**Setting up, scoping, or speeding up a campaign**
→ [workflows/configuration.md](workflows/configuration.md)
→ Also load [references/optimization-strategies.md](references/optimization-strategies.md) when the campaign estimate is long enough to need trimming, or the user asks to make it faster.

**Campaign finished, hunting for bugs in untested code**
→ [workflows/bug-hunter.md](workflows/bug-hunter.md)

**Turning results into a formal analysis report**
→ [workflows/analyzing-results.md](workflows/analyzing-results.md), plus:
- [references/equivalent-mutants.md](references/equivalent-mutants.md) — equivalence catalog and verification procedure
- [references/severity-classification.md](references/severity-classification.md) — severity tier criteria
- [references/report-template.md](references/report-template.md) — report structure
- [references/blockchain-patterns.md](references/blockchain-patterns.md) — **only** for Solidity, Move, FunC/Tolk, Cairo, or Solana Rust targets
- [references/input-formats.md](references/input-formats.md) — unless the results came from mewt or muton. Foreign tool output may not be self-describing; this covers the parsing anchors for slither-mutate, mull, and dextool-mutate

**Anything else** → run `mewt --help` or `mewt <subcommand> --help`, then assist directly.

---

## Essential Commands

```bash
# Set up and run
mewt init                    # Create config and database
mewt mutate [paths]          # Generate mutants without testing them
mewt run [paths]             # Generate mutants and run the campaign

# Read results
mewt status                  # Overview with per-file breakdown
mewt results                 # Uncaught mutants (default view)
mewt results --all           # Every outcome, not just uncaught
mewt results --format json   # json | sarif | ids | table

# Narrow down (these filters work on both `results` and `print mutants`)
mewt results --target 'src/auth/**'   # Quote globs so the shell does not expand them
mewt results --severity high,medium
mewt results --mutation-types ER,CR
mewt results --status Uncaught        # Uncaught | TestFail | Skipped | Timeout
mewt results --line 42

# Investigate and re-test
mewt print mutant --id [id]              # View the mutated code
mewt test --ids [ids]                    # Re-test specific mutants
mewt test --ids-file uncaught_ids.txt    # Re-test IDs from a file, or '-' for stdin

# Inspect configuration
mewt print config                        # Effective config
mewt print targets                       # Files actually mutated
mewt print mutations --language [lang]   # Mutations and severities for a language
```

Language labels are canonical `family` or `family/dialect` values in mewt 4.x — for example `rust`, `javascript/ts`, `move/sui`, `move/iota`.

---

## What Results Mean

- **Caught/TestFail**: tests detected the mutation (good)
- **Uncaught**: tests did not detect the change. Inspect the code to distinguish a testing gap from an equivalent mutation.
- **Timeout**: tests took too long — inconclusive, not evidence of coverage
- **Skipped**: a less severe mutant was skipped because a more severe mutant on the same line was uncaught

---

## Interpreting Mutation Types

`mewt print mutations --language [lang]` lists every mutation slug, description, and severity for a language, and is authoritative — the operator set grows with each release. What that output does not tell you is what a survivor *means*, which is where prioritization comes from:

| Severity | Representative slugs | What an uncaught mutant tells you |
|----------|---------------------|-----------------------------------|
| High | `ER` (Error Replacement) | Tests tolerate the injected error. Investigate whether the path executes, whether error handling masks the change, and whether assertions check the outcome. |
| Medium | `CR` (Comment Replacement) | Removing the statement does not fail the tests. Check whether its effects matter and whether assertions observe them. |
| Medium | `IF`/`IT` (If False/True), `NR` (Negation Removal) | Tests do not distinguish the changed condition. Both constant replacements surviving can indicate an unexecuted condition or weak assertions on the branch outcomes. |
| Low | Operator shuffles (`AOS`, `COS`, `LOS`, `BOS`, shift/assignment variants), `BL`, `AS`, `LC`, `WF` | Check boundary inputs, arithmetic assertions, and semantic equivalence. The mutation result alone does not establish whether the code executed. |

Severity ranks the *mutation*, not the risk. A low-severity survivor in a fee calculation matters more than a high-severity survivor in a log line — weigh what the mutated code does. Filter with `--severity` to work through the results in priority order.
  • Property-based testing (Trail of Bits)

    Writes and reviews property tests with Hypothesis, fast-check, proptest and others, and tells a wrong property from a real bug when one fails.

    Checked at 149d7b2

  • Test-driven development

    Enforces red-green-refactor: write a failing test, watch it fail, write the least code to pass, then clean up. Part of obra's Superpowers set.

    Engineering workflowJesse Vincent (obra)Checked at 22f0b46

  • Playwright CLI

    Microsoft's skill for driving a real browser with playwright-cli: snapshots, clicks, form input, network mocking, tracing and turning sessions into tests.

    MicrosoftChecked at c872a33