rust-modern-guidelines
Skill0 starsChanged 4 days agoApache-2.0View on GitHub
Consults the version-accurate Rust modernization catalog (`cargo modernize guidelines` + `explain`) before writing or refactoring Rust code and verifies changed lines with `cargo modernize --diff` after editing.
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rust-coderSkill
- rust-debuggingSkill
- rust-dependenciesSkill
- rust-errorsSkill
- rust-idiomaticSkill
- rust-performanceSkill
- rust-securitySkill
- rust-structural-qualitySkill
- rust-testingSkill
- rust-verificationSkill
- thermo-nuclear-code-quality-reviewSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 0 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Use this two-step progressive-disclosure workflow whenever writing new Rust code, refactoring existing modules, or raising a crate's …
- Very specific: line 14
Run cargo modernize guidelines list inside the target workspace so cargo-modernize auto-detects the workspace MSRV and edition.
- Very specific: line 20
When migrating from an older MSRV or auditing recent releases, filter by release window (e.g., --since 1.80 or --since 1.88) instead of …
- Very specific: line 36
After making edits, run the fast read-only scanner on your diff (never touches the working tree or .git/index) — batch it in the same …
- Very specific: line 42
When reviewing or modernizing a PR branch against a base branch, scope strictly to the branch diff with cargo modernize --diff <base> …
- Very specific: line 43
If a site is intentionally kept in the older form, add a reasoned inline keep (// cargo-modernize: keep <rule-id> — <reason>) or record it …
- Very specific: line 44
If a rule did not fire where expected, inspect the exact rejection gate with cargo modernize why <rule-id> <file>:<line>.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rust Modern Guidelines (cargo-modernize)
Use this two-step progressive-disclosure workflow whenever writing new Rust code, refactoring existing modules, or raising a crate's rust-version / edition. It keeps context small while covering 100% of modernization knowledge — including both CST-detectable idioms (C1, C3) and type-dependent idioms (C4) that syntax-only scanners cannot auto-detect.
Requires the cargo-modernize CLI (cargo modernize --version). If it is not installed yet, suggest installing the prebuilt binary via cargo binstall cargo-modernize (works on any local Rust toolchain) or from GitHub Releases.
Step 1 — Load the Compact Index (Before Writing Code)
Run cargo modernize guidelines list inside the target workspace so cargo-modernize auto-detects the workspace MSRV and edition. Start with --impact high --format compact (or --since <1.NN>) to stay compact and avoid extra tool turns; omit --impact high only for full crate-wide modernization audits:
cargo modernize guidelines list --impact high --format compact- When migrating from an older MSRV or auditing recent releases, filter by release window (e.g.,
--since 1.80or--since 1.88) instead of loading all 1.64–1.100 entries. - For high-leverage architectural / type-wall idioms (
!(never-type),Allocator,core::range,#[expect], trait upcasting,extract_if,as_chunks, strict provenance,async fnin traits,core::error::Error), inspect--class c4 --impact high --format compact. - Machine-readable output is available via
--format json.
Step 2 — Pull Full Details in One Batched Call
Select the 3–8 guideline IDs relevant to the code you are about to write or review, then fetch all of their before/after examples, behavioral edge cases, const availability, SemVer notes, and upstream rustdoc links in a single batched call (avoid calling explain one ID at a time):
cargo modernize explain strip-circumfix map-or-default assert-matches drop-guardApply the modern forms directly while respecting each rule's When to keep old form and Behavioral differences notes.
Step 3 — Verify Changed Lines Once After Editing
After making edits, run the fast read-only scanner on your diff (never touches the working tree or .git/index) — batch it in the same verification shell command as cargo test / cargo clippy to minimize round-trips:
cargo modernize --diff --format compact- When reviewing or modernizing a PR branch against a base branch, scope strictly to the branch diff with
cargo modernize --diff <base> --format compact(e.g.,--diff main). - If a site is intentionally kept in the older form, add a reasoned inline keep (
// cargo-modernize: keep <rule-id> — <reason>) or record it in.cargo-modernize.toml. - If a rule did not fire where expected, inspect the exact rejection gate with
cargo modernize why <rule-id> <file>:<line>. - For CI enforcement, run
cargo modernize --diff origin/main --check(exits0clean,1findings,2error).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

