Agent Friendly Code

What to put in an AGENTS.md for a Rust repo

Cargo makes the commands the same everywhere, so the useful lines are the flags: which features CI builds, whether warnings fail it, and the oldest Rust you support. In a workspace, say what each crate is.

Which commands should it list?

  • cargo build --workspaceevery member; a virtual workspace root does this by default
  • cargo test -p <crate> <name>one crate, tests whose name contains <name>; doc tests run too
  • cargo clippy --all-targets -- -D warningsfails on any warning, rustc's included
  • cargo fmt --all -- --checkexits non-zero if anything is unformatted; settings in rustfmt.toml
  • cargo test --all-featurestests and Clippy build default features only unless told otherwise

Write them as your repo runs them, with its package manager and flags, plus how to run one test.

What layout should it explain?

  • The workspace members and what each crate is for; they share one Cargo.lock and target/.
  • rust-version (the MSRV) and any rust-toolchain.toml, which pins the toolchain and its components.
  • Shared versions in [workspace.dependencies], which members inherit with workspace = true.

What do agents get wrong?

  • Features must be additive: enabling one should never remove functionality.
  • Code must build on rust-version; Clippy's incompatible_msrv lint flags newer APIs.
  • Name the feature sets CI tests (default, --no-default-features, --all-features); a change can break one the agent never built.

From the official docs: doc.rust-lang.org/cargo-test.html (new tab) · doc.rust-lang.org/usage.html (new tab) · github.com/rustfmt (new tab) · doc.rust-lang.org/workspaces.html (new tab) · doc.rust-lang.org/features.html (new tab) · doc.rust-lang.org/rust-version.html (new tab) · rust-lang.github.io/overrides.html (new tab). The rest of the file is the same for any project: what goes in an AGENTS.md.

Rust repos with an AGENTS.md or CLAUDE.md (24)

24 of the 45 Rust repos on the leaderboard have an AGENTS.md or CLAUDE.md at the root, and 23 are long enough to pass the AGENTS.md check in full. Most-starred first; each file name links to the file.

Rust repos on the leaderboard with an AGENTS.md or CLAUDE.md
RepoFileLength
rustdesk/rustdeskAGENTS.md 18,208
rust-lang/rustAGENTS.md 13,839
denoland/denoCLAUDE.md 11,861
oven-sh/bunAGENTS.md 17,516
zed-industries/zedAGENTS.md 12,454
astral-sh/uvAGENTS.md 3,745
warpdotdev/warpAGENTS.md 19,737
meilisearch/meilisearchAGENTS.md 989
aaif-goose/gooseAGENTS.md 6,078
astral-sh/ruffAGENTS.md 20,201
nushell/nushellAGENTS.md 2,364
pnpm/pnpmAGENTS.md 33,872
qdrant/qdrantCLAUDE.md 5,588
h4ckf0r0day/obscuraAGENTS.md 10,387
surrealdb/surrealdbCLAUDE.md 6,080
nautechsystems/nautilus_traderAGENTS.md 5,349
vercel/turborepoAGENTS.md 2,364
chroma-core/chromaAGENTS.md 128
biomejs/biomeAGENTS.md 5,171
oxc-project/oxcAGENTS.md 15,226
risingwavelabs/risingwaveAGENTS.md 7,610
GreptimeTeam/greptimedbAGENTS.md 8,382
MaterializeInc/materializeAGENTS.md 8,331
krakenfx/kraken-cliAGENTS.md 39,417

More examples