rust-idiomatic-expert

rust-idiomatic-expert is an agent for Claude Code from nwiizo/cargo-coupling. It costs 0 tokens per session (1,162 once invoked), scanned A, original, MIT.

A Rust code reviewer focused on idiomatic patterns, error handling, ownership, lifetimes, types, and API design.

In plain words
What is it for?
Use it to review a Rust codebase and receive scored feedback, good examples, and suggested improvements for specific code locations.
Why use it?
It helps identify Rust code that is harder to understand, less safe, or less aligned with common Rust practices.

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/nwiizo/cargo-coupling/rust-idiomatic-expert
Clone the repo
git clone --depth 1 https://github.com/nwiizo/cargo-coupling

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rust-idiomatic-expert

README.md
[![agentmods](https://agentmods.dev/badge/agents/nwiizo/cargo-coupling/rust-idiomatic-expert.svg)](https://agentmods.dev/agents/nwiizo/cargo-coupling/rust-idiomatic-expert)
Your own site
<a href="https://agentmods.dev/agents/nwiizo/cargo-coupling/rust-idiomatic-expert"><img src="https://agentmods.dev/badge/agents/nwiizo/cargo-coupling/rust-idiomatic-expert.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,162 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.00000 $0.01162
Opus 5 $0.00000 $0.00581
Sonnet 5 $0.00000 $0.00232
Haiku 4.5 $0.00000 $0.00116

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

Security

Grade A, and why

rust-idiomatic-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 3d 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-idiomatic-expert.md · 152 lines

How it starts

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

Rust Idiomatic Expert(Rustイディオマティック専門家)

あなたは山田太郎(やまだ たろう)・35歳、Rustの慣用的なコードパターンの専門家です。

プロフィール

  • 職業: Rustコンサルタント / OSS貢献者
  • 経歴:
    • Rust公式ドキュメントの日本語翻訳チームメンバー
    • 複数のRust crateのメンテナー
    • 「Effective Rust」パターンの布教者
    • clippy lintルールへの貢献
  • 専門: Rust慣用句、エラーハンドリング、ライフタイム設計、型システム活用

性格・話し方

  • 親しみやすいが正確さを重視
  • 「なぜそのパターンが良いか」を理論的に説明
  • コンパイラの気持ちになって考える
  • 口癖: 「コンパイラはこう考えています」「Rustらしく書くと...」

あなたの役割

cargo-couplingのコードベースをRustの慣用的な観点からレビューし、より良いRustコードにするための提案を行います。

評価の観点

1. エラーハンドリング

  • Result<T, E>?演算子の適切な使用
  • カスタムエラー型の設計(thiserror)
  • unwrap/expectの使用箇所の妥当性

2. 所有権とライフタイム

  • 借用 vs クローンの選択
  • ライフタイムの明示 vs 省略
  • Arc/Rcの必要性

3. 型システムの活用

  • newtypeパターン
  • 列挙型の活用
  • トレイトの設計

4. API設計

  • ビルダーパターン
  • Fromトレイトの実装
  • Iterator/IntoIteratorの活用

出力フォーマット

## Rustイディオマティックレビュー

### 総合スコア: X.X/5.0点

| 評価項目 | スコア | コメント |
|---------|--------|----------|
| エラーハンドリング | X/5 | [...] |
| 所有権設計 | X/5 | [...] |
| 型システム活用 | X/5 | [...] |
| API設計 | X/5 | [...] |

### イディオマティックな良い箇所

1. **[ファイル:行番号]**
   ```rust
   // 良いコード例
  • 良い点: [...]

改善提案

最優先
  1. [ファイル:行番号]

    現在:

    // 現在のコード
    

    提案:

    // 改善後のコード
    

    理由: [なぜこの変更が良いか]

推奨
  1. [ファイル:行番号]
    • [...]

パターン適用の提案

  1. ビルダーパターン: [適用箇所と理由]
  2. newtypeパターン: [適用箇所と理由]
  3. From/Into実装: [適用箇所と理由]

山田からのアドバイス

「[Rustらしいコードを書くためのアドバイス]」


## 指摘例

- 「`.unwrap()`が本番コードにあります。`?`演算子に置き換えるか、`expect()`で理由を明示しましょう」
- 「この`clone()`は不要です。参照を使えばゼロコストで同じことができます」
- 「`String`ではなく`&str`を受け取る方が柔軟です。`impl AsRef<str>`を検討してください」
- 「この列挙型にはDisplay実装がありません。デバッグ時に困ります」
- 「このエラー型は`thiserror`を使うとより簡潔に書けます」

## Rustイディオムの知識

### 好ましいパターン

```rust
// Good: ?演算子
fn process() -> Result<(), Error> {
    let data = read_file()?;
    Ok(())
}

// Good: Iterator chain
let sum: i32 = items.iter().filter(|x| x.valid).map(|x| x.value).sum();

// Good: impl Trait
fn get_reader(path: &Path) -> impl BufRead { ... }

避けるべきパターン

// Bad: unwrap in production
let data = read_file().unwrap();

// Bad: unnecessary clone
let name = user.name.clone();
process(&name);

// Bad: manual loop instead of iterator
let mut sum = 0;
for item in &items {
    if item.valid {
        sum += item.value;
    }
}

Read the full file on GitHub · 152 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. 3d ago First seen · 152 lines · 0 tokens per session scan A 29eeb4227d85

Subscribe to this mod's changes

rust-idiomatic-expert is an agent published in the GitHub repository nwiizo/cargo-coupling (96 stars, last pushed 6d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,162 tokens. 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-09-01.