adversarial-rust

adversarial-rust is a skill for Claude Code, Codex from pproenca/dot-skills. It costs 223 tokens per session (2,734 once invoked), scanned A, original, MIT.

A review and refactoring guide for existing Rust code shaped by habits from other programming languages. It helps bring that code back toward Rust's way of handling ownership, errors, loops, and concurrency.

In plain words
What is it for?
Use it to review or restructure Rust code that uses object-oriented designs, shared object graphs, exception-style errors, C-style loops, or detached asynchronous work.
Why use it?
It identifies design patterns that may work elsewhere but create awkward or unsafe Rust. It also explains when an unusual pattern is justified.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions AGENTS.md; mentions Codex.

Good fit Use it to review or restructure Rust code that uses object-oriented designs, shared object graphs, exception-style errors, C-style loops, or detached asynchronous work.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/pproenca/dot-skills/adversarial-rust.svg)](https://agentmods.dev/skills/pproenca/dot-skills/adversarial-rust)
Your own site
<a href="https://agentmods.dev/skills/pproenca/dot-skills/adversarial-rust"><img src="https://agentmods.dev/badge/skills/pproenca/dot-skills/adversarial-rust.svg" alt="Measured on agentmods" height="20"></a>
Per session 223 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,734 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.00223 $0.02734
Opus 5 $0.00112 $0.01367
Sonnet 5 $0.00045 $0.00547
Haiku 4.5 $0.00022 $0.00273

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

Security

Grade A, and why

adversarial-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.

skills/.experimental/adversarial-rust/SKILL.md · 95 lines

How it starts

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

Adversarial Rust

An adversarial, architecture-level review-and-refactor pass for Rust. Where a greenfield idiom skill answers "which tool should I reach for now?", this skill takes code that already exists and imported the wrong mental model — objects and interfaces from Java/C#, shared-everything graphs from garbage-collected languages, exceptions, C-style loops and sentinels, detached-promise concurrency — names the paradigm it betrays, and prescribes the refactor that collapses it back to idiomatic Rust.

Every rule is grounded in a single production codebase: the codex-rs workspace (github.com/openai/codex, codex-rs/ at commit f1affbac5e, ~125 crates / ~2,500 Rust files). The Correct side of each rule is what that codebase actually does, the enforcement evidence is its workspace lint config (unwrap_used, redundant_clone, needless_collect, await_holding_lock and ~30 more denied), and the carve-outs are the real exceptions it keeps — so "when NOT to apply" is never hypothetical. There is no rule for things a capable model already gets right.

When to Apply

  • Reviewing or refactoring existing Rust for architecture, not just style — "make this actually idiomatic", "why does this feel like Java in Rust"
  • Flattening ported ceremony — dependency-injection traits with one implementation, Deref-simulated inheritance, stateless *Manager/*Service structs, getter/setter boilerplate, a builder for every struct
  • Untangling fought ownership — .clone() sprinkled until it compiles, Rc<RefCell<T>> object graphs, self-referential struct attempts
  • Fixing anemic data — boolean/string state machines, parallel Option fields, raw primitives carrying domain meaning, god-structs of Options escaping the serde boundary
  • Removing exception-style flow — unwrap on expected failures, sentinel returns, catch_unwind as try/catch, anyhow on library API surfaces
  • Collapsing habitual indirection — Box<dyn Trait> for closed sets, boxed callback parameters, index loops and per-step collect() chains
  • Repairing imported concurrency habits — blocking calls inside async fn, guards held across .await, async task fan-out for CPU-bound work, fire-and-forget tokio::spawn

Read the full file on GitHub · 95 lines

Files

What ships with it

28 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. 7d ago First seen · 95 lines · 223 tokens per session scan A 2d5af930f3a3

Subscribe to this mod's changes

adversarial-rust is a skill published in the GitHub repository pproenca/dot-skills (203 stars, last pushed 22d ago), licensed MIT. It adds 223 tokens to every session and 2,734 once invoked, about $0.0011 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.

Related

Other skills, from other repositories

architecture-audit

Systematic architecture audit and refactoring methodology for Rust + TypeScript codebases. Use when performing refactoring, cleanup, unification, code review, dead code removal, module reorganization, or tech debt elimination. Ensures no naming confusion, semantic overloading, hidden defaults, duplicate logic, or…

org2AI/ORG2 · 70 tokens

rust-review

A Rust code-review skill for services, checking for crashes, unsafe SQL construction, exposed credentials, ignored errors, and unfinished code.

liuyanghejerry/Clausura · 25 tokens

rust-skills

Comprehensive Rust coding guidelines with 265 rules across 26 categories. Use when writing, reviewing, or refactoring Rust code. Covers ownership, error handling, async patterns, concurrency, unsafe code, API design, memory optimization, performance, numeric safety, conversions, serde, pattern matching, macros…

leonardomso/rust-skills · 84 tokens

architectural_review

Review Rust code for advanced architectural patterns — capability mixins, typed commands, concurrency model choice, smart pointer/interior mutability selection, error-handling architecture, and memory layout. Use when the user asks to review system architecture, suggest broad design improvements, or evaluate trait…

EmilLindfors/a2a-rs · 82 tokens

hexagonal_review

Review a Rust codebase for hexagonal architecture compliance — dependency direction, port shape, adapter grouping, error boundaries, feature-flag placement, and testability. Use when the user asks to review architecture, audit layering, check ports-and-adapters discipline, or evaluate whether a Rust project's…

EmilLindfors/a2a-rs · 65 tokens

m15-anti-pattern

Use when reviewing code for anti-patterns. Keywords: anti-pattern, common mistake, pitfall, code smell, bad practice, code review, is this an anti-pattern, better way to do this, common mistake to avoid, why is this bad, idiomatic way, beginner mistake, fighting borrow checker, clone everywhere, unwrap in production…

moeru-ai/auv · 101 tokens