Agent skill

Rust Best Practices

by farm-fe in farm-fe/farm

Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook.

MITAuto-check passedDevelopment

Install Rust Best Practices

skills CLI
$ npx skills add farm-fe/farm --skill rust-best-practices -a claude-code

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

GitHub CLI
$ gh skill install farm-fe/farm rust-best-practices --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/farm-fe/farm.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/rust-best-practices .claude/skills/rust-best-practices && 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-best-practices
GitHub stars
5.6k
Used in
3 other repos
Token cost
~1.1k tokens
SKILL.md length
391 words
Files
10 (incl. references)
Skills in repo
20
Repo updated
First seen
Licence
MIT

At a glance

Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook.

  • Writing new Rust code
  • SKILL.md covers Best Practices Reference and Quick Reference
  • Calls cargo
  • Refactoring existing Rust code

What it does

Rust Best Practices is an agent skill from farm-fe/farm. Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook. Use this skill when: (1) writing new Rust code or functions, (2) reviewing or refactoring existing Rust code, (3) deciding between borrowing vs cloning or ownership patterns, (4) implementing error handling with Result types, (5) optimizing Rust code for performance, (6) writing tests or documentation for Rust projects.

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 10 other files, including reference files (for example `references/chapter_01.md`, `references/chapter_02.md` and `references/chapter_03.md`). Compatibility notes: Rust 1.70+, Cargo

It sits in Development, covering Refactoring, Linting and formatting and Error handling. It works with Rust and Apollo GraphQL. The repository describes itself as: Extremely fast Vite-compatible web build tool written in Rust. The licence is MIT.

When your agent uses it

  • Writing new Rust code
  • Refactoring existing Rust code
  • Deciding between borrowing vs cloning
  • Ownership patterns

Example prompts

  • “/rust-best-practices”

Requirements

  • Compatibility (from SKILL.md): Rust 1.70+, Cargo
  • Pre-approved tools (allowed-tools): Bash(cargo:*), Bash(rustc:*), Bash(rustfmt:*), Bash(clippy:*), Read, Write, Edit, Glob, Grep

What it can do on your machine

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

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash(cargo:*)
    • Bash(rustc:*)
    • Bash(rustfmt:*)
    • Bash(clippy:*)
    • Read
    • Write
    • Edit
    • Glob
    • Grep

    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):

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

  • Compatibility

    Rust 1.70+, Cargo

    From compatibility in the SKILL.md frontmatter.

Context cost

Rust Best Practices loads about 1.1k tokens when it runs, and up to ~23k if it reads all its reference files. Until then it costs about 108 tokens; SKILL.md has 391 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~108
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~23k

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 farm-fe/farm at commit 2000ef8, republished under its MIT licence (© farm-fe). 391 words, ~1,085 tokens.

