rust-best-practices SKILL.md skillA

rust-best-practices from morganlinton/beautifulrust is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.

Install it, pinned
mdr add morganlinton/beautifulrust/rust-best-practices@git:20261030.3385ca7

Pins git:20261030.3385ca7 in mdr.lock. Pin the fingerprint instead.

Audit grade
A, 17 of 17 checks passed
Kind
SKILL.md skill
Repository
morganlinton/beautifulrust
Path
skills/rust-best-practices/SKILL.md
Versions recorded
8
Latest version
git:20261030.3385ca7, committed Oct 30, 2026
First version recorded
Oct 22, 2026
Size
29,732 bytes
Repository stars
1,637
License
MIT

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…

Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.

What the file says

# Rust best practices

Distilled from five Rust style and design guides, with a digest of each in `references/`.
Where they disagree, this file says which to follow and why.

## 1. Mindset

- **Write Rust-shaped code.** Don't port C++, Java, C#, or Python constructs one-to-one.
  Model errors with `Result`, resources with ownership and `Drop`, polymorphism with
  traits and enums, and nullability with `Option`. Inheritance-flavored tricks (`Deref` to
  a "base" struct, `Manager`/`Factory` types, `throw_if_null` helpers) are smells.
- **Make invalid states unrepresentable.** Push invariants into types: enums instead of
  bool flags and "must be X if Y" comments, newtypes for units and IDs, fallible
  constructors that validate once. Then the compiler enforces what a comment only requests.
- **Application code is not library code.** Library code (anything with external users)
  follows the API-design rules below strictly. Application code should favor simplicity
  and directness: concrete types, `String` or `&str` rather than `impl Into<String>`
  parameters, `anyhow`-style errors, `Vec` return values, no speculative generality.
…

Read the whole file at its exact version.

How to install

The exact contents, by fingerprint
mdr add morganlinton/beautifulrust/rust-best-practices@sha256:f9446430549a64d9

The line at the top of this page pins the label git:20261030.3385ca7, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.

Badge

mdr badge

[![mdr](https://markdownregistry.com/badge/art_tukr24o4ah4a5elk.svg)](https://markdownregistry.com/a/art_tukr24o4ah4a5elk)

1 badge image fetches in 30 days. What the badge shows.

Versions

The registry has recorded 8 versions of this file, between Oct 22, 2026 and Oct 30, 2026, about one every day.

versioncommittedcommitsizeaudit
git:20261030.3385ca7 latest2026-10-30 3385ca7 29,732 BA view · diff
git:20261028.9d48ef12026-10-28 9d48ef1 29,634 BA view · diff
git:20261027.58757ee2026-10-27 58757ee 29,638 BA view · diff
git:20261027.e20db6f2026-10-27 e20db6f 29,502 BA view · diff
git:20261026.a2b22682026-10-26 a2b2268 29,506 BA view · diff
git:20261025.ca5f1492026-10-25 ca5f149 29,948 BA view · diff
git:20261024.6b3a96c2026-10-24 6b3a96c 29,767 BA view · diff
git:20261022.681bc2e2026-10-22 681bc2e 28,617 BA view

Audit of the latest version

A  17 of 17 checks passed. Fixed automatic checks with no AI involved, so the same checks give the same answer every run.
  • pass: Frontmatter block present
  • pass: Frontmatter declares a name
  • pass: Frontmatter declares a description
  • pass: Size between 200 bytes and 200 KB (29732 bytes)
  • pass: No zero-width or bidi control characters
  • pass: No instruction hidden inside an HTML comment
  • pass: No link to an exfiltration or paste host
  • pass: No credential-shaped string
  • pass: No instruction to send local credentials anywhere
  • pass: No text hidden with inline styles
  • pass: No prompt-injection phrasing
  • pass: No curl or wget piped into a shell
  • pass: No recursive delete of root, home or parent
  • pass: No instruction to read or print local credentials
  • pass: No base64 blob over 200 characters
  • pass: No link to a raw IP address
  • pass: No script tag

Source

GitHub

morganlinton/beautifulrust · 1,637 stars · license MIT · pushed 2026-10-30 · branch main

API

GET https://markdownregistry.com/api/v1/artifacts/art_tukr24o4ah4a5elk
GET https://markdownregistry.com/api/v1/resolve?ref=morganlinton/beautifulrust/rust-best-practices
GET https://markdownregistry.com/api/v1/blob/f9446430549a64d9fb2d480c875c4920b1d98c2540b937bd41448200b2639f6a

Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.

Guides: the SKILL.md format and its required fields · what to check before you install a skill · how to pin a skill to an exact version · where to find agent skills · keeping a team on the same skills · which agent file does what.

More from morganlinton/beautifulrust

rust-port SKILL.md skill
morganlinton/beautifulrust · skills/rust-port/SKILL.md · Port code from C, C++, Python, Go, JavaScript, or TypeScript into idiomatic Rust that keeps the original behavior…
git:20261025.a3c06a2 · audit A · 1,637 stars
rust-review SKILL.md skill
morganlinton/beautifulrust · skills/rust-review/SKILL.md · Review existing Rust code for idiom, API design, error handling, safety, and maintainability, and produce a prioritized…
git:20261030.3385ca7 · audit A · 1,637 stars

Every file in morganlinton/beautifulrust

Other files named rust-best-practices

rust-best-practices SKILL.md skill
majiayu000/spellbook · skills/rust-best-practices/SKILL.md · Use when writing, modifying, or reviewing Rust code. ALWAYS invoke before Rust edits; covers Microsoft Pragmatic Rust…
git:20260605.9a7bea3 · audit A · 289 stars
rust-best-practices SKILL.md skill
ryo-ebata/cc-audit · .claude/skills/rust-best-practices/SKILL.md · Rust coding best practices for cc-audit development. Use when writing new Rust code, reviewing code, or refactoring…
git:20260128.b3d3d80 · audit A · 26 stars
rust-best-practices SKILL.md skill
kalarislabs/skill-doctor · skills/rust-best-practices/SKILL.md · Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook. Use this skill when: (1)…
v1.1.1 · audit A · 14 stars
rust-best-practices SKILL.md skill
adulari/forge · crates/forge-skills/builtin/rust-best-practices/SKILL.md · Write, review, or refactor Rust so it is idiomatic, safe, and maintainable. Use this skill whenever the task involves…
git:20260704.a5242bf · audit A · 11 stars
rust-best-practices SKILL.md skill
elaboration-studio/agentic-hub · .agents/skills/rust-best-practices/SKILL.md · Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook. Use this skill when: (1)…
v1.1.0 · audit A · 4 stars
rust-best-practices SKILL.md skill
sutchan/agent-skills-hub · skills/rust-best-practices/SKILL.md · 编写惯用 Rust 代码的最佳实践指南(基于 Apollo GraphQL 手册):编写新代码、审查/重构既有代码、借用与克隆/所有权取舍、Result 错误处理、性能优化、编写测试与文档时使用。
git:20261017.b913806 · audit A · 2 stars

Browse by kind, by grade A, or by owner.