Skip to content
affaan-m avatar

Rust Patterns

Idiomatic Rust patterns for ownership, error handling, enums, traits, iterators, and concurrency in production code.

CCM score
71 of 100
skills.sh installs
12.9K
GitHub stars
312.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers ownership and borrowing, Result and ? propagation, enum state modeling, traits and generics, iterators, and Arc<Mutex<T>> concurrency
  • Includes code examples contrasting idiomatic and anti-pattern versions, such as avoiding unwrap() and wildcard match arms
  • Enforces thiserror for typed library errors and anyhow for application errors, with exhaustive matching on business logic
  • Designed for writing, reviewing, or refactoring Rust code where ownership, error handling, traits, or concurrency is in question

Install

$ npx -y skills add affaan-m/ecc --skill rust-patterns -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Rust Development Patterns

Idiomatic Rust patterns and best practices for building safe, performant, and maintainable applications.

When to Use

  • Writing new Rust code
  • Reviewing Rust code
  • Refactoring existing Rust code
  • Designing crate structure and module layout

How It Works

This skill enforces idiomatic Rust conventions across six key areas: ownership and borrowing to prevent data races at compile time, Result/? error propagation with thiserror for libraries and anyhow for applications, enums and exhaustive pattern matching to make illegal states unrepresentable, traits and generics for zero-cost abstraction, safe concurrency via Arc<Mutex<T>>, channels, and async/await, and minimal pub surfaces organized by domain.

Core Principles

1. Ownership and Borrowing

Rust's ownership system prevents data races and memory bugs at compile time.

// Good: Pass references when you don't need ownership
fn process(data: &[u8]) -> usize {
    data.len()
}

// Good: Take ownership only when you need to store or consume
fn store(data: Vec<u8>) -> Record {
    Record { payload: data }
}

Details

Repository
github.com/affaan-m/ecc
Category
Rust
First seen
Jul 14, 2026

Questions

What does the rust-patterns skill help with?

The rust-patterns skill covers idiomatic Rust patterns, including ownership and borrowing, error handling, traits, and concurrency. It is meant for writing, reviewing, and refactoring Rust code, and for designing crate structure and module layout.

Where does rust-patterns rank among Rust skills?

On the Rust category page on Claude Marketplaces, rust-patterns ranks in the top 10. Other skills in the same category include fix-errors, rust-best-practices, rust-async-patterns, rust-testing, and memory-safety-patterns.

How do I install the rust-patterns skill?

Run npx -y skills add affaan-m/ecc --skill rust-patterns -y in your project. Once installed, the agent can enforce idiomatic Rust conventions such as Result and ? error propagation, enum-based state modeling, and safe concurrency with Arc and Mutex.

Does rust-patterns recommend error crates for Rust projects?

Yes, the skill recommends thiserror for library code, where errors are structured and typed, and anyhow for application code, where error handling is more flexible. It also advises against unwrap() in production code.

More from affaan-m/ecc

All 257

Similar to Rust Patterns

More Rust