Rust Best Practices

Steers Rust code toward idiomatic error handling, borrowing, iterators, and async patterns

Tested · Works

Test report

Verdict
Tested · Works
Score
8.8/10
Tested
Jul 31, 2026
Environment
Claude Code 2.x (agent harness)
Upstream re-checked
Aug 10, 2026 · 0450842

Fetched SKILL.md raw (HTTP 200); frontmatter parses with name+description and allowed-tools. Body is fully self-contained — no file/script references to spot-check, no security smells (no curl|sh, base64, exfiltration, or injection text), no hardcoded paths. Trigger phrasings — SHOULD (all judged load): "fix this borrow checker error in my Rust struct", "write an async tokio function to download files concurrently in Rust", "review my Rust crate's error handling and make it more idiomatic"; SHOULD NOT (both judged skip): "optimize my Python script's memory usage" (memory/optimize but not Rust), "explain the history of the Rust programming language" (Rust named but not writing/reviewing/optimizing code) — 5/5. Output test: wrote a get_port config parser two ways in /tmp scratchpad (baseline.rs, skill.rs). Baseline panics on malformed input (parts[1] index + parse().unwrap()) and silently returns 0 on missing port; skill version — following the body strictly — takes &str, returns Result<u16, ConfigError> via a thiserror enum, uses split_once/find_map iterators, no unwrap, and adds 3 #[cfg(test)] tests. Six concrete differences, each traceable to a skill rule. No rustc/cargo available so I did not compile (skill version uses thiserror); logic verified by tracing. Docs mostly accurate but the "Microsoft Pragmatic Rust Guidelines" attribution oversells generic idiomatic-Rust advice, costing one docs point.

Scored on four weighted criteria — install, triggering, output vs. baseline, docs. How scoring works

  • Installs cleanly 5/5
  • Triggers reliably 5/5
  • Output vs. baseline 8/10
  • Docs & honesty 4/5

What Rust Best Practices does

Guidance skill that steers Rust code toward idiomatic patterns: Result/thiserror error handling, borrowing over ownership, iterators, no unwrap, and cargo/clippy/tokio conventions. Triggers when writing, reviewing, or optimizing Rust code or dealing with lifetimes, the borrow checker, and async Rust.

How to install Rust Best Practices

git clone --depth 1 https://github.com/majiayu000/spellbook.git /tmp/rust-best-practices-src
mkdir -p ~/.claude/skills/rust-best-practices
cp /tmp/rust-best-practices-src/plugins/rust-dev/skills/rust-best-practices.SKILL.md ~/.claude/skills/rust-best-practices/SKILL.md
# NOTE: nonstandard layout in repo — the skill is a flat file `rust-best-practices.SKILL.md`
#       (not a directory), so the cp above renames it to SKILL.md at the correct path.
# Self-contained: no scripts, references, or external deps. Guidance-only skill.
# Plugin-marketplace alternative: the repo ships a `rust-dev` plugin
#   (plugins/rust-dev/.claude-plugin/plugin.json) that also bundles this skill.

Skills live in ~/.claude/skills/ (global) or .claude/skills/ (per-project). Restart Claude Code after installing.

Commands — how to trigger Rust Best Practices

  • /rust-best-practices Steers Rust code toward idiomatic error handling, borrowing, iterators, and async patterns

It also activates on plain-language prompts like these:

  • Review this Rust code for idiomatic patterns
  • Fix this borrow checker error in my function
  • Optimize this async Rust code for performance

Frequently asked questions

Is the Rust Best Practices skill free?
Yes. The skill itself is free from majiayu000/spellbook. SkillProof publishes the install command and an independent test verdict at no cost.
Does Rust Best Practices work with Claude Code?
We tested it with Claude Code 2.x (agent harness) on Jul 31, 2026. Verdict: Tested · Works. Fetched SKILL.md raw (HTTP 200); frontmatter parses with name+description and allowed-tools. Body is fully self-contained — no file/script references to spot-check, no security smells (no curl|sh, base64, exfiltration, or injection text), no hardcoded paths. Trigger phrasings — SHOULD (all judged load): "fix this borrow checker error in my Rust struct", "write an async tokio function to download files concurrently in Rust", "review my Rust crate's error handling and make it more idiomatic"; SHOULD NOT (both judged skip): "optimize my Python script's memory usage" (memory/optimize but not Rust), "explain the history of the Rust programming language" (Rust named but not writing/reviewing/optimizing code) — 5/5. Output test: wrote a get_port config parser two ways in /tmp scratchpad (baseline.rs, skill.rs). Baseline panics on malformed input (parts[1] index + parse().unwrap()) and silently returns 0 on missing port; skill version — following the body strictly — takes &str, returns Result<u16, ConfigError> via a thiserror enum, uses split_once/find_map iterators, no unwrap, and adds 3 #[cfg(test)] tests. Six concrete differences, each traceable to a skill rule. No rustc/cargo available so I did not compile (skill version uses thiserror); logic verified by tracing. Docs mostly accurate but the "Microsoft Pragmatic Rust Guidelines" attribution oversells generic idiomatic-Rust advice, costing one docs point.
What is the Rust Best Practices SkillProof Score?
8.8/10 — installs cleanly 5/5, triggers reliably 5/5, output vs. baseline 8/10, docs & honesty 4/5.
How do I install Rust Best Practices?
Copy the install command from this page, run it in your terminal, and restart Claude Code. Skills live in ~/.claude/skills/ (global) or .claude/skills/ inside a project.
Can I use Rust Best Practices with Cursor, Copilot, Gemini CLI, Codex or other AI tools?
The SKILL.md format is native to Claude (Claude Code, Desktop, claude.ai). The instructions inside adapt to other assistants: Cursor rules, GitHub Copilot instructions, Windsurf rules, Custom GPTs, AGENTS.md for OpenAI Codex, and GEMINI.md for Google Gemini CLI — our conversion guides cover each, and the free converter on the tools page does the wrapping for you.