rust-idioms

Guides Rust implementation, review, and modernization against edition and MSRV constraints.

Updated Jul 4, 2023
One-click install
npx skills add https://github.com/kohdice/dotfiles --skill rust-idioms-kohdice
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rust-idioms
Source: https://github.com/kohdice/dotfiles/tree/main/config/agents/skills/rust-idioms
Command: npx skills add https://github.com/kohdice/dotfiles --skill rust-idioms-kohdice

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Rust code recommendations often ignore the project's declared edition and minimum supported Rust version, producing suggestions the compiler rejects or that break MSRV guarantees. This Skill resolves the project baseline first and grounds every idiom in official Rust sources. ## Core Features & Use Cases - Baseline Resolution: Reads Cargo.toml, workspace package fields, and rust-toolchain files to determine the exact edition and MSRV before writing or reviewing code. - Version-Tagged Idiom Catalog: Applies a catalog of modern idioms from Rust 1.65 through 1.98, gating each recommendation on the resolved MSRV and edition. - Structured Review Reports: Produces findings tagged [error], [warn], [recommend], or [gated-option], each citing the stabilizing Rust version or official guideline. - Use Case: When reviewing a crate pinned to Rust 1.75 on edition 2021, the Skill flags let chains as a gated option requiring 1.88 and edition 2024 instead of proposing them as a direct fix. ## Quick Start Review this Rust crate for idiomatic improvements while respecting its declared edition and MSRV.

Frequently Asked Questions about rust-idioms

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I modernize Rust code without breaking MSRV?▼

Resolve the crate's rust-version and edition from Cargo.toml first, then apply only idioms stabilized at or before that MSRV. Features stabilized later are presented as gated options labeled with the required Rust version, never as direct fixes.

How to review Rust code for edition 2024 compatibility?▼

Check for edition 2024 semantics: explicit unsafe blocks inside unsafe fn, #[unsafe(no_mangle)] attributes, unsafe extern blocks, disallowed static mut references, and changed temporary lifetimes in if let conditions. Each finding cites the applicable edition rule.

Which Rust dependencies can be replaced by std library features?▼

lazy_static and once_cell map to OnceLock (1.70) or LazyLock (1.80), cfg-if to cfg_select! (1.95), async-trait to native async fn in traits (1.75), and assert_matches to std macros (1.96), subject to the project MSRV.

Does the idiom catalog cover the latest Rust release?▼

The catalog is verified against official sources up to Rust 1.98. If the resolved MSRV or pinned toolchain is newer, the Skill checks release notes for newer stabilizations and flags that the catalog needs updating.

What happens when Rust documentation sources are unreachable?▼

The Skill tries at most one alternate route, then degrades gracefully: it prefers constructs with catalog-listed versions or labels recommendations as unverified with the assumed stabilizing version, never blocking the deliverable.