[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FEH68KQJNSSR8BTC8PR9Z1":3,"skill-same:01M6FEH68KQJNSSR8BTC8PR9Z1":53},{"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":26,"linkOnly":27,"markdownContent":28,"markdownBody":28,"frontMatter":29,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":35,"ownerHtmlUrl":36,"ownerBlogUrl":6,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M6FEH68KQJNSSR8BTC8PR9Z1","rust-refactor",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\u002Fpproenca\u002Fdot-skills\u002Frust-refactor\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000007","代码审查","SCENARIO","使用场景",[23,24,25],"rust","refactor","rust refactor","2026-11-10 10:12:30",false,"# Rust Refactor Best Practices\n\nArchitectural refactoring guide for Rust applications. Contains 91 rules across 10 categories, prioritized by impact from critical (type safety, ownership) to incremental (iterator idioms).\n\n## When to Apply\n\n- Refactoring existing Rust codebases or planning large-scale restructuring\n- Reviewing PRs for architectural issues and code smells\n- Designing type-safe APIs with proper error handling\n- Organizing Rust project structure with Cargo workspaces\n- Improving module boundaries and visibility control\n- Applying consistent naming conventions (RFC 430)\n- Replacing stringly-typed APIs with strong types\n\n## Rule Categories\n\n| Category | Impact | Rules | Key Topics |\n|----------|--------|-------|------------|\n| Type Safety & Patterns | CRITICAL | 20 | Newtypes, typestate builders, PhantomData, enums, trait objects, associated types |\n| Ownership & Borrowing | CRITICAL | 6 | Borrowing, Cow, lifetime elision, clone avoidance |\n| Error Handling | HIGH | 15 | thiserror\u002Fanyhow, two-tier strategy, context, graceful degradation |\n| API Design & Traits | HIGH | 6 | Sealed traits, extension traits, generic bounds, builder pattern |\n| Project Organization | HIGH | 6 | Cargo workspaces, crate separation, feature grouping |\n| Module & Visibility | MEDIUM-HIGH | 9 | Re-exports, visibility control, test co-location, module splitting |\n| Naming Conventions | MEDIUM-HIGH | 13 | RFC 430, snake_case, PascalCase, predicates, unit suffixes |\n| Conversion Traits | MEDIUM | 5 | From\u002FInto, AsRef, TryFrom, Deref |\n| Idiomatic Patterns | MEDIUM | 6 | Default, let-else, destructuring, match guards |\n| Iterator & Collections | LOW-MEDIUM | 5 | Iterator methods, collect turbofish, filter_map |\n\n## Quick Reference\n\n**Critical patterns** — get these right first:\n- Use newtype patterns to prevent unit confusion and encode invariants\n- Prefer borrowing over ownership in function parameters\n- Use thiserror for library errors, anyhow for application errors\n- Use typestate builders for compile-time required field enforcement\n\n**Common mistakes** — avoid these anti-patterns:\n- Stringly-typed APIs instead of strong types\n- Unnecessary clone calls when borrowing would work\n- panic! for recoverable errors instead of Result\n- Over-exposing internal types with pub visibility\n\n## Table of Contents\n\n1. [Type Safety & Patterns](references\u002F_sections.md#1-type-safety--patterns) — **CRITICAL**\n   - 1.1 [Encode Invariants in Newtype Constructors](references\u002Ftype-newtype-invariants.md) — CRITICAL\n   - 1.2 [Use Newtype Pattern for Unit Safety](references\u002Ftype-newtype-units.md) — CRITICAL\n   - 1.3 [Replace Stringly-Typed APIs with Strong Types](references\u002Ftype-strong-typing-strings.md) — CRITICAL\n   - 1.4 [Use Non-Exhaustive for Extensible Enums](references\u002Ftype-non-exhaustive-enums.md) — CRITICAL\n   - 1.5 [Use PhantomData for Type-Level State](references\u002Ftype-phantom-data.md) — CRITICAL\n   - 1.6 [Use Typestate Builders for Required Fields](references\u002Ftype-builder-required-fields.md) — CRITICAL\n   - 1.7 [Use Associated Types for Related Type Relationships](references\u002Ftype-associated-types.md) — HIGH\n   - 1.8 [Use Enums for Type-Safe Variants](references\u002Ftype-enum-variants.md) — HIGH\n   - 1.9 [Use Option&lt;T&gt; for Nullable Fields](references\u002Ftype-option-nullable-fields.md) — HIGH\n   - 1.10 [Use async_trait for Async Trait Methods](references\u002Ftype-async-trait.md) — MEDIUM\n   - 1.11 [Use bitflags! for Type-Safe Bit Flags](references\u002Ftype-bitflags.md) — MEDIUM\n   - 1.12 [Use Box&lt;dyn Trait&gt; for Runtime Polymorphism](references\u002Ftype-boxed-trait-objects.md) — MEDIUM\n   - 1.13 [Use Builder Pattern with Method Chaining](references\u002Ftype-builder-pattern.md) — MEDIUM\n   - 1.14 [Derive Copy for Simple Enums](references\u002Ftype-enum-copy-simple.md) — MEDIUM\n   - 1.15 [Implement Operator Traits for Domain Types](references\u002Ftype-operator-overload.md) — MEDIUM\n   - 1.16 [Use PhantomData for Unused Generic Parameters](references\u002Ftype-phantom-unused-params.md) — MEDIUM\n   - 1.17 [Use Public Fields for Data Structs](references\u002Ftype-public-fields.md) — MEDIUM\n   - 1.18 [Use Consistent Derive Order for Data Structs](references\u002Ftype-standard-derives.md) — MEDIUM\n   - 1.19 [Group Related Trait Implementations Together](references\u002Ftype-trait-impl-grouping.md) — LOW\n   - 1.20 [Use Type Aliases for Complex Generics](references\u002Ftype-type-aliases.md) — LOW\n2. [Ownership & Borrowing](references\u002F_sections.md#2-ownership--borrowing) — **CRITICAL**\n   - 2.1 [Accept Borrowed Types Over Owned References](references\u002Fown-accept-borrowed-types.md) — CRITICAL\n   - 2.2 [Avoid Unnecessary Clone Calls](references\u002Fown-avoid-unnecessary-clone.md) — CRITICAL\n   - 2.3 [Use Cow for Conditional Ownership](references\u002Fown-cow-conditional-clone.md) — CRITICAL\n   - 2.4 [Leverage Lifetime Elision Rules](references\u002Fown-lifetime-elision.md) — CRITICAL\n   - 2.5 [Prefer Borrowing Over Ownership in Function Parameters](references\u002Fown-prefer-borrowing.md) — CRITICAL\n   - 2.6 [Return Owned Types for Caller Flexibility](references\u002Fown-return-owned-for-flexibility.md) — CRITICAL\n3. [Error Handling](references\u002F_sections.md#3-error-handling) — **HIGH**\n   - 3.1 [Use Two-Tier Error Strategy](references\u002Ferr-two-tier-strategy.md) — HIGH\n   - 3.2 [Use thiserror for Custom Error Types](references\u002Ferr-thiserror-enum.md) — HIGH\n   - 3.3 [Use anyhow for Application Error Handling](references\u002Ferr-anyhow-for-applications.md) — HIGH\n   - 3.4 [Use Result Instead of panic! for Recoverable Errors](references\u002Ferr-use-result-not-panic.md) — HIGH\n   - 3.5 [Reserve panic! for Unrecoverable Situations](references\u002Ferr-panic-unrecoverable.md) — HIGH\n   - 3.6 [Include Path Context in IO Errors](references\u002Ferr-path-context.md) — HIGH\n   - 3.7 [Use Option for Absence, Not Sentinel Values](references\u002Ferr-option-for-absence.md) — HIGH\n   - 3.8 [Use the Question Mark Operator for Error Propagation](references\u002Ferr-question-mark-propagation.md) — HIGH\n   - 3.9 [Use context() and with_context() for Error Messages](references\u002Ferr-anyhow-context.md) — MEDIUM\n   - 3.10 [Use bail! for Validation Failures](references\u002Ferr-bail-validation.md) — MEDIUM\n   - 3.11 [Use Graceful Degradation for Non-Critical Operations](references\u002Ferr-graceful-degradation.md) — MEDIUM\n   - 3.12 [Use #[source] for Error Chaining](references\u002Ferr-source-attribute.md) — MEDIUM\n   - 3.13 [Use expect() with Descriptive Messages](references\u002Ferr-expect-message.md) — LOW\n   - 3.14 [Use ok_or_else for Expensive Error Construction](references\u002Ferr-ok-or-else.md) — LOW\n   - 3.15 [Define Module-Local Result Type Alias](references\u002Ferr-result-alias.md) — LOW\n4. [API Design & Traits](references\u002F_sections.md#4-api-design--traits) — **HIGH**\n   - 4.1 [Derive Common Traits for Public Types](references\u002Fapi-derive-common-traits.md) — HIGH\n   - 4.2 [Implement Standard Traits for Ergonomic APIs](references\u002Fapi-impl-standard-traits.md) — HIGH\n   - 4.3 [Use Trait Bounds for Generic Flexibility](references\u002Fapi-generic-bounds.md) — HIGH\n   - 4.4 [Use Sealed Traits to Prevent External Implementation](references\u002Fapi-sealed-traits.md) — HIGH\n   - 4.5 [Use Builder Pattern for Complex Construction](references\u002Fapi-builder-pattern.md) — HIGH\n   - 4.6 [Use Extension Traits to Add Methods to Foreign Types](references\u002Fapi-extension-traits.md) — HIGH\n5. [Project Organization](references\u002F_sections.md#5-project-organization) — **HIGH**\n   - 5.1 [Use Cargo Workspace for Multi-Crate Projects](references\u002Forg-cargo-workspace.md) — HIGH\n   - 5.2 [Use snake_case for All Directory Names](references\u002Forg-directory-naming.md) — HIGH\n   - 5.3 [Separate Binary and Library Crates](references\u002Forg-binary-library-separation.md) — HIGH\n   - 5.4 [Group Crates by Feature Domain](references\u002Forg-feature-domain-grouping.md) — MEDIUM\n   - 5.5 [Use Dedicated Common Crate for Shared Utilities](references\u002Forg-common-crate.md) — MEDIUM\n   - 5.6 [Keep Crate Structure Flat](references\u002Forg-flat-crate-structure.md) — MEDIUM\n6. [Module & Visibility](references\u002F_sections.md#6-module--visibility) — **MEDIUM-HIGH**\n   - 6.1 [Use Explicit Module Declarations in lib.rs](references\u002Fmod-explicit-declarations.md) — HIGH\n   - 6.2 [Co-locate Tests as test.rs Files](references\u002Fmod-colocated-tests.md) — HIGH\n   - 6.3 [Minimize Public API Surface](references\u002Fmod-minimize-pub-api.md) — MEDIUM-HIGH\n   - 6.4 [Use pub use for Clean Module Re-exports](references\u002Fmod-pub-use-reexports.md) — MEDIUM-HIGH\n   - 6.5 [Split Large Modules into Submodules](references\u002Fmod-split-large-modules.md) — MEDIUM-HIGH\n   - 6.6 [Use crate Prefix for Internal Imports](references\u002Fmod-crate-prefix-imports.md) — MEDIUM-HIGH\n   - 6.7 [Use tests Submodule for Unit Tests](references\u002Fmod-tests-submodule.md) — MEDIUM-HIGH\n   - 6.8 [Use cfg Attributes for Conditional Modules](references\u002Fmod-conditional-compilation.md) — MEDIUM\n   - 6.9 [Separate Types and Errors into Dedicated Files](references\u002Fmod-types-errors-files.md) — MEDIUM\n7. [Naming Conventions](references\u002F_sections.md#7-naming-conventions) — **MEDIUM-HIGH**\n   - 7.1 [Use snake_case for Functions and Methods](references\u002Fname-function-snake-case.md) — HIGH\n   - 7.2 [Use PascalCase for Types](references\u002Fname-type-pascal-case.md) — HIGH\n   - 7.3 [Use snake_case for Module Names](references\u002Fname-module-snake-case.md) — HIGH\n   - 7.4 [Use new for Constructors](references\u002Fname-constructor-new.md) — HIGH\n   - 7.5 [Use SCREAMING_SNAKE_CASE for Constants](references\u002Fname-constant-screaming.md) — MEDIUM\n   - 7.6 [Prefix Getter Functions with get_](references\u002Fname-getter-prefix.md) — MEDIUM\n   - 7.7 [Use is_, has_, should_ for Boolean Predicates](references\u002Fname-boolean-predicates.md) — MEDIUM\n   - 7.8 [Use to_ and from_ for Conversions](references\u002Fname-conversion-to-from.md) — MEDIUM\n   - 7.9 [Use Descriptive Suffixes for Type Specialization](references\u002Fname-type-suffixes.md) — MEDIUM\n   - 7.10 [Include Unit Suffixes in Field Names](references\u002Fname-field-unit-suffixes.md) — LOW\n   - 7.11 [Use Descriptive or Single-Letter Generic Parameters](references\u002Fname-generic-parameters.md) — LOW\n   - 7.12 [Use Single Lowercase Letters for Lifetimes](references\u002Fname-lifetime-parameters.md) — LOW\n   - 7.13 [Name Test Files as test.rs](references\u002Fname-test-files.md) — LOW\n8. [Conversion Traits](references\u002F_sections.md#8-conversion-traits) — **MEDIUM**\n   - 8.1 [Implement From Instead of Into](references\u002Fconv-impl-from-not-into.md) — MEDIUM\n   - 8.2 [Accept AsRef for Flexible String Parameters](references\u002Fconv-asref-for-flexibility.md) — MEDIUM\n   - 8.3 [Implement Deref for Transparent Newtype Access](references\u002Fconv-impl-deref-for-newtypes.md) — MEDIUM\n   - 8.4 [Use TryFrom for Fallible Conversions](references\u002Fconv-tryfrom-for-fallible.md) — MEDIUM\n   - 8.5 [Use Inner Function Pattern to Reduce Monomorphization](references\u002Fconv-inner-function-pattern.md) — MEDIUM\n9. [Idiomatic Patterns](references\u002F_sections.md#9-idiomatic-patterns) — **MEDIUM**\n   - 9.1 [Implement Default Instead of new() Without Arguments](references\u002Fidiom-default-trait.md) — MEDIUM\n   - 9.2 [Follow Constructor Naming Conventions](references\u002Fidiom-constructor-naming.md) — MEDIUM\n   - 9.3 [Use let-else for Early Returns on Pattern Match Failure](references\u002Fidiom-let-else.md) — MEDIUM\n   - 9.4 [Use Struct Update Syntax for Partial Overrides](references\u002Fidiom-struct-update-syntax.md) — MEDIUM\n   - 9.5 [Use Destructuring for Multiple Returns and Field Access](references\u002Fidiom-destructuring-assignment.md) — MEDIUM\n   - 9.6 [Use Match Guards for Complex Conditions](references\u002Fidiom-match-guards.md) — MEDIUM\n10. [Iterator & Collections](references\u002F_sections.md#10-iterator--collections) — **LOW-MEDIUM**\n    - 10.1 [Prefer Iterator Methods Over Manual Loops](references\u002Fiter-prefer-iterators-over-loops.md) — LOW-MEDIUM\n    - 10.2 [Use Turbofish for Explicit collect Type](references\u002Fiter-use-collect-turbofish.md) — LOW-MEDIUM\n    - 10.3 [Use filter_map for Combined Filter and Transform](references\u002Fiter-filter-map-combined.md) — LOW-MEDIUM\n    - 10.4 [Avoid Collecting Then Iterating](references\u002Fiter-avoid-collect-then-iterate.md) — LOW-MEDIUM\n    - 10.5 [Use enumerate Instead of Manual Index Tracking](references\u002Fiter-enumerate-for-indices.md) — LOW-MEDIUM\n\n## References\n\n1. [https:\u002F\u002Frust-lang.github.io\u002Fapi-guidelines\u002F](https:\u002F\u002Frust-lang.github.io\u002Fapi-guidelines\u002F)\n2. [https:\u002F\u002Frust-unofficial.github.io\u002Fpatterns\u002F](https:\u002F\u002Frust-unofficial.github.io\u002Fpatterns\u002F)\n3. [https:\u002F\u002Fdoc.rust-lang.org\u002Fbook\u002F](https:\u002F\u002Fdoc.rust-lang.org\u002Fbook\u002F)\n4. [https:\u002F\u002Fwww.lurklurk.org\u002Feffective-rust\u002F](https:\u002F\u002Fwww.lurklurk.org\u002Feffective-rust\u002F)\n5. [https:\u002F\u002Frust-lang.github.io\u002Frust-clippy\u002F](https:\u002F\u002Frust-lang.github.io\u002Frust-clippy\u002F)\n\n## Related Skills\n\n- For performance optimization, see `rust-optimise` skill\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fpproenca\u002Fdot-skills\u002Frust-refactor",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":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill rust-refactor",{"tool":45,"command":46},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill rust-refactor",{"tool":48,"command":49},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill rust-refactor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Frust-refactor\u002FSKILL.md",true,[],[54,66,76,85,91,98],{"skillNo":55,"name":56,"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":57,"categories":58,"keywords":62,"publishedAt":26},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[59],{"categoryNo":60,"categoryName":61,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",[63,64,65],"model","model hierarchy","model hierarchy skill",{"skillNo":67,"name":68,"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":69,"categories":70,"keywords":72,"publishedAt":26},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[71],{"categoryNo":60,"categoryName":61,"taxonomyType":20,"taxonomyTypeDesc":21},[73,74,75],"MCP","zoom","zoom mcp",{"skillNo":77,"name":78,"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":79,"categories":80,"keywords":81,"publishedAt":26},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[82,83,84,74],"sdk","zoom apps sdk","apps",{"skillNo":86,"name":87,"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":88,"categories":89,"keywords":90,"publishedAt":26},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[87],{"skillNo":92,"name":93,"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":94,"categories":95,"keywords":97,"publishedAt":26},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[96],{"categoryNo":60,"categoryName":61,"taxonomyType":20,"taxonomyTypeDesc":21},[93],{"skillNo":99,"name":100,"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":101,"categories":102,"keywords":103,"publishedAt":26},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[100]]