[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AWT2Q0HF9Y5YKZ1EY2PMCS":3,"skill-same:01M7AWT2Q0HF9Y5YKZ1EY2PMCS":44},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7AWT2Q0HF9Y5YKZ1EY2PMCS","m02-resource",null,"CRITICAL: Use for smart pointers and resource management. Triggers: Box, Rc, Arc, Weak, RefCell, Cell, smart pointer, heap allocation, reference counting, RAII, Drop, should I use Box or Rc, when to use Arc vs Rc, 智能指针, 引用计数, 堆分配","wxxb789\u002Fmarkturbo","wxxb789","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F49564443?v=4","01M7AWR3AB19SNE4ATARY9KV3W","01M7AWR3AZ5Y5ADAY47KF3RBRJ",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fm02-resource\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: m02-resource\ndescription: \"CRITICAL: Use for smart pointers and resource management. Triggers: Box, Rc, Arc, Weak, RefCell, Cell, smart pointer, heap allocation, reference counting, RAII, Drop, should I use Box or Rc, when to use Arc vs Rc, 智能指针, 引用计数, 堆分配\"\nuser-invocable: false\n---\n\n# Resource Management\n\n> **Layer 1: Language Mechanics**\n\n## Core Question\n\n**What ownership pattern does this resource need?**\n\nBefore choosing a smart pointer, understand:\n- Is ownership single or shared?\n- Is access single-threaded or multi-threaded?\n- Are there potential cycles?\n\n---\n\n## Error → Design Question\n\n| Error | Don't Just Say | Ask Instead |\n|-------|----------------|-------------|\n| \"Need heap allocation\" | \"Use Box\" | Why can't this be on stack? |\n| Rc memory leak | \"Use Weak\" | Is the cycle necessary in design? |\n| RefCell panic | \"Use try_borrow\" | Is runtime check the right approach? |\n| Arc overhead complaint | \"Accept it\" | Is multi-thread access actually needed? |\n\n---\n\n## Thinking Prompt\n\nBefore choosing a smart pointer:\n\n1. **What's the ownership model?**\n   - Single owner → Box or owned value\n   - Shared ownership → Rc\u002FArc\n   - Weak reference → Weak\n\n2. **What's the thread context?**\n   - Single-thread → Rc, Cell, RefCell\n   - Multi-thread → Arc, Mutex, RwLock\n\n3. **Are there cycles?**\n   - Yes → One direction must be Weak\n   - No → Regular Rc\u002FArc is fine\n\n---\n\n## Trace Up ↑\n\nWhen pointer choice is unclear, trace to design:\n\n```\n\"Should I use Arc or Rc?\"\n    ↑ Ask: Is this data shared across threads?\n    ↑ Check: m07-concurrency (thread model)\n    ↑ Check: domain-* (performance constraints)\n```\n\n| Situation | Trace To | Question |\n|-----------|----------|----------|\n| Rc vs Arc confusion | m07-concurrency | What's the concurrency model? |\n| RefCell panics | m03-mutability | Is interior mutability right here? |\n| Memory leaks | m12-lifecycle | Where should cleanup happen? |\n\n---\n\n## Trace Down ↓\n\nFrom design to implementation:\n\n```\n\"Need single-owner heap data\"\n    ↓ Use: Box\u003CT>\n\n\"Need shared immutable data (single-thread)\"\n    ↓ Use: Rc\u003CT>\n\n\"Need shared immutable data (multi-thread)\"\n    ↓ Use: Arc\u003CT>\n\n\"Need to break reference cycle\"\n    ↓ Use: Weak\u003CT>\n\n\"Need shared mutable data\"\n    ↓ Single-thread: Rc\u003CRefCell\u003CT>>\n    ↓ Multi-thread: Arc\u003CMutex\u003CT>> or Arc\u003CRwLock\u003CT>>\n```\n\n---\n\n## Quick Reference\n\n| Type | Ownership | Thread-Safe | Use When |\n|------|-----------|-------------|----------|\n| `Box\u003CT>` | Single | Yes | Heap allocation, recursive types |\n| `Rc\u003CT>` | Shared | No | Single-thread shared ownership |\n| `Arc\u003CT>` | Shared | Yes | Multi-thread shared ownership |\n| `Weak\u003CT>` | Weak ref | Same as Rc\u002FArc | Break reference cycles |\n| `Cell\u003CT>` | Single | No | Interior mutability (Copy types) |\n| `RefCell\u003CT>` | Single | No | Interior mutability (runtime check) |\n\n## Decision Flowchart\n\n```\nNeed heap allocation?\n├─ Yes → Single owner?\n│        ├─ Yes → Box\u003CT>\n│        └─ No → Multi-thread?\n│                ├─ Yes → Arc\u003CT>\n│                └─ No → Rc\u003CT>\n└─ No → Stack allocation (default)\n\nHave reference cycles?\n├─ Yes → Use Weak for one direction\n└─ No → Regular Rc\u002FArc\n\nNeed interior mutability?\n├─ Yes → Thread-safe needed?\n│        ├─ Yes → Mutex\u003CT> or RwLock\u003CT>\n│        └─ No → T: Copy? → Cell\u003CT> : RefCell\u003CT>\n└─ No → Use &mut T\n```\n\n---\n\n## Common Errors\n\n| Problem | Cause | Fix |\n|---------|-------|-----|\n| Rc cycle leak | Mutual strong refs | Use Weak for one direction |\n| RefCell panic | Borrow conflict at runtime | Use try_borrow or restructure |\n| Arc overhead | Atomic ops in hot path | Consider Rc if single-threaded |\n| Box unnecessary | Data fits on stack | Remove Box |\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why Bad | Better |\n|--------------|---------|--------|\n| Arc everywhere | Unnecessary atomic overhead | Use Rc for single-thread |\n| RefCell everywhere | Runtime panics | Design clear ownership |\n| Box for small types | Unnecessary allocation | Stack allocation |\n| Ignore Weak for cycles | Memory leaks | Design parent-child with Weak |\n\n---\n\n## Related Skills\n\n| When | See |\n|------|-----|\n| Ownership errors | m01-ownership |\n| Interior mutability details | m03-mutability |\n| Multi-thread context | m07-concurrency |\n| Resource lifecycle | m12-lifecycle |\n","# Resource Management\n\n> **Layer 1: Language Mechanics**\n\n## Core Question\n\n**What ownership pattern does this resource need?**\n\nBefore choosing a smart pointer, understand:\n- Is ownership single or shared?\n- Is access single-threaded or multi-threaded?\n- Are there potential cycles?\n\n---\n\n## Error → Design Question\n\n| Error | Don't Just Say | Ask Instead |\n|-------|----------------|-------------|\n| \"Need heap allocation\" | \"Use Box\" | Why can't this be on stack? |\n| Rc memory leak | \"Use Weak\" | Is the cycle necessary in design? |\n| RefCell panic | \"Use try_borrow\" | Is runtime check the right approach? |\n| Arc overhead complaint | \"Accept it\" | Is multi-thread access actually needed? |\n\n---\n\n## Thinking Prompt\n\nBefore choosing a smart pointer:\n\n1. **What's the ownership model?**\n   - Single owner → Box or owned value\n   - Shared ownership → Rc\u002FArc\n   - Weak reference → Weak\n\n2. **What's the thread context?**\n   - Single-thread → Rc, Cell, RefCell\n   - Multi-thread → Arc, Mutex, RwLock\n\n3. **Are there cycles?**\n   - Yes → One direction must be Weak\n   - No → Regular Rc\u002FArc is fine\n\n---\n\n## Trace Up ↑\n\nWhen pointer choice is unclear, trace to design:\n\n```\n\"Should I use Arc or Rc?\"\n    ↑ Ask: Is this data shared across threads?\n    ↑ Check: m07-concurrency (thread model)\n    ↑ Check: domain-* (performance constraints)\n```\n\n| Situation | Trace To | Question |\n|-----------|----------|----------|\n| Rc vs Arc confusion | m07-concurrency | What's the concurrency model? |\n| RefCell panics | m03-mutability | Is interior mutability right here? |\n| Memory leaks | m12-lifecycle | Where should cleanup happen? |\n\n---\n\n## Trace Down ↓\n\nFrom design to implementation:\n\n```\n\"Need single-owner heap data\"\n    ↓ Use: Box\u003CT>\n\n\"Need shared immutable data (single-thread)\"\n    ↓ Use: Rc\u003CT>\n\n\"Need shared immutable data (multi-thread)\"\n    ↓ Use: Arc\u003CT>\n\n\"Need to break reference cycle\"\n    ↓ Use: Weak\u003CT>\n\n\"Need shared mutable data\"\n    ↓ Single-thread: Rc\u003CRefCell\u003CT>>\n    ↓ Multi-thread: Arc\u003CMutex\u003CT>> or Arc\u003CRwLock\u003CT>>\n```\n\n---\n\n## Quick Reference\n\n| Type | Ownership | Thread-Safe | Use When |\n|------|-----------|-------------|----------|\n| `Box\u003CT>` | Single | Yes | Heap allocation, recursive types |\n| `Rc\u003CT>` | Shared | No | Single-thread shared ownership |\n| `Arc\u003CT>` | Shared | Yes | Multi-thread shared ownership |\n| `Weak\u003CT>` | Weak ref | Same as Rc\u002FArc | Break reference cycles |\n| `Cell\u003CT>` | Single | No | Interior mutability (Copy types) |\n| `RefCell\u003CT>` | Single | No | Interior mutability (runtime check) |\n\n## Decision Flowchart\n\n```\nNeed heap allocation?\n├─ Yes → Single owner?\n│        ├─ Yes → Box\u003CT>\n│        └─ No → Multi-thread?\n│                ├─ Yes → Arc\u003CT>\n│                └─ No → Rc\u003CT>\n└─ No → Stack allocation (default)\n\nHave reference cycles?\n├─ Yes → Use Weak for one direction\n└─ No → Regular Rc\u002FArc\n\nNeed interior mutability?\n├─ Yes → Thread-safe needed?\n│        ├─ Yes → Mutex\u003CT> or RwLock\u003CT>\n│        └─ No → T: Copy? → Cell\u003CT> : RefCell\u003CT>\n└─ No → Use &mut T\n```\n\n---\n\n## Common Errors\n\n| Problem | Cause | Fix |\n|---------|-------|-----|\n| Rc cycle leak | Mutual strong refs | Use Weak for one direction |\n| RefCell panic | Borrow conflict at runtime | Use try_borrow or restructure |\n| Arc overhead | Atomic ops in hot path | Consider Rc if single-threaded |\n| Box unnecessary | Data fits on stack | Remove Box |\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why Bad | Better |\n|--------------|---------|--------|\n| Arc everywhere | Unnecessary atomic overhead | Use Rc for single-thread |\n| RefCell everywhere | Runtime panics | Design clear ownership |\n| Box for small types | Unnecessary allocation | Stack allocation |\n| Ignore Weak for cycles | Memory leaks | Design parent-child with Weak |\n\n---\n\n## Related Skills\n\n| When | See |\n|------|-----|\n| Ownership errors | m01-ownership |\n| Interior mutability details | m03-mutability |\n| Multi-thread context | m07-concurrency |\n| Resource lifecycle | m12-lifecycle |\n",{"name":5,"description":7,"user-invocable":19},"main","0f3f41ed51c357d4f79561a132514089c1aaa97d",".agents\u002Fskills\u002Fm02-resource",0,"https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo","https:\u002F\u002Fgithub.com\u002Fwxxb789","2026-11-15 04:06:53",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add wxxb789\u002Fmarkturbo --skill m02-resource",{"tool":36,"command":37},"bunx","bunx skills add wxxb789\u002Fmarkturbo --skill m02-resource",{"tool":39,"command":40},"pnpm","pnpm dlx skills add wxxb789\u002Fmarkturbo --skill m02-resource","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fm02-resource\u002FSKILL.md",true,[],[45,52,58,65,72,78],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M7AWXVVZ6JEJVFGGT2WBSEN0","hello-diagrams","A valid, fully-populated Agent Skill, shown here so the Skills inspector has something correct to display.","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Fsample\u002F.claude\u002Fskills\u002Fhello-diagrams\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":18},"01M7AWXTNG6ZV6WW5CHJZXJYEC","Broken-Example","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Fsample\u002F.claude\u002Fskills\u002Fbroken-example\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":18},"01M7AWXS5WN306ENF2MYJYP7VM","valid-skill","A fully conformant skill with every optional field populated.","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fvalid-skill\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":18},"01M7AWXR0NY08YVHE0G8VTJJ97","a-different-name","The name does not match the directory, which is a conformance warning.","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fname-mismatch\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":18},"01M7AWXQ5EV9JCA0WG9Q1WB13Y","missing-metadata","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fmissing-metadata\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":18},"01M7AWXP8GT7FATM53B914ZN50","malformed-yaml","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fmalformed-yaml\u002FSKILL.md",[],[]]