[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ETNFACJEYXSA6XXYM7T0PB":3,"skill-same:01M6ETNFACJEYXSA6XXYM7T0PB":69},{"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":33,"linkOnly":34,"markdownContent":35,"markdownBody":36,"frontMatter":37,"refName":40,"commitSha":41,"skillDirectory":42,"forksCount":43,"repositoryHtmlUrl":44,"repositoryHomepageUrl":45,"ownerHtmlUrl":46,"ownerBlogUrl":6,"ownerDescription":47,"updatedAt":48,"install":49,"resources":62},"01M6ETNFACJEYXSA6XXYM7T0PB","property-testing-guide",null,"Introduces property-based testing with proptest, helping users find edge cases automatically by testing invariants and properties. Activates when users test algorithms or data structures.","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Femillindfors\u002Fproperty-testing-guide\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32],"testing","guide","property testing guide","test","edge","data","grep","find","read","properties","algorithms","data structures","users","with","2026-11-10 10:12:30",false,"---\nname: property-testing-guide\ndescription: Introduces property-based testing with proptest, helping users find edge cases automatically by testing invariants and properties. Activates when users test algorithms or data structures.\nallowed-tools: Read, Grep\nversion: 1.0.0\n---\n\n# Property-Based Testing Guide Skill\n\nYou are an expert at property-based testing in Rust using proptest. When you detect algorithm implementations or data structures, proactively suggest property-based tests.\n\n## When to Activate\n\nActivate when you notice:\n- Algorithm implementations (sorting, parsing, encoding)\n- Data structure implementations\n- Serialization\u002Fdeserialization code\n- Functions with many edge cases\n- Questions about testing complex logic\n\n## Property-Based Testing Concepts\n\n**Traditional Testing**: Test specific inputs\n**Property Testing**: Test properties that should always hold\n\n### Example: Serialization\n\n**Traditional**:\n```rust\n#[test]\nfn test_serialize_user() {\n    let user = User { id: \"123\", email: \"test@example.com\" };\n    let json = serialize(user);\n    assert_eq!(json, r#\"{\"id\":\"123\",\"email\":\"test@example.com\"}\"#);\n}\n```\n\n**Property-Based**:\n```rust\nproptest! {\n    #[test]\n    fn test_serialization_roundtrip(id in \"[a-z0-9]+\", email in \"[a-z]+@[a-z]+\\\\.com\") {\n        let user = User { id, email: email.clone() };\n        let serialized = serialize(&user)?;\n        let deserialized = deserialize(&serialized)?;\n\n        \u002F\u002F Property: roundtrip should preserve data\n        prop_assert_eq!(user.id, deserialized.id);\n        prop_assert_eq!(user.email, deserialized.email);\n    }\n}\n```\n\n## Common Properties to Test\n\n### 1. Roundtrip Properties\n\n**Pattern**:\n```rust\nuse proptest::prelude::*;\n\nproptest! {\n    #[test]\n    fn test_encode_decode_roundtrip(data in \".*\") {\n        let encoded = encode(&data);\n        let decoded = decode(&encoded)?;\n\n        \u002F\u002F Property: encoding then decoding gives original\n        prop_assert_eq!(data, decoded);\n    }\n}\n```\n\n### 2. Idempotence\n\n**Pattern**:\n```rust\nproptest! {\n    #[test]\n    fn test_normalize_idempotent(s in \".*\") {\n        let normalized = normalize(&s);\n        let double_normalized = normalize(&normalized);\n\n        \u002F\u002F Property: applying twice gives same result as once\n        prop_assert_eq!(normalized, double_normalized);\n    }\n}\n```\n\n### 3. Invariants\n\n**Pattern**:\n```rust\nproptest! {\n    #[test]\n    fn test_sort_invariants(mut vec in prop::collection::vec(any::\u003Ci32>(), 0..100)) {\n        let original_len = vec.len();\n        sort(&mut vec);\n\n        \u002F\u002F Property 1: Length unchanged\n        prop_assert_eq!(vec.len(), original_len);\n\n        \u002F\u002F Property 2: Sorted order\n        for i in 1..vec.len() {\n            prop_assert!(vec[i-1] \u003C= vec[i]);\n        }\n    }\n}\n```\n\n### 4. Comparison with Oracle\n\n**Pattern**:\n```rust\nproptest! {\n    #[test]\n    fn test_custom_sort_matches_stdlib(mut vec in prop::collection::vec(any::\u003Ci32>(), 0..100)) {\n        let mut expected = vec.clone();\n        expected.sort();\n\n        custom_sort(&mut vec);\n\n        \u002F\u002F Property: matches standard library behavior\n        prop_assert_eq!(vec, expected);\n    }\n}\n```\n\n### 5. Inverse Functions\n\n**Pattern**:\n```rust\nproptest! {\n    #[test]\n    fn test_add_subtract_inverse(a in any::\u003Ci32>(), b in any::\u003Ci32>()) {\n        if let Some(sum) = a.checked_add(b) {\n            let result = sum.checked_sub(b);\n\n            \u002F\u002F Property: subtraction is inverse of addition\n            prop_assert_eq!(result, Some(a));\n        }\n    }\n}\n```\n\n## Custom Strategies\n\n### Strategy for Domain Types\n\n```rust\nuse proptest::prelude::*;\n\nfn user_strategy() -> impl Strategy\u003CValue = User> {\n    (\"[a-z]{5,10}\", \"[a-z]{3,8}@[a-z]{3,8}\\\\.com\", 18..100u8)\n        .prop_map(|(name, email, age)| User {\n            name,\n            email,\n            age,\n        })\n}\n\nproptest! {\n    #[test]\n    fn test_user_validation(user in user_strategy()) {\n        \u002F\u002F Property: all generated users should be valid\n        prop_assert!(validate_user(&user).is_ok());\n    }\n}\n```\n\n### Strategy with Constraints\n\n```rust\nfn positive_money() -> impl Strategy\u003CValue = Money> {\n    (1..1_000_000u64).prop_map(|cents| Money::from_cents(cents))\n}\n\nproptest! {\n    #[test]\n    fn test_money_operations(a in positive_money(), b in positive_money()) {\n        let sum = a + b;\n\n        \u002F\u002F Property: sum is greater than both operands\n        prop_assert!(sum >= a);\n        prop_assert!(sum >= b);\n    }\n}\n```\n\n## Testing Patterns\n\n### Pattern 1: Parser Testing\n\n```rust\nproptest! {\n    #[test]\n    fn test_parser_never_panics(s in \".*\") {\n        \u002F\u002F Property: parser should never panic, only return Ok or Err\n        let _ = parse(&s);  \u002F\u002F Should not panic\n    }\n\n    #[test]\n    fn test_valid_input_parses(\n        name in \"[a-zA-Z]+\",\n        age in 0..150u8,\n    ) {\n        let input = format!(\"{},{}\", name, age);\n        let result = parse(&input);\n\n        \u002F\u002F Property: valid input always succeeds\n        prop_assert!(result.is_ok());\n    }\n}\n```\n\n### Pattern 2: Data Structure Invariants\n\n```rust\nproptest! {\n    #[test]\n    fn test_btree_invariants(\n        operations in prop::collection::vec(\n            prop_oneof![\n                any::\u003Ci32>().prop_map(Operation::Insert),\n                any::\u003Ci32>().prop_map(Operation::Remove),\n            ],\n            0..100\n        )\n    ) {\n        let mut tree = BTree::new();\n\n        for op in operations {\n            match op {\n                Operation::Insert(val) => tree.insert(val),\n                Operation::Remove(val) => tree.remove(val),\n            }\n\n            \u002F\u002F Property: tree maintains balance invariant\n            prop_assert!(tree.is_balanced());\n            \u002F\u002F Property: tree maintains order invariant\n            prop_assert!(tree.is_sorted());\n        }\n    }\n}\n```\n\n### Pattern 3: Equivalence Testing\n\n```rust\nproptest! {\n    #[test]\n    fn test_optimized_version_equivalent(data in prop::collection::vec(any::\u003Ci32>(), 0..100)) {\n        let result1 = slow_but_correct(&data);\n        let result2 = fast_optimized(&data);\n\n        \u002F\u002F Property: optimized version gives same results\n        prop_assert_eq!(result1, result2);\n    }\n}\n```\n\n## Dependencies\n\n```toml\n[dev-dependencies]\nproptest = \"1.0\"\n```\n\n## Shrinking\n\nProptest automatically finds minimal failing cases:\n\n```rust\nproptest! {\n    #[test]\n    fn test_divide(a in any::\u003Ci32>(), b in any::\u003Ci32>()) {\n        let result = divide(a, b);  \u002F\u002F Fails when b == 0\n\n        \u002F\u002F proptest will shrink to smallest failing case: b = 0\n        prop_assert!(result.is_ok());\n    }\n}\n```\n\n## Your Approach\n\nWhen you see:\n1. **Serialization** → Suggest roundtrip property\n2. **Sorting\u002Fordering** → Suggest invariant properties\n3. **Parsers** → Suggest \"never panics\" property\n4. **Algorithms** → Suggest comparison with oracle\n5. **Data structures** → Suggest invariant testing\n\nProactively suggest property-based tests to find edge cases automatically.\n","# Property-Based Testing Guide Skill\n\nYou are an expert at property-based testing in Rust using proptest. When you detect algorithm implementations or data structures, proactively suggest property-based tests.\n\n## When to Activate\n\nActivate when you notice:\n- Algorithm implementations (sorting, parsing, encoding)\n- Data structure implementations\n- Serialization\u002Fdeserialization code\n- Functions with many edge cases\n- Questions about testing complex logic\n\n## Property-Based Testing Concepts\n\n**Traditional Testing**: Test specific inputs\n**Property Testing**: Test properties that should always hold\n\n### Example: Serialization\n\n**Traditional**:\n```rust\n#[test]\nfn test_serialize_user() {\n    let user = User { id: \"123\", email: \"test@example.com\" };\n    let json = serialize(user);\n    assert_eq!(json, r#\"{\"id\":\"123\",\"email\":\"test@example.com\"}\"#);\n}\n```\n\n**Property-Based**:\n```rust\nproptest! {\n    #[test]\n    fn test_serialization_roundtrip(id in \"[a-z0-9]+\", email in \"[a-z]+@[a-z]+\\\\.com\") {\n        let user = User { id, email: email.clone() };\n        let serialized = serialize(&user)?;\n        let deserialized = deserialize(&serialized)?;\n\n        \u002F\u002F Property: roundtrip should preserve data\n        prop_assert_eq!(user.id, deserialized.id);\n        prop_assert_eq!(user.email, deserialized.email);\n    }\n}\n```\n\n## Common Properties to Test\n\n### 1. Roundtrip Properties\n\n**Pattern**:\n```rust\nuse proptest::prelude::*;\n\nproptest! {\n    #[test]\n    fn test_encode_decode_roundtrip(data in \".*\") {\n        let encoded = encode(&data);\n        let decoded = decode(&encoded)?;\n\n        \u002F\u002F Property: encoding then decoding gives original\n        prop_assert_eq!(data, decoded);\n    }\n}\n```\n\n### 2. Idempotence\n\n**Pattern**:\n```rust\nproptest! {\n    #[test]\n    fn test_normalize_idempotent(s in \".*\") {\n        let normalized = normalize(&s);\n        let double_normalized = normalize(&normalized);\n\n        \u002F\u002F Property: applying twice gives same result as once\n        prop_assert_eq!(normalized, double_normalized);\n    }\n}\n```\n\n### 3. Invariants\n\n**Pattern**:\n```rust\nproptest! {\n    #[test]\n    fn test_sort_invariants(mut vec in prop::collection::vec(any::\u003Ci32>(), 0..100)) {\n        let original_len = vec.len();\n        sort(&mut vec);\n\n        \u002F\u002F Property 1: Length unchanged\n        prop_assert_eq!(vec.len(), original_len);\n\n        \u002F\u002F Property 2: Sorted order\n        for i in 1..vec.len() {\n            prop_assert!(vec[i-1] \u003C= vec[i]);\n        }\n    }\n}\n```\n\n### 4. Comparison with Oracle\n\n**Pattern**:\n```rust\nproptest! {\n    #[test]\n    fn test_custom_sort_matches_stdlib(mut vec in prop::collection::vec(any::\u003Ci32>(), 0..100)) {\n        let mut expected = vec.clone();\n        expected.sort();\n\n        custom_sort(&mut vec);\n\n        \u002F\u002F Property: matches standard library behavior\n        prop_assert_eq!(vec, expected);\n    }\n}\n```\n\n### 5. Inverse Functions\n\n**Pattern**:\n```rust\nproptest! {\n    #[test]\n    fn test_add_subtract_inverse(a in any::\u003Ci32>(), b in any::\u003Ci32>()) {\n        if let Some(sum) = a.checked_add(b) {\n            let result = sum.checked_sub(b);\n\n            \u002F\u002F Property: subtraction is inverse of addition\n            prop_assert_eq!(result, Some(a));\n        }\n    }\n}\n```\n\n## Custom Strategies\n\n### Strategy for Domain Types\n\n```rust\nuse proptest::prelude::*;\n\nfn user_strategy() -> impl Strategy\u003CValue = User> {\n    (\"[a-z]{5,10}\", \"[a-z]{3,8}@[a-z]{3,8}\\\\.com\", 18..100u8)\n        .prop_map(|(name, email, age)| User {\n            name,\n            email,\n            age,\n        })\n}\n\nproptest! {\n    #[test]\n    fn test_user_validation(user in user_strategy()) {\n        \u002F\u002F Property: all generated users should be valid\n        prop_assert!(validate_user(&user).is_ok());\n    }\n}\n```\n\n### Strategy with Constraints\n\n```rust\nfn positive_money() -> impl Strategy\u003CValue = Money> {\n    (1..1_000_000u64).prop_map(|cents| Money::from_cents(cents))\n}\n\nproptest! {\n    #[test]\n    fn test_money_operations(a in positive_money(), b in positive_money()) {\n        let sum = a + b;\n\n        \u002F\u002F Property: sum is greater than both operands\n        prop_assert!(sum >= a);\n        prop_assert!(sum >= b);\n    }\n}\n```\n\n## Testing Patterns\n\n### Pattern 1: Parser Testing\n\n```rust\nproptest! {\n    #[test]\n    fn test_parser_never_panics(s in \".*\") {\n        \u002F\u002F Property: parser should never panic, only return Ok or Err\n        let _ = parse(&s);  \u002F\u002F Should not panic\n    }\n\n    #[test]\n    fn test_valid_input_parses(\n        name in \"[a-zA-Z]+\",\n        age in 0..150u8,\n    ) {\n        let input = format!(\"{},{}\", name, age);\n        let result = parse(&input);\n\n        \u002F\u002F Property: valid input always succeeds\n        prop_assert!(result.is_ok());\n    }\n}\n```\n\n### Pattern 2: Data Structure Invariants\n\n```rust\nproptest! {\n    #[test]\n    fn test_btree_invariants(\n        operations in prop::collection::vec(\n            prop_oneof![\n                any::\u003Ci32>().prop_map(Operation::Insert),\n                any::\u003Ci32>().prop_map(Operation::Remove),\n            ],\n            0..100\n        )\n    ) {\n        let mut tree = BTree::new();\n\n        for op in operations {\n            match op {\n                Operation::Insert(val) => tree.insert(val),\n                Operation::Remove(val) => tree.remove(val),\n            }\n\n            \u002F\u002F Property: tree maintains balance invariant\n            prop_assert!(tree.is_balanced());\n            \u002F\u002F Property: tree maintains order invariant\n            prop_assert!(tree.is_sorted());\n        }\n    }\n}\n```\n\n### Pattern 3: Equivalence Testing\n\n```rust\nproptest! {\n    #[test]\n    fn test_optimized_version_equivalent(data in prop::collection::vec(any::\u003Ci32>(), 0..100)) {\n        let result1 = slow_but_correct(&data);\n        let result2 = fast_optimized(&data);\n\n        \u002F\u002F Property: optimized version gives same results\n        prop_assert_eq!(result1, result2);\n    }\n}\n```\n\n## Dependencies\n\n```toml\n[dev-dependencies]\nproptest = \"1.0\"\n```\n\n## Shrinking\n\nProptest automatically finds minimal failing cases:\n\n```rust\nproptest! {\n    #[test]\n    fn test_divide(a in any::\u003Ci32>(), b in any::\u003Ci32>()) {\n        let result = divide(a, b);  \u002F\u002F Fails when b == 0\n\n        \u002F\u002F proptest will shrink to smallest failing case: b = 0\n        prop_assert!(result.is_ok());\n    }\n}\n```\n\n## Your Approach\n\nWhen you see:\n1. **Serialization** → Suggest roundtrip property\n2. **Sorting\u002Fordering** → Suggest invariant properties\n3. **Parsers** → Suggest \"never panics\" property\n4. **Algorithms** → Suggest comparison with oracle\n5. **Data structures** → Suggest invariant testing\n\nProactively suggest property-based tests to find edge cases automatically.\n",{"name":5,"version":38,"description":7,"allowed-tools":39},"1.0.0","Read, Grep","main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Faiskillstore\u002Fmarketplace\u002Femillindfors\u002Fproperty-testing-guide",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":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill property-testing-guide",{"tool":55,"command":56},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill property-testing-guide",{"tool":58,"command":59},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill property-testing-guide","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Femillindfors\u002Fproperty-testing-guide\u002FSKILL.md",true,[63],{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},"skill-report.json","REFERENCE","参考文档",9149,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Femillindfors\u002Fproperty-testing-guide\u002Fskill-report.json",[70,79,88,97,103,109],{"skillNo":71,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":33},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[76,77,78],"model","model hierarchy","model hierarchy skill",{"skillNo":80,"name":81,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":33},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[85,86,87],"MCP","zoom","zoom mcp",{"skillNo":89,"name":90,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":33},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[94,95,96,86],"sdk","zoom apps sdk","apps",{"skillNo":98,"name":99,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":33},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[99],{"skillNo":104,"name":105,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":33},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[105],{"skillNo":110,"name":111,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":33},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[111]]