Rust Anti Pattern
Rust anti-patterns and common mistakes expert. Handles code review issues with clone abuse, unwrap in production, String misuse, index loops, and refactoring guidance.
Install
npx skills add huiali/rust-skills --skill rust-anti-patterngit clone --depth 1 https://github.com/huiali/rust-skills.git /tmp/rust-skills
mkdir -p ~/.claude/skills
cp -r /tmp/rust-skills/.codex/skills/rust-anti-pattern ~/.claude/skills/rust-anti-patternPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
## Top 5 Beginner Mistakes
| Rank | Mistake | Correct Approach |
|------|---------|------------------|
| 1 | Using `.clone()` to escape borrow checker | Use references |
| 2 | Using `.unwrap()` in production code | Use `?` or `with_context()` |
| 3 | Everything is `String` | Use `&str`, `Cow<str>` when needed |
| 4 | Index-based loops | Use iterators `.iter()`, `.enumerate()` |
| 5 | Fighting lifetimes | Redesign data structure |
## Common Anti-Patterns
### Anti-Pattern 1: Clone Everywhere
```rust
// ❌ Bad: escaping borrow checker
fn process(user: User) {
let name = user.name.clone(); // Why clone?
// ...
}
// ✅ Good: use references
fn process(user: &User) {
let name = &user.name; // Just borrow
}
```
**When clone is actually needed:**
- Truly need independent copy
- API design requires owned value
- Data flow requirements
### Anti-Pattern 2: Unwrap in Production
```rust
// ❌ Bad: may panic
let config = File::open("config.json").unwrap();
// ✅ Good: propagate error
let config = File::open("config.json")?;
// ✅ Good: with context
let config = File::open("config.json")
.context("failed to open config")?;
```
### Anti-Pattern 3: String Everywhere
```rust
// ❌ Bad: unnecessary allocation
fn greet(name: String) {
println!("Hello, {}", name);
}
// ✅ Good: borrow is enough
fn greet(name: &str) {
println!("Hello, {}", name);
}
// When String is actually needed: ownership or mutation required
```
### Anti-Pattern 4: Index LoopsDetails
- Skill name
rust-anti-pattern- Repository
- huiali/rust-skills
- Path
.codex/skills/rust-anti-pattern/SKILL.md- License
- MIT
- Repo updated
- 9 February 2026
FAQ
What does the Rust Anti Pattern skill do?
Rust anti-patterns and common mistakes expert. Handles code review issues with clone abuse, unwrap in production, String misuse, index loops, and refactoring guidance.
How do I install the Rust Anti Pattern skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add huiali/rust-skills --skill rust-anti-pattern. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Rust Anti Pattern popular?
It lives in huiali/rust-skills, which has 49 GitHub stars and 7 forks.
Related skills
Rust Actor
49huiali/rust-skills
Actor model expert covering message passing, state isolation, supervision trees, deadlock prevention, fault tolerance, Actix framework, and Erlang-style concurrency patterns.
Rust Async
49huiali/rust-skills
Advanced async patterns expert. Handles Stream processing, backpressure control, select/join operations, cancellation, Future trait implementation, and async runtime optimization.
Rust Async Pattern
49huiali/rust-skills
Advanced async patterns expert covering Stream implementation, zero-copy buffers, tokio::spawn lifetimes, plugin system scheduling, tonic streaming, and async lifetime management.
Rust
48martinholovsky/claude-skills-generator
Systems programming expertise for Tauri desktop application backend development with memory safety and performance optimization
Rust Auth
49huiali/rust-skills
Authentication and authorization expert covering JWT, API keys, OAuth, RBAC, password hashing, distributed token storage, and session management patterns.
Rabbitmq Expert
48martinholovsky/claude-skills-generator
Expert RabbitMQ administrator and developer specializing in message broker architecture, exchange patterns, clustering, high availability, and production monitoring. Use when designing message queue systems, implementing pub/sub patterns, troubleshooting RabbitMQ clusters, or optimizing message throughput and reliability.
Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.