Loading...
Loading...
Architectural refactoring guide for Rust applications covering type safety, ownership patterns, error handling strategies, API design, project organization, module structure, naming conventions, conversion traits, and idiomatic patterns. Use when refactoring Rust codebases, reviewing PRs for architectural issues, improving type safety, designing error handling strategies, or organizing project structure. Complements the rust-optimise skill (performance patterns). Does NOT cover performance optimization, memory allocation, or async concurrency tuning (see rust-optimise skill).
npx skill4agent add pproenca/dot-skills rust-refactor| Category | Impact | Rules | Key Topics |
|---|---|---|---|
| Type Safety & Patterns | CRITICAL | 20 | Newtypes, typestate builders, PhantomData, enums, trait objects, associated types |
| Ownership & Borrowing | CRITICAL | 6 | Borrowing, Cow, lifetime elision, clone avoidance |
| Error Handling | HIGH | 15 | thiserror/anyhow, two-tier strategy, context, graceful degradation |
| API Design & Traits | HIGH | 6 | Sealed traits, extension traits, generic bounds, builder pattern |
| Project Organization | HIGH | 6 | Cargo workspaces, crate separation, feature grouping |
| Module & Visibility | MEDIUM-HIGH | 9 | Re-exports, visibility control, test co-location, module splitting |
| Naming Conventions | MEDIUM-HIGH | 13 | RFC 430, snake_case, PascalCase, predicates, unit suffixes |
| Conversion Traits | MEDIUM | 5 | From/Into, AsRef, TryFrom, Deref |
| Idiomatic Patterns | MEDIUM | 6 | Default, let-else, destructuring, match guards |
| Iterator & Collections | LOW-MEDIUM | 5 | Iterator methods, collect turbofish, filter_map |
rust-optimise