Rust Best Practices
farm-fe/farm
Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook.
A skill your agent uses when reviewing or refactoring existing Rust code that carries an alien mental model — OO/enterprise ceremony from Java/C, garbage-collected object graphs, exception-style…
$ npx skills add pproenca/dot-skills --skill adversarial-rust -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install pproenca/dot-skills adversarial-rust --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/pproenca/dot-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.experimental/adversarial-rust .claude/skills/adversarial-rust && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "adversarial-rust" agent skill from https://github.com/pproenca/dot-skills/tree/master/skills/.experimental/adversarial-rust into .claude/skills/adversarial-rust/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "adversarial-rust", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/pproenca/dot-skills/tree/master/skills/.experimental/adversarial-rustType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add pproenca/dot-skills --skill adversarial-rust -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install pproenca/dot-skills adversarial-rust --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pproenca/dot-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/.experimental/adversarial-rust .agents/skills/adversarial-rust && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "adversarial-rust" agent skill from https://github.com/pproenca/dot-skills/tree/master/skills/.experimental/adversarial-rust into .agents/skills/adversarial-rust/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "adversarial-rust", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add pproenca/dot-skills --skill adversarial-rust -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install pproenca/dot-skills adversarial-rust --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pproenca/dot-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/.experimental/adversarial-rust .cursor/skills/adversarial-rust && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "adversarial-rust" agent skill from https://github.com/pproenca/dot-skills/tree/master/skills/.experimental/adversarial-rust into .cursor/skills/adversarial-rust/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "adversarial-rust", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/pproenca/dot-skills.git --path skills/.experimental/adversarial-rust--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add pproenca/dot-skills --skill adversarial-rust -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install pproenca/dot-skills adversarial-rust --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pproenca/dot-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/.experimental/adversarial-rust .gemini/skills/adversarial-rust && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "adversarial-rust" agent skill from https://github.com/pproenca/dot-skills/tree/master/skills/.experimental/adversarial-rust into .gemini/skills/adversarial-rust/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "adversarial-rust", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install pproenca/dot-skills adversarial-rustInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add pproenca/dot-skills --skill adversarial-rust -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/pproenca/dot-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/.experimental/adversarial-rust .github/skills/adversarial-rust && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "adversarial-rust" agent skill from https://github.com/pproenca/dot-skills/tree/master/skills/.experimental/adversarial-rust into .github/skills/adversarial-rust/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "adversarial-rust", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add pproenca/dot-skills --skill adversarial-rust -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install pproenca/dot-skills adversarial-rust --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pproenca/dot-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/.experimental/adversarial-rust .opencode/skills/adversarial-rust && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "adversarial-rust" agent skill from https://github.com/pproenca/dot-skills/tree/master/skills/.experimental/adversarial-rust into .opencode/skills/adversarial-rust/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "adversarial-rust", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
adversarial-rustA skill your agent uses when reviewing or refactoring existing Rust code that carries an alien mental model — OO/enterprise ceremony from Java/C, garbage-collected object graphs, exception-style…
Adversarial Rust is an agent skill from pproenca/dot-skills. Use this skill when reviewing or refactoring existing Rust code that carries an alien mental model — OO/enterprise ceremony from Java/C, garbage-collected object graphs, exception-style control flow, or imperative loops ported onto the borrow checker. It is the adversarial, architecture-level counterpart to greenfield idiom advice — it names the paradigm the code betrays and prescribes the deep refactor that collapses it, up to deleting whole layers (single-impl DI traits, Deref inheritance, Manager/Service…
Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 31 other files, including reference files and assets (for example `AGENTS.md`, `assets/templates/_template.md` and `metadata.json`).
It sits in Development, covering Refactoring and Linting and formatting. It works with Rust, Java and C#. The repository describes itself as: A collection of AI agent skills following the Agent Skills open format. The licence is MIT.
7 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit cf93c57. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md.
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Adversarial Rust loads about 2.8k tokens when it runs, and up to ~20k if it reads all its reference files. Until then it costs about 260 tokens; SKILL.md has 1,010 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from pproenca/dot-skills at commit cf93c57, republished under its MIT licence (© pproenca). 1,010 words, ~2,814 tokens.
.claude/skills/adversarial-rust/SKILL.md (or your agent's skills folder). This skill also uses 28 other files; get the full folder from GitHub.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.
Deref-simulated inheritance, stateless *Manager/*Service structs, getter/setter boilerplate, a builder for every struct.clone() sprinkled until it compiles, Rc<RefCell<T>> object graphs, self-referential struct attemptsOption fields, raw primitives carrying domain meaning, god-structs of Options escaping the serde boundaryunwrap on expected failures, sentinel returns, catch_unwind as try/catch, anyhow on library API surfacesBox<dyn Trait> for closed sets, boxed callback parameters, index loops and per-step collect() chainsasync fn, guards held across .await, async task fan-out for CPU-bound work, fire-and-forget tokio::spawnFor greenfield "which pattern, which crate, which discipline" decisions while writing new Rust — async cancellation, error enum design, sandboxing, testing architecture — use openai-codex-rust-patterns instead; this skill is its diagnostic, layer-flattening counterpart drawn from the same codebase.
| # | Category | Prefix | The alien model it rips out |
|---|---|---|---|
| 1 | Enterprise Ceremony & Fake OO | arch- | DI traits, Deref inheritance, Manager structs, getter ceremony, reflexive builders → concrete types, delegation, module functions, public fields, struct literals |
| 2 | Ownership Fought, Not Used | own- | clone-to-compile, Rc<RefCell> graphs, self-referential structs → designed clones, owning ID-keyed maps, single owners |
| 3 | Anemic & Stringly Data | type- | bool/String states, parallel Options, raw primitives, escaped god-structs → data-carrying enums, newtypes, one wire-to-domain resolve |
| 4 | Exception-Style Control Flow | flow- | unwrap-as-handling, sentinels, catch_unwind, opaque library errors → Result + ?, Option, thiserror enums, anyhow at the rim |
| 5 | Dynamic Dispatch by Habit | dyn- | Box<dyn> for closed sets, boxed callback params → tagged enums, generic Fn at the API, channels over listeners |
| 6 | Imperative Iteration | iter- | index loops, mut accumulators, collect-per-step → named combinators, one lazy chain, collect into Result |
| 7 | Concurrency From Another Runtime | conc- | blocking in async, guards across await, async CPU fan-out, orphan spawns → spawn_blocking, narrowed locks, bounded thread pools, owned handles |
arch-drop-di-trait-single-impl — delete the DI trait with one implementation; codex-rs ships ModelClient and Session concretearch-no-deref-inheritance — all 18 codex-rs Deref impls are newtypes or smart pointers; zero simulate a hierarchyarch-free-functions-over-manager-struct — stateless capability = module functions (git-utils, apply-patch); a *Manager earns its name by owning statearch-public-fields-over-getter-ceremony — Config and every protocol type are all-pub; accessors exist only where an invariant livesarch-default-literal-over-builder — 1,787 struct literals with ..Default::default() vs 16 builders; a builder needs staged construction to earn itselfown-restructure-over-clone — surviving clones are designed (Copy IDs, Arc bumps, lock snapshots); a compile-fixing clone forks dataown-no-rc-refcell-object-graph — zero Rc<RefCell> in ~2,500 files; narrow Mutex fields, channels, or ID maps insteadown-id-map-over-self-referential — graphs live in HashMap<ThreadId, Arc<CodexThread>>; cross-references are IDs, never referencestype-enum-over-bool-string-state — variants own their fields (SandboxPolicy); its external-sandbox variant types even yes/no as NetworkAccess, not booltype-result-over-parallel-options — one Option per shape is CodexAuth in denial; found/missing/failed is Result<Option<T>, E>type-newtype-parse-dont-validate — parse once into ThreadId/AgentPath; model names stay String because no invariant existstype-split-option-god-struct — ConfigToml (91 of 97 fields are Options) is fine on the wire; resolve it once into rich Configflow-result-over-unwrap-expected — unwrap_used/expect_used denied workspace-wide; escapes carry #[expect] + a written invariantflow-option-over-sentinel-values — lookups return Option; -1 exists only at the OS exit-code boundaryflow-no-catch-unwind-try-catch — every codex-rs production use supervises a foreign fault domain; none catch expected failuresflow-thiserror-library-anyhow-application — CodexErr/ApiError/TransportError per layer; anyhow at main()dyn-enum-over-box-dyn-closed-set — Op/EventMsg/TurnItem are enums; dyn is the tool registry others extend at runtimedyn-generics-over-boxed-callbacks — generic F: Fn at the API, box only for storage, channels instead of listener registrationiter-combinator-over-index-loop — 13 manual_* lints denied; for survives for awaits, side effects, index-as-data, FFIiter-stay-lazy-single-collect — one lazy chain; collect::<Result<Vec<_>, _>>() is the fallible-pipeline idiom (49 production uses)conc-spawn-blocking-over-blocking-async — ~50 spawn_blocking sites: git, file locks, zstd, OAuth serversconc-narrow-locks-before-await — even tokio guards may not cross .await; snapshot out or #[expect] with an atomicity reasonconc-blocking-pool-over-async-cpu-fanout — no rayon; CPU fan-out on bounded OS threads behind one spawn_blockingconc-own-spawned-task-handles — AbortOnDropHandle + child CancellationToken; interrupt is cancel → grace window → abortRead a reference file when its smell shows up in the code under review. Each rule names the alien pattern, explains why Rust rejects it, and shows the refactor with real codex-rs names and a permalink into the codebase at the pinned commit. Prefer the deepest refactor the change budget allows — redesigning ownership beats sprinkling clone; deleting the DI trait beats mocking through it. Every example compiles on Rust 1.86 (2021 edition).
openai-codex-rust-patterns — the greenfield counterpart distilled from the same codex-rs workspace: which pattern to reach for while writing production Rust (async cancellation, error enum design, sandboxing, testing, workspace layout). Use it for authoring decisions; use this skill for adversarial review and ceremony-flattening refactors. Several rules here hand off to it once the flatten is done (flow-thiserror-library-anyhow-application → its errors- rules, flow-result-over-unwrap-expected → defensive-deny-unwrap-workspace-wide, arch-drop-di-trait-single-impl → its testing seams).| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and source references |
© pproenca, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 28 other files (references, assets) in skills/.experimental/adversarial-rust of pproenca/dot-skills.
Open the folder on GitHubat commit cf93c57
Adversarial Rust next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Adversarial Rust this skillpproenca/dot-skills | 214 | — | ~2.8k | Automated safety check: Pass | MIT | |
| Rust Best Practicesfarm-fe/farm | 5.6k | 3 repos | ~1.1k | Automated safety check: Pass | MIT | |
| Rust Hygiene Audittsz-org/tsz | 572 | — | ~1.5k | Automated safety check: Pass | Apache-2.0 | |
| Code Revieweralirezarezvani/claude-skills | 28k | 1 repos | ~1.6k | Automated safety check: Pass | MIT | |
| Precheckayutaz/piper-plus | 218 | — | ~647 | Automated safety check: Pass | MIT | |
| Rust Best Practicesscott-fryxell/brayness | 124 | — | ~888 | Automated safety check: Pass | MIT |
farm-fe/farm
Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook.
tsz-org/tsz
Run a deep DRY + code-hygiene audit of the Rust workspace and turn the findings into verified, deduplicated, hierarchical GitHub tech-debt issues.
alirezarezvani/claude-skills
Code review automation for TypeScript, JavaScript, Python, Go, Swift, Kotlin, C, .NET, Java, C, C++, Rust, Ruby, PHP, and Dart/Flutter.
ayutaz/piper-plus
PR 作成前の lint + format + test 一括実行。引数で scope (python/rust/cs/go/js/cpp/all) を指定可能。未指定なら git diff から自動判定。
scott-fryxell/brayness
Idiomatic Rust guide based on Apollo GraphQL's best practices handbook.
managedcode/dotnet-skills
Primary router skill for broad .NET work. An agent skill from managedcode/dotnet-skills.
pproenca/dot-skills
Audio forensics and voice recovery guidelines for CSI-level audio analysis.
pproenca/dot-skills
Guided, scripted pipeline for running JSX/TSX/React codemods safely across large legacy codebases.
pproenca/dot-skills
Create well-structured RFCs and technical proposals for software projects.
pproenca/dot-skills
Developer-experience friction auditing and fixing — slow onboarding, repeated manual setup steps, missing bootstrap/reset/seed scripts, undiscoverable conventions.
pproenca/dot-skills
Turn a rough idea for a language into a complete, implementable specification — a DSL, query, config/data, template, or protocol language — by interviewing the author dimension by dimension until…
pproenca/dot-skills
Drafting Python Enhancement Proposals (PEPs) — proposing a Python language feature, a standard library change, an interoperability standard, or an informational/process document for the Python…
Categories
A skill your agent uses when reviewing or refactoring existing Rust code that carries an alien mental model — OO/enterprise ceremony from Java/C, garbage-collected object graphs, exception-style…. Adversarial Rust is an agent skill from pproenca/dot-skills. Use this skill when reviewing or refactoring existing Rust code that carries an alien mental model — OO/enterprise ceremony from Java/C, garbage-collected object graphs, exception-style control flow, or imperative loops ported onto the borrow checker.
Adversarial Rust fits situations like: refactoring existing Rust code that carries an alien mental model — OO/enterprise ceremony from Java/C; garbage-collected object graphs; exception-style control flow; imperative loops ported onto the borrow checker.
Run `npx skills add pproenca/dot-skills --skill adversarial-rust -a claude-code`. Or copy the skill folder (skills/.experimental/adversarial-rust in pproenca/dot-skills) into .claude/skills/adversarial-rust in your project. Claude Code loads it when a task matches its description.
Run `npx skills add pproenca/dot-skills --skill adversarial-rust -a codex`. Or copy the skill folder (skills/.experimental/adversarial-rust in pproenca/dot-skills) into .agents/skills/adversarial-rust in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pproenca/dot-skills --skill adversarial-rust -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/adversarial-rust, .gemini/skills/adversarial-rust, .github/skills/adversarial-rust and .opencode/skills/adversarial-rust in your project.
SKILL.md names no scripts, command-line tools or credentials: Adversarial Rust is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Adversarial Rust is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 17k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Adversarial Rust: Rust Best Practices (farm-fe/farm, 5.6k stars), Rust Hygiene Audit (tsz-org/tsz, 572 stars), Code Reviewer (alirezarezvani/claude-skills, 28k stars) and Precheck (ayutaz/piper-plus, 218 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
pproenca (a GitHub user) maintains it in pproenca/dot-skills, which has 214 GitHub stars. The repository holds 182 skills in this directory. The repository was last updated on August 15, 2026.
Source: pproenca/dot-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.