mutation-testing: Running a mewt/muton Mutation Testing Campaign with an Agent Skill

Preface

Line coverage tells you “which lines were executed,” but it rarely shows whether assertions truly catch behavior changes. Mutation testing injects small changes into the source code and runs the test suite to see how many mutants are “killed.” Surviving mutants often point to test gaps or equivalent mutants that require manual review.

mewt and muton are commonly used mutation testing tools, but configuring campaigns, scoping, timeout tuning, and interpreting results involve many steps and scattered documentation. Trail of Bits has turned this workflow into the mutation-testing Skill in their skills repository: it routes to configuration, bug hunting, and report-writing workflows based on scenario, and includes reference notes for commands and result meanings. Below we explain what it is, what it does, and how to install and use it in typical scenarios.

What Is This?

mutation-testing is a Skill under the Verification class of plugins in Trail of Bits Skills. The official description: configure mewt or muton campaigns, analyze surviving mutants, and chase down source code issues in weakly tested areas.

The Skill declares these tools: Read, Write, Bash, Grep. It loads the workflows and references corresponding to your intent instead of dumping all documentation at once. The official note states: muton and mewt have the same interface; the examples below use mewt, and when using muton, replace with muton and file names like muton.toml, muton.sqlite, etc. Command-line behavior should follow mewt --help and mewt <subcommand> --help; the examples reflect the mewt 4.x API.

Core Features

Scenario Routing

The Skill first determines which type of task you want to do, then loads the listed documents (workflows and references do not auto-load each other):

Scenario Load Content
Setup, scope limitation, or speeding up campaigns workflows/configuration.md; if you expect a very long campaign or explicitly request acceleration, additionally load references/optimization-strategies.md
After a campaign ends, find bugs in insufficiently tested code workflows/bug-hunter.md
Organize results into a formal analysis report workflows/analyzing-results.md, plus references on equivalent mutants, severity, report templates; for blockchain targets, add blockchain-patterns.md; for results not produced by mewt/muton, refer to input-formats.md
Others Follow mewt --help and assist directly

When to Use / When Not to Use

Suitable when the conversation mentions mewt, muton, or mutation testing; you need to configure, scope, or accelerate campaigns; you need to analyze surviving/uncaught mutants, equivalent mutants, kill rates; or you want to use mutation results to find bugs in source code.

Not needed when the user only asks about tests or line coverage without any mutation testing context.

Result State Meanings

  • Caught / TestFail: The tests detected the mutation (expected behavior).
  • Uncaught: The tests did not detect the change—distinguish whether it’s a test gap or an equivalent mutant.
  • Timeout: The test timed out; the conclusion is uncertain and cannot be treated as coverage evidence.
  • Skipped: When a more severe mutant on the same line is uncaught, a lower-severity mutation may be skipped.

Severity describes the priority of the mutation type, not business risk; low-severity mutants on critical paths like billing should still be prioritized for manual review.

Installation and Activation

mutation-testing is distributed via the trailofbits/skills marketplace. Installation specifics depend on your editor/CLI and the official repository instructions.

Claude Code

/plugin marketplace add trailofbits/skills

Browse and install the corresponding plugin via /plugin menu.

Codex

codex plugin marketplace add trailofbits/skills
codex plugin list
codex plugin add <plugin-name>@trailofbits

For local development, run in the parent directory of the skills repository:

/plugins marketplace add ./skills

After installing the marketplace, select the plugin that contains mutation-testing (path: plugins/mutation-testing/) to enable the Skill. On Cursor, if loading the same marketplace via Claude plugin marketplace compatibility, follow the same marketplace addition steps as above; client differences not listed in the materials are not expanded here.

Typical Usage

1. Initialization and Running Campaigns

Initialize first, then generate mutants or run a full campaign in one go:

mewt init                    # create config and database
mewt mutate [paths]          # only generate mutants, do not run tests
mewt run [paths]             # generate mutants and execute campaign

2. Check Progress and Results

mewt status                  # overview and per-file breakdown
mewt results                 # default: uncaught mutants
mewt results --all           # all results
mewt results --format json   # json | sarif | ids | table

Narrow down by path, severity, mutation type, status, or line number (results and print mutants share filter semantics):

mewt results --target 'src/auth/**'   # quote globs to avoid shell expansion
mewt results --severity high,medium
mewt results --mutation-types ER,CR
mewt results --status Uncaught        # Uncaught | TestFail | Skipped | Timeout
mewt results --line 42

3. Deep-Dive Into a Single Mutation and Retest

mewt print mutant --id [id]              # view post-mutation code
mewt test --ids [ids]                    # retest specified IDs
mewt test --ids-file uncaught_ids.txt    # retest from file or stdin ('-')

4. Check Configuration and Language Mutation Sets

mewt print config                        # currently effective config
mewt print targets                       # files actually mutated
mewt print mutations --language [lang]   # mutation operators and severity for a language

Language labels are the canonical family or family/dialect in mewt 4.x, e.g., rust, javascript/ts, move/sui, move/iota.

5. Interpret Uncaught Mutants with the Skill

mewt print mutations --language [lang] is the authoritative list of operators and severities. The priority examples given in the materials are as follows (specific slugs follow tool output):

Severity Representative slug What uncaught typically means
High ER (Error Replacement) Tests tolerate the injected error; check whether the path was executed, whether error handling masks changes, whether assertions check results
Medium CR (Comment Replacement) Tests still pass after deleting the statement; determine whether the statement’s side effects are observed by assertions
Medium IF/IT, NR Branch or condition changes are not distinguished; both branch constant replacements surviving may indicate the condition wasn’t executed or assertions are weak
Low AOS, COS, operator_shuffle, BL, AS, etc. Focus on boundary inputs and arithmetic assertions; mutation results alone cannot prove code execution

For formal reports, cataloging equivalent mutants and validation steps, severity grading, report structure, etc., the Skill loads the corresponding references when routed to the “analysis report” workflow.

Use Cases and Caveats

Suitable: Teams already using or planning to use mewt/muton; need AI assistance to complete campaign configuration, long campaign optimization, triage of surviving mutants, or to infer test and code issues from mutation results; for smart contracts and similar scenarios, the Skill can route to blockchain-specific pattern references (Solidity, Move, FunC/Tolk, Cairo, Solana Rust, etc.).

Caveats:

  • If the discussion is only about coverage and not mutation testing, do not rely on this Skill to replace coverage tooling explanations.
  • Importing results from external tools (e.g., slither-mutate, mull, dextool-mutate) requires reference to input-formats.md; formats may differ from mewt/muton native output.
  • Timeout entries cannot be treated as evidence of “being tested”; for long campaigns, combine the configuration and optimization-strategies workflows to tune scope and performance.

Conclusion

mutation-testing consolidates mewt/muton configuration, acceleration, result analysis, and bug hunting workflows into a routable Skill, reducing the entry cost for this advanced topic. Official Skill documentation:

https://github.com/trailofbits/skills/tree/main/plugins/mutation-testing/skills/mutation-testing

Skills marketplace and installation instructions:

https://github.com/trailofbits/skills

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye