mx-detect
Skill2 starsChanged 4 months agoMITView on GitHub
MutantX Phase 1 — Detect project language, test command, and source files for mutation testing.
In this repository12 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- mutateSkill
- mx-detectSkill
- mx-generateSkill
- mx-reportSkill
- mx-testSkill
- mx-validateSkill
- mutateSkill
- mx-generateSkill
- mx-reportSkill
- mx-testSkill
- mx-validateSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Write the detection results as JSON to .mutants/detect.json so downstream phases can consume them.
- Very specific: line 24
If test-cmd is provided, use it directly.
- Distinctive: line 39
If no indicator is found, ask the user for the language, test command, and source file patterns.
- Very specific: line 55
If the user provides files, use that pattern instead of auto-detection, but still apply the exclusions below.
- Distinctive: line 57
After identifying candidate source files:
- Very specific: line 66
If more than 30 source files are detected, ask the user to narrow scope with the files argument, or select the 10 most complex files …
- Very specific: line 88
Create the .mutants/ directory if it doesn't exist.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MutantX — Phase 1: Project Detection
You are the detection phase of a mutation testing engine. Your job is to identify the project's language, test command, and source files to mutate.
Write the detection results as JSON to .mutants/detect.json so downstream phases can consume them.
Language & Test Command Detection
If test-cmd is provided, use it directly. Otherwise, check for these indicator files in order and use the first match:
| Indicator File | Language | Default Test Command | Default Source Pattern |
package.json | JavaScript/TypeScript | Read scripts.test from package.json; fall back to npx jest or npx vitest run | src/**/*.{ts,tsx,js,jsx} minus **/*.{test,spec}.* and **/__tests__/** |
pyproject.toml or setup.py or requirements.txt | Python | pytest | src/**/*.py or **/*.py minus **/test_* and **/*_test.py and **/tests/** |
Cargo.toml | Rust | cargo test | src/**/*.rs minus test modules |
go.mod | Go | go test ./... | **/*.go minus *_test.go |
pom.xml | Java (Maven) | mvn test | src/main/**/*.java |
build.gradle | Java (Gradle) | ./gradlew test | src/main/**/*.java |
*.sln or *.csproj | C# | dotnet test | **/*.cs minus **/Tests/** and **/*.Tests/** |
mix.exs | Elixir | mix test | lib/**/*.ex |
Gemfile | Ruby | bundle exec rspec or rake test | lib/**/*.rb or app/**/*.rb |
CMakeLists.txt or Makefile (with C/C++ sources) | C/C++ | Auto-detect: cmake --build . && ctest or make test | src/**/*.{c,cpp,cc,cxx,h,hpp} minus test files |
If no indicator is found, ask the user for the language, test command, and source file patterns.
Incremental builds (C/C++ and anything built with Make)
mx-test.py waits for a new wall-clock second before every patch apply and revert, so timestamp-based rebuilds see each change. That covers Make, CMake's Makefile generator and Python's .pyc cache. It does not cover build systems that cache by content or by build ID in ways that can miss a one-line edit, or test commands that do not rebuild at all (for example, running ./build/tests directly).
For compiled projects, make sure the test command rebuilds before it runs the tests. If unsure, prefer one that deletes the object files of the mutated sources first, for example:
find build -name '*.o' -path '*core*' -delete && cmake --build build && ./build/tests/run_testsTell the user which rebuild strategy the test command relies on. mx-test.py re-runs the tests on unmutated code after the last mutant and fails loudly if a stale build left mutated code behind.
Source File Selection
If the user provides files, use that pattern instead of auto-detection, but still apply the exclusions below.
After identifying candidate source files:
- Exclude test files — files matching test patterns for the detected language (e.g.,
test_*.py,*.test.ts,*_test.go). - Exclude generated/vendored code —
node_modules/,vendor/,dist/,build/,.git/,target/,__pycache__/,cmake-build*/. - Exclude config files —
*.config.*,*.json,*.yaml,*.yml,*.toml,*.xml(unless they contain business logic). - Prioritize by complexity — prefer files with functions, conditionals, and loops over simple declarations or re-exports.
Large Project Handling
If more than 30 source files are detected, ask the user to narrow scope with the files argument, or select the 10 most complex files automatically.
Output
Write .mutants/detect.json:
{
"language": "<detected language>",
"test_command": "<test command>",
"source_files": ["path/to/file1.py", "path/to/file2.py"],
"source_patterns": ["<glob patterns used>"],
"test_patterns": ["<glob patterns matching the test files>"],
"build_command": "<optional: build step to run before test_command>",
"detected_at": "<ISO 8601 timestamp>"
}build_command is optional. For compiled languages, set it to the build step and keep test_command for running the tests, so mx-test.py can report mutants that break the build (killed-build) separately from mutants the tests catch. Omit it when the test command builds and tests in one step.
test_patterns lists globs (relative to the project root, ** allowed) that match the test source files, for example ["tests/**/*.py"] or ["tests/*.cpp"]. mx-validate.py hashes these files and re-tests cached results when they change. If omitted, it falls back to common test naming conventions.
Create the .mutants/ directory if it doesn't exist.
Display the detection results to the user before finishing:
Detected: Python project
Test command: pytest
Source files: 12 files in src/ (excluding tests)Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

