rust

rust is a skill for Claude Code, Codex from joshuadavidthomas/agent-skills. It costs 156 tokens per session (3,895 once invoked), scanned A, original, MIT.

A Rust programming guide focused on modeling data, ownership, errors, APIs, asynchronous code, unsafe code, and tests in ways that fit Rust's rules.

In plain words
What is it for?
Reviewing or writing Rust code, especially when dealing with the borrow checker, lifetimes, traits, domain types, errors, Tokio, Cargo, or performance.
Why use it?
It helps prevent code from merely compiling while retaining design habits from languages such as Python, Java, or TypeScript.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Reviewing or writing Rust code, especially when dealing with the borrow checker, lifetimes, traits, domain types, errors, Tokio, Cargo, or performance.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/joshuadavidthomas/agent-skills/rust
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.

Any agent
npx skills add joshuadavidthomas/agent-skills --skill rust
Clone the repo
git clone --depth 1 https://github.com/joshuadavidthomas/agent-skills

Made for: Claude Code, Codex.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/joshuadavidthomas/agent-skills/rust.svg)](https://agentmods.dev/skills/joshuadavidthomas/agent-skills/rust)
Your own site
<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>
Per session 156 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,895 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.00156 $0.03895
Opus 5 $0.00078 $0.01947
Sonnet 5 $0.00031 $0.00779
Haiku 4.5 $0.00016 $0.00390

Measured 8d ago against content hash c1f6492cfb19, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

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.

rust/SKILL.md · 139 lines

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

  1. Every string with domain meaning is a newtype. Bare String erases 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.
  2. Every boolean parameter is a lie — use an enum. true and false carry 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. Enums are the primary modeling tool. Rust enums are sum types. A struct with a kind field plus Option payload fields is always an enum waiting to be written. See references/enums-as-modeling-tool.md.
  8. 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 Trait only when the set is genuinely open. See traits.md.
  9. 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.

Read the full file on GitHub · 139 lines

Files

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.

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. 8d ago First seen · 139 lines · 156 tokens per session scan A c1f6492cfb19

Subscribe to this mod's changes

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.