agentsclimarketplace

Mutation testing

Skill rshankras/claude-code-apple-skills/skills/testing/mutation-testing

EXPERIMENTAL — mutation testing with muter to measure whether tests actually assert anything: mutants that survive reveal assertion-free coverage. Advisory report only, never a merge gate. Use on engine/logic targets when coverage numbers look good but bugs still slip through.From its SKILL.md

Install
npx -y skills add rshankras/claude-code-apple-skills --skill mutation-testing

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

4.3 KB, 899 tokens by cl100k_base, as published. Nobody here has run it

Mutation Testing (Experimental)

Status: EXPERIMENTAL — advisory report only. Never wire this as a merge gate.

Coverage proves a line ran under test; mutation testing proves a test would notice if the line were wrong. Muter mutates the source (flips > to <, && to ||, deletes statements), reruns the suite per mutant, and reports the mutants that survived — code that is covered but effectively unasserted. It is the truest answer to "did the agent write real tests or coverage theater," and also the slowest and most fragile tool in the gauntlet, which is why it stays advisory.

When This Skill Activates

Use this skill when:

  • Coverage is healthy but bugs still slip through covered code
  • Auditing agent-written test suites for assertion-free tests
  • A periodic (nightly/weekly) quality audit of engine/logic targets

Do NOT use as a per-commit or merge-blocking check — a full mutation run multiplies the suite's runtime by the mutant count.

Setup

  1. Install muter and confirm it runs against the current Xcode before investing further:
brew install muter-mutation-testing/formulae/muter
muter --version
  1. Copy templates/muter.conf.yml to the repo root as muter.conf.yml and scope it (see below).
  2. First run:
muter run    # writes an HTML/console report of surviving mutants

Scoping: Engines Only

Mutation-test the code where logic density is highest and the suite claims real coverage — engine/store/service types. Exclude UI, generated code, and test files: mutating a SwiftUI body mostly produces noise, and every excluded file cuts the runtime multiplier.

mutateSourcesInDirectories:
  - App/Engines
  - App/Stores
excludeList:
  - "*View.swift"
  - "*Preview*"

Reading the Report

  • Killed mutant — a test failed: the suite genuinely asserts this behavior.
  • Survived mutant — every test passed with the code broken: coverage without verification. Each survivor is a concrete, located prompt: write the assertion that kills it.
  • Mutation score (killed ÷ total) is a trend number for the same scope over time; do not chase an absolute score.

Caveats (Why This Stays Advisory)

  • Toolchain fragility: muter rewrites source and drives xcodebuild; new Xcode releases can break it until the project catches up. Always verify a plain muter run completes on the current toolchain before trusting results.
  • Swift Testing detection: muter's kill detection matured on XCTest. Verify it detects Swift Testing (#expect) failures in YOUR project: run one mutant cycle on a file whose suite you trust, and confirm survivors/kills match expectations.
  • Runtime: suite time × mutants. Scope hard, run nightly or on demand.

Deterministic Fallback: Manual Mutation Spot-Checks

When muter can't run (toolchain break, CI limits), the drill from testing/fitness-functions/ scales down to single mutations by hand:

  1. Pick a critical function; invert one condition (or return a constant).
  2. Run its suite — a test MUST fail. If nothing fails, the suite has an assertion gap: write the missing test now.
  3. Revert. Two or three spot-checks per engine per release is a meaningful audit.

Common Pitfalls

PitfallProblemSolution
Wiring as a merge gateRuntime + fragility block everyoneNightly/on-demand advisory report
Mutating the whole appHours of UI-noise mutantsScope to engine/store directories
Chasing a scoreScore varies with scope, not qualityTrack survivors fixed, not the percentage
Trusting an unverified runKill detection may miss the test frameworkCalibrate on a suite you trust first

References

  • testing/coverage-ratchet/ — the cheap proxy this tool audits
  • testing/fitness-functions/ — deliberate-break drill (the manual fallback)
  • testing/tdd-feature/ — writing the assertions that kill survivors

What ships with it: 1 file

678 B alongside SKILL.md

templates/

Gives 0 of the 12 instructions most test generation skills give in 899 tokens

Counted across 85 of the 114 authors here whose files we hold, read 2026-09-06

  • Mock external dependencies in unit testsin 7 of 85
  • Test behavior, not implementation detailsin 6 of 85
  • Cover happy path, edge cases, and error casesin 6 of 85
  • Write the test first and watch it failin 5 of 85
  • Test mobile, web, and developer APIs separatelyin 4 of 85
  • Identify the API type and enumerate endpointsin 4 of 85
  • Check rate limiting on authentication endpointsin 4 of 85
  • Check all API versionsin 4 of 85
  • Test all HTTP methods on each endpointin 4 of 85
  • Test IDOR by changing object identifiersin 4 of 85
  • Run GraphQL introspection to fetch the schemain 4 of 85
  • Test SQL injection in JSON parametersin 3 of 85

Said here and by no other author read

  • Install muter and verify it runs on current Xcode
  • Copy the config template and scope it
  • Run muter run to report surviving mutants
  • Scope mutation testing to engine, store, and service directories
  • Exclude UI, generated code, and test files from mutation
  • Verify plain muter run completes before trusting results

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.