Agents write plausible Rust that compiles after a few rounds, often by cloning everything, unwrapping on input and sprinkling allow attributes over clippy. This loadout sets the habits Rust reviewers expect: typed error enums with source(), anyhow only in binaries, cargo fmt, clippy with -D warnings and tests before reporting, unsafe only with approval and a SAFETY comment, and no edition, MSRV or major dependency bumps on the side. The skill's error example is compiled and tested by the verifier.
What's in it
- Done-gate: cargo fmt --check, clippy -D warnings, cargo test
- Typed error enums; no unwrap or panic on input-driven paths
- unsafe only with approval and a SAFETY comment
- No MSRV, edition or major version bumps as a side effect
- Stop and explain after two rounds against the borrow checker
You'll need
- Tools:
cargo
Verification
| Check | Result | What we found |
|---|---|---|
| Listinglisting.yaml matches the schema and declares every file in the folder. | Pass | Schema valid; 5 files declared, none missing or extra
|
| Files parseJSON parses; SKILL.md and .mdc front matter is valid YAML with the fields each agent needs; code fences are closed. | Pass | All 5 files parse; front matter valid |
| AdaptersCLAUDE.md imports @AGENTS.md, GEMINI.md imports @./AGENTS.md, and both match the generator. | Pass | CLAUDE.md and GEMINI.md import AGENTS.md and are up to date
|
| Install pathsEvery file lands where each agent documents it, with no collisions, and the laid-out project is re-discovered correctly. | Pass | Correct paths for all 6 agents; layouts re-discovered
|
| MCP configmcp.json is structurally valid, converts to each agent's format, declares no literal secrets, and referenced packages exist on npm/PyPI. | Not applicable | No MCP servers in this loadout |
| Safety scanThe intake scanner finds no credentials, risky shell, hidden Unicode or prompt-injection wording, and the listing's network flag is honest. | Pass | Clean: no credentials, risky shell or hidden text
|
| ReferencesLinks and file paths between the loadout's files resolve, including for each agent's installed layout. | Pass | 1 reference between files resolves for every agent |
| Size limitsFile count and sizes are within the submission limits; SKILL.md bodies stay under 500 lines. | Pass | 5 files, 6.2 KB total; largest skills/rust-change/references/errors.rs 2.6 KB
|
| LicenceA recognised SPDX licence, with the licence text available. | Pass | MIT, by Agent Loadout; text in the repository LICENSE |
| Starter buildA minimal fixture project with the loadout applied installs and builds or type-checks, and the loadout's own code examples compile. | Pass | The rust-change skill's typed error example compiles in a crate with forbid(unsafe_code) and its unit and doc tests pass offline; rustfmt and clippy -D warnings run where installed
|
What this means: a script checked the files themselves: they parse, they install where each agent looks, any MCP config is sound, the safety scan is clean, references between files resolve, and, where a free and repeatable fixture exists, a small starter project builds with the loadout applied. No AI agent was run. Per-agent results ("tested with agent") are separate and stay untested until an agent actually runs.
Install
Choose your agent. Run the commands from your project root, or download a zip already laid out in the right folders.
Claude Code reads CLAUDE.md (imports AGENTS.md with @AGENTS.md) and skills from .claude/skills/.
curl -fsSL --create-dirs -o AGENTS.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/AGENTS.md curl -fsSL --create-dirs -o CLAUDE.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/CLAUDE.md curl -fsSL --create-dirs -o .claude/skills/rust-change/SKILL.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/skills/rust-change/SKILL.md curl -fsSL --create-dirs -o .claude/skills/rust-change/references/errors.rs https://loadout.jnw-it.com/raw/rust-crate/1.0.0/skills/rust-change/references/errors.rs
| File | Goes to |
|---|---|
AGENTS.md | AGENTS.md |
CLAUDE.md | CLAUDE.md |
skills/rust-change/SKILL.md | .claude/skills/rust-change/SKILL.md |
skills/rust-change/references/errors.rs | .claude/skills/rust-change/references/errors.rs |
Already have an AGENTS.md or CLAUDE.md? The commands above overwrite it — download the file instead and merge the sections you want.
Codex CLI reads AGENTS.md and skills from .agents/skills/.
curl -fsSL --create-dirs -o AGENTS.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/AGENTS.md curl -fsSL --create-dirs -o .agents/skills/rust-change/SKILL.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/skills/rust-change/SKILL.md curl -fsSL --create-dirs -o .agents/skills/rust-change/references/errors.rs https://loadout.jnw-it.com/raw/rust-crate/1.0.0/skills/rust-change/references/errors.rs
| File | Goes to |
|---|---|
AGENTS.md | AGENTS.md |
skills/rust-change/SKILL.md | .agents/skills/rust-change/SKILL.md |
skills/rust-change/references/errors.rs | .agents/skills/rust-change/references/errors.rs |
Already have an AGENTS.md or CLAUDE.md? The commands above overwrite it — download the file instead and merge the sections you want.
Cursor reads AGENTS.md + .cursor/rules/*.mdc and skills from .agents/skills/.
curl -fsSL --create-dirs -o AGENTS.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/AGENTS.md curl -fsSL --create-dirs -o .agents/skills/rust-change/SKILL.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/skills/rust-change/SKILL.md curl -fsSL --create-dirs -o .agents/skills/rust-change/references/errors.rs https://loadout.jnw-it.com/raw/rust-crate/1.0.0/skills/rust-change/references/errors.rs
| File | Goes to |
|---|---|
AGENTS.md | AGENTS.md |
skills/rust-change/SKILL.md | .agents/skills/rust-change/SKILL.md |
skills/rust-change/references/errors.rs | .agents/skills/rust-change/references/errors.rs |
Already have an AGENTS.md or CLAUDE.md? The commands above overwrite it — download the file instead and merge the sections you want.
Gemini CLI reads GEMINI.md (imports AGENTS.md with @./AGENTS.md) and skills from .agents/skills/.
curl -fsSL --create-dirs -o AGENTS.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/AGENTS.md curl -fsSL --create-dirs -o GEMINI.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/GEMINI.md curl -fsSL --create-dirs -o .agents/skills/rust-change/SKILL.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/skills/rust-change/SKILL.md curl -fsSL --create-dirs -o .agents/skills/rust-change/references/errors.rs https://loadout.jnw-it.com/raw/rust-crate/1.0.0/skills/rust-change/references/errors.rs
| File | Goes to |
|---|---|
AGENTS.md | AGENTS.md |
GEMINI.md | GEMINI.md |
skills/rust-change/SKILL.md | .agents/skills/rust-change/SKILL.md |
skills/rust-change/references/errors.rs | .agents/skills/rust-change/references/errors.rs |
Already have an AGENTS.md or CLAUDE.md? The commands above overwrite it — download the file instead and merge the sections you want.
Antigravity CLI reads AGENTS.md (read natively; GEMINI.md is also read) and skills from .agents/skills/.
curl -fsSL --create-dirs -o AGENTS.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/AGENTS.md curl -fsSL --create-dirs -o .agents/skills/rust-change/SKILL.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/skills/rust-change/SKILL.md curl -fsSL --create-dirs -o .agents/skills/rust-change/references/errors.rs https://loadout.jnw-it.com/raw/rust-crate/1.0.0/skills/rust-change/references/errors.rs
| File | Goes to |
|---|---|
AGENTS.md | AGENTS.md |
skills/rust-change/SKILL.md | .agents/skills/rust-change/SKILL.md |
skills/rust-change/references/errors.rs | .agents/skills/rust-change/references/errors.rs |
Already have an AGENTS.md or CLAUDE.md? The commands above overwrite it — download the file instead and merge the sections you want.
GitHub Copilot reads AGENTS.md and skills from .agents/skills/.
curl -fsSL --create-dirs -o AGENTS.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/AGENTS.md curl -fsSL --create-dirs -o .agents/skills/rust-change/SKILL.md https://loadout.jnw-it.com/raw/rust-crate/1.0.0/skills/rust-change/SKILL.md curl -fsSL --create-dirs -o .agents/skills/rust-change/references/errors.rs https://loadout.jnw-it.com/raw/rust-crate/1.0.0/skills/rust-change/references/errors.rs
| File | Goes to |
|---|---|
AGENTS.md | AGENTS.md |
skills/rust-change/SKILL.md | .agents/skills/rust-change/SKILL.md |
skills/rust-change/references/errors.rs | .agents/skills/rust-change/references/errors.rs |
Already have an AGENTS.md or CLAUDE.md? The commands above overwrite it — download the file instead and merge the sections you want.
Files
Rules AGENTS.md Rust rules for errors, safety, dependencies and style. 29 lines
# AGENTS.md: Rust crate
Rust project built with Cargo. Read `Cargo.toml` for the edition and `rust-version` (MSRV) before using newer features.
## Commands
- Build: `cargo build`. Tests: `cargo test` (add `--all-features` if the crate has features).
- Format: `cargo fmt --all -- --check`. Lint: `cargo clippy --all-targets --all-features -- -D warnings`.
- Docs: `cargo doc --no-deps`. Dependency advisories, if installed: `cargo deny check` or `cargo audit`.
- Done means: fmt clean, clippy with no warnings, tests green. Do not silence a lint with `#[allow]` without a comment why.
## Errors
- Library code returns `Result<T, E>` with a typed error enum; no `unwrap()`, `expect()` or `panic!` on input-driven paths.
`expect("reason")` is fine for true invariants, with the reason saying why it cannot fail.
- Binaries may use `anyhow` for context (`.context("reading config")`). Libraries should not expose `anyhow::Error`.
- Use `?` to propagate. Add context at boundaries, not at every call.
## Safety and dependencies
- `unsafe` only with the human's approval and a `// SAFETY:` comment explaining the invariant. Prefer `#![forbid(unsafe_code)]`.
- Add dependencies with `cargo add <crate>`; check it is maintained and widely used. Keep default features off when you
only need a small part (`cargo add <crate> --no-default-features --features ...`).
- Never bump the MSRV, edition or a major dependency version as a side effect of another change.
## Style
- Borrow instead of clone; clone only where ownership is genuinely needed, and not to quiet the borrow checker.
If you fight the borrow checker for more than two attempts, stop and explain the ownership problem.
- Prefer iterators and `match` over index loops and nested `if let`. Keep functions short; name types after the domain.
- Public items get doc comments with an example where it helps; doc tests run with `cargo test`.
- Use the `rust-change` skill for any non-trivial change. Adapter CLAUDE.md Imports AGENTS.md for Claude Code. 10 lines
# CLAUDE.md
@AGENTS.md
## Claude Code notes
- Skills from this loadout live in `.claude/skills/`: `rust-change`. Use them when their description matches the task.
- Follow AGENTS.md above; where this file and AGENTS.md disagree, AGENTS.md wins.
<!-- From the Agent Loadout "Rust crate rules" v1.0.0 — https://loadout.jnw-it.com/loadouts/rust-crate/ --> Adapter GEMINI.md Imports AGENTS.md for Gemini CLI. 10 lines
# GEMINI.md
@./AGENTS.md
## Gemini CLI notes
- Skills from this loadout live in `.agents/skills/`: `rust-change`. Use them when their description matches the task.
- Follow AGENTS.md above; where this file and AGENTS.md disagree, AGENTS.md wins.
<!-- From the Agent Loadout "Rust crate rules" v1.0.0 — https://loadout.jnw-it.com/loadouts/rust-crate/ --> Skill skills/rust-change/SKILL.md Reviewable Rust change with the three gates. 16 lines
---
name: rust-change
description: Make a reviewable Rust change with typed errors, a failing test first for bugs, and fmt, clippy -D warnings and tests before reporting. Use for any non-trivial change to a Rust crate.
---
# Rust change
1. Read the module and its tests. Run `cargo test` once first so you know the baseline.
2. For a bug: write a failing test that reproduces it before touching the code.
3. Model errors as an enum like `references/errors.rs`: one variant per failure the caller can act on, `Display` written
for humans, `source()` returning the underlying error. `thiserror` is fine if the crate already uses it.
4. Make the change. Keep public API changes out unless asked; if unavoidable, list them in your report.
5. Run, in order: `cargo fmt --all`, `cargo clippy --all-targets --all-features -- -D warnings`, `cargo test`.
Fix every clippy warning you introduced. Do not add `#[allow(...)]` to pass.
6. Report: what changed, tests added, and the three command results. Skill file skills/rust-change/references/errors.rs Typed error enum with Display, source() and tests. 86 lines
//! Typed error pattern without extra dependencies. Callers can match on the variant; humans get a clear message.
//! When copying, change `fixture_crate::errors` in the doc test to your crate and module path.
use std::fmt;
use std::num::ParseIntError;
#[derive(Debug, PartialEq)]
pub enum ConfigError {
/// A required key is missing.
Missing(&'static str),
/// A value could not be parsed.
BadNumber { key: &'static str, source: ParseIntError },
/// A value is outside the allowed range.
OutOfRange { key: &'static str, value: u32, max: u32 },
}
impl fmt::Display for ConfigError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Missing(key) => write!(f, "missing required setting `{key}`"),
Self::BadNumber { key, .. } => write!(f, "setting `{key}` is not a whole number"),
Self::OutOfRange { key, value, max } => write!(f, "setting `{key}` is {value}, the maximum is {max}"),
}
}
}
impl std::error::Error for ConfigError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Self::BadNumber { source, .. } => Some(source),
_ => None,
}
}
}
/// Reads the worker count from `key=value` lines.
///
/// ```
/// # use fixture_crate::errors::workers;
/// assert_eq!(workers("workers=4"), Ok(4));
/// ```
pub fn workers(config: &str) -> Result<u32, ConfigError> {
const KEY: &str = "workers";
const MAX: u32 = 64;
let raw = config
.lines()
.filter_map(|line| line.split_once('='))
.find(|(k, _)| k.trim() == KEY)
.map(|(_, v)| v.trim())
.ok_or(ConfigError::Missing(KEY))?;
let value: u32 = raw.parse().map_err(|source| ConfigError::BadNumber { key: KEY, source })?;
if value > MAX {
return Err(ConfigError::OutOfRange { key: KEY, value, max: MAX });
}
Ok(value)
}
#[cfg(test)]
mod tests {
use super::*;
use std::error::Error;
#[test]
fn reads_value() {
assert_eq!(workers("name=x\nworkers = 8\n"), Ok(8));
}
#[test]
fn missing_key() {
assert_eq!(workers("name=x"), Err(ConfigError::Missing("workers")));
}
#[test]
fn bad_number_keeps_source() {
let err = workers("workers=lots").unwrap_err();
assert!(matches!(err, ConfigError::BadNumber { .. }));
assert!(err.source().is_some());
assert_eq!(err.to_string(), "setting `workers` is not a whole number");
}
#[test]
fn out_of_range() {
assert_eq!(workers("workers=100"), Err(ConfigError::OutOfRange { key: "workers", value: 100, max: 64 }));
}
} All files: source zip · Licence MIT · By Agent Loadout · First listed
Credits
Public work that inspired this loadout. The wording here is our own; follow the links for the originals.
Installing and testing
How do I install Rust crate rules in Claude Code?
From your project root, put AGENTS.md, CLAUDE.md, skills/rust-change/SKILL.md at .claude/skills/rust-change/SKILL.md, skills/rust-change/references/errors.rs at .claude/skills/rust-change/references/errors.rs. The "Claude Code" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/rust-crate/claude-code.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.
How do I install Rust crate rules in Codex CLI?
From your project root, put AGENTS.md, skills/rust-change/SKILL.md at .agents/skills/rust-change/SKILL.md, skills/rust-change/references/errors.rs at .agents/skills/rust-change/references/errors.rs. The "Codex CLI" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/rust-crate/codex.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.
How do I install Rust crate rules in Cursor?
From your project root, put AGENTS.md, skills/rust-change/SKILL.md at .agents/skills/rust-change/SKILL.md, skills/rust-change/references/errors.rs at .agents/skills/rust-change/references/errors.rs. The "Cursor" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/rust-crate/cursor.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.
How do I install Rust crate rules in Gemini CLI?
From your project root, put AGENTS.md, GEMINI.md, skills/rust-change/SKILL.md at .agents/skills/rust-change/SKILL.md, skills/rust-change/references/errors.rs at .agents/skills/rust-change/references/errors.rs. The "Gemini CLI" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/rust-crate/gemini-cli.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.
How do I install Rust crate rules in Antigravity CLI?
From your project root, put AGENTS.md, skills/rust-change/SKILL.md at .agents/skills/rust-change/SKILL.md, skills/rust-change/references/errors.rs at .agents/skills/rust-change/references/errors.rs. The "Antigravity CLI" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/rust-crate/antigravity-cli.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.
How do I install Rust crate rules in GitHub Copilot?
From your project root, put AGENTS.md, skills/rust-change/SKILL.md at .agents/skills/rust-change/SKILL.md, skills/rust-change/references/errors.rs at .agents/skills/rust-change/references/errors.rs. The "GitHub Copilot" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/rust-crate/copilot.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.
Has Rust crate rules been tested?
It passed the Level 1 automated install checks on 2026-10-17: the files parse, install to each agent's documented paths, and pass the safety scan. No AI agent has run it yet, so no agent pass or fail is claimed.
More for Claude Code, Codex, Cursor, Gemini CLI, Antigravity CLI and GitHub Copilot.