[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DETCFMH7Q1EK0KNJS2ZBZ4":3,"skill-same:01M7DETCFMH7Q1EK0KNJS2ZBZ4":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M7DETCFMH7Q1EK0KNJS2ZBZ4","testing",null,"Use when designing, writing, or reviewing tests — deciding what to test, structuring a suite, adding randomized or exhaustive tests, making failures reproducible, or dealing with slow or flaky tests","kejadlen\u002Fdotfiles","kejadlen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F8639?v=4","01M7DEPV4SN2WBW50SBF2KG7D1","Alpha Chen","01M7DEPV5FBX0YWCBKEVHKT8E2",10,"MIT","https:\u002F\u002Fgithub.com\u002Fkejadlen\u002Fdotfiles\u002Fblob\u002Fmain\u002Fai\u002Fskills\u002Ftesting\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: testing\ndescription: Use when designing, writing, or reviewing tests — deciding what to test, structuring a suite, adding randomized or exhaustive tests, making failures reproducible, or dealing with slow or flaky tests\n---\n\n# Testing\n\nHow I design test suites. The defaults are what I follow; the last section\nlists ideas to weigh case by case. Points drawn from elsewhere link their\nsource.\n\n*This is a self-improving skill. If you used it and it came up short — a missing command, flag, gotcha, or workflow — invoke the `self-improving-skills` skill and follow it before you finish.*\n\n## Defaults\n\n### Test features at the boundary\n\nA suite exists to make change cheap. Test what the software does at its\nboundary — the public API for a library, what the user sees for an app — not\nits internal functions. If rewriting the implementation would break the\ntests, they pin code, not features. ([How to Test][how])\n\n[how]: https:\u002F\u002Fmatklad.github.io\u002F2021\u002F05\u002F31\u002Fhow-to-test.html\n\n### Substitute explicitly\n\nWhen a test needs a stand-in, inject it as a dependency, or subclass the real\ntype with one that honors its contract (Liskov substitution). Never\nmonkeypatch.\n\n### Optimize purity, not size\n\nClassify tests by purity (how much IO, threading, and timing they depend on)\nand extent (how much code they exercise), not \"unit\" versus \"integration.\"\nEach step toward pure, single-threaded computation buys about half an order\nof magnitude of speed and removes a source of flakes, so push hard on purity.\nLet extent be whatever the feature needs. ([Unit and Integration Tests][unit])\n\nGet purity through sans-IO design: the caller does IO and passes values in,\nand the core computes and returns values.\n\n[unit]: https:\u002F\u002Fmatklad.github.io\u002F2022\u002F07\u002F04\u002Funit-and-integration-tests.html\n\n### Make new cases data\n\nShape the code under test as value in, value out, so a new case is data — an\ninline string or a file under `test_data\u002F` — not a new test function. Adding\na test must be trivial, or people stop adding them.\n\n### Generate inputs before writing examples\n\nReach for a randomized or property test first, and fall back to examples or\nsnapshots when inputs can't be generated. Keep a couple of example tests as\nsmoke checks. Write property tests with the `hegel-skill:hegel` skill.\n\n- Bugs live in small, tricky inputs. When the domain allows it, enumerate\n  every input up to a bound instead of sampling: a generator that takes an\n  RNG becomes an enumerator when the RNG is rigged to emit every\n  sequence. ([Generate All the Things][gen])\n- Pass the RNG explicitly; never use an ambient global. Every randomized\n  failure prints a seed that reproduces it. ([On Random Numbers][rng])\n- When a fuzzer misses a bug found some other way, fix the fuzzer until it\n  finds the bug, then fix the code. ([Finding Bugs][bugs])\n\n[gen]: https:\u002F\u002Fmatklad.github.io\u002F2021\u002F11\u002F07\u002Fgenerate-all-the-things.html\n[rng]: https:\u002F\u002Fmatklad.github.io\u002F2023\u002F01\u002F04\u002Fon-random-numbers.html\n[bugs]: https:\u002F\u002Fmatklad.github.io\u002F2026\u002F09\u002F19\u002Ffinding-bugs.html\n\n### Keep main green\n\nMerge through a queue that tests the merge result, so main always passes.\nThen every failure on main is a flake: keep a list of them and fix the most\nfrequent first. ([Catch Flakes On Main][flakes])\n\n[flakes]: https:\u002F\u002Fmatklad.github.io\u002F2026\u002F05\u002F14\u002Fcatch-flakes-on-main.html\n\n### Keep the suite fast\n\nGate slow tests behind a runtime env var such as `RUN_SLOW_TESTS`, skipped\nlocally and run in CI — not behind conditional compilation. Print each\ntest's duration so slowness stays visible.\n\n## Worth weighing\n\nValid, but not defaults:\n\n- Route every test through one `check(input, expected)` helper, so an API\n  change touches one place. ([How to Test][how])\n- Prefer snapshot tests, where the framework rewrites the expected literal\n  in update mode, over hand-written expectations. ([Underusing Snapshot\n  Testing][snap], [Snapshot Testing For the Masses][snap-tb])\n- Compare against an oracle: a naive implementation, a model, or a second\n  implementation. ([Finding Bugs][bugs])\n- Swarm testing: randomize operation weights per run so rare combinations\n  happen. ([Swarm Testing Data Structures][swarm])\n- Coverage marks tie a branch to the test that exercises it, which keeps\n  negative tests honest. ([A Trick For Test Maintenance][marks])\n- Treat any repository check — lint, licenses, binary size — as a test, and\n  ratchet improvements against a list of known violators. ([Of Rats and\n  Ratchets][rats])\n- Deeper techniques: finite-entropy PRNGs that shrink for free ([Test Case\n  Minimization][min], [Random Fuzzy Thoughts][fuzzy]), deterministic thread\n  interleavings ([Properly Testing Concurrent Data Structures][conc]),\n  liveness simulation ([Simulation Testing For Liveness][live]), and fuzzers\n  at several levels of realism ([A Tale Of Four Fuzzers][four]).\n- Rust: one integration-test crate and `doctest = false` in large\n  workspaces. ([Delete Cargo Integration Tests][cargo])\n\n[snap]: https:\u002F\u002Fmatklad.github.io\u002F2025\u002F04\u002F15\u002Funderusing-snapshot-testing.html\n[snap-tb]: https:\u002F\u002Ftigerbeetle.com\u002Fblog\u002F2024-05-14-snapshot-testing-for-the-masses\n[swarm]: https:\u002F\u002Ftigerbeetle.com\u002Fblog\u002F2025-04-23-swarm-testing-data-structures\n[marks]: https:\u002F\u002Fmatklad.github.io\u002F2018\u002F06\u002F18\u002Fa-trick-for-test-maintenance.html\n[rats]: https:\u002F\u002Fmatklad.github.io\u002F2024\u002F01\u002F03\u002Fof-rats-and-ratchets.html\n[min]: https:\u002F\u002Fmatklad.github.io\u002F2026\u002F04\u002F20\u002Ftest-case-minimization.html\n[fuzzy]: https:\u002F\u002Ftigerbeetle.com\u002Fblog\u002F2023-03-28-random-fuzzy-thoughts\n[conc]: https:\u002F\u002Fmatklad.github.io\u002F2024\u002F07\u002F05\u002Fproperly-testing-concurrent-data-structures.html\n[live]: https:\u002F\u002Ftigerbeetle.com\u002Fblog\u002F2023-07-06-simulation-testing-for-liveness\n[four]: https:\u002F\u002Ftigerbeetle.com\u002Fblog\u002F2025-11-28-tale-of-four-fuzzers\n[cargo]: https:\u002F\u002Fmatklad.github.io\u002F2021\u002F02\u002F27\u002Fdelete-cargo-integration-tests.html\n","# Testing\n\nHow I design test suites. The defaults are what I follow; the last section\nlists ideas to weigh case by case. Points drawn from elsewhere link their\nsource.\n\n*This is a self-improving skill. If you used it and it came up short — a missing command, flag, gotcha, or workflow — invoke the `self-improving-skills` skill and follow it before you finish.*\n\n## Defaults\n\n### Test features at the boundary\n\nA suite exists to make change cheap. Test what the software does at its\nboundary — the public API for a library, what the user sees for an app — not\nits internal functions. If rewriting the implementation would break the\ntests, they pin code, not features. ([How to Test][how])\n\n[how]: https:\u002F\u002Fmatklad.github.io\u002F2021\u002F05\u002F31\u002Fhow-to-test.html\n\n### Substitute explicitly\n\nWhen a test needs a stand-in, inject it as a dependency, or subclass the real\ntype with one that honors its contract (Liskov substitution). Never\nmonkeypatch.\n\n### Optimize purity, not size\n\nClassify tests by purity (how much IO, threading, and timing they depend on)\nand extent (how much code they exercise), not \"unit\" versus \"integration.\"\nEach step toward pure, single-threaded computation buys about half an order\nof magnitude of speed and removes a source of flakes, so push hard on purity.\nLet extent be whatever the feature needs. ([Unit and Integration Tests][unit])\n\nGet purity through sans-IO design: the caller does IO and passes values in,\nand the core computes and returns values.\n\n[unit]: https:\u002F\u002Fmatklad.github.io\u002F2022\u002F07\u002F04\u002Funit-and-integration-tests.html\n\n### Make new cases data\n\nShape the code under test as value in, value out, so a new case is data — an\ninline string or a file under `test_data\u002F` — not a new test function. Adding\na test must be trivial, or people stop adding them.\n\n### Generate inputs before writing examples\n\nReach for a randomized or property test first, and fall back to examples or\nsnapshots when inputs can't be generated. Keep a couple of example tests as\nsmoke checks. Write property tests with the `hegel-skill:hegel` skill.\n\n- Bugs live in small, tricky inputs. When the domain allows it, enumerate\n  every input up to a bound instead of sampling: a generator that takes an\n  RNG becomes an enumerator when the RNG is rigged to emit every\n  sequence. ([Generate All the Things][gen])\n- Pass the RNG explicitly; never use an ambient global. Every randomized\n  failure prints a seed that reproduces it. ([On Random Numbers][rng])\n- When a fuzzer misses a bug found some other way, fix the fuzzer until it\n  finds the bug, then fix the code. ([Finding Bugs][bugs])\n\n[gen]: https:\u002F\u002Fmatklad.github.io\u002F2021\u002F11\u002F07\u002Fgenerate-all-the-things.html\n[rng]: https:\u002F\u002Fmatklad.github.io\u002F2023\u002F01\u002F04\u002Fon-random-numbers.html\n[bugs]: https:\u002F\u002Fmatklad.github.io\u002F2026\u002F09\u002F19\u002Ffinding-bugs.html\n\n### Keep main green\n\nMerge through a queue that tests the merge result, so main always passes.\nThen every failure on main is a flake: keep a list of them and fix the most\nfrequent first. ([Catch Flakes On Main][flakes])\n\n[flakes]: https:\u002F\u002Fmatklad.github.io\u002F2026\u002F05\u002F14\u002Fcatch-flakes-on-main.html\n\n### Keep the suite fast\n\nGate slow tests behind a runtime env var such as `RUN_SLOW_TESTS`, skipped\nlocally and run in CI — not behind conditional compilation. Print each\ntest's duration so slowness stays visible.\n\n## Worth weighing\n\nValid, but not defaults:\n\n- Route every test through one `check(input, expected)` helper, so an API\n  change touches one place. ([How to Test][how])\n- Prefer snapshot tests, where the framework rewrites the expected literal\n  in update mode, over hand-written expectations. ([Underusing Snapshot\n  Testing][snap], [Snapshot Testing For the Masses][snap-tb])\n- Compare against an oracle: a naive implementation, a model, or a second\n  implementation. ([Finding Bugs][bugs])\n- Swarm testing: randomize operation weights per run so rare combinations\n  happen. ([Swarm Testing Data Structures][swarm])\n- Coverage marks tie a branch to the test that exercises it, which keeps\n  negative tests honest. ([A Trick For Test Maintenance][marks])\n- Treat any repository check — lint, licenses, binary size — as a test, and\n  ratchet improvements against a list of known violators. ([Of Rats and\n  Ratchets][rats])\n- Deeper techniques: finite-entropy PRNGs that shrink for free ([Test Case\n  Minimization][min], [Random Fuzzy Thoughts][fuzzy]), deterministic thread\n  interleavings ([Properly Testing Concurrent Data Structures][conc]),\n  liveness simulation ([Simulation Testing For Liveness][live]), and fuzzers\n  at several levels of realism ([A Tale Of Four Fuzzers][four]).\n- Rust: one integration-test crate and `doctest = false` in large\n  workspaces. ([Delete Cargo Integration Tests][cargo])\n\n[snap]: https:\u002F\u002Fmatklad.github.io\u002F2025\u002F04\u002F15\u002Funderusing-snapshot-testing.html\n[snap-tb]: https:\u002F\u002Ftigerbeetle.com\u002Fblog\u002F2024-05-14-snapshot-testing-for-the-masses\n[swarm]: https:\u002F\u002Ftigerbeetle.com\u002Fblog\u002F2025-04-23-swarm-testing-data-structures\n[marks]: https:\u002F\u002Fmatklad.github.io\u002F2018\u002F06\u002F18\u002Fa-trick-for-test-maintenance.html\n[rats]: https:\u002F\u002Fmatklad.github.io\u002F2024\u002F01\u002F03\u002Fof-rats-and-ratchets.html\n[min]: https:\u002F\u002Fmatklad.github.io\u002F2026\u002F04\u002F20\u002Ftest-case-minimization.html\n[fuzzy]: https:\u002F\u002Ftigerbeetle.com\u002Fblog\u002F2023-03-28-random-fuzzy-thoughts\n[conc]: https:\u002F\u002Fmatklad.github.io\u002F2024\u002F07\u002F05\u002Fproperly-testing-concurrent-data-structures.html\n[live]: https:\u002F\u002Ftigerbeetle.com\u002Fblog\u002F2023-07-06-simulation-testing-for-liveness\n[four]: https:\u002F\u002Ftigerbeetle.com\u002Fblog\u002F2025-11-28-tale-of-four-fuzzers\n[cargo]: https:\u002F\u002Fmatklad.github.io\u002F2021\u002F02\u002F27\u002Fdelete-cargo-integration-tests.html\n",{"name":5,"description":7},"main","54400d2fb3ebb925baf35311c647aaa31e7a5222","ai\u002Fskills\u002Ftesting",0,"https:\u002F\u002Fgithub.com\u002Fkejadlen\u002Fdotfiles","https:\u002F\u002Fgithub.com\u002Fkejadlen","https:\u002F\u002Fkejadlen.dev","2026-11-14 03:39:37",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add kejadlen\u002Fdotfiles --skill testing",{"tool":38,"command":39},"bunx","bunx skills add kejadlen\u002Fdotfiles --skill testing",{"tool":41,"command":42},"pnpm","pnpm dlx skills add kejadlen\u002Fdotfiles --skill testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkejadlen\u002Fdotfiles\u002Fblob\u002Fmain\u002Fai\u002Fskills\u002Ftesting\u002FSKILL.md",true,[],[47,54,61,68,75,82],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M7DEVM19CB8GSCZV56PHA594","zoekt","Use when searching code across repositories — prefer zoekt over grep\u002Fripgrep for indexed code search. Covers indexing repos, search syntax, and query patterns.","https:\u002F\u002Fgithub.com\u002Fkejadlen\u002Fdotfiles\u002Fblob\u002Fmain\u002Fai\u002Fskills\u002Fzoekt\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M7DEVF10JKR56RSX30PZ8BNH","writing-for-accessibility","Use when writing documentation, alt text, diagrams, or any content that should be accessible to people with disabilities. Covers alt text, color contrast, inclusive language, and accessible visuals. Also use when reviewing documents for accessibility.","https:\u002F\u002Fgithub.com\u002Fkejadlen\u002Fdotfiles\u002Fblob\u002Fmain\u002Fai\u002Fskills\u002Fwriting-for-accessibility\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M7DEVA0Q63VMQWG32VN18XYB","writing-error-messages","Use when writing, reviewing, or improving error messages in code, CLI tools, APIs, or UIs. Covers identifying the cause, explaining the fix, and setting the right tone. Also use when error messages are vague, unactionable, or confusing.","https:\u002F\u002Fgithub.com\u002Fkejadlen\u002Fdotfiles\u002Fblob\u002Fmain\u002Fai\u002Fskills\u002Fwriting-error-messages\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M7DEV6GGF2H3FW3YCPWXRRT6","working-in-the-open","Use when making design decisions during implementation — routes rationale to the right venue (commits, task comments, code comments, or documentation) based on how durable the context needs to be","https:\u002F\u002Fgithub.com\u002Fkejadlen\u002Fdotfiles\u002Fblob\u002Fmain\u002Fai\u002Fskills\u002Fworking-in-the-open\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7DEV2XTM37B9S0QV8X9SNSW","web-standards","Use when writing or reviewing HTML, CSS, or browser JavaScript — covers semantic markup, native platform features over libraries, Baseline browser support, accessibility and APCA contrast, and optional validation with vnu, axe, and Lighthouse","https:\u002F\u002Fgithub.com\u002Fkejadlen\u002Fdotfiles\u002Fblob\u002Fmain\u002Fai\u002Fskills\u002Fweb-standards\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M7DETYVQNPNGXC094DT0PTDF","web-design","Use when designing or building web UI, frontends, or styling — covers personal web design preferences, fluid layout, and Alpine.js","https:\u002F\u002Fgithub.com\u002Fkejadlen\u002Fdotfiles\u002Fblob\u002Fmain\u002Fai\u002Fskills\u002Fweb-design\u002FSKILL.md",[],[]]