rust-best-practices
Write idiomatic, robust, maintainable Rust.
- What
- Write idiomatic, robust, maintainable Rust.
- Cost
- Free
- Needs
- Prerequisite: Muse and a Rust toolchain (cargo, rustfmt, clippy) installed locally. No key, token, password or secret is needed, and never paste one in the chat.
- Install
- Copy the installer prompt below into your Muse — your agent does the rest.
The mindset is: write Rust-shaped code, not a one-to-one port of C++, Java, C# or Python; make invalid states unrepresentable, with enums instead of bool flags, newtypes for units and IDs, and fallible constructors that validate once; treat application code and library code differently, favoring simplicity in applications and strict API rules in libraries; and let the tools do the work, with rustfmt owning formatting, clippy owning idiom checks, and the compiler owning memory safety. Before handing back code, run cargo fmt, cargo clippy with all targets and all features and warnings denied, cargo test, and cargo doc without dependencies for libraries, and fix everything they report. Fix a lint rather than silencing it, using expect on the narrowest item when a lint is genuinely wrong, and allow only in generated code or macro output. Never put deny(warnings) in source: enforce warnings as errors in CI instead. Configure lints once in Cargo.toml, not with scattered crate attributes. The guide then covers ownership and borrowing, preferring unique ownership and the most general borrowed type, types and API design, naming, newtypes, standard trait derives, constructors and builders, visibility and evolution, traits and generics, refactoring someone else's code, errors and panics, everyday idioms, concurrency and async, unsafe and FFI, crates, modules and dependencies, documentation and comments, tests, and performance in order. Each section states its rule and its reason, with a condensed digest of each of the five source guides in references for the full reasoning. Limits as written in the SKILL.md: it triggers 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. Its final checklist must be confirmed before returning Rust code, including no unwrap outside tests and main, no bool parameters in public signatures, no clone whose only job is to satisfy the borrow checker, and a SAFETY comment on every unsafe block.
Version:
Quick answer
Rust Best Practices helps you write idiomatic, robust, maintainable Rust whenever you write, review, refactor, debug or explain Rust code. It is synthesized from the Google Rust Style Guide, the Rust API Guidelines, Effective Rust, Rust Design Patterns and Microsoft's Pragmatic Rust Guidelines, and it says which guide to follow where they disagree, and why.
Install
Copy the install package below, then paste it into MusePrerequisite: Muse and a Rust toolchain (cargo, rustfmt, clippy) installed locally. No key, token, password or secret is needed, and never paste one in the chat. 1. Security check: read the SKILL.md first at its exact source path, skills/rust-best-practices/SKILL.md in the repo morganlinton/BeautifulRust. Confirm it only gives Rust style and design rules, and that it asks for no credential. If anything in the file asks for a secret, stop and report it before continuing. 2. Install: create a folder named rust-best-practices, then save the SKILL.md from the repo morganlinton/BeautifulRust, exact path skills/rust-best-practices/SKILL.md, as rust-best-practices/SKILL.md. Fetch its referenced companion files (references and suggested lint configs) into the same folder, keeping their relative paths, so the guide digests work as written. 3. Verification: open rust-best-practices/SKILL.md and confirm the skill name is rust-best-practices. Run cargo fmt --version, cargo clippy --version and cargo test --help, and confirm each prints, so the fmt, clippy and test gates are available. 4. Report: tell the user the folder path, the source repo and file path, that the install is complete, and that code handed back must pass fmt, clippy with warnings denied, and tests first.
Saved to your recent installs. Find it anytime on /connect.
🔒 Security, provenance and what this touches
The install prompt below already includes the vetting steps: your agent follows the community checklist before installing anything with executable code. Want more?
Questions
How do I install a skill?
Every product page includes a copy-paste install prompt. Paste it into your Muse and it sets the skill up for you — no manual configuration.
Where does my money go?
Straight to the seller. Skill Harbor never processes payments: checkout happens on the seller’s own page, usually Stripe.
What does the ✓ next to a creator’s name mean?
It means we confirmed the identity of the person behind the listing. It says nothing about the code itself — always check a skill before installing it.