179 Rust rules your AI coding agent can use to write better code.
Works with Claude Code, Cursor, Windsurf, Copilot, Codex, Aider, Zed, Amp, Cline, and pretty much any other agent that supports skills.
npx add-skill leonardomso/rust-skillsThat's it. The CLI figures out which agents you have and installs the skill to the right place.
After installing, just ask your agent:
/rust-skills review this function
/rust-skills is my error handling idiomatic?
/rust-skills check for memory issues
The agent loads the relevant rules and applies them to your code.
179 rules split into 14 categories:
| Category | Rules | What it covers |
|---|---|---|
| Ownership & Borrowing | 12 | When to borrow vs clone, Arc/Rc, lifetimes |
| Error Handling | 12 | thiserror for libs, anyhow for apps, the ? operator |
| Memory | 15 | SmallVec, arenas, avoiding allocations |
| API Design | 15 | Builder pattern, newtypes, sealed traits |
| Async | 15 | Tokio patterns, channels, spawn_blocking |
| Optimization | 12 | LTO, inlining, PGO, SIMD |
| Naming | 16 | Following Rust API Guidelines |
| Type Safety | 10 | Newtypes, parse don't validate |
| Testing | 13 | Proptest, mockall, criterion |
| Docs | 11 | Doc examples, intra-doc links |
| Performance | 11 | Iterators, entry API, collect patterns |
| Project Structure | 11 | Workspaces, module layout |
| Linting | 11 | Clippy config, CI setup |
| Anti-patterns | 15 | Common mistakes and how to fix them |
Each rule has:
- Why it matters
- Bad code example
- Good code example
- Links to official docs when relevant
If add-skill doesn't work for your setup, here's how to install manually:
Claude Code
Global (applies to all projects):
git clone https://github.com/leonardomso/rust-skills.git ~/.claude/skills/rust-skillsOr just for one project:
git clone https://github.com/leonardomso/rust-skills.git .claude/skills/rust-skillsOpenCode
git clone https://github.com/leonardomso/rust-skills.git .opencode/skills/rust-skillsCursor
git clone https://github.com/leonardomso/rust-skills.git .cursor/skills/rust-skillsOr just grab the skill file:
curl -o .cursorrules https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.mdWindsurf
mkdir -p .windsurf/rules
curl -o .windsurf/rules/rust-skills.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.mdOpenAI Codex
git clone https://github.com/leonardomso/rust-skills.git .codex/skills/rust-skillsOr use the AGENTS.md standard:
curl -o AGENTS.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.mdGitHub Copilot
mkdir -p .github
curl -o .github/copilot-instructions.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.mdAider
Add to .aider.conf.yml:
read: path/to/rust-skills/SKILL.mdOr pass it directly:
aider --read path/to/rust-skills/SKILL.mdZed
curl -o AGENTS.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.mdAmp
git clone https://github.com/leonardomso/rust-skills.git .agents/skills/rust-skillsCline / Roo Code
mkdir -p .clinerules
curl -o .clinerules/rust-skills.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.mdOther agents (AGENTS.md)
If your agent supports the AGENTS.md standard:
curl -o AGENTS.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.mdSee SKILL.md for the full list with links to each rule file.
- Rust API Guidelines
- Rust Performance Book
- Rust Design Patterns
- Real code from ripgrep, tokio, serde, polars, axum
- Clippy docs
PRs welcome. Just follow the format of existing rules.
MIT