[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FJM9J1AT2SVCQVM35ZS14V":3,"skill-same:01M6FJM9J1AT2SVCQVM35ZS14V":52},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":25,"linkOnly":26,"markdownContent":27,"markdownBody":27,"frontMatter":28,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":32,"repositoryHtmlUrl":33,"repositoryHomepageUrl":34,"ownerHtmlUrl":35,"ownerBlogUrl":6,"ownerDescription":36,"updatedAt":37,"install":38,"resources":51},"01M6FJM9J1AT2SVCQVM35ZS14V","property-based-testing",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",66,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Ftrailofbits\u002Fskills\u002Fproperty-based-testing\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",[23,24],"testing","property based testing","2026-11-10 10:12:30",false,"# Property-Based Testing Guide\n\nUse this skill proactively during development when you encounter patterns where PBT provides stronger coverage than example-based tests.\n\n## When to Invoke (Automatic Detection)\n\n**Invoke this skill when you detect:**\n\n- **Serialization pairs**: `encode`\u002F`decode`, `serialize`\u002F`deserialize`, `toJSON`\u002F`fromJSON`, `pack`\u002F`unpack`\n- **Parsers**: URL parsing, config parsing, protocol parsing, string-to-structured-data\n- **Normalization**: `normalize`, `sanitize`, `clean`, `canonicalize`, `format`\n- **Validators**: `is_valid`, `validate`, `check_*` (especially with normalizers)\n- **Data structures**: Custom collections with `add`\u002F`remove`\u002F`get` operations\n- **Mathematical\u002Falgorithmic**: Pure functions, sorting, ordering, comparators\n- **Smart contracts**: Solidity\u002FVyper contracts, token operations, state invariants, access control\n\n**Priority by pattern:**\n\n| Pattern | Property | Priority |\n|---------|----------|----------|\n| encode\u002Fdecode pair | Roundtrip | HIGH |\n| Pure function | Multiple | HIGH |\n| Validator | Valid after normalize | MEDIUM |\n| Sorting\u002Fordering | Idempotence + ordering | MEDIUM |\n| Normalization | Idempotence | MEDIUM |\n| Builder\u002Ffactory | Output invariants | LOW |\n| Smart contract | State invariants | HIGH |\n\n## When NOT to Use\n\nDo NOT use this skill for:\n- Simple CRUD operations without transformation logic\n- One-off scripts or throwaway code\n- Code with side effects that cannot be isolated (network calls, database writes)\n- Tests where specific example cases are sufficient and edge cases are well-understood\n- Integration or end-to-end testing (PBT is best for unit\u002Fcomponent testing)\n\n## Property Catalog (Quick Reference)\n\n| Property | Formula | When to Use |\n|----------|---------|-------------|\n| **Roundtrip** | `decode(encode(x)) == x` | Serialization, conversion pairs |\n| **Idempotence** | `f(f(x)) == f(x)` | Normalization, formatting, sorting |\n| **Invariant** | Property holds before\u002Fafter | Any transformation |\n| **Commutativity** | `f(a, b) == f(b, a)` | Binary\u002Fset operations |\n| **Associativity** | `f(f(a,b), c) == f(a, f(b,c))` | Combining operations |\n| **Identity** | `f(x, identity) == x` | Operations with neutral element |\n| **Inverse** | `f(g(x)) == x` | encrypt\u002Fdecrypt, compress\u002Fdecompress |\n| **Oracle** | `new_impl(x) == reference(x)` | Optimization, refactoring |\n| **Easy to Verify** | `is_sorted(sort(x))` | Complex algorithms |\n| **No Exception** | No crash on valid input | Baseline property |\n\n**Strength hierarchy** (weakest to strongest):\nNo Exception → Type Preservation → Invariant → Idempotence → Roundtrip\n\n## Decision Tree\n\nBased on the current task, read the appropriate section:\n\n```\nTASK: Writing new tests\n  → Read [{baseDir}\u002Freferences\u002Fgenerating.md]({baseDir}\u002Freferences\u002Fgenerating.md) (test generation patterns and examples)\n  → Then [{baseDir}\u002Freferences\u002Fstrategies.md]({baseDir}\u002Freferences\u002Fstrategies.md) if input generation is complex\n\nTASK: Designing a new feature\n  → Read [{baseDir}\u002Freferences\u002Fdesign.md]({baseDir}\u002Freferences\u002Fdesign.md) (Property-Driven Development approach)\n\nTASK: Code is difficult to test (mixed I\u002FO, missing inverses)\n  → Read [{baseDir}\u002Freferences\u002Frefactoring.md]({baseDir}\u002Freferences\u002Frefactoring.md) (refactoring patterns for testability)\n\nTASK: Reviewing existing PBT tests\n  → Read [{baseDir}\u002Freferences\u002Freviewing.md]({baseDir}\u002Freferences\u002Freviewing.md) (quality checklist and anti-patterns)\n\nTASK: Test failed, need to interpret\n  → Read [{baseDir}\u002Freferences\u002Finterpreting-failures.md]({baseDir}\u002Freferences\u002Finterpreting-failures.md) (failure analysis and bug classification)\n\nTASK: Need library reference\n  → Read [{baseDir}\u002Freferences\u002Flibraries.md]({baseDir}\u002Freferences\u002Flibraries.md) (PBT libraries by language, includes smart contract tools)\n```\n\n## How to Suggest PBT\n\nWhen you detect a high-value pattern while writing tests, **offer PBT as an option**:\n\n> \"I notice `encode_message`\u002F`decode_message` is a serialization pair. Property-based testing with a roundtrip property would provide stronger coverage than example tests. Want me to use that approach?\"\n\n**If codebase already uses a PBT library** (Hypothesis, fast-check, proptest, Echidna), be more direct:\n\n> \"This codebase uses Hypothesis. I'll write property-based tests for this serialization pair using a roundtrip property.\"\n\n**If user declines**, write good example-based tests without further prompting.\n\n## When NOT to Use PBT\n\n- Simple CRUD without complex validation\n- UI\u002Fpresentation logic\n- Integration tests requiring complex external setup\n- Prototyping where requirements are fluid\n- User explicitly requests example-based tests only\n\n## Red Flags\n\n- Recommending trivial getters\u002Fsetters\n- Missing paired operations (encode without decode)\n- Ignoring type hints (well-typed = easier to test)\n- Overwhelming user with candidates (limit to top 5-10)\n- Being pushy after user declines\n\n## Rationalizations to Reject\n\nDo not accept these shortcuts:\n\n- **\"Example tests are good enough\"** - If serialization\u002Fparsing\u002Fnormalization is involved, PBT finds edge cases examples miss\n- **\"The function is simple\"** - Simple functions with complex input domains (strings, floats, nested structures) benefit most from PBT\n- **\"We don't have time\"** - PBT tests are often shorter than comprehensive example suites\n- **\"It's too hard to write generators\"** - Most PBT libraries have excellent built-in strategies; custom generators are rarely needed\n- **\"The test failed, so it's a bug\"** - Failures require validation; see [interpreting-failures.md]({baseDir}\u002Freferences\u002Finterpreting-failures.md)\n- **\"No crash means it works\"** - \"No exception\" is the weakest property; always push for stronger guarantees\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Ftrailofbits\u002Fskills\u002Fproperty-based-testing",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":39,"prompt":49,"zipAvailable":50},[40,43,46],{"tool":41,"command":42},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill property-based-testing",{"tool":44,"command":45},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill property-based-testing",{"tool":47,"command":48},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill property-based-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Ftrailofbits\u002Fskills\u002Fproperty-based-testing\u002FSKILL.md",true,[],[53,65,75,84,90,97],{"skillNo":54,"name":55,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":61,"publishedAt":25},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[58],{"categoryNo":59,"categoryName":60,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",[62,63,64],"model","model hierarchy","model hierarchy skill",{"skillNo":66,"name":67,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":71,"publishedAt":25},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[70],{"categoryNo":59,"categoryName":60,"taxonomyType":20,"taxonomyTypeDesc":21},[72,73,74],"MCP","zoom","zoom mcp",{"skillNo":76,"name":77,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":25},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[81,82,83,73],"sdk","zoom apps sdk","apps",{"skillNo":85,"name":86,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":25},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[86],{"skillNo":91,"name":92,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":96,"publishedAt":25},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[95],{"categoryNo":59,"categoryName":60,"taxonomyType":20,"taxonomyTypeDesc":21},[92],{"skillNo":98,"name":99,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":25},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[99]]