rust

Rust idiomatic patterns and conventions.

⭐41stars🔀4forks📁View on GitHub🕐Updated Dec 30, 2025⬇️1downloads

When & Why to Use This Skill

This Claude skill serves as an expert guide for writing idiomatic Rust code, ensuring projects adhere to the language's core principles of safety and performance. By focusing on ownership, borrowing, and functional programming patterns, it helps developers eliminate common pitfalls and implement robust testing structures using the AAA pattern.

Use Cases

  • Idiomatic Code Refactoring: Transform legacy or non-idiomatic Rust code into clean, efficient patterns by replacing manual loops with iterators and optimizing memory usage through borrowing.
  • Automated Code Auditing: Review pull requests to ensure proper trait derivations (Debug, Clone, PartialEq) and adherence to Rust's strict ownership and borrowing conventions.
  • Standardized Unit Testing: Generate and organize test modules using the 'Arrange, Act, Assert' (AAA) pattern to improve code coverage and maintainability.
  • Performance Optimization: Identify unnecessary cloning operations and suggest zero-cost abstractions to leverage Rust's performance capabilities fully.
namerust
descriptionRust idiomatic patterns and conventions.

Conventions

  • Ownership: Minimize cloning, prefer borrowing
  • Traits: Derive Debug, Clone, PartialEq where appropriate
  • Style: Iterators over loops, effective pattern matching

Testing

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn behavior_description() {
        // AAA pattern
    }
}