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 EmilLindfors/a2a-rs --skill refactor_idiomatic_rustgit clone --depth 1 https://github.com/EmilLindfors/a2a-rsWrote 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/emillindfors/a2a-rs/refactor_idiomatic_rust)<a href="https://agentmods.dev/skills/emillindfors/a2a-rs/refactor_idiomatic_rust"><img src="https://agentmods.dev/badge/skills/emillindfors/a2a-rs/refactor_idiomatic_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.00085 | $0.00878 |
| Opus 5 | $0.00043 | $0.00439 |
| Sonnet 5 | $0.00017 | $0.00176 |
| Haiku 4.5 | $0.00009 | $0.00088 |
Grade A, and why
refactor_idiomatic_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 7d 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 — 42 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactor Idiomatic Rust
This skill helps you refactor Rust code into idiomatic patterns based on the "Rust Patterns & Engineering How-Tos" guide. When asked to refactor or review Rust code for idiomatic usage, apply the principles derived from: https://microsoft.github.io/RustTraining/rust-patterns-book/
Generics and Monomorphization
- Prefer Generics (Static Dispatch) when dealing with a closed set of types or when performance in hot loops is critical (e.g., millions of calls). Generics are zero-cost abstractions as they inline perfectly, but be mindful of code bloat.
- Prefer Trait Objects (
dyn TraitDynamic Dispatch) for cold paths, heterogeneous collections, plugin systems, or when the cost of monomorphization code bloat outweighs the minor cost of vtable lookup. - Use
const fnwhere possible for simple constructors or logic that can be evaluated at compile time, reducing runtime overhead.
Traits and Composition
- Distinguish between Associated Types (when there is one output/result per implementing type, e.g.,
Iterator::Item) and Generic Parameters (when a type can implement the trait for many target types, e.g.,From<T>). - Consider using Enum Dispatch as a middle ground between Generics and
dyn Trait. If the set of types is closed, placing them in an enum and implementing the trait on the enum gives static dispatch performance with dynamic-like flexibility without heap allocation or vtable cost. - Apply the Extension Trait pattern to safely add methods to foreign types (types you don't own). Define a trait with your method and provide a blanket implementation (
impl<T: SomeBound> MyExtension for T). - Use Blanket Implementations carefully but effectively (e.g.
impl<T: Display> ToString for T) to give trait implementations for free to any type matching the constraints. - Maintain Trait Object Safety Rules: Traits meant for dynamic dispatch must not have
Self: Sizedbounds on methods meant for the vtable, no generic type parameters on methods, and noSelfin return position (unless boxed).
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.
- 7d ago First seen · 42 lines · 85 tokens per session scan A cbe6b699b485
refactor_idiomatic_rust is a skill published in the GitHub repository EmilLindfors/a2a-rs (87 stars, last pushed yesterday), licensed MIT. It adds 85 tokens to every session and 878 once invoked, about $0.0004 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
rust-patterns
Idiomatic Rust patterns, ownership, error handling, traits, concurrency, and best practices for building safe, performant applications.
dd-code-generation
Use pup CLI for immediate Datadog operations or generate code for integration into applications.
omh-rust
This is a Hermes-native rust workflow skill.
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-project
Modern Rust project architecture guide for 2025. Use when creating Rust projects (CLI, web services, libraries). Covers workspace structure, error handling, async patterns, and idiomatic Rust best practices.
gcs-rust-download-object-api
Fix "DownloadObjectRequest not found" error in google-cloud-storage Rust crate. Use when: (1) Trying to download objects from GCS using the Rust SDK, (2) Looking for a download request type in http::objects::download module, (3) Compile error about missing type. The downloadobject method uses GetObjectRequest from the…