Borrowing it
Nothing to install: this file belongs to ryo-ebata/cc-audit. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/ryo-ebata/cc-audit/main/.claude/skills/rust-best-practices/SKILL.mdgit clone --depth 1 https://github.com/ryo-ebata/cc-auditWrote 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.
[](https://agentmods.dev/skills/ryo-ebata/cc-audit/rust-best-practices)<a href="https://agentmods.dev/skills/ryo-ebata/cc-audit/rust-best-practices"><img src="https://agentmods.dev/badge/skills/ryo-ebata/cc-audit/rust-best-practices.svg" alt="Measured on agentmods" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00043 | $0.01958 |
| Opus 5 | $0.00022 | $0.00979 |
| Sonnet 5 | $0.00009 | $0.00392 |
| Haiku 4.5 | $0.00004 | $0.00196 |
Grade A, and why
rust-best-practices 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 8d 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.
How it starts
The opening of the file, as written. The whole thing — 377 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Rust Best Practices for cc-audit
Error Handling
Prefer ? Over unwrap()
// BAD: Panics on error
let content = fs::read_to_string(path).unwrap();
// GOOD: Propagates error
let content = fs::read_to_string(path)?;
// GOOD: With context
let content = fs::read_to_string(path)
.map_err(|e| ScanError::IoError { path: path.into(), source: e })?;
Use thiserror for Custom Errors
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ScanError {
#[error("failed to read file: {path}")]
IoError {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("invalid pattern: {0}")]
InvalidPattern(String),
}
When unwrap() is Acceptable
- In tests
- After validation guarantees success
- With
unreachable!()comment explaining why
// OK: We just checked is_some()
if value.is_some() {
let v = value.unwrap(); // Known safe
}
// BETTER: Use if-let or match
if let Some(v) = value {
// use v
}
Option and Result Patterns
Prefer Combinators
// BAD: Verbose match
let result = match opt {
Some(v) => Some(v.to_uppercase()),
None => None,
};
// GOOD: Use map
let result = opt.map(|v| v.to_uppercase());
// GOOD: Chain combinators
let result = opt
.filter(|s| !s.is_empty())
.map(|s| s.trim())
.unwrap_or_default();
ok_or vs ok_or_else
// Use ok_or for cheap errors
let value = opt.ok_or(MyError::NotFound)?;
// Use ok_or_else for expensive error construction
let value = opt.ok_or_else(|| MyError::detailed(context))?;
Ownership and Borrowing
Prefer Borrowing Over Cloning
// BAD: Unnecessary clone
fn process(data: String) { /* ... */ }
process(my_string.clone());
// GOOD: Borrow if not consuming
fn process(data: &str) { /* ... */ }
process(&my_string);
Use Cow for Flexible Ownership
use std::borrow::Cow;
fn normalize_path(path: &str) -> Cow<'_, str> {
if path.contains('\\') {
Cow::Owned(path.replace('\\', "/"))
} else {
Cow::Borrowed(path)
}
}
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.
- 8d ago First seen · 377 lines · 43 tokens per session scan A a6372b3aba92
rust-best-practices is a skill published in the GitHub repository ryo-ebata/cc-audit (24 stars, last pushed today), licensed MIT. It adds 43 tokens to every session and 1,958 once invoked, about $0.0002 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.
Other skills, from other repositories
rust-check
Run cargo check on the current Rust project to find compile errors.
dd-code-generation
Use pup CLI for immediate Datadog operations or generate code for integration into applications.
rust-crate-ci
Load before editing any Rust crate in this repo (currently runners/swarm-sandbox-runner). Covers the mandatory local validation gate, common rustfmt/clippy pitfalls, and Windows-specific Rust correctness patterns that CI enforces but are hard to catch locally without a Windows toolchain.
adding-a-command
Creates a new CLI command following the Commander.js pattern in src/commands/. Handles command registration in src/cli.ts, telemetry tracking via tracked() wrapper, and option parsing. Use when user says add command, new CLI command, create subcommand, or adds files to src/commands/. Do NOT use for modifying existing…
rust-patterns
Rust: ownership, lifetimes, async (Tokio), Result/anyhow/thiserror, traits, unsafe. Triggers: Rust, borrow checker, lifetime, Tokio, cargo, trait, impl, Result, unsafe, clippy.
rust-dependency-audit
Audit Rust dependencies for vulnerabilities, license compliance, supply chain integrity, and freshness using cargo-audit, cargo-deny, cargo-vet.