rust
Installation
SKILL.md
Rust Best Practices
Apply these guidelines when writing or reviewing Rust code.
Best Practices Reference
Before reviewing, familiarize yourself with the relevant chapters. Read ALL relevant chapters in the same turn in parallel. Reference these files when providing feedback:
- Chapter 1 - Coding Styles and Idioms: Borrowing vs cloning, Copy trait, Option/Result handling, iterators, import ordering, when to extract a function (duplication vs. wrong abstraction)
- Chapter 2 - Clippy and Linting: Clippy configuration, important lints, workspace lint setup
- Chapter 3 - Performance Mindset: Profiling, avoiding redundant clones, stack vs heap, zero-cost abstractions
- Chapter 4 - Error Handling: Result vs panic, thiserror vs anyhow, error hierarchies
- Chapter 5 - Automated Testing: Test naming, one assertion per test, snapshot testing
- Chapter 6 - Generics and Dispatch: Static vs dynamic dispatch, trait objects, dyn compatibility
- Chapter 7 - Type State Pattern: Compile-time state safety, when to use it
- Chapter 8 - Comments vs Documentation: When to comment,
SAFETY:/CONTEXT:prefixes, TODOs as issues, doc comments, rustdoc - Chapter 9 - Understanding Pointers: Thread safety, Send/Sync, pointer types
- Chapter 10 - Async Patterns with Tokio: Execution model, JoinSet, channels, streams, async traits, graceful shutdown, async debugging