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 agentmods add skills/softspark/ai-toolkit/rust-patternsnpx skills add softspark/ai-toolkit --skill rust-patternsgit clone --depth 1 https://github.com/softspark/ai-toolkitWrote 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/softspark/ai-toolkit/rust-patterns)<a href="https://agentmods.dev/skills/softspark/ai-toolkit/rust-patterns"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/rust-patterns.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 | $0.00053 | $0.03038 |
| Opus 5 | $0.00026 | $0.01519 |
| Sonnet 5 | $0.00011 | $0.00608 |
| Haiku 4.5 | $0.00005 | $0.00304 |
Grade A, and why
rust-patterns 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 yesterday.
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 — 448 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Rust Patterns
Project Structure
my-app/
├── Cargo.toml
├── src/
│ ├── main.rs # Binary entry point
│ ├── lib.rs # Library root (re-exports)
│ ├── error.rs # Crate-level error types
│ ├── api/
│ │ ├── mod.rs
│ │ └── handlers.rs
│ └── domain/
│ ├── mod.rs
│ └── service.rs
├── tests/ # Integration tests (separate crate)
│ └── api_test.rs
├── benches/ # criterion benchmarks
│ └── throughput.rs
└── examples/
└── demo.rs
Workspace layout for multi-crate projects:
# Cargo.toml (workspace root)
[workspace]
resolver = "2"
members = ["crates/core", "crates/api", "crates/cli"]
[workspace.dependencies]
serde = { version = "1", features = ["derive"] }
tokio = { version = "1", features = ["full"] }
Idioms / Code Style
Ownership and Borrowing
// Borrow when you only need to read
fn print_name(name: &str) { println!("{name}"); }
// Take ownership when storing or consuming the value
fn register_user(name: String) -> User {
User { name, id: Uuid::new_v4() }
}
Lifetimes
// Annotate only when the compiler cannot infer
struct Parser<'input> {
source: &'input str,
pos: usize,
}
impl<'input> Parser<'input> {
fn next_token(&mut self) -> Option<&'input str> {
let start = self.pos;
// ... advance self.pos ...
Some(&self.source[start..self.pos])
}
}
Trait-Based Design
trait Repository {
fn find_by_id(&self, id: Uuid) -> Result<Option<User>, DbError>;
fn save(&self, user: &User) -> Result<(), DbError>;
}
// Accept generics for testability
fn create_user(repo: &impl Repository, name: String) -> Result<User, AppError> {
let user = User::new(name);
repo.save(&user)?;
Ok(user)
}
Iterators, Pattern Matching, Newtype
// Iterator chains over manual loops
let active: Vec<&str> = users.iter()
.filter(|u| u.is_active)
.map(|u| u.email.as_str())
.collect();
// Exhaustive matching
match command {
Command::Start { port } => start_server(port),
Command::Stop => shutdown(),
}
// let-else for early exit (Rust 1.65+)
let Some(cfg) = load_config() else { return Ok(Config::default()); };
// Newtype to prevent primitive misuse
struct UserId(Uuid);
struct Email(String);
impl Email {
fn new(raw: &str) -> Result<Self, ValidationError> {
if raw.contains('@') { Ok(Self(raw.to_lowercase())) }
else { Err(ValidationError::InvalidEmail) }
}
}
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.
- yesterday First seen · 448 lines · 53 tokens per session scan A 6d955fccd5b2
rust-patterns is a skill published in the GitHub repository softspark/ai-toolkit (169 stars, last pushed today), licensed Apache-2.0. It adds 53 tokens to every session and 3,038 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
bevy-ecs
Structure a Bevy app around its Entity Component System: build the App with plugins, define Component/Resource types, write systems with Query/Res/Commands, filter and order systems, and use the Time resource for frame-rate-independent motion. Use when building or debugging a Bevy game in Rust — when the user mentions…
rust-engineer
Acquire expert Rust developer specialisation in rust systems programming, memory safety, and zero-cost abstractions. Masters ownership patterns, async programming, and performance optimisation for mission-critical applications.
rust-development
You MUST activate this skill when working on Rust projects.
neo-rust
Use this skill when writing, refactoring, debugging, or auditing Rust code. Trigger for .rs files, Cargo projects, ownership/borrowing/lifetime issues, Result/Option error handling, unnecessary clone/performance work, unsafe code review, or modern Rust architecture.
polars
Fast in-memory DataFrame library for datasets that fit in RAM. Use when pandas is too slow but data still fits in memory. Lazy evaluation, parallel execution, Apache Arrow backend. Best for 1-100GB datasets, ETL pipelines, faster pandas replacement. For larger-than-RAM data use dask or vaex.
first-plan-lens-rust
Stack lens para Rust. Use durante Discovery quando Cargo.toml for detectado. Cobre binários, libs, async runtimes (tokio/async-std), error handling, web frameworks (axum, actix-web, rocket).