All skills
massimodeluisa avatar

/rust-best-practices

@d521b51

Write and review production Rust using the official API Guidelines, Style Guide, and this engineering standard: allocation contracts, ownership, Result vs panic, debug_assert, Clippy, tests, rustdoc, unsafe, and Cargo CI. Use when writing, reviewing, or refactoring Rust; choosing borrow vs clone; designing crate APIs; handling errors; bounding heap use; configuring clippy or rustfmt; or when the user runs /rust-best-practices. Do not use for other languages. Triggers: rust, rustc, cargo, clippy, rustfmt, ownership, clone, borrow, Result, unwrap, expect, panic, thiserror, anyhow, heapless, no_std, allocation, debug_assert, type-state, Send, Sync, unsafe, FFI, rustdoc, MSRV, rust-best-practices, rust style, rust guidelines

Use this Skill: https://skilld.dev/gh/massimodeluisa/rust-best-practices-skill/rust-best-practices

This session only. Nothing lands on disk.

referencesofficial.md

≈2.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Official Rust documentation

Cite the live page. Fetch it when the task needs current syntax, lint names, or checklist text. Do not invent APIs, lint ids, or rustdoc section names from memory.

Open first

Need Page
Formatting, imports, naming in source Style Guide
Public crate API shape API Guidelines and the checklist
Language and std The Book, Reference, Rust by Example, std
Editions Edition Guide
Unsafe Nomicon, Reference: unsafety
Tooling Cargo book, rustdoc, Clippy, rustfmt
no_std / heap #![no_std], core, alloc
Asserts debug_assert!, assert!
Formatting without String format_args!
In-place slice algorithms slice (sort_unstable*, select_nth_unstable*)
Profiles Cargo profiles
Clippy config Clippy configuration, lint configuration, lint index
rustdoc lints rustdoc lints

Language site: https://www.rust-lang.org/. Logo and trademark: rust-artwork, trademark policy.

API Guidelines checklist

Treat as the default for public crates. Quote the C-* id in review. Full text: checklist.

Area Ids
Naming C-CASE, C-CONV, C-GETTER, C-ITER, C-ITER-TY, C-FEATURE, C-WORD-ORDER
Interoperability C-COMMON-TRAITS, C-CONV-TRAITS, C-COLLECT, C-SERDE, C-SEND-SYNC, C-GOOD-ERR, C-NUM-FMT, C-RW-VALUE
Macros C-EVOCATIVE, C-MACRO-ATTR, C-ANYWHERE, C-MACRO-VIS, C-MACRO-TY
Documentation C-CRATE-DOC, C-EXAMPLE, C-QUESTION-MARK, C-FAILURE, C-LINK, C-METADATA, C-RELNOTES, C-HIDDEN
Predictability C-SMART-PTR, C-CONV-SPECIFIC, C-METHOD, C-NO-OUT, C-OVERLOAD, C-DEREF, C-CTOR
Flexibility C-INTERMEDIATE, C-CALLER-CONTROL, C-GENERIC, C-OBJECT
Type safety C-NEWTYPE, C-CUSTOM-TYPE, C-BITFLAG, C-BUILDER
Dependability C-VALIDATE, C-DTOR-FAIL, C-DTOR-BLOCK
Debuggability C-DEBUG, C-DEBUG-NONEMPTY
Future proofing C-SEALED, C-STRUCT-PRIVATE, C-NEWTYPE-HIDE, C-STRUCT-BOUNDS
Necessities C-STABLE, C-PERMISSIVE

C-NO-OUT and caller-owned buffers. Return values from ordinary library APIs. When the memory profile is heapless or allocation-free, caller-owned output and scratch slices are the contract (C-CALLER-CONTROL), not a Vec return.

Style Guide (source formatting)

Style Guide owns whitespace, wrapping, imports, and punctuation. rustfmt is the mechanical enforcer. Do not spend review time on formatting rustfmt already owns. Manual decisions stay on naming, module shape, visibility, API semantics, and control flow.

Import order when rustfmt is configured for it: std/core/alloc, then external crates, then workspace crates, then super/crate. Details: quality.md.

Source: SKILL.md on GitHub

No alerts15d3 checks · Risk SAFE
  • Gen Agent Trust Hub15d

    The skill provides a comprehensive set of Rust engineering standards and best practices for writing and reviewing code. It covers memory allocation, API design, error handling, and performance optimization. No malicious behavior or security risks were identified.

  • Socket15d

    No alerts

  • Snyk15d

    Risk: LOW · No issues

Signed by skilld at d521b51. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 2 weeks ago
Other metadata
metadata
{
  "author": "massimodeluisa",
  "version": "1.0.0",
  "website": "https://www.rust-lang.org/"
}

README badge

README badge for massimodeluisa/rust-best-practices-skill