Rust Skills

265 short Rust rules for an AI agent covering ownership, errors, async, unsafe and performance, each with a bad and a good code example

  • 654 ★ on the repository
  • Last commit
  • MIT
Skill

Minimal access

Why this level

  • The skill is text rules and examples; it runs nothing and makes no network calls
  • The agent reads your project files as it does without the skill, and the skill asks for no extra permissions
All reasons and checks

leonardomso/rust-skills

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add skills/rust-skills

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Minimal accessThe tool runs nothing and makes no network calls.

  • The skill is text rules and examples; it runs nothing and makes no network calls
  • The agent reads your project files as it does without the skill, and the skill asks for no extra permissions

This is third-party code. Review the repository files before installing.

What it does

Rust Skills is a set of 265 rules in 26 categories that an agent follows when writing and reviewing Rust (Rust 1.96, 2024 edition). The author's premise is that agents left alone write average code: they clone to dodge the borrow checker, call `.unwrap()` everywhere and reach for `Box<dyn Trait>` where `impl Trait` would do. The rules describe what strong code looks like. Each rule sits in its own file under `rules/` and has a one-line summary, an explanation, a bad example, a good example and links to related rules. SKILL.md works as a table of contents: every rule as one line, grouped by category with a priority from critical to reference. The agent reads the index and opens only the files it needs, so context stays small. You invoke the skill with `/rust-skills` and a question such as «review this function», «is my error handling idiomatic?» or «is this unsafe block sound?». The README shows a `first_word` function with `&String` and `.unwrap()` turning into a version that takes `&str` and returns an `Option`.

Who it is for. For Rust developers who hand code writing and review to an agent and want it to follow the language's idioms.

Good fit when

  • An agent writes a new Rust function or module and you want it to borrow instead of adding needless `.clone()` calls
  • You need to check whether error handling is idiomatic: `thiserror` for a library, `anyhow` for an application, the `?` operator
  • Before a merge you want an `unsafe` block reviewed: `SAFETY:` comments, Miri, `MaybeUninit`
  • You are designing a public library API and checking it against the builder, newtype and sealed trait patterns
  • You want fewer allocations or a faster hot path: rules on `SmallVec`, arenas, LTO, PGO and SIMD

Not a fit when

  • The project is not written in Rust: the rules are entirely about this language, its ecosystem and tooling
  • You need a general language-agnostic code review: the catalog has universal skills for that
  • You need compiler-level checking: the skill guides the agent's style and sits beside `cargo clippy` and tests
  • The project is stuck on an old Rust version: the rules target 1.96 and the 2024 edition, so some advice may not compile

Example request

/rust-skills check whether error handling in src/parser.rs is idiomatic and whether it has needless clones

Limitations

The skill gives the agent rules and the result depends on the model; it runs no code itself. The rules target Rust 1.96 and the 2024 edition, and the author advises verifying examples on current stable.

The author states that the material is based on official documentation, books and a study of popular crates, with text and examples written from scratch. The project is not affiliated with the Rust team or crate authors.

One passage of the README says 218 rules instead of 265: go by the figure in SKILL.md and the index, which matches the contents of the `rules/` folder.

How to disable. Delete the rust-skills folder from the agent's skills directory: `~/.claude/skills/rust-skills` for Claude Code or `.cursor/skills/rust-skills` in the project for Cursor. If you installed with `npx add-skill`, remove the skill from the directory the command used. Delete any AGENTS.md or .cursorrules files you downloaded by hand separately.

FAQ

How do I install Rust Skills in Claude Code?

Run `npx add-skill leonardomso/rust-skills`: the command detects the agents you have and puts the skill in the right folder. Manually: `git clone https://github.com/leonardomso/rust-skills.git ~/.claude/skills/rust-skills` for all projects, or into `.claude/skills/rust-skills` for one.

How do I invoke the skill?

With `/rust-skills` and a question, for example `/rust-skills is this unsafe block sound?`. The agent loads the index and opens only the rules that relate to your code.

What does a rule consist of?

Each rule is a file `rules/<prefix>-<name>.md` with a one-line summary, an explanation, a bad and a good example and a See Also section. Prefixes such as `own-`, `err-` and `async-` map to categories, so when reviewing async code the agent can pull only `async-`, `conc-` and `own-`.

Which agents are supported?

The README names Claude Code, Cursor, Windsurf, Copilot, Codex, Aider, Zed, Amp and Cline and gives manual install steps for each. For Windsurf, Copilot and Zed it downloads SKILL.md into `.windsurf/rules/`, `.github/copilot-instructions.md` or AGENTS.md instead of a skill folder.

How is it different from an ordinary agent code review?

The agent gets a concrete Rust rule list with priorities: ownership, error handling, memory and unsafe are marked critical. A generic review skill checks general matters such as architecture and security, while these rules are tied to the language's idioms.

Discussion

No questions or reviews yet.

Skills

A code review skill across many languages and frameworks: architecture, performance, security, anti-patterns and common bugs

SkillMinimal access2.2KRepository stars

Agent rules from programming books

AI agents Rules / Skills from Programming Books

Skills and AGENTS.md rules distilled from classic books: Clean Code, Refactoring, DDD, Clean Architecture, DDIA and more

SkillMinimal access3.1KRepository stars

Mindrally skills collection

Claude Code Skills Collection

Over two hundred coding-guideline skills for frameworks and languages, converted from Cursor rules to SKILL.md

SkillMinimal access288Repository stars

Guard skills for coding agents: a second pass over the diff that catches typical AI mistakes in code, tests and docs

SkillMinimal access1.3KRepository stars

The author's personal set: shared agent rules and dozens of skills for GitHub, the browser, macOS, messaging and releases, plus a sync script

SkillBroad access7.4KRepository stars

Two skills for coding agents: wtf audits a project before shipping, better-codex keeps the agent disciplined while working on code

SkillExtended access1.4KRepository stars

README in short

The README opens with the thesis that agents left alone write average Rust. It then covers one-command install, example `/rust-skills` requests, a table of 26 categories with rule counts and an explanation of the index, rule files and prefixes. Manual install is written out for ten agents. It closes with the sources, which are the official Rust docs, books on performance and patterns and the studied crates, plus the format of a new rule for contributors.

README badge

Original SKILL.md

---
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
  version: "1.5.1"
  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

| Priority | Category | Impact | Prefix | Rules |
|----------|----------|--------|--------|-------|
| 1 | Ownership & Borrowing | CRITICAL | `own-` | 12 |
| 2 | Error Handling | CRITICAL | `err-` | 12 |
| 3 | Memory Optimization | CRITICAL | `mem-` | 17 |
| 4 | Unsafe Code | CRITICAL | `unsafe-` | 7 |

Report a problem

Foxx AIRust Skills
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.