File contents Mutation Testing
Run cargo-mutants, analyze missed mutants, write tests for new code, verify fixes.
Workflow
Run : Scope to changed files or specified targets
Analyze : Focus on new/changed code missed mutants (ignore pre-existing)
Fix : Add tests for missed mutants in new code
Verify : Re-run on fixed functions to confirm 0 missed
Commands
# Scoped to specific files (recommended for incremental work)
cargo mutants --no-shuffle -j4 -f src/config.rs -f src/volatility.rs
# Scoped to specific functions
cargo mutants --no-shuffle -j4 -F "function_name"
# Full run (slow, 1000+ mutants)
cargo mutants --no-shuffle -j4 -- --lib
# Check results
cat mutants.out/missed.txt | grep "target_file.rs"
cat mutants.out/caught.txt | wc -l
Options
Option
Description
-f <FILE>
Limit to specific source file
-F <PATTERN>
Filter by function name pattern
-E <PATTERN>
Exclude by function name
-j <N>
Parallel jobs (default: auto)
--no-shuffle
Deterministic ordering
-- --lib
Only run library tests
Result Interpretation
Result
Meaning
Action
caught
Test detected mutation
None (good)
missed
Test didn't detect
Add/improve test
unviable
Compile error from mutation
Ignore
timeout
Test too slow
Optimize or skip
Triage Strategy
Pre-existing missed mutants in main.rs (CLI entry point): low priority, hard to unit test
Output formatting functions (report.rs, cli_output.rs): low priority unless logic-heavy
Business logic (config.rs, balance.rs, analyzer.rs): high priority
New code: always fix missed mutants before release
1 --- 2 name: mutants 3 description: Mutation Testing 4 --- 5 6 # Mutation Testing 7 8 Run cargo-mutants, analyze missed mutants, write tests for new code, verify fixes. 9 10 ## Workflow 11 12 1. **Run**: Scope to changed files or specified targets 13 2. **Analyze**: Focus on new/changed code missed mutants (ignore pre-existing) 14 3. **Fix**: Add tests for missed mutants in new code 15 4. **Verify**: Re-run on fixed functions to confirm 0 missed 16 17 ## Commands 18 19 ```bash 20 # Scoped to specific files (recommended for incremental work) 21 cargo mutants --no-shuffle -j4 -f src/config.rs -f src/volatility.rs 22 23 # Scoped to specific functions 24 cargo mutants --no-shuffle -j4 -F "function_name" 25 26 # Full run (slow, 1000+ mutants) 27 cargo mutants --no-shuffle -j4 -- --lib 28 29 # Check results 30 cat mutants.out/missed.txt | grep "target_file.rs" 31 cat mutants.out/caught.txt | wc -l 32 ``` 33 34 ## Options 35 36 | Option | Description | 37 |--------|-------------| 38 | `-f <FILE>` | Limit to specific source file | 39 | `-F <PATTERN>` | Filter by function name pattern | 40 | `-E <PATTERN>` | Exclude by function name | 41 | `-j <N>` | Parallel jobs (default: auto) | 42 | `--no-shuffle` | Deterministic ordering | 43 | `-- --lib` | Only run library tests | 44 45 ## Result Interpretation 46 47 | Result | Meaning | Action | 48 |--------|---------|--------| 49 | **caught** | Test detected mutation | None (good) | 50 | **missed** | Test didn't detect | Add/improve test | 51 | **unviable** | Compile error from mutation | Ignore | 52 | **timeout** | Test too slow | Optimize or skip | 53 54 ## Triage Strategy 55 56 - Pre-existing missed mutants in `main.rs` (CLI entry point): low priority, hard to unit test 57 - Output formatting functions (`report.rs`, `cli_output.rs`): low priority unless logic-heavy 58 - Business logic (`config.rs`, `balance.rs`, `analyzer.rs`): high priority 59 - New code: always fix missed mutants before release
nwiizo/cargo-coupling/tree/main/.claude/skills/mutants commit 0650062ec0
Frequently asked questions How do I install the Mutants skill? Run npx skillmds@latest add nwiizo/mutants in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Mutants skill do? Mutation Testing It is listed under Coding & Dev Tools on SkillMD.
Is Mutants safe to use? This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Mutants? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Mutants free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Mutants? nwiizo (@nwiizo) published this skill. Their other Agent Skills are listed on their SkillMD profile.