Agent skill

Rust Skills

by JMBeresford in JMBeresford/retrom

Comprehensive Rust coding guidelines with 265 rules across 26 categories.

MITAuto-check passedDevelopment

Install Rust Skills

skills CLI
$ npx skills add JMBeresford/retrom --skill rust-skills -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install JMBeresford/retrom rust-skills --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/JMBeresford/retrom.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/rust-skills .claude/skills/rust-skills && rm -rf skills-src

Use ~/.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/

Facts

Skill name
rust-skills
GitHub stars
2.1k
Used in
1 other repo
Token cost
~9.5k tokens
SKILL.md length
3,126 words
Files
266
Skills in repo
3
Repo updated
First seen
Licence
MIT

At a glance

Comprehensive Rust coding guidelines with 265 rules across 26 categories.

  • Works in 12 steps: Ownership & Borrowing (CRITICAL) → Error Handling (CRITICAL) → Memory Optimization (CRITICAL) → …
  • Refactoring Rust code
  • SKILL.md covers When to Apply, Rule Categories by Priority and Quick Reference
  • Calls cargo

What it does

Rust Skills is an agent skill from JMBeresford/retrom. 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, closures, observability, testing, and common anti-patterns. Invoke with /rust-skills.

Its SKILL.md is about 9.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 266 other files (for example `rules/anti-clone-excessive.md`, `rules/anti-collect-intermediate.md` and `rules/anti-empty-catch.md`).

It sits in Development, covering API design, Refactoring and Observability. It works with Rust. The repository describes itself as: A centralized game library/collection management service with a focus on emulation. The licence is MIT.

When your agent uses it

  • Refactoring Rust code
  • Tasks that involve API design
  • Tasks that involve Refactoring

Example prompts

  • “/rust-skills”

Workflow steps

12 steps, taken from the step headings in SKILL.md.

  1. Ownership & Borrowing (CRITICAL)
  2. Error Handling (CRITICAL)
  3. Memory Optimization (CRITICAL)
  4. Unsafe Code (CRITICAL)
  5. API Design (HIGH)
  6. Async/Await (HIGH)
  7. Concurrency (HIGH)
  8. Compiler Optimization (HIGH)
  9. Numeric & Arithmetic Safety (HIGH)
  10. Type Safety (MEDIUM)
  11. Trait & Generics Design (MEDIUM)
  12. Conversions (MEDIUM)

What it can do on your machine

Read from SKILL.md and the folder at commit c081a2d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    Shell commands in SKILL.md call:

    • cargo

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • doc.rust-lang.org
    • rust-lang.github.io
    • nnethercote.github.io
    • rust-unofficial.github.io
    • marabos.nl
    • effective-rust.com
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Rust Skills loads about 9.5k tokens when it runs. Until then it costs about 103 tokens; SKILL.md has 3,126 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~103
When it runs · the whole SKILL.md, loaded when a task matches
~9.5k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from JMBeresford/retrom at commit c081a2d, republished under its MIT licence (© JMBeresford). 3,126 words, ~9,452 tokens.

