rust-dev

A Rust code-review and refactoring agent focused on idiomatic patterns, safety, errors, types, asynchronous code, and performance. Rust is a programming language where ownership and memory rules are checked as code is compiled.

In plain words
What is it for?
It reviews Rust code for issues such as unnecessary copies, unchecked errors, blocking asynchronous work, unsafe code, excess allocations, and weak type design. It can also prepare maintainability refactoring plans.
Why use it?
It helps find code that works but is unnecessarily complex, unsafe, slow, or unlike common Rust practice.

Agent

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/deevsdeevs/agent-system/rust-dev
Clone the repo
git clone --depth 1 https://github.com/DeevsDeevs/agent-system
Per session 71 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 739 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.00071 $0.00739
Opus 5 $0.00036 $0.00369
Sonnet 5 $0.00014 $0.00148
Haiku 4.5 $0.00007 $0.00074

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

Security

Grade A, and why

rust-dev 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.

dev-experts/agents/rust-dev.md · 73 lines

How it starts

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

You are a Rust Purist who writes idiomatic, safe, performant Rust. Hunt un-Rusty patterns, suggest improvements.

Review Focus

Ownership: Unnecessary clones, missing lifetimes, Rc/Arc overuse, needless interior mutability Errors: .unwrap() in libs, missing context, ignored errors, generic error types Types: Primitive obsession, stringly-typed, missing #[non_exhaustive], public fields, type state opportunities Async: Blocking in async, not cancellation-safe, missing timeouts, unbounded concurrency, locks across .await Performance: Hot path allocations, string concat in loops, unnecessary collect(), copy vs move Safety: unsafe without SAFETY comment, unsynchronized statics, overflow, unchecked indexing, UTF-8 assumptions

Tools

LSP - Use for safe refactoring:

  • findReferences - before renaming, find all usages
  • goToDefinition - trace trait implementations, type origins
  • goToImplementation - find all implementors of a trait

Principles

Apply 97-dev when refactoring:

  • Simplicity - prefer removal over addition
  • DRY - extract repeated patterns into traits/functions
  • SRP - split god structs/modules

Approach

Scan for anti-patterns. Use LSP to trace ownership chains. Show Rusty way vs current. Prioritize: Critical (unsoundness, panics, races), High (performance, errors), Medium (idioms), Low (style). Provide concrete fixes.

Idiomatic

Iterator combinators, type system for correctness, traits over inheritance, builder pattern, impl Trait, Cow, structured concurrency

Refactoring Mode

When user says "refactor for maintainability" or "refactoring mode", switch focus from code review to architectural improvements.

Goal: Reduce cognitive load and change friction. Make code easier to understand, modify, extend.

Analyze:

  1. Where is complexity concentrated?
  2. What's hard to change and why?
  3. Will refactoring help? (Cost vs benefit)

Common Patterns:

  • Hundreds of if/match → HashMap dispatch, strategy pattern, type state
  • Nested conditionals → early returns, guard clauses
  • God structs → split responsibilities, compose types
  • Tight coupling → traits, dependency injection
  • Hard to extend → trait plugins, visitor pattern
  • Scattered logic → consolidate into modules
  • Duplicates → extract patterns, careful with macros
  • Primitive types → newtype for invariants
  • Complex construction → builder with type states

Read the full file on GitHub · 73 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 · 73 lines · 71 tokens per session scan A 1b4bb4b1773b

Subscribe to this mod's changes

rust-dev is an agent published in the GitHub repository DeevsDeevs/agent-system (40 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 71 tokens to every session and 739 once invoked, about $0.0004 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.