[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AWVG7JPQSGTMCPMSKJZH7H":3,"skill-same:01M7AWVG7JPQSGTMCPMSKJZH7H":50},{"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},"01M7AWVG7JPQSGTMCPMSKJZH7H","m15-anti-pattern",null,"Use when reviewing code for anti-patterns. Keywords: anti-pattern, common mistake, pitfall, code smell, bad practice, code review, is this an anti-pattern, better way to do this, common mistake to avoid, why is this bad, idiomatic way, beginner mistake, fighting borrow checker, clone everywhere, unwrap in production, should I refactor, 反模式, 常见错误, 代码异味, 最佳实践, 地道写法","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\u002Fm15-anti-pattern\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: m15-anti-pattern\ndescription: \"Use when reviewing code for anti-patterns. Keywords: anti-pattern, common mistake, pitfall, code smell, bad practice, code review, is this an anti-pattern, better way to do this, common mistake to avoid, why is this bad, idiomatic way, beginner mistake, fighting borrow checker, clone everywhere, unwrap in production, should I refactor, 反模式, 常见错误, 代码异味, 最佳实践, 地道写法\"\nuser-invocable: false\n---\n\n# Anti-Patterns\n\n> **Layer 2: Design Choices**\n\n## Core Question\n\n**Is this pattern hiding a design problem?**\n\nWhen reviewing code:\n- Is this solving the symptom or the cause?\n- Is there a more idiomatic approach?\n- Does this fight or flow with Rust?\n\n---\n\n## Anti-Pattern → Better Pattern\n\n| Anti-Pattern | Why Bad | Better |\n|--------------|---------|--------|\n| `.clone()` everywhere | Hides ownership issues | Proper references or ownership |\n| `.unwrap()` in production | Runtime panics | `?`, `expect`, or handling |\n| `Rc` when single owner | Unnecessary overhead | Simple ownership |\n| `unsafe` for convenience | UB risk | Find safe pattern |\n| OOP via `Deref` | Misleading API | Composition, traits |\n| Giant match arms | Unmaintainable | Extract to methods |\n| `String` everywhere | Allocation waste | `&str`, `Cow\u003Cstr>` |\n| Ignoring `#[must_use]` | Lost errors | Handle or `let _ =` |\n\n---\n\n## Thinking Prompt\n\nWhen seeing suspicious code:\n\n1. **Is this symptom or cause?**\n   - Clone to avoid borrow? → Ownership design issue\n   - Unwrap \"because it won't fail\"? → Unhandled case\n\n2. **What would idiomatic code look like?**\n   - References instead of clones\n   - Iterators instead of index loops\n   - Pattern matching instead of flags\n\n3. **Does this fight Rust?**\n   - Fighting borrow checker → restructure\n   - Excessive unsafe → find safe pattern\n\n---\n\n## Trace Up ↑\n\nTo design understanding:\n\n```\n\"Why does my code have so many clones?\"\n    ↑ Ask: Is the ownership model correct?\n    ↑ Check: m09-domain (data flow design)\n    ↑ Check: m01-ownership (reference patterns)\n```\n\n| Anti-Pattern | Trace To | Question |\n|--------------|----------|----------|\n| Clone everywhere | m01-ownership | Who should own this data? |\n| Unwrap everywhere | m06-error-handling | What's the error strategy? |\n| Rc everywhere | m09-domain | Is ownership clear? |\n| Fighting lifetimes | m09-domain | Should data structure change? |\n\n---\n\n## Trace Down ↓\n\nTo implementation (Layer 1):\n\n```\n\"Replace clone with proper ownership\"\n    ↓ m01-ownership: Reference patterns\n    ↓ m02-resource: Smart pointer if needed\n\n\"Replace unwrap with proper handling\"\n    ↓ m06-error-handling: ? operator\n    ↓ m06-error-handling: expect with message\n```\n\n---\n\n## Top 5 Beginner Mistakes\n\n| Rank | Mistake | Fix |\n|------|---------|-----|\n| 1 | Clone to escape borrow checker | Use references |\n| 2 | Unwrap in production | Propagate with `?` |\n| 3 | String for everything | Use `&str` |\n| 4 | Index loops | Use iterators |\n| 5 | Fighting lifetimes | Restructure to own data |\n\n## Code Smell → Refactoring\n\n| Smell | Indicates | Refactoring |\n|-------|-----------|-------------|\n| Many `.clone()` | Ownership unclear | Clarify data flow |\n| Many `.unwrap()` | Error handling missing | Add proper handling |\n| Many `pub` fields | Encapsulation broken | Private + accessors |\n| Deep nesting | Complex logic | Extract methods |\n| Long functions | Multiple responsibilities | Split |\n| Giant enums | Missing abstraction | Trait + types |\n\n---\n\n## Common Error Patterns\n\n| Error | Anti-Pattern Cause | Fix |\n|-------|-------------------|-----|\n| E0382 use after move | Cloning vs ownership | Proper references |\n| Panic in production | Unwrap everywhere | ?, matching |\n| Slow performance | String for all text | &str, Cow |\n| Borrow checker fights | Wrong structure | Restructure |\n| Memory bloat | Rc\u002FArc everywhere | Simple ownership |\n\n---\n\n## Deprecated → Better\n\n| Deprecated | Better |\n|------------|--------|\n| Index-based loops | `.iter()`, `.enumerate()` |\n| `collect::\u003CVec\u003C_>>()` then iterate | Chain iterators |\n| Manual unsafe cell | `Cell`, `RefCell` |\n| `mem::transmute` for casts | `as` or `TryFrom` |\n| Custom linked list | `Vec`, `VecDeque` |\n| `lazy_static!` | `std::sync::OnceLock` |\n\n---\n\n## Quick Review Checklist\n\n- [ ] No `.clone()` without justification\n- [ ] No `.unwrap()` in library code\n- [ ] No `pub` fields with invariants\n- [ ] No index loops when iterator works\n- [ ] No `String` where `&str` suffices\n- [ ] No ignored `#[must_use]` warnings\n- [ ] No `unsafe` without SAFETY comment\n- [ ] No giant functions (>50 lines)\n\n---\n\n## Related Skills\n\n| When | See |\n|------|-----|\n| Ownership patterns | m01-ownership |\n| Error handling | m06-error-handling |\n| Mental models | m14-mental-model |\n| Performance | m10-performance |\n","# Anti-Patterns\n\n> **Layer 2: Design Choices**\n\n## Core Question\n\n**Is this pattern hiding a design problem?**\n\nWhen reviewing code:\n- Is this solving the symptom or the cause?\n- Is there a more idiomatic approach?\n- Does this fight or flow with Rust?\n\n---\n\n## Anti-Pattern → Better Pattern\n\n| Anti-Pattern | Why Bad | Better |\n|--------------|---------|--------|\n| `.clone()` everywhere | Hides ownership issues | Proper references or ownership |\n| `.unwrap()` in production | Runtime panics | `?`, `expect`, or handling |\n| `Rc` when single owner | Unnecessary overhead | Simple ownership |\n| `unsafe` for convenience | UB risk | Find safe pattern |\n| OOP via `Deref` | Misleading API | Composition, traits |\n| Giant match arms | Unmaintainable | Extract to methods |\n| `String` everywhere | Allocation waste | `&str`, `Cow\u003Cstr>` |\n| Ignoring `#[must_use]` | Lost errors | Handle or `let _ =` |\n\n---\n\n## Thinking Prompt\n\nWhen seeing suspicious code:\n\n1. **Is this symptom or cause?**\n   - Clone to avoid borrow? → Ownership design issue\n   - Unwrap \"because it won't fail\"? → Unhandled case\n\n2. **What would idiomatic code look like?**\n   - References instead of clones\n   - Iterators instead of index loops\n   - Pattern matching instead of flags\n\n3. **Does this fight Rust?**\n   - Fighting borrow checker → restructure\n   - Excessive unsafe → find safe pattern\n\n---\n\n## Trace Up ↑\n\nTo design understanding:\n\n```\n\"Why does my code have so many clones?\"\n    ↑ Ask: Is the ownership model correct?\n    ↑ Check: m09-domain (data flow design)\n    ↑ Check: m01-ownership (reference patterns)\n```\n\n| Anti-Pattern | Trace To | Question |\n|--------------|----------|----------|\n| Clone everywhere | m01-ownership | Who should own this data? |\n| Unwrap everywhere | m06-error-handling | What's the error strategy? |\n| Rc everywhere | m09-domain | Is ownership clear? |\n| Fighting lifetimes | m09-domain | Should data structure change? |\n\n---\n\n## Trace Down ↓\n\nTo implementation (Layer 1):\n\n```\n\"Replace clone with proper ownership\"\n    ↓ m01-ownership: Reference patterns\n    ↓ m02-resource: Smart pointer if needed\n\n\"Replace unwrap with proper handling\"\n    ↓ m06-error-handling: ? operator\n    ↓ m06-error-handling: expect with message\n```\n\n---\n\n## Top 5 Beginner Mistakes\n\n| Rank | Mistake | Fix |\n|------|---------|-----|\n| 1 | Clone to escape borrow checker | Use references |\n| 2 | Unwrap in production | Propagate with `?` |\n| 3 | String for everything | Use `&str` |\n| 4 | Index loops | Use iterators |\n| 5 | Fighting lifetimes | Restructure to own data |\n\n## Code Smell → Refactoring\n\n| Smell | Indicates | Refactoring |\n|-------|-----------|-------------|\n| Many `.clone()` | Ownership unclear | Clarify data flow |\n| Many `.unwrap()` | Error handling missing | Add proper handling |\n| Many `pub` fields | Encapsulation broken | Private + accessors |\n| Deep nesting | Complex logic | Extract methods |\n| Long functions | Multiple responsibilities | Split |\n| Giant enums | Missing abstraction | Trait + types |\n\n---\n\n## Common Error Patterns\n\n| Error | Anti-Pattern Cause | Fix |\n|-------|-------------------|-----|\n| E0382 use after move | Cloning vs ownership | Proper references |\n| Panic in production | Unwrap everywhere | ?, matching |\n| Slow performance | String for all text | &str, Cow |\n| Borrow checker fights | Wrong structure | Restructure |\n| Memory bloat | Rc\u002FArc everywhere | Simple ownership |\n\n---\n\n## Deprecated → Better\n\n| Deprecated | Better |\n|------------|--------|\n| Index-based loops | `.iter()`, `.enumerate()` |\n| `collect::\u003CVec\u003C_>>()` then iterate | Chain iterators |\n| Manual unsafe cell | `Cell`, `RefCell` |\n| `mem::transmute` for casts | `as` or `TryFrom` |\n| Custom linked list | `Vec`, `VecDeque` |\n| `lazy_static!` | `std::sync::OnceLock` |\n\n---\n\n## Quick Review Checklist\n\n- [ ] No `.clone()` without justification\n- [ ] No `.unwrap()` in library code\n- [ ] No `pub` fields with invariants\n- [ ] No index loops when iterator works\n- [ ] No `String` where `&str` suffices\n- [ ] No ignored `#[must_use]` warnings\n- [ ] No `unsafe` without SAFETY comment\n- [ ] No giant functions (>50 lines)\n\n---\n\n## Related Skills\n\n| When | See |\n|------|-----|\n| Ownership patterns | m01-ownership |\n| Error handling | m06-error-handling |\n| Mental models | m14-mental-model |\n| Performance | m10-performance |\n",{"name":5,"description":7,"user-invocable":19},"main","0f3f41ed51c357d4f79561a132514089c1aaa97d",".agents\u002Fskills\u002Fm15-anti-pattern",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 m15-anti-pattern",{"tool":36,"command":37},"bunx","bunx skills add wxxb789\u002Fmarkturbo --skill m15-anti-pattern",{"tool":39,"command":40},"pnpm","pnpm dlx skills add wxxb789\u002Fmarkturbo --skill m15-anti-pattern","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fm15-anti-pattern\u002FSKILL.md",true,[44],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"patterns\u002Fcommon-mistakes.md","REFERENCE","参考文档",8259,"https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fm15-anti-pattern\u002Fpatterns\u002Fcommon-mistakes.md",[51,58,64,71,78,84],{"skillNo":52,"name":53,"nameZh":6,"description":54,"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},"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":59,"name":60,"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":61,"categories":62,"keywords":63,"publishedAt":18},"01M7AWXTNG6ZV6WW5CHJZXJYEC","Broken-Example","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Fsample\u002F.claude\u002Fskills\u002Fbroken-example\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"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":72,"name":73,"nameZh":6,"description":74,"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},"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":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},"01M7AWXQ5EV9JCA0WG9Q1WB13Y","missing-metadata","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fmissing-metadata\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"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":87,"categories":88,"keywords":89,"publishedAt":18},"01M7AWXP8GT7FATM53B914ZN50","malformed-yaml","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fmalformed-yaml\u002FSKILL.md",[],[]]