| name | rust |
| description | Rust performance optimization guidelines. This skill should be used when writing, reviewing, or refactoring Rust code to ensure optimal performance patterns. Triggers on tasks involving memory allocation, ownership, borrowing, iterators, async code, or performance optimization. |
Community Rust Best Practices
Comprehensive performance optimization guide for Rust applications. Contains 42 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
- Writing new Rust code
- Optimizing memory allocation and ownership patterns
- Working with iterators and collections
- Writing async code with Tokio or other runtimes
- Reviewing code for performance issues
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|
| 1 | Memory Allocation | CRITICAL | mem- |
| 2 | Ownership & Borrowing | CRITICAL | own- |
| 3 | Data Structure Selection | HIGH | ds- |
| 4 | Iterator & Collection Patterns | HIGH | iter- |
| 5 | Async & Concurrency | MEDIUM-HIGH | async- |
| 6 | Algorithm Complexity | MEDIUM | algo- |
| 7 | Compile-Time Optimization | MEDIUM | comp- |
| 8 | Micro-optimizations | LOW | micro- |
Quick Reference
1. Memory Allocation (CRITICAL)
2. Ownership & Borrowing (CRITICAL)
3. Data Structure Selection (HIGH)
4. Iterator & Collection Patterns (HIGH)
5. Async & Concurrency (MEDIUM-HIGH)
6. Algorithm Complexity (MEDIUM)
7. Compile-Time Optimization (MEDIUM)
8. Micro-optimizations (LOW)
How to Use
Read individual reference files for detailed explanations and code examples:
Full Compiled Document
For a comprehensive guide with all rules in a single document, see AGENTS.md.
Reference Files