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.
npx skills add majiayu000/spellbook --skill rust-best-practicesgit clone --depth 1 https://github.com/majiayu000/spellbookWrote 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/majiayu000/spellbook/rust-best-practices)<a href="https://agentmods.dev/skills/majiayu000/spellbook/rust-best-practices"><img src="https://agentmods.dev/badge/skills/majiayu000/spellbook/rust-best-practices/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.
<a href="https://agentmods.dev/skills/majiayu000/spellbook/rust-best-practices"><img src="https://agentmods.dev/badge/skills/majiayu000/spellbook/rust-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.00051 | $0.00610 |
| Opus 5 | $0.00026 | $0.00305 |
| Sonnet 5 | $0.00010 | $0.00122 |
| Haiku 4.5 | $0.00005 | $0.00061 |
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 6d 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 — 62 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Rust Best Practices Assistant
Core Principles
- Prefer safe Rust; use
unsafeonly when absolutely necessary and well-documented - Leverage the type system to prevent bugs at compile time
- Use
Result<T, E>for error handling, avoidpanic!in library code - Make illegal states unrepresentable through proper type design
Code Style
- Format all code with
rustfmt - Follow all
clippysuggestions (run withcargo clippy -- -W clippy::pedantic) - Use
snake_casefor variables and functions - Use
CamelCasefor types and traits - Use
SCREAMING_SNAKE_CASEfor constants
Memory & Ownership
- Prefer borrowing (
&T,&mut T) over ownership when possible - Use
Cow<str>for strings that might be borrowed or owned - Avoid unnecessary
.clone()- consider borrowing or restructuring - Use
Arc<T>for shared ownership across threads,Rc<T>for single-threaded
Error Handling
- Use
thiserrorfor defining library error types - Use
anyhowfor application-level error handling - Provide meaningful, actionable error messages
- Use
?operator for error propagation
Performance
- Avoid unnecessary heap allocations
- Prefer iterators over manual loops (zero-cost abstraction)
- Use
&strinstead ofStringfor function parameters when possible - Consider using
SmallVecfor small, stack-allocated vectors
Async Rust
- Use
tokioas the async runtime for most applications - Prefer
async fnover manualFutureimplementations - Avoid blocking operations in async contexts
- Use
tokio::spawnfor concurrent tasks
Testing
- Write unit tests in the same file using
#[cfg(test)]module - Use
#[should_panic]for testing panic behavior - Use
proptestorquickcheckfor property-based testing - Aim for meaningful test coverage, not just line coverage
Common Patterns
- Use the builder pattern for complex object construction
- Use
FromandIntotraits for type conversions - Implement
Defaultwhen a sensible default exists - Use
Option<T>instead of sentinel values
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.
- 6d ago First seen · 62 lines · 51 tokens per session scan A 77402ffc4879
rust-best-practices is a skill published in the GitHub repository majiayu000/spellbook (277 stars, last pushed yesterday), licensed MIT. It adds 51 tokens to every session and 610 once invoked, about $0.0003 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-09-03.
Other skills, from other repositories
Rust Patterns
Use this skill when writing Rust crates/services and you want reliable patterns for error handling, module structure, ownership boundaries, and maintainable APIs.
python-release
Handle Python SDK release, build, bump, packaging metadata, PyPI client pin, uv.lock, nox/build workflow, and publish verification changes. Use for Python release process work or dependency pin bumps; do not use for ordinary Python feature implementation.
Agent Browser Automation
Fast Rust-based headless browser automation CLI with Node.js fallback for AI agents, featuring navigation, clicking, typing, snapshots, and structured commands optimized for agent workflows.
pneuma-session
Instructions for renaming an active Pneuma session and replacing its default preview with a useful title and summary. A Pneuma session is one work area inside a larger project.
architecture-audit
Systematic architecture audit and refactoring methodology for Rust + TypeScript codebases. Use when performing refactoring, cleanup, unification, code review, dead code removal, module reorganization, or tech debt elimination. Ensures no naming confusion, semantic overloading, hidden defaults, duplicate logic, or…
dcg
Destructive Command Guard - High-performance Rust hook for Claude Code that blocks dangerous commands before execution. SIMD-accelerated, modular pack system, whitelist-first architecture. Essential safety layer for agent workflows.