Mutation audit

From gonzalezpazmonica/pm-workspace · View interactive version

Mutation audit is an AI agent skill from the GitHub repository gonzalezpazmonica/pm-workspace. Usar cuando se quiere medir la calidad real de los tests mediante mutation testing.

How to use this skill

Skill file

Skill: Mutation Audit

Detecta tests zombies. Cobertura alta ≠ tests efectivos.

Ref: SE-035, research javiergomezcorio substack (57% → 74% mutation score automated).

Cuándo usar

Cuándo NO usar

Invocación

# Bash module
bash scripts/mutation-audit.sh --target scripts/X.sh --tests tests/test-X.bats

# Python module
bash scripts/mutation-audit.sh --target src/module.py --tests tests/test_module.py --runner pytest

# TypeScript
bash scripts/mutation-audit.sh --target src/Y.ts --tests test/Y.test.ts --runner "npm test"

# Con threshold custom
bash scripts/mutation-audit.sh --target scripts/X.sh --tests tests/test-X.bats --threshold 80 --mutants 10 --json

# Modo simulate (Slice 1 fast path — SIN ejecución real, etiquetado "simulated")
bash scripts/mutation-audit.sh --target scripts/X.sh --tests tests/test-X.bats --simulate

Output

Verbose (default)

=== SE-035 Mutation Audit ===
Target:    scripts/X.sh
Tests:     tests/test-X.bats
Language:  bash
Mode:      real
Mutants:   5 (killed=4, survived=1, equivalent=0, executed=5)
Score:     80% [PASS threshold 70%]

executed = número de mutantes que pasaron REALMENTE por el runner (el guard de

ejecución). En modo --simulate, executed=0 y Mode: simulated con WARNING.

JSON (--json)

{
  "verdict":"PASS",
  "execution":"real",
  "target":"scripts/X.sh",
  "tests":"tests/test-X.bats",
  "language":"bash",
  "mutants_total":5,
  "executed":5,
  "killed":4,
  "survived":1,
  "equivalent":0,
  "score_pct":80,
  "threshold_pct":70,
  "survivors":["line=42 mutator=comparison-boundary status=survived"]
}

Mutadores (Slice 1)

| Mutador | Aplica a | Ejemplo |

|---|---|---|

| arithmetic-op-swap | bash/py/ts | + → -, * → / |

| comparison-boundary | bash/py/ts | > → >=, < → <= |

| conditional-negate | bash/py/ts | if X → if ! X |

| return-null | py/ts | return X → return None/null |

Interpretación del score

Cada superviviente (mutante no matado) indica un gap concreto: diff muestra qué cambio NO fue detectado.

Caveats de interpretación (detalle en DOMAIN.md)

Integración en flujo

Restricciones

Referencias

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.