[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6J864WJVVBV1BSB75AY7CJN":3,"skill-same:01M6J864WJVVBV1BSB75AY7CJN":64},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":14,"repositoryHtmlUrl":48,"repositoryHomepageUrl":6,"ownerHtmlUrl":49,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":50,"install":51,"resources":63},"01M6J864WJVVBV1BSB75AY7CJN","run-mutation-tests",null,"Use when the user wants to run mutation testing, verify test quality, check test coverage effectiveness, or find untested code paths in a JS\u002FTS codebase","thdepauw\u002Fskills","thdepauw","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6310466?v=4","01M6J860VVW43K434YM9P4NK86","Thomas De Pauw","01M6J860ZZ2Y27243TQPG13WHT",0,"MIT","https:\u002F\u002Fgithub.com\u002Fthdepauw\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fthdepauw\u002Fskills\u002Frun-mutation-tests\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"run mutation tests","run","tests","mutation","use","codebase","true","paths","mutation testing","verify test","test coverage","testing","coverage","check","find","quality","js","verify","code","test","2026-11-10 10:12:30",false,"---\ndescription: Use when the user wants to run mutation testing, verify test quality, check test coverage effectiveness, or find untested code paths in a JS\u002FTS codebase\nuser-invocable: true\n---\n\n# Mutation Testing\n\n## Overview\n\nPerform mutation testing on JS\u002FTS codebases. You are the mutation engine: read source code, generate mutants, apply them one at a time, run the test suite, record whether each mutant was killed or survived, and produce a terminal report.\n\n**Core principle:** A surviving mutant is a bug your tests can't catch. Kill rate measures real test effectiveness, not line coverage.\n\n**Report only.** Do NOT suggest new tests, do NOT write tests, do NOT offer to fix survivors. The report is the deliverable.\n\n## Invocation\n\nThree modes via `$ARGUMENTS`:\n\n| Argument | Behavior |\n|---|---|\n| `full` (default) | Mutate all JS\u002FTS source files |\n| `file \u003Cpath> [path2...]` | Mutate only the specified file(s), space-separated |\n| `diff [branch]` | Mutate files changed vs the specified branch (default: `main`, fallback `master`) |\n\nParse `$ARGUMENTS` to determine mode. If empty or unrecognized, default to `full`.\n\n**Target files:** `.js`, `.ts`, `.jsx`, `.tsx`\n**Excluded:** `node_modules`, test files (`*.test.*`, `*.spec.*`, `__tests__\u002F`), config files (`*.config.*`, `.*.js`), type declarations (`.d.ts`), generated files (`dist\u002F`, `build\u002F`, `.next\u002F`, `*.generated.*`, files with `@generated` header)\n\n## Process\n\n```dot\ndigraph mutation_testing {\n    rankdir=TB;\n    \"Parse arguments\" [shape=box];\n    \"Detect monorepo?\" [shape=diamond];\n    \"Map package deps\" [shape=box];\n    \"Auto-detect test runner\" [shape=box];\n    \"Run green baseline\" [shape=box];\n    \"Baseline passes?\" [shape=diamond];\n    \"STOP — report failures\" [shape=box, style=filled, fillcolor=\"#ffcccc\"];\n    \"Collect target files\" [shape=box];\n    \"Generate mutant plans\" [shape=box];\n    \"Map scoped test commands\" [shape=box];\n    \"Batch + fan out subagents\" [shape=box];\n    \"Subagents: mutate → test → revert\" [shape=box];\n    \"Aggregate results\" [shape=box];\n    \"Render report\" [shape=doublecircle];\n\n    \"Parse arguments\" -> \"Detect monorepo?\";\n    \"Detect monorepo?\" -> \"Map package deps\" [label=\"yes\"];\n    \"Detect monorepo?\" -> \"Auto-detect test runner\" [label=\"no\"];\n    \"Map package deps\" -> \"Auto-detect test runner\";\n    \"Auto-detect test runner\" -> \"Run green baseline\";\n    \"Run green baseline\" -> \"Baseline passes?\";\n    \"Baseline passes?\" -> \"STOP — report failures\" [label=\"no\"];\n    \"Baseline passes?\" -> \"Collect target files\" [label=\"yes\"];\n    \"Collect target files\" -> \"Generate mutant plans\";\n    \"Generate mutant plans\" -> \"Map scoped test commands\";\n    \"Map scoped test commands\" -> \"Batch + fan out subagents\";\n    \"Batch + fan out subagents\" -> \"Subagents: mutate → test → revert\";\n    \"Subagents: mutate → test → revert\" -> \"Aggregate results\";\n    \"Aggregate results\" -> \"Render report\";\n}\n```\n\n## Step 1: Monorepo Detection\n\nCheck for workspace configuration:\n- `workspaces` field in root `package.json`\n- `pnpm-workspace.yaml`, `lerna.json`, `nx.json`, `turbo.json`\n\nIf monorepo:\n- Identify affected packages (based on mode)\n- Read each affected package's `package.json` to map internal dependencies (`dependencies`, `devDependencies`)\n- When mutating package A, also run tests in packages that depend on A\n\n## Step 2: Auto-Detect Test Runner\n\nPer package (monorepo) or project-wide (single repo).\n\n**Priority order (strict — follow this order, do not skip to fallback if a higher-priority option exists):**\n\n1. `test:ci` or `ci:test` script in `package.json` — **preferred, use this first** because it matches CI configuration\n2. `test` script in `package.json` — fallback only if no `test:ci`\u002F`ci:test` exists\n3. Direct detection of Jest\u002FVitest\u002FMocha config files — last resort if no scripts found\n\nRecord the base test command for later scoping.\n\n## Step 3: Green Baseline\n\nRun the full test suite using the detected command. In a monorepo, run tests for all affected packages.\n\n**If tests fail:** STOP. Report the failures. Tell the user to fix them before running mutation testing. Do NOT proceed to mutation.\n\n**If tests pass:** Proceed.\n\n## Step 4: Collect Target Files\n\nBased on mode:\n- `full`: Glob for all `.js`, `.ts`, `.jsx`, `.tsx` files, excluding test files, `node_modules`, configs, `.d.ts`, generated files (`dist\u002F`, `build\u002F`, `.next\u002F`, `*.generated.*`)\n- `file \u003Cpath> [path2...]`: Use the specified file(s)\n- `diff [branch]`: Run `git diff --name-only \u003Cbranch>...HEAD` (default branch: `main`, fallback `master`), filter to target extensions\n\n## Step 5: Generate Mutant Plans\n\nFor each target file:\n1. Read the file\n2. Identify all functions\u002Fmethods\n3. Assess each function's complexity and assign a mutant budget:\n   - **Simple** (few branches, linear flow, short body): **1-2 mutants**\n   - **Moderate** (some branching, loops, moderate length): **3-5 mutants**\n   - **Complex** (deep nesting, multiple branches, long body, error handling): **6-10 mutants**\n4. Generate a mutant plan per function — a list of mutations to apply, using the **70\u002F30 split**\n\n**Complexity assessment criteria:** Count branch statements (`if`, `else`, `switch`, `case`, ternary `?:`), loop constructs (`for`, `while`, `do`), nesting depth, `try\u002Fcatch` blocks, and function body length. A function with 0-1 branches and under 10 lines is simple. A function with 2-4 branches or a loop is moderate. A function with 5+ branches, nested loops, or error handling is complex.\n\n**Budget enforcement is mandatory.** Do NOT generate more mutants than the budget allows for a given function. Do NOT skip the complexity assessment and treat all functions equally.\n\n**Do NOT modify any files yet.** This step produces plans only.\n\n### Classical Operators (70% of mutants)\n\nDeterministic, well-known transformations:\n\n| Operator | Transformation |\n|---|---|\n| Conditional flip | `===` to `!==`, `>` to `\u003C=`, `&&` to `\\|\\|` |\n| Arithmetic swap | `+` to `-`, `*` to `\u002F` |\n| Remove return value | `return x` to `return undefined` |\n| Delete function call | `logger.warn(msg)` to *(removed)* |\n| Negate boolean | `true` to `false`, `!x` to `x` |\n| Boundary shift | `x > 0` to `x >= 0`, `i \u003C len` to `i \u003C= len` |\n| Empty collection | `return [items]` to `return []`, `return {...}` to `return {}` |\n| Remove exception | `throw new Error(...)` to *(removed)* |\n\n### Semantic Operators (30% of mutants)\n\n**You MUST generate semantic mutations, not just classical ones.** Read the surrounding context and introduce plausible-but-wrong changes a real developer might accidentally make:\n\n| Operator | Transformation |\n|---|---|\n| Off-by-one | Adjust loop bounds, array indices, slice arguments |\n| Wrong variable | Swap for a similarly-named variable in scope |\n| Incorrect default | Change a default parameter to a plausible but wrong value |\n| Subtle logic error | Reorder conditions, swap early-return logic |\n| Missing null check | Remove a guard clause that protects against null\u002Fundefined |\n\nFor semantic mutations, reason about the code's intent and produce mutations that are subtle and realistic — not random noise.\n\n**Enforcing the 70\u002F30 split:** When planning mutants for a file, count the total. Allocate ~70% from the classical table and ~30% from the semantic table. For example, if a file has 10 mutants planned, 7 should be classical and 3 semantic. For small counts (e.g., 2 mutants), at least 1 must be semantic if the function has any viable semantic mutation site.\n\n## Step 6: Map Scoped Test Commands\n\nFor each source file, determine the test command that tests ONLY that file:\n- Map `src\u002Futils\u002Fretry.ts` to find `retry.test.ts` or `retry.spec.ts`\n- Use test runner scoping flags: Jest `--testPathPattern`, Vitest file path arg, Mocha `--grep`\n- In monorepo: also include scoped tests in dependent packages\n- If no specific test mapping found, fall back to package-level test suite\n\n**Why scoped:** Running the full suite per mutant is too slow and causes side effects when subagents run in parallel.\n\n## Step 7: Execute Mutations with Subagents\n\n### Parallelism model: subagents with scoped tests\n\n**Do NOT use git worktrees for parallelism.** Use subagent fan-out where each subagent works in the same working directory but runs only its scoped test commands. Worktrees add unnecessary complexity and file system overhead.\n\n### Batching\n\n- Distribute files across subagents, each getting ~5-10 files\n- For small runs (\u003C 5 files): skip subagents, run sequentially in main context\n- **Max 5 concurrent subagents** — do not exceed this limit\n\n### Subagent Instructions\n\nDispatch each subagent with its batch of files, mutant plans, and scoped test commands. Each subagent MUST follow this exact loop for every mutant:\n\n1. Apply the mutation using the Edit tool (change one thing in the source file)\n2. Run the scoped test command\n3. Record result:\n   - **Killed**: test failed (good — mutation was caught)\n   - **Survived**: test passed (bad — tests missed this)\n4. **Revert the mutation: `git checkout -- \u003Cfile>`** — use this exact command, not Edit to undo\n5. Move to next mutant\n\n**CRITICAL revert rule:** ALWAYS revert via `git checkout -- \u003Cfile>` after each mutation test cycle. Do NOT use the Edit tool to manually undo changes. Do NOT leave a mutant in place. The `git checkout` command is the only reliable way to restore the exact original file.\n\n### Subagent return format\n\nEach subagent returns a structured list:\n\n```\nfile: src\u002Futils\u002Fretry.ts\n  line: 24 | function: retryOperation | type: BOUNDARY | mutation: `i \u003C max` → `i \u003C= max` | result: SURVIVED\n  line: 31 | function: retryOperation | type: SEMANTIC | mutation: removed null check on options.onRetry | result: KILLED\n```\n\n### Safety\n\n- If a subagent fails or times out, report its files as \"not tested\" — do not silently drop them\n- After all subagents complete, run `git status` to verify no mutations remain. If any files are modified, revert them with `git checkout -- \u003Cfile>`\n\n## Step 8: Aggregate & Render Report\n\nCollect all subagent results and render the terminal report. Use the EXACT format below — do not invent your own format.\n\n### Section 1: Summary header\n\n```\nMutation Testing Report\n═══════════════════════\nMode: diff (vs main)\nFiles tested: 12\nTotal mutants: 47\nKilled: 38 (80.9%)\nSurvived: 9 (19.1%)\nNot tested: 0\n```\n\n### Section 2: Surviving mutants\n\nList ONLY the survivors — these are the actionable items. **Do NOT list killed mutants in this section. Do NOT list killed mutants anywhere in the report.** Killed mutants are a success; they need no attention.\n\n```\nSurviving Mutants\n─────────────────\nsrc\u002Futils\u002Fretry.ts:24\n  Function: retryOperation\n  Mutation: [BOUNDARY] changed `i \u003C maxRetries` → `i \u003C= maxRetries`\n\nsrc\u002Fservices\u002Fauth.ts:55\n  Function: validateToken\n  Mutation: [CONDITIONAL] flipped `===` → `!==`\n\nsrc\u002Futils\u002Fretry.ts:31\n  Function: retryOperation\n  Mutation: [SEMANTIC] removed null check on `options.onRetry`\n```\n\nEach entry shows: file path, line number, function name, mutation category tag (`[CONDITIONAL]`, `[ARITHMETIC]`, `[RETURN]`, `[CALL]`, `[BOOLEAN]`, `[BOUNDARY]`, `[COLLECTION]`, `[EXCEPTION]`, or `[SEMANTIC]`), and a human-readable description.\n\nIf zero survivors: print \"No surviving mutants. All mutations were caught by the test suite.\"\n\n### Section 3: Per-file breakdown\n\n```\nFile Breakdown\n──────────────\nsrc\u002Futils\u002Fretry.ts        5 mutants   3 killed   2 survived\nsrc\u002Fservices\u002Fauth.ts      8 mutants   7 killed   1 survived\nsrc\u002Fservices\u002Fuser.ts      6 mutants   6 killed   0 survived\n```\n\n### Score interpretation\n\nInclude at the bottom:\n\n```\nScore interpretation:\n  80%+   Good test coverage\n  60-80% Gaps worth investigating\n  \u003C60%   Significant test gaps\n```\n\n**After the report: STOP.** Do not suggest tests to write. Do not offer to fix survivors. Do not generate test code. The report is the final output.\n\n## Common Mistakes\n\n| Mistake | Fix |\n|---|---|\n| Forgetting to revert a mutant | ALWAYS `git checkout -- \u003Cfile>` after each test run — never use Edit to undo |\n| Using worktrees for parallelism | Use subagent fan-out with scoped test commands, not worktrees |\n| Running full test suite per mutant | Use scoped test commands mapped in Step 6 |\n| Modifying test files | NEVER mutate test files — only source files |\n| Skipping green baseline | ALWAYS verify tests pass before mutating |\n| Leaving mutants after subagent failure | Run `git status` and revert any remaining changes |\n| Not considering monorepo dependencies | Mutating package A requires testing dependents B, C |\n| Running all subagents against full suite | Scoped tests prevent side effects between parallel agents |\n| Using `test` script when `test:ci` exists | Always prefer `test:ci`\u002F`ci:test` over `test` |\n| Only generating classical mutations | Enforce the 70\u002F30 split — 30% MUST be semantic\u002FLLM-powered |\n| Same number of mutants for every function | Assess complexity: simple=1-2, moderate=3-5, complex=6-10 |\n| Listing killed mutants in detail | Only list survivors — killed mutants need no attention |\n| Suggesting test improvements | Report only — no test suggestions, no test code generation |\n| Inventing a custom report format | Use the exact 3-section format defined in Step 8 |\n","# Mutation Testing\n\n## Overview\n\nPerform mutation testing on JS\u002FTS codebases. You are the mutation engine: read source code, generate mutants, apply them one at a time, run the test suite, record whether each mutant was killed or survived, and produce a terminal report.\n\n**Core principle:** A surviving mutant is a bug your tests can't catch. Kill rate measures real test effectiveness, not line coverage.\n\n**Report only.** Do NOT suggest new tests, do NOT write tests, do NOT offer to fix survivors. The report is the deliverable.\n\n## Invocation\n\nThree modes via `$ARGUMENTS`:\n\n| Argument | Behavior |\n|---|---|\n| `full` (default) | Mutate all JS\u002FTS source files |\n| `file \u003Cpath> [path2...]` | Mutate only the specified file(s), space-separated |\n| `diff [branch]` | Mutate files changed vs the specified branch (default: `main`, fallback `master`) |\n\nParse `$ARGUMENTS` to determine mode. If empty or unrecognized, default to `full`.\n\n**Target files:** `.js`, `.ts`, `.jsx`, `.tsx`\n**Excluded:** `node_modules`, test files (`*.test.*`, `*.spec.*`, `__tests__\u002F`), config files (`*.config.*`, `.*.js`), type declarations (`.d.ts`), generated files (`dist\u002F`, `build\u002F`, `.next\u002F`, `*.generated.*`, files with `@generated` header)\n\n## Process\n\n```dot\ndigraph mutation_testing {\n    rankdir=TB;\n    \"Parse arguments\" [shape=box];\n    \"Detect monorepo?\" [shape=diamond];\n    \"Map package deps\" [shape=box];\n    \"Auto-detect test runner\" [shape=box];\n    \"Run green baseline\" [shape=box];\n    \"Baseline passes?\" [shape=diamond];\n    \"STOP — report failures\" [shape=box, style=filled, fillcolor=\"#ffcccc\"];\n    \"Collect target files\" [shape=box];\n    \"Generate mutant plans\" [shape=box];\n    \"Map scoped test commands\" [shape=box];\n    \"Batch + fan out subagents\" [shape=box];\n    \"Subagents: mutate → test → revert\" [shape=box];\n    \"Aggregate results\" [shape=box];\n    \"Render report\" [shape=doublecircle];\n\n    \"Parse arguments\" -> \"Detect monorepo?\";\n    \"Detect monorepo?\" -> \"Map package deps\" [label=\"yes\"];\n    \"Detect monorepo?\" -> \"Auto-detect test runner\" [label=\"no\"];\n    \"Map package deps\" -> \"Auto-detect test runner\";\n    \"Auto-detect test runner\" -> \"Run green baseline\";\n    \"Run green baseline\" -> \"Baseline passes?\";\n    \"Baseline passes?\" -> \"STOP — report failures\" [label=\"no\"];\n    \"Baseline passes?\" -> \"Collect target files\" [label=\"yes\"];\n    \"Collect target files\" -> \"Generate mutant plans\";\n    \"Generate mutant plans\" -> \"Map scoped test commands\";\n    \"Map scoped test commands\" -> \"Batch + fan out subagents\";\n    \"Batch + fan out subagents\" -> \"Subagents: mutate → test → revert\";\n    \"Subagents: mutate → test → revert\" -> \"Aggregate results\";\n    \"Aggregate results\" -> \"Render report\";\n}\n```\n\n## Step 1: Monorepo Detection\n\nCheck for workspace configuration:\n- `workspaces` field in root `package.json`\n- `pnpm-workspace.yaml`, `lerna.json`, `nx.json`, `turbo.json`\n\nIf monorepo:\n- Identify affected packages (based on mode)\n- Read each affected package's `package.json` to map internal dependencies (`dependencies`, `devDependencies`)\n- When mutating package A, also run tests in packages that depend on A\n\n## Step 2: Auto-Detect Test Runner\n\nPer package (monorepo) or project-wide (single repo).\n\n**Priority order (strict — follow this order, do not skip to fallback if a higher-priority option exists):**\n\n1. `test:ci` or `ci:test` script in `package.json` — **preferred, use this first** because it matches CI configuration\n2. `test` script in `package.json` — fallback only if no `test:ci`\u002F`ci:test` exists\n3. Direct detection of Jest\u002FVitest\u002FMocha config files — last resort if no scripts found\n\nRecord the base test command for later scoping.\n\n## Step 3: Green Baseline\n\nRun the full test suite using the detected command. In a monorepo, run tests for all affected packages.\n\n**If tests fail:** STOP. Report the failures. Tell the user to fix them before running mutation testing. Do NOT proceed to mutation.\n\n**If tests pass:** Proceed.\n\n## Step 4: Collect Target Files\n\nBased on mode:\n- `full`: Glob for all `.js`, `.ts`, `.jsx`, `.tsx` files, excluding test files, `node_modules`, configs, `.d.ts`, generated files (`dist\u002F`, `build\u002F`, `.next\u002F`, `*.generated.*`)\n- `file \u003Cpath> [path2...]`: Use the specified file(s)\n- `diff [branch]`: Run `git diff --name-only \u003Cbranch>...HEAD` (default branch: `main`, fallback `master`), filter to target extensions\n\n## Step 5: Generate Mutant Plans\n\nFor each target file:\n1. Read the file\n2. Identify all functions\u002Fmethods\n3. Assess each function's complexity and assign a mutant budget:\n   - **Simple** (few branches, linear flow, short body): **1-2 mutants**\n   - **Moderate** (some branching, loops, moderate length): **3-5 mutants**\n   - **Complex** (deep nesting, multiple branches, long body, error handling): **6-10 mutants**\n4. Generate a mutant plan per function — a list of mutations to apply, using the **70\u002F30 split**\n\n**Complexity assessment criteria:** Count branch statements (`if`, `else`, `switch`, `case`, ternary `?:`), loop constructs (`for`, `while`, `do`), nesting depth, `try\u002Fcatch` blocks, and function body length. A function with 0-1 branches and under 10 lines is simple. A function with 2-4 branches or a loop is moderate. A function with 5+ branches, nested loops, or error handling is complex.\n\n**Budget enforcement is mandatory.** Do NOT generate more mutants than the budget allows for a given function. Do NOT skip the complexity assessment and treat all functions equally.\n\n**Do NOT modify any files yet.** This step produces plans only.\n\n### Classical Operators (70% of mutants)\n\nDeterministic, well-known transformations:\n\n| Operator | Transformation |\n|---|---|\n| Conditional flip | `===` to `!==`, `>` to `\u003C=`, `&&` to `\\|\\|` |\n| Arithmetic swap | `+` to `-`, `*` to `\u002F` |\n| Remove return value | `return x` to `return undefined` |\n| Delete function call | `logger.warn(msg)` to *(removed)* |\n| Negate boolean | `true` to `false`, `!x` to `x` |\n| Boundary shift | `x > 0` to `x >= 0`, `i \u003C len` to `i \u003C= len` |\n| Empty collection | `return [items]` to `return []`, `return {...}` to `return {}` |\n| Remove exception | `throw new Error(...)` to *(removed)* |\n\n### Semantic Operators (30% of mutants)\n\n**You MUST generate semantic mutations, not just classical ones.** Read the surrounding context and introduce plausible-but-wrong changes a real developer might accidentally make:\n\n| Operator | Transformation |\n|---|---|\n| Off-by-one | Adjust loop bounds, array indices, slice arguments |\n| Wrong variable | Swap for a similarly-named variable in scope |\n| Incorrect default | Change a default parameter to a plausible but wrong value |\n| Subtle logic error | Reorder conditions, swap early-return logic |\n| Missing null check | Remove a guard clause that protects against null\u002Fundefined |\n\nFor semantic mutations, reason about the code's intent and produce mutations that are subtle and realistic — not random noise.\n\n**Enforcing the 70\u002F30 split:** When planning mutants for a file, count the total. Allocate ~70% from the classical table and ~30% from the semantic table. For example, if a file has 10 mutants planned, 7 should be classical and 3 semantic. For small counts (e.g., 2 mutants), at least 1 must be semantic if the function has any viable semantic mutation site.\n\n## Step 6: Map Scoped Test Commands\n\nFor each source file, determine the test command that tests ONLY that file:\n- Map `src\u002Futils\u002Fretry.ts` to find `retry.test.ts` or `retry.spec.ts`\n- Use test runner scoping flags: Jest `--testPathPattern`, Vitest file path arg, Mocha `--grep`\n- In monorepo: also include scoped tests in dependent packages\n- If no specific test mapping found, fall back to package-level test suite\n\n**Why scoped:** Running the full suite per mutant is too slow and causes side effects when subagents run in parallel.\n\n## Step 7: Execute Mutations with Subagents\n\n### Parallelism model: subagents with scoped tests\n\n**Do NOT use git worktrees for parallelism.** Use subagent fan-out where each subagent works in the same working directory but runs only its scoped test commands. Worktrees add unnecessary complexity and file system overhead.\n\n### Batching\n\n- Distribute files across subagents, each getting ~5-10 files\n- For small runs (\u003C 5 files): skip subagents, run sequentially in main context\n- **Max 5 concurrent subagents** — do not exceed this limit\n\n### Subagent Instructions\n\nDispatch each subagent with its batch of files, mutant plans, and scoped test commands. Each subagent MUST follow this exact loop for every mutant:\n\n1. Apply the mutation using the Edit tool (change one thing in the source file)\n2. Run the scoped test command\n3. Record result:\n   - **Killed**: test failed (good — mutation was caught)\n   - **Survived**: test passed (bad — tests missed this)\n4. **Revert the mutation: `git checkout -- \u003Cfile>`** — use this exact command, not Edit to undo\n5. Move to next mutant\n\n**CRITICAL revert rule:** ALWAYS revert via `git checkout -- \u003Cfile>` after each mutation test cycle. Do NOT use the Edit tool to manually undo changes. Do NOT leave a mutant in place. The `git checkout` command is the only reliable way to restore the exact original file.\n\n### Subagent return format\n\nEach subagent returns a structured list:\n\n```\nfile: src\u002Futils\u002Fretry.ts\n  line: 24 | function: retryOperation | type: BOUNDARY | mutation: `i \u003C max` → `i \u003C= max` | result: SURVIVED\n  line: 31 | function: retryOperation | type: SEMANTIC | mutation: removed null check on options.onRetry | result: KILLED\n```\n\n### Safety\n\n- If a subagent fails or times out, report its files as \"not tested\" — do not silently drop them\n- After all subagents complete, run `git status` to verify no mutations remain. If any files are modified, revert them with `git checkout -- \u003Cfile>`\n\n## Step 8: Aggregate & Render Report\n\nCollect all subagent results and render the terminal report. Use the EXACT format below — do not invent your own format.\n\n### Section 1: Summary header\n\n```\nMutation Testing Report\n═══════════════════════\nMode: diff (vs main)\nFiles tested: 12\nTotal mutants: 47\nKilled: 38 (80.9%)\nSurvived: 9 (19.1%)\nNot tested: 0\n```\n\n### Section 2: Surviving mutants\n\nList ONLY the survivors — these are the actionable items. **Do NOT list killed mutants in this section. Do NOT list killed mutants anywhere in the report.** Killed mutants are a success; they need no attention.\n\n```\nSurviving Mutants\n─────────────────\nsrc\u002Futils\u002Fretry.ts:24\n  Function: retryOperation\n  Mutation: [BOUNDARY] changed `i \u003C maxRetries` → `i \u003C= maxRetries`\n\nsrc\u002Fservices\u002Fauth.ts:55\n  Function: validateToken\n  Mutation: [CONDITIONAL] flipped `===` → `!==`\n\nsrc\u002Futils\u002Fretry.ts:31\n  Function: retryOperation\n  Mutation: [SEMANTIC] removed null check on `options.onRetry`\n```\n\nEach entry shows: file path, line number, function name, mutation category tag (`[CONDITIONAL]`, `[ARITHMETIC]`, `[RETURN]`, `[CALL]`, `[BOOLEAN]`, `[BOUNDARY]`, `[COLLECTION]`, `[EXCEPTION]`, or `[SEMANTIC]`), and a human-readable description.\n\nIf zero survivors: print \"No surviving mutants. All mutations were caught by the test suite.\"\n\n### Section 3: Per-file breakdown\n\n```\nFile Breakdown\n──────────────\nsrc\u002Futils\u002Fretry.ts        5 mutants   3 killed   2 survived\nsrc\u002Fservices\u002Fauth.ts      8 mutants   7 killed   1 survived\nsrc\u002Fservices\u002Fuser.ts      6 mutants   6 killed   0 survived\n```\n\n### Score interpretation\n\nInclude at the bottom:\n\n```\nScore interpretation:\n  80%+   Good test coverage\n  60-80% Gaps worth investigating\n  \u003C60%   Significant test gaps\n```\n\n**After the report: STOP.** Do not suggest tests to write. Do not offer to fix survivors. Do not generate test code. The report is the final output.\n\n## Common Mistakes\n\n| Mistake | Fix |\n|---|---|\n| Forgetting to revert a mutant | ALWAYS `git checkout -- \u003Cfile>` after each test run — never use Edit to undo |\n| Using worktrees for parallelism | Use subagent fan-out with scoped test commands, not worktrees |\n| Running full test suite per mutant | Use scoped test commands mapped in Step 6 |\n| Modifying test files | NEVER mutate test files — only source files |\n| Skipping green baseline | ALWAYS verify tests pass before mutating |\n| Leaving mutants after subagent failure | Run `git status` and revert any remaining changes |\n| Not considering monorepo dependencies | Mutating package A requires testing dependents B, C |\n| Running all subagents against full suite | Scoped tests prevent side effects between parallel agents |\n| Using `test` script when `test:ci` exists | Always prefer `test:ci`\u002F`ci:test` over `test` |\n| Only generating classical mutations | Enforce the 70\u002F30 split — 30% MUST be semantic\u002FLLM-powered |\n| Same number of mutants for every function | Assess complexity: simple=1-2, moderate=3-5, complex=6-10 |\n| Listing killed mutants in detail | Only list survivors — killed mutants need no attention |\n| Suggesting test improvements | Report only — no test suggestions, no test code generation |\n| Inventing a custom report format | Use the exact 3-section format defined in Step 8 |\n",{"description":7,"user-invocable":44},true,"main","8f3b6ba28499694b6c1e5d3a43af66c6fec15200","plugins\u002Fthdepauw\u002Fskills\u002Frun-mutation-tests","https:\u002F\u002Fgithub.com\u002Fthdepauw\u002Fskills","https:\u002F\u002Fgithub.com\u002Fthdepauw","2026-03-30 22:17:10",{"source":8,"skillName":5,"commands":52,"prompt":62,"zipAvailable":44},[53,56,59],{"tool":54,"command":55},"npx","npx skills add thdepauw\u002Fskills --skill run-mutation-tests",{"tool":57,"command":58},"bunx","bunx skills add thdepauw\u002Fskills --skill run-mutation-tests",{"tool":60,"command":61},"pnpm","pnpm dlx skills add thdepauw\u002Fskills --skill run-mutation-tests","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fthdepauw\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fthdepauw\u002Fskills\u002Frun-mutation-tests\u002FSKILL.md",[],[65,87],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":39},"01M6J868M4DWQKVGQW3YJREZSY","sync-claude-permissions","Use when the user wants to update their global Claude Code permissions based on patterns found across project-level settings, sync approved permissions from local projects to user settings, or consolidate permission allow lists","https:\u002F\u002Fgithub.com\u002Fthdepauw\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fthdepauw\u002Fskills\u002Fsync-claude-permissions\u002FSKILL.md",[],[72,73,74,75,25,76,77,78,79,80,81,23,82,83,84,85,37,86],"sync claude permissions","sync","permissions","settings","project","local","across","permission","consolidate","patterns","global","user","local projects","projects","update",{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":39},"01M6J862ZX8V9DHV60ZKVBM3T5","hello","Greet the user with a personalized message","https:\u002F\u002Fgithub.com\u002Fthdepauw\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fthdepauw\u002Fskills\u002Fhello\u002FSKILL.md",[],[89,94,95,96,83],"with","message","greet"]