원클릭으로
rust-best-practices
Guide for writing, refactoring, reviewing, optimizing, and documenting idiomatic Rust code on a Rust 1.97 stable baseline.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Guide for writing, refactoring, reviewing, optimizing, and documenting idiomatic Rust code on a Rust 1.97 stable baseline.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Create, update, refactor, audit, or align repository AGENTS.md guidance from repository evidence without adding language, tool, or dependency recommendations.
Design, patch, audit, or align Rust tests with evidence-based guidance for unit tests, integration/e2e tests, doctests, insta snapshots, compile-fail/UI tests, golden files, fixtures, property tests, fuzz tests, async/concurrency tests, unsafe-code validation, Criterion benchmarks, Cargo test semantics, Rust 1.97 test idioms, feature/target/MSRV matrices, flaky-test triage, coverage/mutation evidence, and focused validation.
Apply forward-only editing, documentation, and review rules for Rust crates or workspaces whose package or workspace version is below 1.0. Use when editing, reviewing, or documenting pre-1.0 Rust APIs, READMEs, AGENTS.md guidance, examples, release notes, migration text, or workflow docs: omit durable absent-surface negative prose such as "does not currently..." and avoid backward/legacy compatibility obligations, old API preservation, aliases, wrappers, or shims unless explicit repository policy or the user requires them.
| name | rust-best-practices |
| description | Guide for writing, refactoring, reviewing, optimizing, and documenting idiomatic Rust code on a Rust 1.97 stable baseline. |
Use this skill when the user asks for Rust code, Rust refactors, code review, performance review, error handling, documentation, API design, or lifecycle modeling.
Assume Rust 1.97 stable and edition 2024 unless the repository declares a
stricter MSRV or the user gives a different target. Respect existing
rust-toolchain.toml, CI, Cargo.toml, workspace lints, and public API stability
before introducing a Rust feature that would raise MSRV.
let PATTERN = expr else { ... }; for early returns where the fallback does
not need the failed value.? for straightforward error propagation, map_err for typed translation,
and inspect_err for local observability.core::range::{Range, RangeInclusive, RangeFrom} when a concrete stored
range needs to be Copy. For public APIs, prefer accepting
impl core::ops::RangeBounds<usize> unless the concrete range type is part of
the domain model.bit_width,
highest_one, lowest_one, isolate_highest_one, and
isolate_lowest_one when they express the domain more directly than manual
shifts and masks.char associated items such as char::from_u32 and
char::REPLACEMENT_CHARACTER; Rust 1.97 deprecates the corresponding
std::char module functions and constants.&str, &[T], &T) for read-only APIs. Take ownership only
when the function stores, transforms, or consumes the value.impl Trait for single-use input polymorphism. Use named generics when
two parameters or a return value must share the same type.dyn Trait.bon for builders. Do not hand-roll type-state builders for ordinary
construction.statum for real lifecycle or protocol type-state. Do not use type-state as
a generic replacement for builders or enums.Read only the chapters relevant to the task. For broad reviews or refactors, read several relevant chapters together before giving feedback.