cargo-modernize
AGENTS.md0 starsChanged 4 days agoApache-2.0View on GitHub
cargo-modernize is a standalone Rust workspace modernization knowledge catalog, AI agent skill, and fast read-only CLI scanner. Run all four checks before completing any change: For catalog or rule edits, also run:
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,266 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository12 other files it gives its agents.
- 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
- rust-modern-guidelinesSkill
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Language & License: All code, diagnostics, documentation, comments, and rule explanations are written in English.
- Distinctive: line 22
Run all four checks before completing any change:
- Very specific: line 41
Do not commit untracked local scratch directories or ignored paths (specs/, target/).
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md 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
Development Guidelines (AGENTS.md)
cargo-modernize is a standalone Rust workspace modernization knowledge catalog, AI agent skill, and fast read-only CLI scanner.
Workspace Structure
catalog(cargo-modernize-catalog) — zero-runtime-dependency#![no_std]data crate (rust-version = "1.85") packaging build-time pre-digested release inventories (catalog/inventory/), declarativeC1/C3/C4rule passports (catalog/entries/), triage records (catalog/triage.toml), manifest/text rules, and paired compilable fixtures (catalog/fixtures/) inside its own manifest root socargo packageandcargo installare self-contained.crates/cargo-modernize-core— internal workspace engine crate poweringcargo-modernize: inventory & passport schemas, exclusive lossless AST adapter overra_ap_syntax/ra_ap_parser, Ruff-model pure Rust CST rules organized by domain (rules/{control_flow,option_result,collections,str_bytes,io_fs_path,num_time,lazy_lock,mem_sync_ffi,syntax_macros}.rs), compact suggestion & validation SDK (sugg.rs), conflict resolver, import scope resolver,guidelinesindex,explain/whytracer, and workspace/VCS/filter passes. Never installs global process hooks (std::panic::set_hook) on its own.crates/cargo-modernize—cargo modernizestandalone CLI subcommand: argument parsing, silent worker panic hook installation,guidelines list, multi-IDexplain,why, report rendering (text,compact,github,json),--write-keep,--check, and exit code mapping (0/1/2).xtask— internal maintainer tooling (publish = false):cargo xtask inventory(extracting release inventories fromrust-lang/rustusingra_ap_mbe),check-catalog(disk verification +rustccompilation of paired fixtures),export-clippy-candidates(local Markdown export ofC4rules), andstress-ui(parser/engine stress testing).
Toolchain & Dependency Constraints
- Build MSRV & Binary Distribution: Build MSRV is Rust
1.98(edition = "2024"), tracking pinnedra_ap_*parser crates (catalogindependently keepsrust-version = "1.85"with zero runtime dependencies). Note thatcargo-modernizeanalyzes user projects targeting any Rust version (1.56+) and any edition (2015–2024); prebuilt binaries (cargo-binstall, GitHub Releases) are the primary distribution channel for users running older Rust toolchains. - Pinned Parser Crates:
ra_ap_syntaxandra_ap_parser(=0.0.352) plusrowan(=0.17.0) are pinned with exact=versions and accessed exclusively through the thin adapter module (crates/cargo-modernize-core/src/syntax_adapter.rs). Update parser versions only once per Rust release alongside full fixture execution. - Dependency Boundary:
ra_ap_mbe,ra_ap_syntax-bridge,ra_ap_tt, andsalsabelong strictly toxtaskand must never be added tocargo-modernize-catalog,cargo-modernize-core, orcargo-modernize. - Unwind Safety: Profiles keep
panic = "unwind"so unexpected parser or detector panics on malformed third-party files can be caught bycatch_unwindand reported in the run summary without aborting the workspace scan; only the CLI binary (cargo-modernize) installs a silent panic hook. - Language & License: All code, diagnostics, documentation, comments, and rule explanations are written in English. Dual-licensed under
MIT OR Apache-2.0.
Required Verification Commands
Run all four checks before completing any change:
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
cargo xtask --helpFor catalog or rule edits, also run:
cargo xtask check-catalogCatalog Authoring Principles
- Derive rules strictly from primary upstream sources (
catalog/inventory/*.toml,rust-lang/rustlibrary/bodies and dogfooding diffs,RELEASES.md, and the Rust Edition Guide) and open-source corpus evidence. - Every catalog entry must carry explicit
class(c1/c3/c4),impact,track,requires,confidence,status,default,behavior, andsemvermetadata. Every executablerust-astrule must have a 1-to-1RuleSpecincrates/cargo-modernize-core/src/rules/plus compilable<id>.rs(and<id>.fixed.rswhen emitting replacements) fixtures with both positive (//~ <id>) and negative twin cases. - Do not commit untracked local scratch directories or ignored paths (
specs/,target/).
Agent Skills
Engineering skills live in .agents/skills/ (.claude/skills is a symlink to it). The canonical user-facing rust-modern-guidelines skill lives in skills/rust-modern-guidelines/SKILL.md (symlinked into .agents/skills/rust-modern-guidelines for local development and packaged via .claude-plugin/, .agents/plugins/, and plugin.json). Maintainer skills in .agents/skills/ are adapted from Dankosik/rust-service-template-rest under the MIT license kept in each skill directory:
rust-modern-guidelines— two-stepcargo modernize guidelines list->explain+--diffmodernization workflow.rust-coder— writing or changing Rust code.rust-idiomatic— types, signatures, trait impls, conversions, ownership.rust-structural-quality— adding modules, traits, helpers, or deciding placement.rust-errors— error types, failure mapping, exit codes, panic isolation.rust-testing— writing or reviewing tests and rule fixtures.rust-debugging— failing tests, wrong or missing findings, nondeterminism.rust-performance— scan time, memory, and allocation claims.rust-dependencies— adding or upgrading crates, features, toolchain, or edition.rust-security— untrusted workspace input, file writes, subprocesses, resource bounds.rust-verification— deciding what executed checks actually prove.thermo-nuclear-code-quality-review— user-invoked read-only simplification audit of a diff, crate, or directory.
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.