Download SKILL.mdSave it as .claude/skills/rust-best-practices/SKILL.md (or your agent's skills folder). This skill also uses 9 other files; get the full folder from GitHub.
name
rust-best-practices
description
Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook. Use this skill when: (1) writing new Rust code or functions, (2) reviewing or refactoring existing Rust code, (3) deciding between borrowing vs cloning or ownership patterns, (4) implementing error handling with Result types, (5) optimizing Rust code for performance, (6) writing tests or documentation for Rust projects.
allowed-tools
Bash(cargo:*), Bash(rustc:*), Bash(rustfmt:*), Bash(clippy:*), Read, Write, Edit, Glob, Grep
compatibility
Rust 1.70+, Cargo
license
MIT
metadata.author
apollographql
metadata.version
1.1.0

Rust Best Practices

Apply these guidelines when writing or reviewing Rust code. Based on Apollo GraphQL's Rust Best Practices Handbook.

Best Practices Reference

Before reviewing, familiarize yourself with Apollo's Rust best practices. Read ALL relevant chapters in the same turn in parallel. Reference these files when providing feedback:

Quick Reference

Borrowing & Ownership
  • Prefer &T over .clone() unless ownership transfer is required
  • Use &str over String, &[T] over Vec<T> in function parameters
  • Small Copy types (≤24 bytes) can be passed by value
  • Use Cow<'_, T> when ownership is ambiguous
Error Handling
  • Return Result<T, E> for fallible operations; avoid panic! in production
  • Never use unwrap()/expect() outside tests
  • Use thiserror for library errors, anyhow for binaries only
  • Prefer ? operator over match chains for error propagation
Show full SKILL.md (162 more words)Show less
Performance
  • Always benchmark with --release flag
  • Run cargo clippy -- -D clippy::perf for performance hints
  • Avoid cloning in loops; use .iter() instead of .into_iter() for Copy types
  • Prefer iterators over manual loops; avoid intermediate .collect() calls
Linting

Run regularly: cargo clippy --all-targets --all-features --locked -- -D warnings

Key lints to watch:

  • redundant_clone - unnecessary cloning
  • large_enum_variant - oversized variants (consider boxing)
  • needless_collect - premature collection

Use #[expect(clippy::lint)] over #[allow(...)] with justification comment.

Testing
  • Name tests descriptively: process_should_return_error_when_input_empty()
  • One assertion per test when possible
  • Use doc tests (///) for public API examples
  • Consider cargo insta for snapshot testing generated output
Generics & Dispatch
  • Prefer generics (static dispatch) for performance-critical code
  • Use dyn Trait only when heterogeneous collections are needed
  • Box at API boundaries, not internally
Type State Pattern

Encode valid states in the type system to catch invalid operations at compile time:

rust
struct Connection<State> { /* ... */ _state: PhantomData<State> }
struct Disconnected;
struct Connected;

impl Connection<Connected> {
    fn send(&self, data: &[u8]) { /* only connected can send */ }
}
Documentation
  • // comments explain why (safety, workarounds, design rationale)
  • /// doc comments explain what and how for public APIs
  • Every TODO needs a linked issue: // TODO(#42): ...
  • Enable #![deny(missing_docs)] for libraries

© farm-fe, 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 9 other files (references) in .agents/skills/rust-best-practices of farm-fe/farm.

  • SKILL.md
  • references/chapter_01.md
  • references/chapter_02.md
  • references/chapter_03.md
  • references/chapter_04.md
  • references/chapter_05.md
  • references/chapter_06.md
  • references/chapter_07.md
  • references/chapter_08.md
  • references/chapter_09.md

Open the folder on GitHubat commit 2000ef8

Used in 4 other repositories

We found 5 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 3 other GitHub owners. This page covers the copy in farm-fe/farm, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Rust Best Practices 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 Best Practices compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Rust Best Practices this skillfarm-fe/farm5.6k3 repos~1.1kAutomated safety check: PassMIT
Rust Best Practicesscott-fryxell/brayness125—~888Automated safety check: PassMIT
Rust Hygiene Audittsz-org/tsz577—~1.5kAutomated safety check: PassApache-2.0
Rust SkillsJMBeresford/retrom2.1k1 repos~9.5kAutomated safety check: PassMIT
Rust Skillsnoh-rs/nohrs156—~5.3kAutomated safety check: PassMIT
Migrate Core Code to Submodulestinyhumansai/openhuman42k—~2.6kAutomated safety check: PassGPL-3.0

Similar skills

  • Rust Best Practices

    scott-fryxell/brayness

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

    125 GitHub stars~888 tokensUpdated 11 days ago
    DevelopmentAuto-check passed
  • Run a deep DRY + code-hygiene audit of the Rust workspace and turn the findings into verified, deduplicated, hierarchical GitHub tech-debt issues.

    577 GitHub stars~1.5k tokensUpdated 29 days ago
    DevelopmentAuto-check passed
  • Rust Skills

    JMBeresford/retrom

    Comprehensive Rust coding guidelines with 265 rules across 26 categories.

    2.1k GitHub starsUsed in 1 repo~9.5k tokens
    DevelopmentAuto-check passed
  • Rust Skills

    noh-rs/nohrs

    Comprehensive Rust coding guidelines with 179 rules across 14 categories.

    156 GitHub stars~5.3k tokensUpdated 7 days ago
    DevelopmentAuto-check passed
  • Migrate Core Code to Submodules

    tinyhumansai/openhuman

    Plans and carries out moving non-host-specific code and its tests from the OpenHuman core into vendored tiny submodule libraries, then releases the submodule and re-pins the host.

    42k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Describes seven Rust design patterns for the RTK CLI filter modules, with when to use each, RTK examples, and notes on when a pattern is overkill.

    83k GitHub stars~1.9k tokensUpdated today
    DevelopmentAuto-check passed

More from farm-fe/farm

All 20 skills in this repo
  • Using Superpowers

    farm-fe/farm

    A skill your agent uses when starting any conversation - establishes how to find and use skills, requiring Skill tool invocation before ANY response including clarifying questions

    5.6k GitHub starsUsed in 35 repos~1.4k tokens
    Auto-check passed
  • A skill your agent uses when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for…

    5.6k GitHub starsUsed in 34 repos~1.8k tokens
    Auto-check passed
  • A skill your agent uses when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and…

    5.6k GitHub starsUsed in 45 repos~1.6k tokens
    Auto-check passed
  • A skill your agent uses when completing tasks, implementing major features, or before merging to verify work meets requirements

    5.6k GitHub starsUsed in 38 repos~702 tokens
    Auto-check passed
  • A skill your agent uses when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any…

    5.6k GitHub starsUsed in 46 repos~1k tokens
    Auto-check passed
  • A universal self-improving agent that learns from ALL skill experiences.

    5.6k GitHub starsUsed in 2 repos~3.3k tokens
    Auto-check: notes

Categories

Questions about Rust Best Practices

What does Rust Best Practices do?

Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook. Rust Best Practices is an agent skill from farm-fe/farm. Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook.

When should I use Rust Best Practices?

Rust Best Practices fits situations like: writing new Rust code; refactoring existing Rust code; deciding between borrowing vs cloning; ownership patterns.

How do I install Rust Best Practices in Claude Code?

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

How do I install Rust Best Practices in Codex?

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

Can I use Rust Best Practices 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 farm-fe/farm --skill rust-best-practices -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-best-practices, .gemini/skills/rust-best-practices, .github/skills/rust-best-practices and .opencode/skills/rust-best-practices in your project.

What does Rust Best Practices need to run?

Going by SKILL.md and its folder, Rust Best Practices needs the command-line tools its instructions call (cargo). Its frontmatter pre-approves these tools: Bash(cargo:*), Bash(rustc:*), Bash(rustfmt:*), Bash(clippy:*), Read, Write, Edit, Glob, Grep. Compatibility (from SKILL.md): Rust 1.70+, Cargo.

Does Rust Best Practices access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Rust Best Practices 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 Best Practices use?

Rust Best Practices 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 Best Practices use?

About 1.1k tokens (SKILL.md is roughly 4.3k 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 22k tokens, read only when the agent opens those files.

What are the alternatives to Rust Best Practices?

Skills that share tags, products or a category with Rust Best Practices: Rust Best Practices (scott-fryxell/brayness, 125 stars), Rust Hygiene Audit (tsz-org/tsz, 577 stars), Rust Skills (JMBeresford/retrom, 2.1k stars) and Rust Skills (noh-rs/nohrs, 156 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Rust Best Practices?

farm-fe (a GitHub organization) maintains it in farm-fe/farm, which has 5,595 GitHub stars. The repository holds 20 skills in this directory. The repository was last updated on September 22, 2026.

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