agentleFS
vmobifystudiovmobifystudio/app-dev-team/skills/mutation-testing/SKILL.md

mutation-testing

Skill5 starsChanged 8 days agoMITView on GitHub

On an app-dev-team project, use when adding or reviewing a gate, guard or test assertion — and whenever a green suite needs to prove it can go red. Used by verification-engineer and test-automation-engineer. mutate.sh covers this plugin's own scripts only; app projects revert the diff instead.

40 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use domain-modeling, code-review and 1 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • GoogleSkill

    domain-modeling

    Build and sharpen a project's domain model. Use when the user wants to pin down domain terminology or a ubiquitous language, record an architectural decision, or when another skill needs to maintain the domain model.

    Also in 3 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 5 projects that use this

  • +1 more from google

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 36 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    No Node or a hostile environment: pick the assertion you doubt, edit the line it guards to invert it, run sh scripts/test.sh, and confirm …

    line 87

“Common” is measured: kept by at least 6 in 10 of the 36 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Mutation testing

defect-hunting §3 says a new rule is not done until you have watched it fail. Done by hand, that is done only when someone remembers — and a fully green suite can hide assertions that cannot fail.

A green suite is evidence only to the extent its assertions can go red. scripts/mutate.sh is that, executable — for this plugin's own scripts/ and hooks/ only. Its catalogue names plugin files and its runner is scripts/test.sh; it cannot mutate an app project.

On an app project

Mutation-test the project's own suite against the ticket's diff: revert the diff's changed production lines (in a scratch copy or throwaway worktree, never the shared tree), run the new tests, and confirm they fail; restore the lines and confirm they pass. A new test that stays green with the change reverted proves nothing about the change. Report it as Mutation: reverted <file:lines> -> <test> FAILED as expected, or name the test that survived.

Running it

sh scripts/mutate.sh                # every catalogued mutation (count them: --list | grep -c "^M")
sh scripts/mutate.sh --list         # the catalogue, plus what it cannot test and why
sh scripts/mutate.sh --only M04     # one mutation (or a list: --only M38,M39), while you iterate
sh scripts/mutate.sh --sample 4     # what CI runs on every PR
sh scripts/mutate.sh --full-suite   # run the whole suite per mutation instead of its section

By default each mutation runs only its test.sh section, which takes seconds; that can hide the "CAUGHT, but NOT by the assertion written for it" verdict, so the nightly full run passes --full-suite.

Exit 0 all caught · 1 something SURVIVED · 2 could not run (baseline not green, anchor drifted).

Three verdicts matter:

  • CAUGHT (n assertions) — the gate bites.
  • SURVIVED — the gate can be deleted and the suite stays green. That is a hole, and it is a finding at the same severity as the bug the gate was supposed to catch.
  • CAUGHT, but NOT by the assertion written for it — some unrelated assertion noticed. Not a hole today; the named guard is decorative, and the next refactor that touches the unrelated one takes the coverage away silently. Fix the named assertion.

The rule

A new gate ships with a mutation proving its assertion bites. Adding a check to board-doctor, ship-gate, verify-done, spawn-gate, a hook, or scripts/test.sh is not done until scripts/mutate.sh --only <your-id> prints CAUGHT and names your assertion.

Adding one is four fields in the catalogue at the top of scripts/mutate.sh:

M87@@scripts/your-gate.sh@@<exact text to break>@@<replacement>@@<the test.sh label that must fail>
  • The find text must occur exactly once in the file. Zero or many exits 2 — a mutation anchored at an arbitrary one of several sites proves nothing, and a drifted anchor must be loud rather than a phantom survivor.
  • Break the behaviour, not the message. Inverting an exit code, demoting a finding to a warning, flipping -gt to -lt, if false, neutering a regex, or returning the fallback instead of refusing are the seven shapes in the catalogue — all seven are things that really shipped here.
  • The last field is a substring of the real label in scripts/test.sh, so the tool can tell "the suite noticed" from "the assertion I wrote noticed".

When you cannot test it

Some assertions need Xcode, a simulator, or a network. Do not fake coverage. Add them to excluded() in scripts/mutate.sh with the reason; they are printed with every score and counted in neither numerator nor denominator. A mutation score that quietly omits the untestable parts is the same lie as a green suite full of decorative assertions.

A gate with no fixture that reaches it belongs there too, with that reason — reporting it as a hole would be a false alarm, and a tool that cries wolf gets switched off.

Safety

Mutations are applied to a copy in $TMPDIR; the real tree is never written to. .git is not copied (in a worktree it points at the real repository). Restore is a trap, and on exit the tool compares git status --porcelain against the snapshot it took at start and fails loudly if it moved.

Manual fallback

No Node or a hostile environment: pick the assertion you doubt, edit the line it guards to invert it, run sh scripts/test.sh, and confirm that assertion by name is in the FAIL list. Then git checkout -- <the one file you edited> — never a repo-wide revert. That is defect-hunting §3's three steps done by hand: confirm the edit landed, confirm the fixture reaches it, watch it go red and green again.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.