[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6CAQFA3T7JVS6TCP968M873":3,"skill-same:01M6CAQFA3T7JVS6TCP968M873":106},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":48,"linkOnly":49,"markdownContent":50,"markdownBody":51,"frontMatter":52,"refName":57,"commitSha":58,"skillDirectory":59,"forksCount":60,"repositoryHtmlUrl":61,"repositoryHomepageUrl":62,"ownerHtmlUrl":63,"ownerBlogUrl":64,"ownerDescription":65,"updatedAt":66,"install":67,"resources":80},"01M6CAQFA3T7JVS6TCP968M873","mutation-test","变异测试质量验证","Run mutation testing to validate test quality beyond code coverage. Use when assessing test effectiveness, finding weak tests, or validating test suite quality.","运行变异测试，以在代码覆盖率之外验证测试质量。适用于评估测试有效性、发现薄弱测试或验证测试套件质量。","jmagly\u002Faiwg","jmagly","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1159087?v=4","01M6C10AK8N2WCSQN11FYGTJWN","Joseph Magly","01M6C10AQ8A2RMED1Y1BSVY7NF",229,"MIT",null,"https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Ftesting-quality\u002Fskills\u002Fmutation-test\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD5WG86P4AQ5GPSSKBFR","测试工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],"test","mutation","mutation test","run","code","quality","coverage","use","validate","test suite","mutation testing","testing","code coverage","tests","suite","test quality","when","2026-11-10 10:12:30",false,"---\nnamespace: aiwg\nname: mutation-test\ndescription: Run mutation testing to validate test quality beyond code coverage. Use when assessing test effectiveness, finding weak tests, or validating test suite quality.\nversion: 1.1.0\nplatforms: [all]\n\n---\n\n# Mutation Test Skill\n\n## Purpose\n\nRun mutation testing to measure test suite effectiveness. Mutation testing introduces small changes (mutants) to code and checks if tests catch them. High coverage with low mutation score indicates weak tests.\n\n## Research Foundation\n\n| Concept | Source | Reference |\n|---------|--------|-----------|\n| Mutation Testing Theory | IEEE TSE (2019) | Papadakis et al. \"Mutation Testing Advances\" |\n| ICST Mutation Workshop | IEEE Annual | [Mutation 2024](https:\u002F\u002Fconf.researchr.org\u002Fhome\u002Ficst-2024\u002Fmutation-2024) |\n| Stryker Mutator | Industry Tool | [stryker-mutator.io](https:\u002F\u002Fstryker-mutator.io\u002F) |\n| PITest | Java Tool | [pitest.org](https:\u002F\u002Fpitest.org\u002F) |\n| mutmut | Python Tool | [github.com\u002Fboxed\u002Fmutmut](https:\u002F\u002Fgithub.com\u002Fboxed\u002Fmutmut) |\n\n## When This Skill Applies\n\n- User asks to \"validate test quality\" or \"check test effectiveness\"\n- User mentions \"mutation testing\" or \"mutation score\"\n- User wants to know if tests are \"actually testing anything\"\n- High coverage but bugs still escaping\n- Assessing test suite health\n- Pre-release quality validation\n\n## Trigger Phrases\n\n| Natural Language | Action |\n|------------------|--------|\n| \"Run mutation testing\" | Execute mutation analysis |\n| \"Check if my tests are effective\" | Run mutation + analyze |\n| \"Validate test quality\" | Mutation score report |\n| \"Are my tests catching real bugs?\" | Mutation analysis |\n| \"Find weak tests\" | Identify low-score tests |\n| \"Why did this bug escape tests?\" | Mutation analysis on module |\n\n## Mutation Testing Concepts\n\n### What is a Mutant?\n\nA mutant is a small code change that should cause tests to fail:\n\n```javascript\n\u002F\u002F Original\nif (age >= 18) { return \"adult\"; }\n\n\u002F\u002F Mutant 1: Changed >= to >\nif (age > 18) { return \"adult\"; }\n\n\u002F\u002F Mutant 2: Changed >= to ==\nif (age == 18) { return \"adult\"; }\n\n\u002F\u002F Mutant 3: Changed \"adult\" to \"\"\nif (age >= 18) { return \"\"; }\n```\n\n### Mutation Operators\n\n| Operator | Example | Tests |\n|----------|---------|-------|\n| Arithmetic | `+` → `-` | Math operations |\n| Relational | `>=` → `>` | Boundary conditions |\n| Logical | `&&` → `\\|\\|` | Boolean logic |\n| Literal | `true` → `false` | Constant handling |\n| Return | `return x` → `return null` | Return value handling |\n\n### Mutation Score\n\n```\nMutation Score = (Killed Mutants \u002F Total Mutants) × 100\n```\n\n| Score | Quality | Interpretation |\n|-------|---------|----------------|\n| 90%+ | Excellent | Tests are highly effective |\n| 80-89% | Good | Target for production |\n| 60-79% | Adequate | Room for improvement |\n| \u003C60% | Poor | Tests need significant work |\n\n## Implementation Process\n\n### 1. Detect Project and Resolve Tool\n\n```python\ndef mutation_tool(project_type):\n    if project_type == \"javascript\":\n        return \"stryker\"\n    elif project_type == \"python\":\n        return \"mutmut\"\n    elif project_type == \"java\":\n        return \"pitest\"\n```\n\nUse the project's existing lockfile or approved dependency workflow. Record the\nresolved tool and version in the evidence; do not install an unpinned tool as an\nimplicit side effect of this skill.\n\n### 2. Configure Mutation Testing\n\n**Stryker (JavaScript)**:\n```json\n\u002F\u002F stryker.config.json\n{\n  \"mutate\": [\"src\u002F**\u002F*.ts\", \"!src\u002F**\u002F*.test.ts\"],\n  \"testRunner\": \"vitest\",\n  \"reporters\": [\"html\", \"progress\"],\n  \"coverageAnalysis\": \"perTest\",\n  \"thresholds\": {\n    \"high\": 80,\n    \"low\": 60,\n    \"break\": 50\n  }\n}\n```\n\n**mutmut 3 (Python)**:\n```toml\n# pyproject.toml\n[tool.mutmut]\nsource_paths = [\"src\u002Fpackage\u002F\"]\nonly_mutate = [\"src\u002Fpackage\u002Fcritical_contract.py\"]\npytest_add_cli_args = [\"--no-cov\", \"-q\"]\npytest_add_cli_args_test_selection = [\"tests\u002Ftest_critical_contract.py\"]\nmutate_only_covered_lines = true\n```\n\nKeep both `only_mutate` and the selected tests explicit. A directory-wide\nfallback is not an acceptable substitute for a target that was selected to fit\nthe runtime budget.\n\n**PITest (Java)**:\n```xml\n\u003C!-- pom.xml -->\n\u003Cplugin>\n    \u003CgroupId>org.pitest\u003C\u002FgroupId>\n    \u003CartifactId>pitest-maven\u003C\u002FartifactId>\n    \u003Cversion>1.15.0\u003C\u002Fversion>\n    \u003Cconfiguration>\n        \u003CtargetClasses>\n            \u003Cparam>com.example.*\u003C\u002Fparam>\n        \u003C\u002FtargetClasses>\n        \u003CmutationThreshold>80\u003C\u002FmutationThreshold>\n    \u003C\u002Fconfiguration>\n\u003C\u002Fplugin>\n```\n\n### 3. Preflight Python Native Extensions\n\nmutmut 3's covered-line mode runs coverage and stats in the same parent Python\nprocess. Its coverage phase snapshots `sys.modules`, runs the selected tests,\nthen unloads every newly imported module. A later stats pass can re-import a\nnative extension that cannot safely be initialized twice. This is an upstream\nmutmut boundary, not a killed\u002Fsurvived mutant and not evidence that the project\ntests failed. See [mutmut #528](https:\u002F\u002Fgithub.com\u002Fboxed\u002Fmutmut\u002Fissues\u002F528).\n\nBefore any Python run with `mutate_only_covered_lines = true`, execute the\nselected tests through the bundled subprocess probe:\n\n```bash\npython scripts\u002Fnative_extension_preflight.py \\\n  --test-selection tests\u002Ftest_critical_contract.py \\\n  --pytest-arg=--no-cov \\\n  --pytest-arg=-q \\\n  --mutation-target src\u002Fpackage\u002Fcritical_contract.py \\\n  --estimated-mutants 120 \\\n  --max-children 4 \\\n  --runtime-budget-seconds 900 \\\n  --format json\n```\n\nThe probe runs the test selection in a disposable subprocess and records native\nmodules imported after its pytest plugin loads. It never unloads or re-imports a\nmodule. Use `--import-file` or `--import-module` for import-only checks when a\npytest selection is not yet available.\n\n| Exit | Classification | Required action |\n|------|----------------|-----------------|\n| `0` | `preflight_safe` | Covered-line mode may proceed; preserve the report. |\n| `2` | `harness_native_extension_reload_risk` | Do not run mutmut covered-line mode. Use only an allowed bounded fallback or a project-approved subprocess-isolated tool. |\n| `3` | `project_test_or_import_failure` | Fix or clarify the direct project test\u002Fimport failure before mutation testing. |\n| `4` | `harness_preflight_timeout` | Reduce the selection or increase the explicitly approved preflight budget. |\n\nDetection is conservative. A safe result proves only that this selected run did\nnot load a native extension after the probe boundary; change the selection or\nenvironment and the preflight must be repeated.\n\n#### Bounded mutmut fallback\n\nWhen a native extension is found, the supported mutmut fallback is\n`mutate_only_covered_lines = false`, but only when the JSON report says\n`fallback.allowed: true`. The fallback gate requires all of:\n\n- one or more explicit `--mutation-target` values matching `only_mutate`;\n- an observed or tool-generated `--estimated-mutants` count (do not guess);\n- the intended `--max-children` value;\n- an explicit `--runtime-budget-seconds` value; and\n- the conservative estimate\n  `baseline_test_seconds × estimated_mutants ÷ max_children × 1.5` to fit the\n  budget.\n\nIf any bound is missing or the estimate exceeds budget, shrink the mutation\ntarget or use a project-approved mutation harness whose coverage and stats\nphases start in fresh subprocesses. Never silently widen `only_mutate` to\ncompensate for disabling covered-line selection.\n\n### 4. Run Mutation Analysis\n\n```bash\n# JavaScript\nnpx stryker run\n\n# Python, only after the preflight decision is recorded\npython -m mutmut run --max-children 4\n\n# Java\nmvn org.pitest:pitest-maven:mutationCoverage\n```\n\n### 5. Classify and Report Results\n\nKeep harness\u002Ftool failures, direct project-test failures, and mutant outcomes in\nseparate fields. For an existing mutmut log, the preflight script can classify\nknown native reload signatures:\n\n```bash\npython scripts\u002Fnative_extension_preflight.py \\\n  --classify-mutmut-log mutation-run.log \\\n  --format json\n```\n\n`Running stats` combined with `cannot load module more than once per process`,\n`module functions cannot set METH_CLASS or METH_STATIC`, or a fatal segmentation\nfault whose report lists extension modules is\n`harness_tool_failure_native_extension_reload`. It must set\n`counts_as_mutant_outcome: false`; do not compute a mutation score from that run.\n`failed to collect stats` is supporting context, not a sufficient signature by\nitself.\nOnly a direct test run that fails independently of the mutation harness is a\n`project_test_failure`. Killed, survived, timeout, and no-tests results are\nmutant outcomes only after preflight, baseline tests, stats collection, and the\nmutation harness complete successfully.\n\n```python\ndef parse_mutation_results(report_path):\n    \"\"\"Parse mutation testing report\"\"\"\n    return {\n        \"execution_mode\": \"mutmut-covered-lines-preflight-safe\",\n        \"harness_status\": \"passed\",\n        \"project_test_status\": \"passed\",\n        \"total_mutants\": 150,\n        \"killed\": 120,\n        \"survived\": 25,\n        \"timeout\": 5,\n        \"mutation_score\": 80.0,\n        \"survivors\": [\n            {\n                \"file\": \"src\u002Fauth\u002Fvalidate.ts\",\n                \"line\": 45,\n                \"mutator\": \"RelationalOperator\",\n                \"original\": \"age >= 18\",\n                \"mutant\": \"age > 18\",\n                \"status\": \"survived\"\n            }\n            # ... more survivors\n        ]\n    }\n```\n\n## Output Format\n\n```markdown\n## Mutation Testing Report\n\n**Module**: src\u002Fauth\u002F\n**Test Suite**: test\u002Fauth\u002F\n**Execution mode**: mutmut covered-line mode (native-extension preflight safe)\n**Harness status**: passed\n**Project baseline tests**: passed\n\n### Summary\n\n| Metric | Value |\n|--------|-------|\n| Total Mutants | 150 |\n| Killed | 120 (80%) |\n| Survived | 25 (17%) |\n| Timeout | 5 (3%) |\n| **Mutation Score** | **80%** |\n\n### Status: PASSED (threshold: 80%)\n\n### Survived Mutants (Highest Priority)\n\n#### 1. `src\u002Fauth\u002Fvalidate.ts:45`\n```diff\n- if (age >= 18) { return \"adult\"; }\n+ if (age > 18) { return \"adult\"; }\n```\n**Problem**: Boundary condition not tested\n**Fix**: Add test case for `age = 18`\n\n#### 2. `src\u002Fauth\u002Flogin.ts:23`\n```diff\n- if (attempts \u003C maxAttempts) { allow(); }\n+ if (attempts \u003C= maxAttempts) { allow(); }\n```\n**Problem**: Off-by-one boundary not tested\n**Fix**: Add test for `attempts = maxAttempts`\n\n### Recommended Test Improvements\n\n1. **Add boundary tests** for `validate.ts` (3 survivors)\n2. **Add error path tests** for `login.ts` (2 survivors)\n3. **Test null\u002Fundefined cases** in `session.ts` (1 survivor)\n\n### Coverage vs Mutation Score\n\n| File | Line Coverage | Mutation Score | Gap |\n|------|--------------|----------------|-----|\n| validate.ts | 95% | 72% | 23% |\n| login.ts | 88% | 85% | 3% |\n| session.ts | 100% | 91% | 9% |\n\n*High coverage with low mutation score indicates weak assertions*\n```\n\n## Integration with CI\n\n### GitHub Actions Integration\n\n```yaml\n- name: Run mutation testing\n  run: npx stryker run --reporters json\n\n- name: Check mutation threshold\n  run: |\n    SCORE=$(jq '.metrics.mutationScore' reports\u002Fmutation\u002Fstryker-incremental.json)\n    if (( $(echo \"$SCORE \u003C 80\" | bc -l) )); then\n      echo \"::error::Mutation score $SCORE% below 80% threshold\"\n      exit 1\n    fi\n```\n\n## Optimization Tips\n\n### Incremental Mutation Testing\n\nOnly test changed code:\n```bash\n# Stryker incremental\nnpx stryker run --incremental\n\n# PITest history\nmvn pitest:mutationCoverage -DwithHistory\n```\n\n### Target Critical Modules First\n\n```json\n{\n  \"mutate\": [\n    \"src\u002Fauth\u002F**\u002F*.ts\",\n    \"src\u002Fpayment\u002F**\u002F*.ts\",\n    \"src\u002Fvalidation\u002F**\u002F*.ts\"\n  ]\n}\n```\n\n## Related Skills\n\n- `tdd-enforce` - Enforce test-first development\n- `flaky-detect` - Identify unreliable tests\n- `test-sync` - Maintain test-code alignment\n\n## Script Reference\n\n### mutation_runner.py\nRun mutation testing for project:\n```bash\npython scripts\u002Fmutation_runner.py --module src\u002Fauth\n```\n\n### mutation_analyzer.py\nAnalyze and prioritize survivors:\n```bash\npython scripts\u002Fmutation_analyzer.py --report stryker-report.json\n```\n\n### native_extension_preflight.py\n\nRun the isolated Python import\u002Ftest preflight and emit machine-readable evidence:\n\n```bash\npython scripts\u002Fnative_extension_preflight.py \\\n  --test-selection tests\u002Ftest_critical_contract.py \\\n  --mutation-target src\u002Fpackage\u002Fcritical_contract.py \\\n  --estimated-mutants 120 --max-children 4 \\\n  --runtime-budget-seconds 900 --format json\n```\n\n## References\n\n- @$AIWG_ROOT\u002F${CLAUDE_PLUGIN_ROOT}\u002FREADME.md — Testing quality addon overview\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002FREADME.md — SDLC framework context for quality gates\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Frules\u002Fvague-discretion.md — Measurable quality thresholds and gate criteria\n- @$AIWG_ROOT\u002Fdocs\u002Fcli-reference.md — CLI reference\n","# Mutation Test Skill\n\n## Purpose\n\nRun mutation testing to measure test suite effectiveness. Mutation testing introduces small changes (mutants) to code and checks if tests catch them. High coverage with low mutation score indicates weak tests.\n\n## Research Foundation\n\n| Concept | Source | Reference |\n|---------|--------|-----------|\n| Mutation Testing Theory | IEEE TSE (2019) | Papadakis et al. \"Mutation Testing Advances\" |\n| ICST Mutation Workshop | IEEE Annual | [Mutation 2024](https:\u002F\u002Fconf.researchr.org\u002Fhome\u002Ficst-2024\u002Fmutation-2024) |\n| Stryker Mutator | Industry Tool | [stryker-mutator.io](https:\u002F\u002Fstryker-mutator.io\u002F) |\n| PITest | Java Tool | [pitest.org](https:\u002F\u002Fpitest.org\u002F) |\n| mutmut | Python Tool | [github.com\u002Fboxed\u002Fmutmut](https:\u002F\u002Fgithub.com\u002Fboxed\u002Fmutmut) |\n\n## When This Skill Applies\n\n- User asks to \"validate test quality\" or \"check test effectiveness\"\n- User mentions \"mutation testing\" or \"mutation score\"\n- User wants to know if tests are \"actually testing anything\"\n- High coverage but bugs still escaping\n- Assessing test suite health\n- Pre-release quality validation\n\n## Trigger Phrases\n\n| Natural Language | Action |\n|------------------|--------|\n| \"Run mutation testing\" | Execute mutation analysis |\n| \"Check if my tests are effective\" | Run mutation + analyze |\n| \"Validate test quality\" | Mutation score report |\n| \"Are my tests catching real bugs?\" | Mutation analysis |\n| \"Find weak tests\" | Identify low-score tests |\n| \"Why did this bug escape tests?\" | Mutation analysis on module |\n\n## Mutation Testing Concepts\n\n### What is a Mutant?\n\nA mutant is a small code change that should cause tests to fail:\n\n```javascript\n\u002F\u002F Original\nif (age >= 18) { return \"adult\"; }\n\n\u002F\u002F Mutant 1: Changed >= to >\nif (age > 18) { return \"adult\"; }\n\n\u002F\u002F Mutant 2: Changed >= to ==\nif (age == 18) { return \"adult\"; }\n\n\u002F\u002F Mutant 3: Changed \"adult\" to \"\"\nif (age >= 18) { return \"\"; }\n```\n\n### Mutation Operators\n\n| Operator | Example | Tests |\n|----------|---------|-------|\n| Arithmetic | `+` → `-` | Math operations |\n| Relational | `>=` → `>` | Boundary conditions |\n| Logical | `&&` → `\\|\\|` | Boolean logic |\n| Literal | `true` → `false` | Constant handling |\n| Return | `return x` → `return null` | Return value handling |\n\n### Mutation Score\n\n```\nMutation Score = (Killed Mutants \u002F Total Mutants) × 100\n```\n\n| Score | Quality | Interpretation |\n|-------|---------|----------------|\n| 90%+ | Excellent | Tests are highly effective |\n| 80-89% | Good | Target for production |\n| 60-79% | Adequate | Room for improvement |\n| \u003C60% | Poor | Tests need significant work |\n\n## Implementation Process\n\n### 1. Detect Project and Resolve Tool\n\n```python\ndef mutation_tool(project_type):\n    if project_type == \"javascript\":\n        return \"stryker\"\n    elif project_type == \"python\":\n        return \"mutmut\"\n    elif project_type == \"java\":\n        return \"pitest\"\n```\n\nUse the project's existing lockfile or approved dependency workflow. Record the\nresolved tool and version in the evidence; do not install an unpinned tool as an\nimplicit side effect of this skill.\n\n### 2. Configure Mutation Testing\n\n**Stryker (JavaScript)**:\n```json\n\u002F\u002F stryker.config.json\n{\n  \"mutate\": [\"src\u002F**\u002F*.ts\", \"!src\u002F**\u002F*.test.ts\"],\n  \"testRunner\": \"vitest\",\n  \"reporters\": [\"html\", \"progress\"],\n  \"coverageAnalysis\": \"perTest\",\n  \"thresholds\": {\n    \"high\": 80,\n    \"low\": 60,\n    \"break\": 50\n  }\n}\n```\n\n**mutmut 3 (Python)**:\n```toml\n# pyproject.toml\n[tool.mutmut]\nsource_paths = [\"src\u002Fpackage\u002F\"]\nonly_mutate = [\"src\u002Fpackage\u002Fcritical_contract.py\"]\npytest_add_cli_args = [\"--no-cov\", \"-q\"]\npytest_add_cli_args_test_selection = [\"tests\u002Ftest_critical_contract.py\"]\nmutate_only_covered_lines = true\n```\n\nKeep both `only_mutate` and the selected tests explicit. A directory-wide\nfallback is not an acceptable substitute for a target that was selected to fit\nthe runtime budget.\n\n**PITest (Java)**:\n```xml\n\u003C!-- pom.xml -->\n\u003Cplugin>\n    \u003CgroupId>org.pitest\u003C\u002FgroupId>\n    \u003CartifactId>pitest-maven\u003C\u002FartifactId>\n    \u003Cversion>1.15.0\u003C\u002Fversion>\n    \u003Cconfiguration>\n        \u003CtargetClasses>\n            \u003Cparam>com.example.*\u003C\u002Fparam>\n        \u003C\u002FtargetClasses>\n        \u003CmutationThreshold>80\u003C\u002FmutationThreshold>\n    \u003C\u002Fconfiguration>\n\u003C\u002Fplugin>\n```\n\n### 3. Preflight Python Native Extensions\n\nmutmut 3's covered-line mode runs coverage and stats in the same parent Python\nprocess. Its coverage phase snapshots `sys.modules`, runs the selected tests,\nthen unloads every newly imported module. A later stats pass can re-import a\nnative extension that cannot safely be initialized twice. This is an upstream\nmutmut boundary, not a killed\u002Fsurvived mutant and not evidence that the project\ntests failed. See [mutmut #528](https:\u002F\u002Fgithub.com\u002Fboxed\u002Fmutmut\u002Fissues\u002F528).\n\nBefore any Python run with `mutate_only_covered_lines = true`, execute the\nselected tests through the bundled subprocess probe:\n\n```bash\npython scripts\u002Fnative_extension_preflight.py \\\n  --test-selection tests\u002Ftest_critical_contract.py \\\n  --pytest-arg=--no-cov \\\n  --pytest-arg=-q \\\n  --mutation-target src\u002Fpackage\u002Fcritical_contract.py \\\n  --estimated-mutants 120 \\\n  --max-children 4 \\\n  --runtime-budget-seconds 900 \\\n  --format json\n```\n\nThe probe runs the test selection in a disposable subprocess and records native\nmodules imported after its pytest plugin loads. It never unloads or re-imports a\nmodule. Use `--import-file` or `--import-module` for import-only checks when a\npytest selection is not yet available.\n\n| Exit | Classification | Required action |\n|------|----------------|-----------------|\n| `0` | `preflight_safe` | Covered-line mode may proceed; preserve the report. |\n| `2` | `harness_native_extension_reload_risk` | Do not run mutmut covered-line mode. Use only an allowed bounded fallback or a project-approved subprocess-isolated tool. |\n| `3` | `project_test_or_import_failure` | Fix or clarify the direct project test\u002Fimport failure before mutation testing. |\n| `4` | `harness_preflight_timeout` | Reduce the selection or increase the explicitly approved preflight budget. |\n\nDetection is conservative. A safe result proves only that this selected run did\nnot load a native extension after the probe boundary; change the selection or\nenvironment and the preflight must be repeated.\n\n#### Bounded mutmut fallback\n\nWhen a native extension is found, the supported mutmut fallback is\n`mutate_only_covered_lines = false`, but only when the JSON report says\n`fallback.allowed: true`. The fallback gate requires all of:\n\n- one or more explicit `--mutation-target` values matching `only_mutate`;\n- an observed or tool-generated `--estimated-mutants` count (do not guess);\n- the intended `--max-children` value;\n- an explicit `--runtime-budget-seconds` value; and\n- the conservative estimate\n  `baseline_test_seconds × estimated_mutants ÷ max_children × 1.5` to fit the\n  budget.\n\nIf any bound is missing or the estimate exceeds budget, shrink the mutation\ntarget or use a project-approved mutation harness whose coverage and stats\nphases start in fresh subprocesses. Never silently widen `only_mutate` to\ncompensate for disabling covered-line selection.\n\n### 4. Run Mutation Analysis\n\n```bash\n# JavaScript\nnpx stryker run\n\n# Python, only after the preflight decision is recorded\npython -m mutmut run --max-children 4\n\n# Java\nmvn org.pitest:pitest-maven:mutationCoverage\n```\n\n### 5. Classify and Report Results\n\nKeep harness\u002Ftool failures, direct project-test failures, and mutant outcomes in\nseparate fields. For an existing mutmut log, the preflight script can classify\nknown native reload signatures:\n\n```bash\npython scripts\u002Fnative_extension_preflight.py \\\n  --classify-mutmut-log mutation-run.log \\\n  --format json\n```\n\n`Running stats` combined with `cannot load module more than once per process`,\n`module functions cannot set METH_CLASS or METH_STATIC`, or a fatal segmentation\nfault whose report lists extension modules is\n`harness_tool_failure_native_extension_reload`. It must set\n`counts_as_mutant_outcome: false`; do not compute a mutation score from that run.\n`failed to collect stats` is supporting context, not a sufficient signature by\nitself.\nOnly a direct test run that fails independently of the mutation harness is a\n`project_test_failure`. Killed, survived, timeout, and no-tests results are\nmutant outcomes only after preflight, baseline tests, stats collection, and the\nmutation harness complete successfully.\n\n```python\ndef parse_mutation_results(report_path):\n    \"\"\"Parse mutation testing report\"\"\"\n    return {\n        \"execution_mode\": \"mutmut-covered-lines-preflight-safe\",\n        \"harness_status\": \"passed\",\n        \"project_test_status\": \"passed\",\n        \"total_mutants\": 150,\n        \"killed\": 120,\n        \"survived\": 25,\n        \"timeout\": 5,\n        \"mutation_score\": 80.0,\n        \"survivors\": [\n            {\n                \"file\": \"src\u002Fauth\u002Fvalidate.ts\",\n                \"line\": 45,\n                \"mutator\": \"RelationalOperator\",\n                \"original\": \"age >= 18\",\n                \"mutant\": \"age > 18\",\n                \"status\": \"survived\"\n            }\n            # ... more survivors\n        ]\n    }\n```\n\n## Output Format\n\n```markdown\n## Mutation Testing Report\n\n**Module**: src\u002Fauth\u002F\n**Test Suite**: test\u002Fauth\u002F\n**Execution mode**: mutmut covered-line mode (native-extension preflight safe)\n**Harness status**: passed\n**Project baseline tests**: passed\n\n### Summary\n\n| Metric | Value |\n|--------|-------|\n| Total Mutants | 150 |\n| Killed | 120 (80%) |\n| Survived | 25 (17%) |\n| Timeout | 5 (3%) |\n| **Mutation Score** | **80%** |\n\n### Status: PASSED (threshold: 80%)\n\n### Survived Mutants (Highest Priority)\n\n#### 1. `src\u002Fauth\u002Fvalidate.ts:45`\n```diff\n- if (age >= 18) { return \"adult\"; }\n+ if (age > 18) { return \"adult\"; }\n```\n**Problem**: Boundary condition not tested\n**Fix**: Add test case for `age = 18`\n\n#### 2. `src\u002Fauth\u002Flogin.ts:23`\n```diff\n- if (attempts \u003C maxAttempts) { allow(); }\n+ if (attempts \u003C= maxAttempts) { allow(); }\n```\n**Problem**: Off-by-one boundary not tested\n**Fix**: Add test for `attempts = maxAttempts`\n\n### Recommended Test Improvements\n\n1. **Add boundary tests** for `validate.ts` (3 survivors)\n2. **Add error path tests** for `login.ts` (2 survivors)\n3. **Test null\u002Fundefined cases** in `session.ts` (1 survivor)\n\n### Coverage vs Mutation Score\n\n| File | Line Coverage | Mutation Score | Gap |\n|------|--------------|----------------|-----|\n| validate.ts | 95% | 72% | 23% |\n| login.ts | 88% | 85% | 3% |\n| session.ts | 100% | 91% | 9% |\n\n*High coverage with low mutation score indicates weak assertions*\n```\n\n## Integration with CI\n\n### GitHub Actions Integration\n\n```yaml\n- name: Run mutation testing\n  run: npx stryker run --reporters json\n\n- name: Check mutation threshold\n  run: |\n    SCORE=$(jq '.metrics.mutationScore' reports\u002Fmutation\u002Fstryker-incremental.json)\n    if (( $(echo \"$SCORE \u003C 80\" | bc -l) )); then\n      echo \"::error::Mutation score $SCORE% below 80% threshold\"\n      exit 1\n    fi\n```\n\n## Optimization Tips\n\n### Incremental Mutation Testing\n\nOnly test changed code:\n```bash\n# Stryker incremental\nnpx stryker run --incremental\n\n# PITest history\nmvn pitest:mutationCoverage -DwithHistory\n```\n\n### Target Critical Modules First\n\n```json\n{\n  \"mutate\": [\n    \"src\u002Fauth\u002F**\u002F*.ts\",\n    \"src\u002Fpayment\u002F**\u002F*.ts\",\n    \"src\u002Fvalidation\u002F**\u002F*.ts\"\n  ]\n}\n```\n\n## Related Skills\n\n- `tdd-enforce` - Enforce test-first development\n- `flaky-detect` - Identify unreliable tests\n- `test-sync` - Maintain test-code alignment\n\n## Script Reference\n\n### mutation_runner.py\nRun mutation testing for project:\n```bash\npython scripts\u002Fmutation_runner.py --module src\u002Fauth\n```\n\n### mutation_analyzer.py\nAnalyze and prioritize survivors:\n```bash\npython scripts\u002Fmutation_analyzer.py --report stryker-report.json\n```\n\n### native_extension_preflight.py\n\nRun the isolated Python import\u002Ftest preflight and emit machine-readable evidence:\n\n```bash\npython scripts\u002Fnative_extension_preflight.py \\\n  --test-selection tests\u002Ftest_critical_contract.py \\\n  --mutation-target src\u002Fpackage\u002Fcritical_contract.py \\\n  --estimated-mutants 120 --max-children 4 \\\n  --runtime-budget-seconds 900 --format json\n```\n\n## References\n\n- @$AIWG_ROOT\u002F${CLAUDE_PLUGIN_ROOT}\u002FREADME.md — Testing quality addon overview\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002FREADME.md — SDLC framework context for quality gates\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Frules\u002Fvague-discretion.md — Measurable quality thresholds and gate criteria\n- @$AIWG_ROOT\u002Fdocs\u002Fcli-reference.md — CLI reference\n",{"name":5,"version":53,"namespace":54,"platforms":55,"description":7},"1.1.0","aiwg",[56],"all","main","6754967c344ccb087a8de06972f55a41067b291b","agentic\u002Fcode\u002Fplugins\u002Ftesting-quality\u002Fskills\u002Fmutation-test",36,"https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg","https:\u002F\u002Faiwg.io","https:\u002F\u002Fgithub.com\u002Fjmagly","https:\u002F\u002Fintegrolabs.io","ml\u002Fai, industrial automation, safety\u002Fsecurity, ssi\r\n\r\nmagly.net\r\nintegrolabs.io\r\naiwg.io\r\nfortemi.com\r\npagenary.com\r\nbytecask.com","2026-11-14 10:46:34",{"source":9,"skillName":5,"commands":68,"prompt":78,"zipAvailable":79},[69,72,75],{"tool":70,"command":71},"npx","npx skills add jmagly\u002Faiwg --skill mutation-test",{"tool":73,"command":74},"bunx","bunx skills add jmagly\u002Faiwg --skill mutation-test",{"tool":76,"command":77},"pnpm","pnpm dlx skills add jmagly\u002Faiwg --skill mutation-test","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Ftesting-quality\u002Fskills\u002Fmutation-test\u002FSKILL.md",true,[81,86,92,96,102],{"path":82,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":84,"sourceHtmlUrl":85},"LICENSE","许可证",10770,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fchains\u002Fdfinity-official-agent-web-identity\u002FLICENSE",{"path":87,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":90,"sourceHtmlUrl":91},"scripts\u002Faiwg_mutation_native_probe.py","SCRIPT","脚本",1927,"https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Ftesting-quality\u002Fskills\u002Fmutation-test\u002Fscripts\u002Faiwg_mutation_native_probe.py",{"path":93,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":94,"sourceHtmlUrl":95},"scripts\u002Fnative_extension_preflight.py",14644,"https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Ftesting-quality\u002Fskills\u002Fmutation-test\u002Fscripts\u002Fnative_extension_preflight.py",{"path":97,"resourceType":98,"resourceTypeDesc":99,"sizeBytes":100,"sourceHtmlUrl":101},"SOURCE.md","REFERENCE","参考文档",336,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fchains\u002Fdfinity-official-agent-web-identity\u002FSOURCE.md",{"path":103,"resourceType":98,"resourceTypeDesc":99,"sizeBytes":104,"sourceHtmlUrl":105},"TRUST.auto.yaml",2171,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fchains\u002Fdfinity-official-agent-web-identity\u002FTRUST.auto.yaml",[107,115,120,147,167,172],{"skillNo":108,"name":109,"nameZh":17,"description":110,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":114},"01M78KW7PZJ9YQZQMW84SN2YD4","plugin-search","Search marketplaces for plugins using configured local manifests and directory caches; rank matching plugins by observed installs, review tier and cache dates without installing or fetching anything","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Futils\u002Fskills\u002Fplugin-search\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":116,"name":109,"nameZh":17,"description":110,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":114},"01M78KSEZS9ZNNFESY9ANW22S0","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Fskills\u002Fplugin-search\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":17,"description":123,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":48},"01M70QA0BSYJ49EES9V4RE8QH1","host-hardening","Read-only system hardening baseline and plan-first host hardening recommendations for SSH, Docker bind addresses, firewall persistence, datastores, exporters and audit retention.","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Fsecurity-engineering\u002Fskills\u002Fhost-hardening\u002FSKILL.md",[],[127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146],"hardening","host","host hardening","verification","secrets","read","request","remediation","recommendations","audit","plan","port","bind","Bash","access","only","retention","re","never","firewall",{"skillNo":148,"name":149,"nameZh":17,"description":150,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":151,"categories":152,"keywords":153,"publishedAt":48},"01M70PNT2Z4HMZPRBTAF6073NN","exposure-analysis","Read-only firewall analysis and effective host exposure reconstruction for Docker published ports, UFW bypass, stale rules, CDN scope, IPv6 asymmetry and external probe allowlists.","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Fforensics\u002Fskills\u002Fexposure-analysis\u002FSKILL.md",[],[154,155,156,157,158,159,132,160,138,145,140,161,128,162,142,163,164,146,165,166],"analysis","exposure analysis","collection","reconstruction","operator","write","credentials","unknown","internet","local","scope","ports","ufw",{"skillNo":168,"name":122,"nameZh":17,"description":123,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":169,"categories":170,"keywords":171,"publishedAt":48},"01M70P8QATMPKA78E4FT5D2TNA","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsecurity-engineering\u002Fskills\u002Fhost-hardening\u002FSKILL.md",[],[127,128,129,144,145,146,139,143,135,131,132,133,134,136,137,138,130,140,141,142],{"skillNo":173,"name":149,"nameZh":17,"description":150,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":174,"categories":175,"keywords":176,"publishedAt":48},"01M70NMPVJ5H0JH131P60FW4R8","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fframeworks\u002Fforensics-complete\u002Fskills\u002Fexposure-analysis\u002FSKILL.md",[],[154,155,166,165,158,164,163,142,157,159,132,160,138,156,140,161,128,146,145,162]]