Modern Rust development with cargo, rustc, clippy, rustfmt, async programming, and memory-safe systems programming. Covers ownership patterns, fearless concurrency, and the modern Rust ecosystem including Tokio, Serde, and popular crates. Use when user mentions Rust, cargo, rustc, clippy, rustfmt, ownership, borrowing, lifetimes, async Rust, or Rust crates.
Provides expert guidance for modern Rust development including cargo workflows, ownership patterns, async programming with Tokio, and memory-safe systems programming.
/plugin marketplace add laurigates/claude-plugins/plugin install rust-plugin@lgates-claude-pluginsThis skill is limited to using the following tools:
REFERENCE.mdExpert knowledge for modern systems programming with Rust, focusing on memory safety, fearless concurrency, and zero-cost abstractions.
Modern Rust Ecosystem
Language Features
Ownership & Memory Safety
Async Programming & Concurrency
Error Handling & Type Safety
Performance Optimization
Testing & Quality Assurance
# Project setup
cargo new my-project # Binary crate
cargo new my-lib --lib # Library crate
cargo init # Initialize in existing directory
# Development workflow
cargo build # Debug build
cargo build --release # Optimized build
cargo run # Build and run
cargo run --release # Run optimized
cargo test # Run all tests
cargo test --lib # Library tests only
cargo bench # Run benchmarks
# Code quality
cargo clippy # Lint code
cargo clippy -- -W clippy::pedantic # Stricter lints
cargo fmt # Format code
cargo fmt --check # Check formatting
cargo fix # Auto-fix warnings
# Dependencies
cargo add serde --features derive # Add dependency
cargo update # Update deps
cargo audit # Security audit
cargo deny check # License/advisory check
# Advanced tools
cargo expand # Macro expansion
cargo flamegraph # Profile with flame graph
cargo doc --open # Generate and open docs
cargo miri test # Check for UB
# Cross-compilation
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown
Idiomatic Rust Patterns
// Use iterators over manual loops
let sum: i32 = numbers.iter().filter(|x| **x > 0).sum();
// Prefer combinators for Option/Result
let value = config.get("key")
.and_then(|v| v.parse().ok())
.unwrap_or_default();
// Use pattern matching effectively
match result {
Ok(value) if value > 0 => process(value),
Ok(_) => handle_zero(),
Err(e) => return Err(e.into()),
}
// Let-else for early returns
let Some(config) = load_config() else {
return Err(ConfigError::NotFound);
};
Project Structure
my-project/
├── Cargo.toml
├── src/
│ ├── lib.rs # Library root
│ ├── main.rs # Binary entry point
│ ├── error.rs # Error types
│ └── modules/
│ └── mod.rs
├── tests/ # Integration tests
├── benches/ # Benchmarks
└── examples/ # Example programs
Error Handling
use thiserror::Error;
#[derive(Error, Debug)]
pub enum AppError {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("parse error: {message}")]
Parse { message: String },
#[error("not found: {0}")]
NotFound(String),
}
pub type Result<T> = std::result::Result<T, AppError>;
Common Crates
| Crate | Purpose |
|---|---|
serde | Serialization/deserialization |
tokio | Async runtime |
reqwest | HTTP client |
sqlx | Async SQL |
clap | CLI argument parsing |
tracing | Logging/diagnostics |
anyhow | Application errors |
thiserror | Library errors |
For detailed async patterns, unsafe code guidelines, WebAssembly compilation, embedded development, and advanced debugging, see REFERENCE.md.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.