Hardens LifeOS tests via property/mutation testing. USE WHEN harden, hardening, property test, property based testing, PBT, fast-check, mutation test, mutation
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-hardening-56d711fa9a6f ,按照其中的说明把「Hardening」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Hardening sharpens what already exists — tests, ISCs, and code — without adding new functionality. Five workflows target test-surface and code-surface robustness: property-based testing via fast-check, mutation testing via Stryker, CRAP-complexity scoring, DRY duplication detection, and acceptance-test mutation that perturbs ISC text to catch fluff.
Example-based tests check a handful of inputs the author thought of, so the bugs that survive are the inputs the author didn't think of. A test suite can be green and still be weak. ISCs can read as crisp pass/fail and still be fluff that anything would satisfy. You can't see any of this by reading the tests — you need to test the tests. This skill mechanizes that: property tests express the universal claim and shrink failures to the minimal counterexample, mutation testing proves the suite catches injected bugs, and acceptance-test mutation proves each ISC actually constrains the work.
Hardening techniques sharpen what already exists — tests, ISCs, code. They don't add new functionality. Five workflows, all targeting test-surface and code-surface robustness.
| Workflow | Trigger | File |
|---|---|---|
| PropertyTest | property test, property based testing, PBT, fast-check, universal quantified claim, shrink counterexample — pure functions, parsers, serializers, data transforms, invariants | Workflows/PropertyTest.md |
| MutationTest | mutation test, mutation testing, Stryker, test the tests | — planned, not yet built (stub; see Status) |
| CrapAnalysis | CRAP score, CRAP analysis, risky undertested code | — planned, not yet built (stub; see Status) |
| DryAnalysis | DRY scan, jscpd, duplication rot | — planned, not yet built (stub; see Status) |
| AcceptanceTestMutation | acceptance test mutation, sharpen ISCs, detect fluff ISCs | — planned, not yet built (stub; see Status) |
These workflows operate against the existing test surface. PropertyTest doesn't replace bun-test examples — properties express the universal claim, examples are sampled instances of it. MutationTest doesn't replace test authoring — it grades existing tests' robustness. CRAP and DRY don't add tests — they prioritize where to add them. Acceptance-test mutation doesn't add ISCs — it mechanizes the Fluff vs Load-bearing distinction from ISAFormat.md.
All five satisfy the same intent: strengthen the test of the test, the test of the ISC, the test of the code. The unifying frame is meta-test — testing the things that test the system.
| Workflow | State | Blocker |
|---|---|---|
| PropertyTest | Fully scaffolded (v1.0) | None — ready to use |
| MutationTest | Stub | Stryker integration; deferred to v6.11.0 |
| CrapAnalysis | Stub | AST walker (oxc or bun build --print-ir) |
| DryAnalysis | Stub | jscpd wrapper |
| AcceptanceTestMutation | Stub | ISC text perturbation generator |
LIFEOS/DOCUMENTATION/Testing/TestingDoctrine.md).bun-property ISC type with property | generator | runs columns (LIFEOS/DOCUMENTATION/ISA/ISAFormat.md § ISC Type Vocabulary).LIFEOS/LIFEOS_SYSTEM_PROMPT.md).AcceptanceTestMutation is the mechanized form of BPE's "would a smarter model render this rule unnecessary" applied to ISCs.// fc seed: 0xdeadbeef.numRuns: 1000 is the default budget. Increase to 10000 for invariant-critical properties; lower to 100 for slow generators (custom record types with large constraints).fc.integer({min: 0, max: 100}) for code that handles all integers). Constrain only what the function actually demands.fc.string() when the function only accepts ASCII). The property must hold across the function's actual valid input domain, no wider.