mutation-probe
Measures test strength with mutation testing: runs the mutation tool, or applies small faults one at a time in an isolated copy, and names the missing test for each survivor. Use when the user says 'mutation score' or asks 'would our tests catch a bug here' or 'are these AI-written tests strong'. Not for untested code (use test-coverage-map).
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- mutation-probe
- license
- Apache-2.0
- description
- Measures test strength with mutation testing: runs the mutation tool, or applies small faults one at a time in an isolated copy, and names the missing test for each survivor. Use when the user says 'mutation score' or asks 'would our tests catch a bug here' or 'are these AI-written tests strong'. Not for untested code (use test-coverage-map).
- argument-hint
- [file, function, class or change]
02 资源文件 3
- 参考文档references/java.md1.2 KB
- 参考文档references/python.md738 B
- 参考文档references/typescript.md828 B
03 SKILL.md 正文
mutation-probe
Objective
Coverage shows that code ran. A mutant shows if a test notices when the code is wrong. This skill changes a copy of the code on purpose, one small fault at a time, and runs the tests. The working code of the user never contains a fault. Each surviving mutant becomes a concrete missing test.
Context
- Read
.agents/qa-project-context.mdif it exists. Use its test commands and any mutation tool. - If it does not exist, find the test command and the mutation tool in the build files. Suggest
qa-project-contextonce. Do not stop the work for it. - If
.qestack/project.tomlexists and theqestackcommand works, the engine already measures the mutation score of a tagged feature:qestack mutation --feature <feature>. Use it for a feature with a feature tag. Use this skill for other targets and for fault plans.
Discovery questions
- What is the target? Keep it small: one function, one class, or one change.
- Does the project have a mutation testing tool? Then use it, with the stack recipe.
- Can you make an isolated copy of the repository, for example a separate version control worktree or a temporary copy? If not, the target files must be committed, so that you can restore each file exactly.
- Is there a fault plan from a review, for example from
test-review-panel? Then use its faults as the mutants, and check each prediction.
Workflow
- Before you start: the working tree must be clean for the target files. Make the isolated copy. Run the related tests once in the copy; they must pass. A probe on red tests means nothing.
- With a mutation tool: run it for the target only (see the stack recipe), read its report, and continue with step 5.
- From a fault plan: take its faults. For each one, check that the
originalline is in the file exactly once. Skip the faults where it is not, and say so. By hand: choose 5 to 15 mutants spread over the rules of the target:- boundary:
<↔<=,>↔>=, a limit ± 1 - logic: negate a condition, swap
andandor, remove one condition - arithmetic:
+↔-,*↔/, another rounding mode - return: a constant, the input, null or empty, the other branch
- removal: a validation, a save, an event, an error throw
- error: catch and ignore an error, return success on failure
- boundary:
- For each mutant, one at a time, in the copy: apply it and run the related tests. Record KILLED, SURVIVED or INVALID (compile error or crash at start). Then restore the file in the copy, and check that it equals the original. If no copy is possible, do the same in the working tree, and check the version control status after each mutant.
- Score = killed ÷ (killed + survived). Do not count invalid mutants.
- For each survivor, name the missing test: the input and the expected result (from the requirement) that would fail on this mutant. For a fault plan, mark each prediction as confirmed or wrong.
- Clean up: delete the copy. Check that the working tree of the user has no change.
Stack recipes
Read only the recipe for the stack of the project: Java, TypeScript and JavaScript, Python. Without a tool, use the manual workflow.
Output
## Mutation probe: <target>
Score: <k>/<k+s> killed (<pct>%) | invalid: <i> | method: tool <name> or manual
| # | Location | Mutation | Result | Killed by / missing test |
|---|---|---|---|---|
Tests to add: <input> -> <expected result> (kills M3, M7)
Anti-patterns
- Faults in the working code of the user. Use an isolated copy. A crash in the middle of a run can leave a fault behind. Work in place only when no copy is possible.
- A mutant left in the code. Restore after each run, and check the version control status at the end.
- Changing the tests during the probe.
- Calling every survivor "equivalent". Say so only with a reason; a human decides.
- Mutants that cannot change behavior or only break the build. They tell nothing.
Done when
- Each mutant has a result. The copy is deleted, and the working tree of the user has no change.
- The score and the method are reported.
- Each survivor has a missing test with an input and an expected result.
Related skills
testcase-reviewer: why the tests are weak.unit-testing: write the missing tests.test-coverage-map: untested code, where every mutant survives.test-runner: the test commands.
04 同仓库更多 Skills
unit-testing
Writes, fixes or improves unit tests for rules, calculations, validation and state logic: arrange-act-assert, exact oracles, boundary sets, doubles only at boundaries, controlled clock and randomness. Use when the user says 'write unit tests', 'TDD this' or 'mock this dependency'. Not for HTTP endpoints (use api-testing).
ui-automation
Writes, fixes or structures browser end-to-end tests for critical journeys: role, label or test ID locators, auto-waiting assertions, API data setup, page objects, auth reuse and traces. Use when the user says 'UI test', 'end-to-end test' or 'our UI tests are brittle'. Not for business rules (use unit-testing).
testcase-reviewer
Reviews automated tests or manual test cases like a senior test architect: scores fidelity, oracles, assertion depth, edge cases and determinism, and finds tests that pass on wrong code. Use when the user says 'review my tests', 'test smells' or 'review AI-written tests'. Not for fault injection (use mutation-probe).
testability-review
Scores how testable a feature, module or design is before tests exist (seams for clock, randomness and network, hidden state, observability) and gives the smallest production change per blocker. Use when the user asks 'is this testable' or 'why is this hard to test'. Not for writing the tests (use unit-testing).
test-strategy
Writes a test strategy for a product, system or team: quality goals, test levels and their share, environments, data, automation scope, non-functional testing, metrics and a roadmap. Use when the user says 'test strategy' or 'QA strategy'. Not for one sprint or release plan (use test-planning).
test-runner
Finds how a project runs its tests, runs the right subset, and triages each failure as product bug, test defect, environment problem or flaky test, with evidence. Use when the user says 'run the tests' or asks 'which tests fail and why'. Not for pipeline design (use ci-cd-integration).