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 joshuadavidthomas/agent-skills --skill rustgit clone --depth 1 https://github.com/joshuadavidthomas/agent-skillsWrote 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/joshuadavidthomas/agent-skills/rust)<a href="https://agentmods.dev/skills/joshuadavidthomas/agent-skills/rust"><img src="https://agentmods.dev/badge/skills/joshuadavidthomas/agent-skills/rust.svg" alt="Measured on agentmods" 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.00156 | $0.03895 |
| Opus 5 | $0.00078 | $0.01947 |
| Sonnet 5 | $0.00031 | $0.00779 |
| Haiku 4.5 | $0.00016 | $0.00390 |
Grade A, and why
rust 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 — 139 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Thinking in Rust
You already know Rust syntax. Change the defaults you reach for first when modeling a domain, handling ownership, designing APIs, or crossing boundaries.
The core failure mode: writing Rust that compiles but thinks like Python, Java, TypeScript, or C. Bare String for domain types. bool for states. Trait objects for closed sets. Error(String) for everything. _ => in every match. Index loops. Sentinel values. Getters and setters on every field. clone() to quiet the compiler. unsafe to escape design pressure. These compile. They are wrong.
Most of these habits come from languages without sum types, ownership, zero-cost newtypes, or exhaustive matching. Recognizing where a pattern comes from helps you see why it is wrong in Rust.
When reviewing Rust, start with the shape of the program: what invariants are represented, who owns each value, which states are impossible, where errors cross boundaries, and whether any escape hatch is hiding a design problem.
Treat these as strong defaults, not rigid laws: when unsure, choose the approach that moves invariants into types and lets the compiler enforce them.
How Rust Thinks
Model the domain in types
- Every string with domain meaning is a newtype. Bare
Stringerases domain knowledge. The compiler cannot distinguish an email from a username from a URL. Wrap it, validate at construction, keep the field private. See references/newtypes-and-domain-types.md. - Every boolean parameter is a lie — use an enum.
trueandfalsecarry no meaning at the call site and cannot extend to a third state. Replace flags with named variants. Applies to struct fields too: correlated booleans are a state machine in disguise. See references/bool-to-enum.md. - Every "I don't know" is explicit.
Option<bool>has three states but none of them are named. Empty collections can mean "checked and empty" or "not checked yet." Make each state a named variant. See references/option-bool-to-enum.md. - Every match on your enum is exhaustive — no wildcard
_ =>arms. Wildcards silence the compiler when you add variants. List every variant of enums you control._ =>is for foreign#[non_exhaustive]types and primitives. See references/exhaustive-matching.md. - Every error variant is a domain fact — no
Error(String). String errors throw away structure. Callers cannot match, test, retry, translate, or recover. Libraries expose typed error enums; applications add context. See error-handling.md. - Parse, don't validate. Validation checks data and throws away the proof. Parsing checks data and returns a type that proves the invariant. After parsing, do not re-check downstream. See references/parse-dont-validate.md.
- Enums are the primary modeling tool. Rust enums are sum types. A struct with a
kindfield plusOptionpayload fields is always an enum waiting to be written. See references/enums-as-modeling-tool.md. - Closed sets are enums, not trait objects. If you know all variants at compile time, use an enum: zero-cost dispatch, exhaustive matching, per-variant data. Use generics or
dyn Traitonly when the set is genuinely open. See traits.md. - Boundaries translate; internals model. Serde, FFI, CLI, HTTP, and database edges should convert DTOs into domain types. Do not let wire formats become your internal model. See serde.md and interop.md.
What ships with it
60 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- async.md 14 KB
- atomics.md 7.7 KB
- error-handling.md 22 KB
- interop.md 7.5 KB
- macros.md 10 KB
- ownership.md 13 KB
- performance.md 9.0 KB
- project-structure.md 11 KB
- references/adapters-and-custom-impls.md 6.7 KB
- references/allocation-and-data-structures.md 3.4 KB
- references/anyhow-patterns.md 4.9 KB
- references/attributes-cheatsheet.md 4.1 KB
- references/benchmarking-and-fuzzing.md 8.5 KB
- references/blocking-and-bridging.md 7.1 KB
- references/bool-to-enum.md 3.6 KB
- references/borrow-by-default.md 3.1 KB
- references/builder-patterns.md 9.2 KB
- references/c-ffi.md 6.0 KB
- references/channels-and-select.md 8.9 KB
- references/combinators.md 5.3 KB
- references/cxx.md 3.6 KB
- references/designing-error-types.md 11 KB
- references/dispatch-patterns.md 7.5 KB
- references/enums-as-modeling-tool.md 6.0 KB
- references/exhaustive-matching.md 3.6 KB
- references/extension-traits.md 8.5 KB
- references/features-and-unification.md 4.2 KB
- references/function-signatures.md 7.6 KB
- references/getter-setter.md 3.3 KB
- references/impl-namespace.md 2.2 KB
- references/iterators-over-indexing.md 3.8 KB
- references/lifetime-patterns.md 6.8 KB
- references/macro_rules-patterns.md 4.3 KB
- references/miri-and-unsafe-testing.md 3.3 KB
- references/napi-rs.md 3.0 KB
- references/newtype-patterns.md 6.9 KB
- references/newtypes-and-domain-types.md 6.8 KB
- references/option-bool-to-enum.md 2.4 KB
- references/option-over-sentinels.md 2.5 KB
- references/ordering-cheatsheet.md 2.0 KB
- references/ownership-before-refcell.md 5.7 KB
- references/ownership-handoff-deadlocks.md 2.1 KB
- references/parse-dont-validate.md 6.0 KB
- references/pattern-matching-tools.md 2.8 KB
- references/patterns-from-rust-atomics-and-locks.md 1.9 KB
- references/proc-macro-patterns.md 3.4 KB
- references/production-patterns.md 8.3 KB
- references/profiling-and-benchmarking.md 2.9 KB
- references/property-testing.md 8.0 KB
- references/public-api-surface.md 3.0 KB
- references/pyo3.md 3.6 KB
- references/safety-comments-and-unsafe-contracts.md 4.0 KB
- references/smart-pointers.md 6.4 KB
- references/snapshot-testing.md 12 KB
- references/standard-traits.md 9.5 KB
- references/struct-collections.md 2.7 KB
- references/testing-and-debugging-macros.md 2.1 KB
- references/thiserror-patterns.md 6.3 KB
- references/trait-patterns.md 8.0 KB
- references/transform-over-mutate.md 4.0 KB
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 · 139 lines · 156 tokens per session scan A c1f6492cfb19
rust is a skill published in the GitHub repository joshuadavidthomas/agent-skills (50 stars, last pushed 1mo ago), licensed MIT. It adds 156 tokens to every session and 3,895 once invoked, about $0.0008 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
edge-python
Write, run, test and package Edge Python programs with the edge CLI. Use when editing .py files in an Edge Python project or when the user asks for Edge Python code.
cargo-fuzz
Sets up and runs cargo-fuzz, the standard fuzzing tool for Cargo-based Rust projects. Covers cargo fuzz init, the nightly toolchain requirement, fuzztarget! harnesses, Arbitrary-derived structured inputs, sanitizer options, cargo fuzz coverage, and reproducing a crash artifact. Use when fuzzing a Rust crate, writing a…
rust-development
Idiomatisk Rust-utvikling med cargo, clippy, error handling, async/tokio, unsafe og testing.
cargo-fuzz
Use when initializing, running, measuring coverage, or triaging a cargo-fuzz target in a Rust crate. Not for remote, credential, publish, deploy, or irreversible changes.
presentations
Build PowerPoint (PPTX) decks — pptxgenjs when Node is present, python-pptx when not; edit existing decks in place via OOXML — with visual QA before delivery.
rust-testing-quality
Use when writing, organizing, or running Rust tests — unit, integration, doc-tests, proptest, criterion benchmarks, or cargo-mutants. Not for CI pipeline wiring (rust-tooling-cicd).