Download SKILL.mdSave it as .claude/skills/rust-skills/SKILL.md (or your agent's skills folder). This skill also uses 265 other files; get the full folder from GitHub.
name
rust-skills
description
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, closures, observability, testing, and common anti-patterns. Invoke with /rust-skills.
license
MIT
metadata.author
leonardomso
metadata.version
1.5.1
metadata.sources
Rust API Guidelines, Rust Performance Book, Rust 2024 Edition Guide, The Rustonomicon, ripgrep, tokio, serde, polars, axum, cargo codebases

Rust Best Practices

Comprehensive guide for writing high-quality, idiomatic, and highly optimized Rust code. Contains 265 rules across 26 categories, prioritized by impact to guide LLMs in code generation and refactoring. Current for Rust 1.96 (2024 edition).

When to Apply

Reference these guidelines when:

  • Writing new Rust functions, structs, or modules
  • Implementing error handling or async code
  • Writing concurrent, parallel, or unsafe code
  • Designing public APIs for libraries
  • Reviewing code for ownership/borrowing issues
  • Optimizing memory usage or reducing allocations
  • Tuning performance for hot paths
  • Refactoring existing Rust code

Rule Categories by Priority

PriorityCategoryImpactPrefixRules
1Ownership & BorrowingCRITICALown-12
2Error HandlingCRITICALerr-12
3Memory OptimizationCRITICALmem-17
4Unsafe CodeCRITICALunsafe-7
5API DesignHIGHapi-17
6Async/AwaitHIGHasync-18
7ConcurrencyHIGHconc-4
8Compiler OptimizationHIGHopt-12
9Numeric & Arithmetic SafetyHIGHnum-5
10Type SafetyMEDIUMtype-13
11Trait & Generics DesignMEDIUMtrait-6
12ConversionsMEDIUMconv-3
13Const & Compile-TimeMEDIUMconst-4
14SerdeMEDIUMserde-8
15Pattern MatchingMEDIUMpat-5
16MacrosMEDIUMmacro-8
17ClosuresMEDIUMclosure-5
18CollectionsMEDIUMcoll-4
19Naming ConventionsMEDIUMname-16
20TestingMEDIUMtest-15
21DocumentationMEDIUMdoc-12
22ObservabilityMEDIUMobs-7
23Performance PatternsMEDIUMperf-13
24Project StructureLOWproj-14
25Clippy & LintingLOWlint-13
26Anti-patternsREFERENCEanti-15

Quick Reference

1. Ownership & Borrowing (CRITICAL)
2. Error Handling (CRITICAL)
3. Memory Optimization (CRITICAL)
4. Unsafe Code (CRITICAL)
  • unsafe-safety-comment - Write a // SAFETY: comment above every unsafe block and a # Safety section in every unsafe fn.
  • unsafe-minimize-scope - Keep unsafe blocks as small as possible — mark only the operation that requires unsafety, not the surrounding safe code.
  • unsafe-miri-ci - Run cargo miri test in CI for every crate that contains unsafe code.
  • unsafe-maybeuninit - Use MaybeUninit<T> for uninitialized memory; never use mem::uninitialized() or mem::zeroed() for types with validity invariants.
  • unsafe-extern-block - In Rust 2024, wrap extern blocks in unsafe extern { } and annotate each item as safe or unsafe.
  • unsafe-send-sync-manual - Document the invariants when manually implementing Send or Sync; prefer letting the compiler derive them automatically.
  • unsafe-no-mangle-unsafe - In Rust 2024, write #[unsafe(no_mangle)], #[unsafe(export_name = "...")], and #[unsafe(link_section = "...")] — not the bare attribute forms.
5. API Design (HIGH)
  • api-builder-pattern - Use Builder pattern for complex construction
  • api-builder-must-use - Mark builder methods with #[must_use] to prevent silent drops
  • api-newtype-safety - Use newtypes to prevent mixing semantically different values
  • api-typestate - Use typestate pattern to encode state machine invariants in the type system
  • api-sealed-trait - Use sealed traits to prevent external implementations while allowing use
  • api-extension-trait - Use extension traits to add methods to external types
  • api-parse-dont-validate - Parse into validated types at boundaries
  • api-impl-into - Accept impl Into<T> for flexible APIs, implement From<T> for conversions
  • api-impl-asref - Use AsRef<T> when you only need to borrow the inner data
  • api-must-use - Mark types and functions with #[must_use] when ignoring results is likely a bug
  • api-non-exhaustive - Use #[non_exhaustive] on public enums and structs for forward compatibility
  • api-from-not-into - Implement From<T>, not Into<U> - From gives you Into for free
  • api-default-impl - Implement Default for types with sensible default values
  • api-common-traits - Implement standard traits (Debug, Clone, PartialEq, etc.) for public types
  • api-serde-optional - Make serde a feature flag, not a hard dependency for library crates
  • api-impl-fromiterator - Implement FromIterator and Extend for collection types, and IntoIterator for all three reference forms
  • api-operator-overload - Overload operators only when the semantics are natural and unsurprising
6. Async/Await (HIGH)
7. Concurrency (HIGH)
8. Compiler Optimization (HIGH)
9. Numeric & Arithmetic Safety (HIGH)
  • num-overflow-explicit - Handle integer overflow explicitly: checked_/saturating_/wrapping_/overflowing_
  • num-cast-try-from - Avoid as for narrowing casts; use From for widening and TryFrom for narrowing
  • num-float-compare - Don't compare floats with ==; use a tolerance, and total_cmp for ordering
  • num-saturating-clamp - Bound values with clamp and saturating arithmetic
  • num-nonzero - Use NonZero* types to forbid zero and unlock the niche optimization
10. Type Safety (MEDIUM)
11. Trait & Generics Design (MEDIUM)
  • trait-associated-type-vs-generic - Use an associated type when each impl has exactly one output type; use a generic parameter when a type can implement the trait for many input types
  • trait-blanket-impl - Use a blanket impl impl<T: Bound> Trait for T to give behaviour to every type that satisfies a bound
  • trait-coherence-newtype - Respect the orphan rule; wrap a foreign type in a newtype to implement a foreign trait on it
  • trait-default-methods - Define a trait in terms of a few required methods plus defaulted ones built on top of them
  • trait-dyn-vs-generic - Choose static dispatch (generics / impl Trait) vs dynamic dispatch (dyn Trait) deliberately
  • trait-object-safety - Keep a trait dyn-compatible (object-safe) when you need dyn Trait
12. Conversions (MEDIUM)
  • conv-tryfrom-fallible - Implement TryFrom for fallible conversions instead of ad-hoc conversion functions
  • conv-fromstr-parsing - Implement FromStr to enable str::parse for string-to-type conversions
  • conv-asmut-mutable - Accept impl AsMut<T> for flexible mutable borrowed inputs instead of concrete mutable references
13. Const & Compile-Time (MEDIUM)
  • const-block - Use inline const { } blocks for compile-time evaluation and assertions
  • const-fn - Make functions const fn when they can run at compile time
  • const-generics - Parameterize over values with const generics <const N: usize>
  • const-vs-static - Use const for an inlined value and static for a single addressed instance
14. Serde (MEDIUM)
15. Pattern Matching (MEDIUM)
16. Macros (MEDIUM)
Show full SKILL.md (1,241 more words)Show less
17. Closures (MEDIUM)
18. Collections (MEDIUM)
  • coll-binaryheap - Use BinaryHeap for a priority queue or repeated max-extraction
  • coll-map-choice - Pick the map by access pattern: HashMap (fast, unordered), BTreeMap (sorted / range queries), IndexMap (insertion order)
  • coll-seq-choice - Default to Vec; use VecDeque for queue/deque behaviour; avoid LinkedList
  • coll-set-membership - Use HashSet/BTreeSet for membership tests and dedup, not linear Vec::contains
19. Naming Conventions (MEDIUM)
20. Testing (MEDIUM)
21. Documentation (MEDIUM)
22. Observability (MEDIUM)
  • obs-tracing-over-log - Use tracing for structured, span-aware diagnostics instead of println! or bare log
  • obs-library-facade - Libraries emit through the tracing/log facade and never install a subscriber
  • obs-structured-fields - Record structured key-value fields, not values interpolated into the message string
  • obs-instrument-spans - Use #[tracing::instrument] and spans to attach context to async tasks and requests
  • obs-levels-filter - Use log levels meaningfully and filter with EnvFilter / RUST_LOG
  • obs-error-chain - Log errors with their full source chain, and log each error exactly once
  • obs-no-sensitive-data - Never log secrets or PII; redact or skip them
23. Performance Patterns (MEDIUM)
24. Project Structure (LOW)
25. Clippy & Linting (LOW)
26. Anti-patterns (REFERENCE)

toml
[profile.release]
opt-level = 3
lto = "fat"
codegen-units = 1
panic = "abort"
strip = true

[profile.bench]
inherits = "release"
debug = true
strip = false

[profile.dev]
opt-level = 0
debug = true

[profile.dev.package."*"]
opt-level = 3  # Optimize dependencies in dev

How to Use

This skill provides rule identifiers for quick reference. When generating or reviewing Rust code:

  1. Check relevant category based on task type
  2. Apply rules with matching prefix
  3. Prioritize CRITICAL > HIGH > MEDIUM > LOW
  4. Read rule files in rules/ for detailed examples
Rule Application by Task
TaskPrimary Categories
New functionown-, err-, name-, pat-
New struct/APIapi-, type-, conv-, doc-
Async codeasync-, own-
Concurrency / parallelismconc-, async-, own-
Unsafe codeunsafe-, type-, test-
Error handlingerr-, api-, pat-
Type conversionsconv-, api-
Serialization (serde)serde-, type-, api-
Numeric / arithmeticnum-, type-
Macros / code generationmacro-, anti-
Closures / callbacksclosure-, type-
Logging / observabilityobs-, err-
Memory optimizationmem-, own-, perf-
Performance tuningopt-, mem-, perf-
Code reviewanti-, lint-

Sources & Attribution

This skill is an independent synthesis of official Rust guidance, well-known books, and patterns from widely-used crates. It is not affiliated with or endorsed by the Rust project or any crate author; the text and code examples are original.

Official Rust documentation

Books & guides

Tooling

Real-world codebases studied for idioms

  • ripgrep, tokio, serde, clap, polars, axum, cargo, hyper, bevy, rayon, and dtolnay's crates (thiserror, anyhow, syn)

This project is MIT-licensed. Referenced upstream materials remain under their own licenses (the official Rust docs and API Guidelines are dual MIT / Apache-2.0).

© JMBeresford, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 265 other files in .agents/skills/rust-skills of JMBeresford/retrom.

  • SKILL.md
  • rules/anti-clone-excessive.md
  • rules/anti-collect-intermediate.md
  • rules/anti-empty-catch.md
  • rules/anti-expect-lazy.md
  • rules/anti-format-hot-path.md
  • rules/anti-index-over-iter.md
  • rules/anti-lock-across-await.md
  • rules/anti-over-abstraction.md
  • rules/anti-panic-expected.md
  • rules/anti-premature-optimize.md
  • rules/anti-string-for-str.md
  • rules/anti-stringly-typed.md
  • rules/anti-type-erasure.md
  • rules/anti-unwrap-abuse.md
  • rules/anti-vec-for-slice.md
  • rules/api-builder-must-use.md
  • rules/api-builder-pattern.md
  • rules/api-common-traits.md
  • rules/api-default-impl.md
  • … and 246 more

Open the folder on GitHubat commit c081a2d

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in JMBeresford/retrom, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Rust Skills 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.

Rust Skills compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Rust Skills this skillJMBeresford/retrom2.1k1 repos~9.5kAutomated safety check: PassMIT
Rust Skillsnoh-rs/nohrs156—~5.3kAutomated safety check: PassMIT
Rust Best Practicesfarm-fe/farm5.6k3 repos~1.1kAutomated safety check: PassMIT
Logging and Error Reporting for Warpwarpdotdev/warp65k1 repos~5.6kAutomated safety check: PassAGPL-3.0
Code Qualitystatic-web-server/static-web-server2.4k—~1.1kAutomated safety check: PassApache-2.0
Rust Best Practicesscott-fryxell/brayness125—~888Automated safety check: PassMIT

Similar skills

  • Rust Skills

    noh-rs/nohrs

    Comprehensive Rust coding guidelines with 179 rules across 14 categories.

    156 GitHub stars~5.3k tokensUpdated 9 days ago
    DevelopmentAuto-check passed
  • Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook.

    5.6k GitHub starsUsed in 3 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Guides log level choices and when to raise a structured Sentry event instead of a plain log line in the Warp Rust codebase, keeping secrets out of logs.

    65k GitHub starsUsed in 1 repo~5.6k tokens
    DevelopmentAuto-check passed
  • Code Quality

    static-web-server/static-web-server

    Review or self-check a change to the Static Web Server (SWS) project before it is called done — correctness, invariants, API design, concurrency, maintainability, and an SWS-specific review checklist.

    2.4k GitHub stars~1.1k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Rust Best Practices

    scott-fryxell/brayness

    Idiomatic Rust guide based on Apollo GraphQL's best practices handbook.

    125 GitHub stars~888 tokensUpdated 13 days ago
    DevelopmentAuto-check passed
  • Error Handling

    ericrisco/rsc-harness

    A skill your agent uses when designing the reaction to a class of failures — typed error taxonomies, retry/backoff/timeout policy, circuit breakers, React/Next error boundaries, and the user-message…

    180 GitHub stars~3.2k tokensUpdated yesterday
    Backend & APIsAuto-check passed

More from JMBeresford/retrom

  • Docker Via Wsl

    JMBeresford/retrom

    A skill your agent uses when YOU (the AI agent) are running on Windows OUTSIDE WSL (Git Bash/MSYS/PowerShell shell) and need to run ANY docker / docker compose command.

    2.1k GitHub stars~832 tokensUpdated 6 days ago
    Auto-check passed
  • Docker Development

    JMBeresford/retrom

    A skill your agent uses when working with ANY Docker task: writing Dockerfiles, configuring docker-compose/compose.yml, multi-stage builds, docker-bake.hcl, container security audits, .dockerignore…

    2.1k GitHub stars~1.1k tokensUpdated 6 days ago
    Auto-check: warnings

Works with

Questions about Rust Skills

What does Rust Skills do?

Comprehensive Rust coding guidelines with 265 rules across 26 categories. Rust Skills is an agent skill from JMBeresford/retrom. Comprehensive Rust coding guidelines with 265 rules across 26 categories.

When should I use Rust Skills?

Rust Skills fits situations like: refactoring Rust code; tasks that involve API design; tasks that involve Refactoring.

How do I install Rust Skills in Claude Code?

Run `npx skills add JMBeresford/retrom --skill rust-skills -a claude-code`. Or copy the skill folder (.agents/skills/rust-skills in JMBeresford/retrom) into .claude/skills/rust-skills in your project. Claude Code loads it when a task matches its description.

How do I install Rust Skills in Codex?

Run `npx skills add JMBeresford/retrom --skill rust-skills -a codex`. Or copy the skill folder (.agents/skills/rust-skills in JMBeresford/retrom) into .agents/skills/rust-skills in your project. Codex loads it when a task matches its description.

Can I use Rust Skills in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add JMBeresford/retrom --skill rust-skills -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rust-skills, .gemini/skills/rust-skills, .github/skills/rust-skills and .opencode/skills/rust-skills in your project.

What does Rust Skills need to run?

Going by SKILL.md and its folder, Rust Skills needs the command-line tools its instructions call (cargo).

Does Rust Skills access the network?

SKILL.md names 7 domains. As links in the text: doc.rust-lang.org, rust-lang.github.io, nnethercote.github.io, rust-unofficial.github.io, marabos.nl, effective-rust.com and github.com. This is read from the text; nothing was executed.

Is Rust Skills safe to install?

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.

What licence does Rust Skills use?

Rust Skills is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Rust Skills use?

About 9.5k tokens (SKILL.md is roughly 38k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Rust Skills?

Skills that share tags, products or a category with Rust Skills: Rust Skills (noh-rs/nohrs, 156 stars), Rust Best Practices (farm-fe/farm, 5.6k stars), Logging and Error Reporting for Warp (warpdotdev/warp, 65k stars) and Code Quality (static-web-server/static-web-server, 2.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Rust Skills?

JMBeresford (a GitHub user) maintains it in JMBeresford/retrom, which has 2,099 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on October 4, 2026.

Source: JMBeresford/retrom on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.