detrix: Command for Claude Code

.claude/commands/audit-crate.md

audit-crate is a command for Claude Code from flashus/detrix. It costs 13 tokens per session (920 once invoked), scanned A, original, MIT.

A command for auditing one Rust crate, which is a Rust project component that can be compiled and managed separately. It can inspect the whole project, the current branch, or only uncommitted changes.

In plain words
What is it for?
Use it to check architecture boundaries, code structure, and likely issues in a selected Detrix crate.
Why use it?
It gives a focused review of one crate instead of requiring an audit of the entire Rust project.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md.

This is flashus/detrix's own configuration. It tells Claude Code how to work on detrix itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything detrix configures →

Reuse

Borrowing it

Nothing to install: this file belongs to flashus/detrix. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/flashus/detrix/main/.claude/commands/audit-crate.md
Clone the repo
git clone --depth 1 https://github.com/flashus/detrix

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 audit-crate

README.md
[![agentmods](https://agentmods.dev/badge/commands/flashus/detrix/audit-crate/github.svg)](https://agentmods.dev/commands/flashus/detrix/audit-crate)
Your own site
<a href="https://agentmods.dev/commands/flashus/detrix/audit-crate"><img src="https://agentmods.dev/badge/commands/flashus/detrix/audit-crate/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for audit-crate

Your own site · 80×15
<a href="https://agentmods.dev/commands/flashus/detrix/audit-crate"><img src="https://agentmods.dev/badge/commands/flashus/detrix/audit-crate.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 920 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00013 $0.00920
Opus 5.5 $0.00005 $0.00368
Sonnet 5.5 $0.00003 $0.00184
Haiku 4.5 $0.00001 $0.00092

Measured 2mo ago against content hash c2a2db83a292, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

audit-crate 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 2mo 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/commands/audit-crate.md · 100 lines

How it starts

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

You are a senior Rust developer performing a focused code audit of a single crate in the Detrix project.

Target

Audit the crate specified in: "$ARGUMENTS"

Parse the arguments as: <crate-name> [scope]

  • <crate-name> is required (e.g. detrix-core, detrix-api)
  • [scope] is optional: branch, uncommitted, or project (default: project)

If scope is branch: only audit files changed on current branch vs main (use git diff main...HEAD -- crates/<crate-name>/). If scope is uncommitted: only audit uncommitted changes (use git diff -- crates/<crate-name>/). If scope is project: audit the entire crate.

Instructions

Read CLAUDE.md first to understand the architecture rules, then audit the crate thoroughly. Use Serena's symbolic tools (get_symbols_overview, find_symbol, find_referencing_symbols) to navigate efficiently — avoid reading entire files unless necessary.

Checklist

Architecture & Design

  • Clean Architecture layer violations (check dependency rules: core depends on NOTHING, ports on core+config only, application on ports+core+config only, infrastructure implements port traits)
  • God files / god modules (files with too many responsibilities)
  • Over-complex code / doom pyramids (deeply nested if/match/loop)
  • Proper component wiring — compare patterns across the crate
  • Config parameter dataflow — params properly passed through layers

Error Handling

  • .map_err() — should use From/TryFrom impls instead; use extension trait pattern to keep context
  • unwrap() / expect() / panic!() in non-test code — app must never panic
  • Similar/duplicate error variants that should be consolidated
  • Proper error propagation with ? operator

Type System & Constants

  • Arc<dyn Trait + Send + Sync> — verify proper type aliases are used
  • Hardcoded strings or magic numbers — should be enums/constants
  • Hardcoded values where config values should be forwarded
  • Default values — are they sensible? Could they cause issues?
  • Constants should be defaults only; actual values from detrix.toml

Read the full file on GitHub · 100 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. 2mo ago First seen · 100 lines · 13 tokens per session scan A c2a2db83a292

Subscribe to this mod's changes

audit-crate is a command published in the GitHub repository flashus/detrix (28 stars, last pushed 2mo ago), licensed MIT. It adds 13 tokens to every session and 920 once invoked, about $0.0001 per session on Opus 5.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.

Related

Other commands, from other repositories