rust-patterns

Enforce idiomatic Rust patterns for ownership, error handling, and concurrency.

Updated Mar 17, 2026
One-click install
npx skills add https://github.com/Blake-John/agent-config --skill rust-patterns-blake-john
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-patterns
Source: https://github.com/Blake-John/agent-config/tree/main/.agents/skill_spec/rust-patterns
Command: npx skills add https://github.com/Blake-John/agent-config --skill rust-patterns-blake-john

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Idiomatic Rust patterns and best practices are hard to recall; this skill codifies ownership, error handling, enums, traits, concurrency, and module design to help you write safe, performant code.

Core Features & Use Cases

  • Enforces ownership and borrowing rules to prevent data races at compile time.
  • Demonstrates idiomatic error handling with Result, ?, thiserror, and anyhow for libraries vs applications.
  • Models states with exhaustive enums and design patterns for zero-cost abstractions.
  • Promotes safe concurrency using Arc<Mutex<T>>, channels, and async/await.
  • guides minimal and domain-oriented module visibility and crate structure.

Quick Start

Apply these idioms to your Rust project to enforce idiomatic patterns across ownership, error handling, and concurrency.

Frequently Asked Questions about rust-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce idiomatic Rust patterns for ownership and borrowing?

Idiomatic Rust patterns enforce ownership and borrowing rules to prevent data races at compile time. This skill codifies ownership discipline, structured error handling, exhaustive enums, and trait-based design for safe, performant code.

What's the best way to handle errors in Rust libraries vs applications?

Error handling in Rust differs by context: use thiserror for libraries to define custom error types, and anyhow for applications to simplify dynamic error handling. This skill guides structured error handling with Result and the ? operator for both scenarios.

How do I implement safe concurrency using Arc Mutex and async await in Rust?

Safe concurrency in Rust uses Arc<Mutex<T>> for shared state, channels for message passing, and async/await for non-blocking operations. This skill promotes these idiomatic patterns to ensure thread safety and zero-cost abstractions.

When do I need exhaustive enums and trait-based design in Rust?

Exhaustive enums and trait-based design in Rust are needed when modeling states and designing zero-cost abstractions. This skill demonstrates how to use these patterns to enforce domain-oriented module visibility and minimal public surfaces.

Does this Rust pattern skill help with refactoring existing code and crate structure?

Yes, this Rust pattern skill is applicable during writing new code, reviewing, and refactoring Rust projects. It guides minimal module visibility and crate structure design to ensure idiomatic ownership, error handling, and concurrency.