一键导入
using-clj-mutate
Use when mutation-testing Clojure code, assessing test quality beyond coverage, or investigating surviving mutations to strengthen specs
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when mutation-testing Clojure code, assessing test quality beyond coverage, or investigating surviving mutations to strengthen specs
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | using-clj-mutate |
| description | Use when mutation-testing Clojure code, assessing test quality beyond coverage, or investigating surviving mutations to strengthen specs |
Mutation testing for Clojure. Mutates source code systematically, runs your specs against each mutant, and reports which mutations survived (tests didn't catch) vs were killed (tests caught). Surviving mutations reveal gaps in your test suite that line coverage alone cannot detect.
clj-mutate auto-detects whether your project uses bb.edn (babashka) or deps.edn (JVM Clojure) and adjusts its spec runner and worker setup accordingly.
Add a :mutate alias to your project's deps.edn:
:mutate {:main-opts ["-m" "clj-mutate.core"]
:extra-deps {clj-mutate/clj-mutate {:local/root "/path/to/clj-mutate"}
org.clojure/tools.reader {:mvn/version "1.4.2"}}
:extra-paths ["spec"]}
Requires Speclj as test runner with a :spec alias that runs all specs.
Optional coverage integration (skips mutations on uncovered lines):
:cov {:main-opts ["-m" "speclj.cloverage" "--" "-p" "src" "-s" "spec" "--lcov"]
:extra-deps {cloverage/cloverage {:mvn/version "1.2.4"}
speclj/speclj {:mvn/version "3.12.2"}}
:extra-paths ["spec"]}
Add mutate and spec tasks to your project's bb.edn:
{:paths ["src" "spec"]
:deps {clj-mutate/clj-mutate {:local/root "/path/to/clj-mutate"}
org.clojure/tools.reader {:mvn/version "1.4.2"}
speclj/speclj {:mvn/version "3.12.2"}}
:tasks {spec {:doc "Run all specs"
:requires ([speclj.main :as speclj])
:task (speclj/-main "-c")}
mutate {:doc "Run mutation testing"
:requires ([clj-mutate.core :as mutate])
:task (apply mutate/-main *command-line-args*)}}}
Important: use speclj 3.12.2+. clj-mutate detects killed mutants by checking whether bb spec exits non-zero. Speclj 3.12.2 correctly propagates exit codes under babashka via {:babashka/exit N}. Earlier versions call System/exit which bb's task runner intercepts, causing bb to always exit 0 — making all mutants appear to survive.
Requires a spec task that runs all specs. Cloverage is not available under babashka; coverage-guided filtering is skipped (all lines are mutation-tested). If an lcov.info file is present from an external source, it will be used.
# deps.edn projects
clj -M:mutate src/myapp/foo.cljc
clj -M:mutate src/myapp/foo.cljc --lines 45,67,89
# bb.edn projects
bb mutate src/myapp/foo.cljc
bb mutate src/myapp/foo.cljc --lines 45,67,89
The tool automatically:
bb.edn or deps.edn) and uses the appropriate spec runner;; mutation-tested: YYYY-MM-DD on full runslcov.info is missing or stalelcov.info if present, otherwise tests all lines| Category | Mutations |
|---|---|
| Arithmetic | + <-> -, * -> /, inc <-> dec |
| Comparison | > <-> >=, < <-> <= |
| Equality | = <-> not= |
| Boolean | true <-> false |
| Conditional | if <-> if-not, when <-> when-not |
| Constant | 0 <-> 1 |
| Result | Meaning | Action |
|---|---|---|
| Killed | Test caught the mutation | Tests are strong here |
| Survived | Tests passed with mutant code | Write a spec that would fail with the mutation |
| Timeout | Mutation caused infinite loop | Treated as killed (mutation had observable impact) |
| Equivalent | Mutation can't change behavior | Auto-suppressed; no action needed |
Known-equivalent mutations are auto-suppressed to reduce false survivors:
</<=/>/>= mutations on (rand) comparisons= mutations in rand-nth single-element guardsrand-nth [...] pools> -> >= at subvec boundariesclj -M:mutate src/myapp/foo.cljcbb mutate src/myapp/foo.cljcclj -M:mutate src/myapp/foo.cljc --lines 45,67bb mutate src/myapp/foo.cljc --lines 45,67:spec alias (deps.edn) or spec task (bb.edn) runs all specs under spec/Bootstrap and run bean work from a hail delivery when session cwd, skills catalog, or checkout layout are ambiguous. Use for isaac-work hails, orchestration/process-test beans, or when list_skills returns empty.
Use this skill when working with c3kit.apron.schema — defining schemas, calling coerce/validate/conform/present, handling errors, or writing custom spec functions. Covers the full API including nested types, entity-level specs, and error handling.
Use this skill when working in projects that depend on c3kit libraries (apron, bucket, wire, scaffold). Covers the schema system, database API, web layer, app lifecycle, and conventions specific to the c3kit ecosystem.
Use this skill when writing, reviewing, or refactoring Clojure or ClojureScript code. Covers naming, formatting, function design, state management, error handling, threading, and cross-platform conventions.
Use when the user asks for a CRAP report, cyclomatic complexity analysis, or code quality metrics on a Clojure project
Use this skill when implementing gherclj feature steps, working on beads that reference .feature files, or writing defgiven/defwhen/defthen definitions and their helpers. Ensures step definitions follow gherclj conventions — especially that defthen helpers assert results.