rust-rules

rust-rules is a skill for Claude Code from softspark/ai-toolkit. It costs 43 tokens per session (3,021 once invoked), scanned A, original, Apache-2.0.

A set of coding guidance for Rust, a programming language with strict compile-time checks for memory and types. It covers naming, ownership, types, and related project conventions.

In plain words
What is it for?
Use it when writing or reviewing Rust projects, Cargo files, libraries, services, and tests.
Why use it?
It helps an agent write Rust code that matches established style and avoids common ownership, typing, and structure problems.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument.

Part of the ai-toolkit plugin — 115 skills, 44 agents, 14 hooks shipped together

Good fit Use it when writing or reviewing Rust projects, Cargo files, libraries, services, and tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/softspark/ai-toolkit/rust-rules
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 softspark/ai-toolkit --skill rust-rules
Clone the repo
git clone --depth 1 https://github.com/softspark/ai-toolkit

Made for: Claude Code.

Or install ai-toolkit, the plugin that ships this one along with the rest of its 115 skills, 44 agents, 14 hooks.

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-rules

README.md
[![agentmods](https://agentmods.dev/badge/skills/softspark/ai-toolkit/rust-rules/github.svg)](https://agentmods.dev/skills/softspark/ai-toolkit/rust-rules)
Your own site
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/rust-rules"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/rust-rules/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 rust-rules

Your own site · 80×15
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/rust-rules"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/rust-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,021 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00043 $0.03021
Opus 5.5 $0.00017 $0.01208
Sonnet 5.5 $0.00009 $0.00604
Haiku 4.5 $0.00004 $0.00302

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

Security

Grade A, and why

rust-rules 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 1mo 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.

app/skills/rust-rules/SKILL.md · 277 lines

How it starts

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

Rust Rules

These rules come from app/rules/rust/ in ai-toolkit. They cover the project's standards for coding style, frameworks, patterns, security, and testing in Rust. Apply them when writing or reviewing Rust code.

Rust Coding Style

Naming

  • snake_case: functions, methods, variables, modules, crates.
  • PascalCase: types, traits, enums, structs, type parameters.
  • SCREAMING_SNAKE: constants and statics.
  • Short lifetimes: 'a, 'b. Descriptive only when multiple coexist: 'input, 'output.
  • Crate names: kebab-case in Cargo.toml, snake_case in code.

Ownership

  • Borrow (&T) when you only need to read. Own (T) when storing or consuming.
  • Use &str over String in function parameters when possible.
  • Use Cow<'_, str> when you sometimes need to allocate.
  • Avoid .clone() as a first resort -- restructure ownership instead.
  • Use Arc<T> only when shared ownership across threads is required.

Types

  • Use newtypes for domain primitives: struct UserId(Uuid).
  • Use #[derive(Debug, Clone, PartialEq)] on data types.
  • Implement Display for user-facing output, Debug for developer output.
  • Use #[non_exhaustive] on public enums and structs for future compatibility.
  • Prefer enums over boolean flags for state representation.

Functions

  • Return Result<T, E> for operations that can fail. Avoid panicking.
  • Use impl Trait in argument position for flexibility, return position for simplicity.
  • Use where clauses for complex bounds instead of inline.
  • Prefer iterators over index-based loops.
  • Use let-else (1.65+) for early-exit pattern matching.

Modules

  • Use mod.rs or filename-based modules. Be consistent within the project.
  • Re-export public API from lib.rs for a clean surface.
  • Keep modules focused. One major type or concept per module.
  • Use pub(crate) for internal-only visibility.

Formatting

  • Use rustfmt with default settings. Do not fight the formatter.
  • Use clippy with -D warnings in CI. Fix all warnings.
  • Set MSRV (Minimum Supported Rust Version) in Cargo.toml.

Read the full file on GitHub · 277 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. 1mo ago First seen · 277 lines · 43 tokens per session scan A 8ac24fad76f9

Subscribe to this mod's changes

rust-rules is a skill published in the GitHub repository softspark/ai-toolkit (181 stars, last pushed today), licensed Apache-2.0. It adds 43 tokens to every session and 3,021 once invoked, about $0.0002 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-09-03.

Related

Other skills, from other repositories

rust-best-practices

Idiomatic Rust development with ownership, borrowing, lifetimes, error handling (thiserror/anyhow), async Tokio patterns, traits, generics, Clippy linting, cargo workspaces, and production patterns for web services (axum/actix-web), CLI tools (clap), and systems programming. Use when writing, reviewing, or debugging…

medy-gribkov/arcana · 80 tokens

rust-performance

Use when writing or reviewing performance-sensitive Rust, profiling slow Rust code, reducing allocations, investigating latency or throughput regressions, or diagnosing bloated binaries and long compile times. Covers allocation, iterators, data layout, hashing, async/concurrency, build profiles, Clippy review gates…

Lu1sDV/skillsmd · 146 tokens

rust-concurrency

Use when implementing or debugging Rust threads, Send/Sync bounds, Arc and synchronization, channels, Tokio async tasks, cancellation, graceful shutdown, backpressure, deadlocks, or choosing Rayon for CPU-bound parallel work.

Lu1sDV/skillsmd · 47 tokens

rust-tdd

Use when implementing Rust features test-first, reproducing Rust bugs with regression tests, characterizing legacy Rust, or applying red-green-refactor with cargo test. Covers boundary and equivalence cases, proptest shrinking, mockall expectations, rstest fixtures, async/concurrent/CLI tests, and coverage…

Lu1sDV/skillsmd · 76 tokens

rust-unsafe-ffi

Use when writing or reviewing Rust unsafe blocks, raw-pointer abstractions, MaybeUninit or manual Drop code, unsafe trait implementations, or C/C++ FFI bindings. Covers pointer validity, aliasing and provenance, C ABI/layout, callbacks, allocator ownership, C strings, unwinding, Rust 2024 unsafe syntax, and…

Lu1sDV/skillsmd · 79 tokens

rust-wasm

Use when compiling Rust to WebAssembly, integrating wasm-bindgen or web-sys with browser JavaScript and the DOM, packaging with wasm-pack, choosing wasm32-unknown-unknown versus wasm32-wasip1 or wasm32-wasip2, designing WIT component interfaces, or debugging Wasm loading, capabilities, and target tests.

Lu1sDV/skillsmd · 73 tokens