/mutant:mutant-testingfrom mutant
Runs mutation testing on Flutter/Dart packages using the mutant CLI. Finds untested code changes, writes tests to catch them, and re-verifies. Use to harden tests on a branch or PR.
Ships in mutant. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A deterministic CLI does the mutating and test running; you triage, write tests and re-verify. The CLI is the judge: never call a mutant killed without a CLI result, and never call one equivalent without a one-line argument the user can check.
mutant --version. If it is missing, install it:
dart pub global activate mutant, or before it is on pub.dev
dart pub global activate --source git https://github.com/dmkasperski/mutant (needs Dart ≥ 3.13).
Below, $FM means that command.cd to the package root (the directory with pubspec.yaml; in a monorepo, the package
being changed)..dart_tool/mutant/manifest.json exists, a previous run was interrupted: run
$FM restore first and tell the user.lib/ files in place while it runs (restored and hash-verified at the end,
also on Ctrl+C). Tell the user not to edit the package or hot-reload it meanwhile, and do not
edit lib/ or test/ yourself while a run is in progress.--flutter "<command>".| Situation | Flags |
|---|---|
| Default: the current branch / PR | --diff $(git merge-base HEAD origin/main) (use the repo's real default branch) |
| Uncommitted work only | --diff HEAD |
| Specific files | --files lib/a.dart --files lib/b.dart |
| Whole package (slow — only if asked) | --all |
If the package is a library tested also from another package (typically an example/ app with a
path: .. dependency), add --test-package example so those tests count.
Useful flags: --ui auto|all|none (UI operators; auto = only files reachable from golden
tests), --exclude <regex>, -j <n>, --dry-run (list mutants only), --no-golden-rebaseline.
$FM --help lists everything. Code can opt out with // mutant:ignore (same or previous line) or
// mutant:ignore-file.
If --dry-run shows more than ~300 mutants, tell the user the estimate (about 1 s per mutant and
test file) and offer to narrow the scope first.
$FM run <scope flags>
Run it in the background when it may take more than ~2 minutes. The last stdout line is JSON with
report (path of the full JSON report), summary, durationMs and aborted. Progress and a short
summary go to stderr.
In CI (e.g. a GitHub workflow that already ran the mutant action) the report path is given to you: skip this step and read that report.
Load the JSON report. Key fields: summary (score, scoreCovered, counts), phasesMs,
baseline.excludedTestFiles, hygiene, warnings, and mutants[] with key, file, line,
operator, description, status, killedBy, testFiles, reason.
Statuses: killed / timeout (caught) · survived (tests ran the code and did not notice) ·
noCoverage (no test executes it) · noTests (no test imports the file) · invalid (does not
compile; not counted) · skipped (direct-mode cap).
If aborted is true or a warning mentions RESTORE MISMATCH: stop, run git status, and tell the
user exactly what is affected before anything else.
For each survived and noCoverage mutant, read the code around it and classify:
noTests mutants: list the files and suggest tests; write a whole new test file only if the user
asked for full coverage.
With more than ~15 bugs, start with logic outside widgets, then UI, and check with the user before going past the first batch.
lib/x/y.dart → test/x/y_test.dart) or the file that already
tests that unit; follow the project's style, helpers and mocking library.Future.delayed (not even Duration.zero): real delays make tests slow and
flaky under load, which also makes mutation results unstable. Use await pumpEventQueue() for
microtasks and zero-delay timers, and fake time for real durations (debounce, timeouts):
testWidgets + tester.pump(duration), or fakeAsync if the project already depends on it.
Under fake time, capture a future's result with .then instead of awaiting it.lib/ to make a mutant die. Never run --update-goldens on existing goldens. Add
golden tests only if the project already uses goldens, and list the new PNG files.flutter test <file> — it must pass on the current code.
If it fails, you found a bug in the code: stop and report it instead of bending the test.Re-run only the targeted mutants with the same scope flags (keys are stable while lib/ is
unchanged). Each key needs its own --only; build the list as an array so the shell does not pass
it as one string:
args=(); for k in $(jq -r '.mutants[] | select(.status=="survived") | .key' report.json); do args+=(--only "$k"); done
$FM run <same scope flags> "${args[@]}"
A mutant is fixed only when this run reports it killed or timeout. Try at most twice per
mutant, then record it as still surviving with what you tried.
If another skill for mutation-testing reports is available, follow it now.
Otherwise summarise: score before → after, tests added (file and what each pins down), bugs in the code if any, mutants still surviving with your verdict, and the JSON report path. Do not commit unless asked (in CI, follow the workflow's instructions).
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
mutation-testing, test-quality, flutter-testing, dart-testing
Other plugins' skills for the same job
npx claudepluginhub dmkasperski/mutant --plugin mutant