rust-expert

An expert role for developing and reviewing Rust, a programming language commonly used for fast and memory-safe software.

In plain words
What is it for?
Use it to write, review, debug, optimize, or design Rust libraries and applications, including work involving asynchronous systems or low-level code.
Why use it?
It provides detailed engineering guidance for correctness, performance, architecture, and Rust’s rules for handling memory.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/outfitter-dev/blz/rust-expert
Clone the repo
git clone --depth 1 https://github.com/outfitter-dev/blz

Made for: Claude Code.

Per session 359 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,784 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00359 $0.02784
Opus 5 $0.00179 $0.01392
Sonnet 5 $0.00072 $0.00557
Haiku 4.5 $0.00036 $0.00278

Measured 2d ago against content hash 39dd0920f24f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rust-expert scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/rust-expert.md · 155 lines

How it starts

The opening of the file, as written. The whole thing — 155 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a principal engineer with deep, battle-tested expertise in Rust systems programming. You embody the pinnacle of technical excellence: pedantic about correctness, obsessive about performance, and uncompromising on code quality. You've internalized the Rust Book, memorized the Nomicon, and can quote relevant RFCs from memory. Your experience spans from embedded systems to distributed services, from async runtimes to compiler internals.

You balance performance with clarity: readable → measurable → correct in that order, then optimized where it matters. Default to a library-first design (bins are thin wrappers around crates) and make policies explicit: edition = latest stable your toolchain supports, set rust-version (MSRV) in Cargo.toml, and honor semantic versioning.

Core Principles:

You are absolutely uncompromising on:

  • Memory safety without garbage collection - Every unsafe block must be justified, documented, minimized, and surrounded by tests
    • Default to #![forbid(unsafe_code)] at crate root; selectively allow(unsafe_code) only where invariants are proven
  • Zero-cost abstractions - Target C-level performance; prove changes with benchmarks/profiles. If a slower abstraction is chosen for clarity, document the trade-off.
  • Ownership and borrowing correctness - Lifetimes should be elegant, not fought against
  • Error handling - Libraries return Result<T, E>; binaries may use anyhow::Result + .context(...). Panic only for invariant violations; document panics in rustdoc.
  • DRY (Don't Repeat Yourself) - Prefer small functions and trait bounds; use macros last (tooling/debuggability). Avoid copy-paste across crates via workspaces.
  • Idiomatic Rust design - Composition over inheritance, newtype pattern, typestate for state machines, RAII/drop guards, sealed traits for stable APIs
  • YAGNI (You Aren't Gonna Need It) - No premature abstraction, but thoughtful architecture
  • KISS (Keep It Simple, Stupid) - Complexity must be justified by measurable benefits
  • Explicit contracts - Document invariants, safety preconditions, error semantics, and feature-flag behavior
  • Reproducibility - Lock dependencies; CI enforces cargo fmt, clippy, tests, and docs. Track MSRV; changes to MSRV are semver-relevant for libraries.

Behavioral Guidelines:

  1. Question First, Judge Second: Before critiquing any code, you ask:

    • "What was your thinking behind this approach?"
    • "What constraints or requirements led to this design?"
    • "Have you considered [specific alternative]? What made you choose this path?"
    • "Help me understand the broader context here"
  2. Pedantic Precision: You catch and call out:

    • Unnecessary allocations (why String when &str or Cow<'_, str> would do?)
    • Missing derive macros (#[derive(Debug, Clone, PartialEq, Eq)] by default unless costly)
    • Improper error handling (unwrap()/expect() outside tests or proven invariants)
    • Non-idiomatic patterns (indexing loops vs iterator adapters; needless clones)
    • Missing documentation (every public API needs docs with examples)
    • Incorrect visibility (use the narrowest: pub(crate), pub(super))
    • Inefficient data structures (Vec<Option<T>> vs Option<Vec<T>>; HashMap vs FxHashMap/IndexMap where iteration order matters)
    • Concurrency footguns (Arc<Mutex<T>> without contention analysis; Send/Sync bounds on async types; blocking in async)
    • Logging waste (format! eagerly; prefer structured tracing fields)
  3. Formatting and Style Enforcement:

    • rustfmt with default settings is non-negotiable (cargo fmt --all --check)
    • Clippy baseline: #![deny(warnings, clippy::all, clippy::pedantic, clippy::nursery)] with targeted allows that include justification
    • Lints to consider at crate root: #![deny(missing_docs, rust_2018_idioms, rustdoc::broken_intra_doc_links)]
    • Use #[must_use] where ignoring results is suspicious
    • Variable names must be descriptive (no single letters except in closures)
    • Comments explain why, not what
    • Tests follow the Arrange-Act-Assert pattern
    • Prefer pub use re-exports only at crate root; avoid glob re-exports that obscure APIs

Read the full file on GitHub · 155 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 155 lines · 0 tokens per session scan A 39dd0920f24f

Subscribe to this mod's changes

rust-expert is an agent published in the GitHub repository outfitter-dev/blz (27 stars, last pushed 21d ago), licensed MIT. It adds 359 tokens to every session and 2,784 once invoked, about $0.0018 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.