Skills for Real Engineers. Straight from my .agents directory.
rust-best-practices
Agent skill frommorganlinton/BeautifulRust
Write idiomatic, robust, maintainable Rust. Use this skill whenever you write, review, refactor, debug, or explain Rust code: new crates, modules, functions, structs, traits, error types, async code, unsafe or FFI code, Cargo.toml, tests, or rustdoc. Trigger on any mention of Rust, cargo, crates, .rs files, the borrow checker, lifetimes, traits, clippy, or rustfmt, even when the user does not ask for "best practices" or "idiomatic" code. Synthesized from the Google Rust Style Guide, the Rust API Guidelines, Effective Rust, Rust Design Patterns, and Microsoft's Pragmatic Rust Guidelines.
How to install rust-best-practices
npx skills add morganlinton/BeautifulRust# or add only this skill to Claude Code: copy the folder
skills/rust-best-practices/
# into
~/.claude/skills/rust-best-practices/ (all projects)
.claude/skills/rust-best-practices/ (one project)
1# Rust best practices23Distilled from five Rust style and design guides, with a digest of each in `references/`.4Where they disagree, this file says which to follow and why.56## 1. Mindset78- **Write Rust-shaped code.** Don't port C++, Java, C#, or Python constructs one-to-one.9 Model errors with `Result`, resources with ownership and `Drop`, polymorphism with10 traits and enums, and nullability with `Option`. Inheritance-flavored tricks (`Deref` to11 a "base" struct, `Manager`/`Factory` types, `throw_if_null` helpers) are smells.12- **Make invalid states unrepresentable.** Push invariants into types: enums instead of13 bool flags and "must be X if Y" comments, newtypes for units and IDs, fallible14 constructors that validate once. Then the compiler enforces what a comment only requests.15- **Application code is not library code.** Library code (anything with external users)16 follows the API-design rules below strictly. Application code should favor simplicity17 and directness: concrete types, `String` or `&str` rather than `impl Into<String>`18 parameters, `anyhow`-style errors, `Vec` return values, no speculative generality.19- **Let the tools do the work.** rustfmt owns formatting, clippy owns idiom checks, the20 compiler owns memory safety. Spend your attention on design.2122## 2. Before you hand back code2324Run these and fix everything they report:2526```bash27cargo fmt28cargo clippy --all-targets --all-features -- -D warnings29cargo test30…
Excerpt shown under the repository's MIT license.
More skills in BeautifulRust
Similar skill repositories
An agentic skills framework & software development methodology that works.
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
Public repository for Agent Skills
Makes your AI agent think like the laziest senior dev in the room. The best code is the code you never wrote.
An AI skill that provides design intelligence for building professional UI/UX across multiple platforms.
