[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AWT5XTBYY1Q7J41MRVMTHT":3,"skill-same:01M7AWT5XTBYY1Q7J41MRVMTHT":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},"01M7AWT5XTBYY1Q7J41MRVMTHT","m03-mutability",null,"CRITICAL: Use for mutability issues. Triggers: E0596, E0499, E0502, cannot borrow as mutable, already borrowed as immutable, mut, &mut, interior mutability, Cell, RefCell, Mutex, RwLock, 可变性, 内部可变性, 借用冲突","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\u002Fm03-mutability\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: m03-mutability\ndescription: \"CRITICAL: Use for mutability issues. Triggers: E0596, E0499, E0502, cannot borrow as mutable, already borrowed as immutable, mut, &mut, interior mutability, Cell, RefCell, Mutex, RwLock, 可变性, 内部可变性, 借用冲突\"\nuser-invocable: false\n---\n\n# Mutability\n\n> **Layer 1: Language Mechanics**\n\n## Core Question\n\n**Why does this data need to change, and who can change it?**\n\nBefore adding interior mutability, understand:\n- Is mutation essential or accidental complexity?\n- Who should control mutation?\n- Is the mutation pattern safe?\n\n---\n\n## Error → Design Question\n\n| Error | Don't Just Say | Ask Instead |\n|-------|----------------|-------------|\n| E0596 | \"Add mut\" | Should this really be mutable? |\n| E0499 | \"Split borrows\" | Is the data structure right? |\n| E0502 | \"Separate scopes\" | Why do we need both borrows? |\n| RefCell panic | \"Use try_borrow\" | Is runtime check appropriate? |\n\n---\n\n## Thinking Prompt\n\nBefore adding mutability:\n\n1. **Is mutation necessary?**\n   - Maybe transform → return new value\n   - Maybe builder → construct immutably\n\n2. **Who controls mutation?**\n   - External caller → `&mut T`\n   - Internal logic → interior mutability\n   - Concurrent access → synchronized mutability\n\n3. **What's the thread context?**\n   - Single-thread → Cell\u002FRefCell\n   - Multi-thread → Mutex\u002FRwLock\u002FAtomic\n\n---\n\n## Trace Up ↑\n\nWhen mutability conflicts persist:\n\n```\nE0499\u002FE0502 (borrow conflicts)\n    ↑ Ask: Is the data structure designed correctly?\n    ↑ Check: m09-domain (should data be split?)\n    ↑ Check: m07-concurrency (is async involved?)\n```\n\n| Persistent Error | Trace To | Question |\n|-----------------|----------|----------|\n| Repeated borrow conflicts | m09-domain | Should data be restructured? |\n| RefCell in async | m07-concurrency | Is Send\u002FSync needed? |\n| Mutex deadlocks | m07-concurrency | Is the lock design right? |\n\n---\n\n## Trace Down ↓\n\nFrom design to implementation:\n\n```\n\"Need mutable access from &self\"\n    ↓ T: Copy → Cell\u003CT>\n    ↓ T: !Copy → RefCell\u003CT>\n\n\"Need thread-safe mutation\"\n    ↓ Simple counters → AtomicXxx\n    ↓ Complex data → Mutex\u003CT> or RwLock\u003CT>\n\n\"Need shared mutable state\"\n    ↓ Single-thread: Rc\u003CRefCell\u003CT>>\n    ↓ Multi-thread: Arc\u003CMutex\u003CT>>\n```\n\n---\n\n## Borrow Rules\n\n```\nAt any time, you can have EITHER:\n├─ Multiple &T (immutable borrows)\n└─ OR one &mut T (mutable borrow)\n\nNever both simultaneously.\n```\n\n## Quick Reference\n\n| Pattern | Thread-Safe | Runtime Cost | Use When |\n|---------|-------------|--------------|----------|\n| `&mut T` | N\u002FA | Zero | Exclusive mutable access |\n| `Cell\u003CT>` | No | Zero | Copy types, no refs needed |\n| `RefCell\u003CT>` | No | Runtime check | Non-Copy, need runtime borrow |\n| `Mutex\u003CT>` | Yes | Lock contention | Thread-safe mutation |\n| `RwLock\u003CT>` | Yes | Lock contention | Many readers, few writers |\n| `Atomic*` | Yes | Minimal | Simple types (bool, usize) |\n\n## Error Code Reference\n\n| Error | Cause | Quick Fix |\n|-------|-------|-----------|\n| E0596 | Borrowing immutable as mutable | Add `mut` or redesign |\n| E0499 | Multiple mutable borrows | Restructure code flow |\n| E0502 | &mut while & exists | Separate borrow scopes |\n\n---\n\n## Interior Mutability Decision\n\n| Scenario | Choose |\n|----------|--------|\n| T: Copy, single-thread | `Cell\u003CT>` |\n| T: !Copy, single-thread | `RefCell\u003CT>` |\n| T: Copy, multi-thread | `AtomicXxx` |\n| T: !Copy, multi-thread | `Mutex\u003CT>` or `RwLock\u003CT>` |\n| Read-heavy, multi-thread | `RwLock\u003CT>` |\n| Simple flags\u002Fcounters | `AtomicBool`, `AtomicUsize` |\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why Bad | Better |\n|--------------|---------|--------|\n| RefCell everywhere | Runtime panics | Clear ownership design |\n| Mutex for single-thread | Unnecessary overhead | RefCell |\n| Ignore RefCell panic | Hard to debug | Handle or restructure |\n| Lock inside hot loop | Performance killer | Batch operations |\n\n---\n\n## Related Skills\n\n| When | See |\n|------|-----|\n| Smart pointer choice | m02-resource |\n| Thread safety | m07-concurrency |\n| Data structure design | m09-domain |\n| Anti-patterns | m15-anti-pattern |\n","# Mutability\n\n> **Layer 1: Language Mechanics**\n\n## Core Question\n\n**Why does this data need to change, and who can change it?**\n\nBefore adding interior mutability, understand:\n- Is mutation essential or accidental complexity?\n- Who should control mutation?\n- Is the mutation pattern safe?\n\n---\n\n## Error → Design Question\n\n| Error | Don't Just Say | Ask Instead |\n|-------|----------------|-------------|\n| E0596 | \"Add mut\" | Should this really be mutable? |\n| E0499 | \"Split borrows\" | Is the data structure right? |\n| E0502 | \"Separate scopes\" | Why do we need both borrows? |\n| RefCell panic | \"Use try_borrow\" | Is runtime check appropriate? |\n\n---\n\n## Thinking Prompt\n\nBefore adding mutability:\n\n1. **Is mutation necessary?**\n   - Maybe transform → return new value\n   - Maybe builder → construct immutably\n\n2. **Who controls mutation?**\n   - External caller → `&mut T`\n   - Internal logic → interior mutability\n   - Concurrent access → synchronized mutability\n\n3. **What's the thread context?**\n   - Single-thread → Cell\u002FRefCell\n   - Multi-thread → Mutex\u002FRwLock\u002FAtomic\n\n---\n\n## Trace Up ↑\n\nWhen mutability conflicts persist:\n\n```\nE0499\u002FE0502 (borrow conflicts)\n    ↑ Ask: Is the data structure designed correctly?\n    ↑ Check: m09-domain (should data be split?)\n    ↑ Check: m07-concurrency (is async involved?)\n```\n\n| Persistent Error | Trace To | Question |\n|-----------------|----------|----------|\n| Repeated borrow conflicts | m09-domain | Should data be restructured? |\n| RefCell in async | m07-concurrency | Is Send\u002FSync needed? |\n| Mutex deadlocks | m07-concurrency | Is the lock design right? |\n\n---\n\n## Trace Down ↓\n\nFrom design to implementation:\n\n```\n\"Need mutable access from &self\"\n    ↓ T: Copy → Cell\u003CT>\n    ↓ T: !Copy → RefCell\u003CT>\n\n\"Need thread-safe mutation\"\n    ↓ Simple counters → AtomicXxx\n    ↓ Complex data → Mutex\u003CT> or RwLock\u003CT>\n\n\"Need shared mutable state\"\n    ↓ Single-thread: Rc\u003CRefCell\u003CT>>\n    ↓ Multi-thread: Arc\u003CMutex\u003CT>>\n```\n\n---\n\n## Borrow Rules\n\n```\nAt any time, you can have EITHER:\n├─ Multiple &T (immutable borrows)\n└─ OR one &mut T (mutable borrow)\n\nNever both simultaneously.\n```\n\n## Quick Reference\n\n| Pattern | Thread-Safe | Runtime Cost | Use When |\n|---------|-------------|--------------|----------|\n| `&mut T` | N\u002FA | Zero | Exclusive mutable access |\n| `Cell\u003CT>` | No | Zero | Copy types, no refs needed |\n| `RefCell\u003CT>` | No | Runtime check | Non-Copy, need runtime borrow |\n| `Mutex\u003CT>` | Yes | Lock contention | Thread-safe mutation |\n| `RwLock\u003CT>` | Yes | Lock contention | Many readers, few writers |\n| `Atomic*` | Yes | Minimal | Simple types (bool, usize) |\n\n## Error Code Reference\n\n| Error | Cause | Quick Fix |\n|-------|-------|-----------|\n| E0596 | Borrowing immutable as mutable | Add `mut` or redesign |\n| E0499 | Multiple mutable borrows | Restructure code flow |\n| E0502 | &mut while & exists | Separate borrow scopes |\n\n---\n\n## Interior Mutability Decision\n\n| Scenario | Choose |\n|----------|--------|\n| T: Copy, single-thread | `Cell\u003CT>` |\n| T: !Copy, single-thread | `RefCell\u003CT>` |\n| T: Copy, multi-thread | `AtomicXxx` |\n| T: !Copy, multi-thread | `Mutex\u003CT>` or `RwLock\u003CT>` |\n| Read-heavy, multi-thread | `RwLock\u003CT>` |\n| Simple flags\u002Fcounters | `AtomicBool`, `AtomicUsize` |\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why Bad | Better |\n|--------------|---------|--------|\n| RefCell everywhere | Runtime panics | Clear ownership design |\n| Mutex for single-thread | Unnecessary overhead | RefCell |\n| Ignore RefCell panic | Hard to debug | Handle or restructure |\n| Lock inside hot loop | Performance killer | Batch operations |\n\n---\n\n## Related Skills\n\n| When | See |\n|------|-----|\n| Smart pointer choice | m02-resource |\n| Thread safety | m07-concurrency |\n| Data structure design | m09-domain |\n| Anti-patterns | m15-anti-pattern |\n",{"name":5,"description":7,"user-invocable":19},"main","0f3f41ed51c357d4f79561a132514089c1aaa97d",".agents\u002Fskills\u002Fm03-mutability",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 m03-mutability",{"tool":36,"command":37},"bunx","bunx skills add wxxb789\u002Fmarkturbo --skill m03-mutability",{"tool":39,"command":40},"pnpm","pnpm dlx skills add wxxb789\u002Fmarkturbo --skill m03-mutability","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fm03-mutability\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",[],[]]