Rust Best Practices
@apollographqlApollo GraphQL's rust-best-practices skill: makes your agent write and review Rust by Apollo's handbook (ownership, errors, Clippy, tests, generics).
Markdown-only Rust guide with no scripts or API keys; the agent may run cargo (including cargo install) and edit your files.
Install Rust Best Practices in Google Antigravity
Antigravity loads skills from .agents/skills/ in your project or ~/.gemini/config/skills/ for all projects (official docs). Full guide
Install the "Rust Best Practices" skill for Google Antigravity. Follow the steps at https://www.antigravityskills.org/install/rust-expert.md (source: https://github.com/apollographql/skills/tree/main/skills/rust-best-practices). Before running anything, show me what you will download and whether it includes scripts, and wait for my OK. Install it into this project (.agents/skills/) unless I say global. When done, check that Antigravity lists it as an installed skill.
The agent reads the install file, shows you what it will download and waits for your OK.
Option 2: install it yourself
- 1. Download the repository
git clone --depth 1 https://github.com/apollographql/skills /tmp/apollo-skills && git -C /tmp/apollo-skills log -1 --format=%h -- skills/rust-best-practices
The second command prints the last commit that changed this skill. We reviewed fd9e4ba; a different hash means the skill changed after our review.
- 2. Copy the skill into this project (workspace skill)
mkdir -p .agents/skills && cp -r /tmp/apollo-skills/skills/rust-best-practices .agents/skills/
Run from your project root. Antigravity then reads .agents/skills/rust-best-practices/SKILL.md plus its references/ folder (keep both; SKILL.md links to the chapters).
- 3. Or install it for all projects (global skill)
mkdir -p ~/.gemini/config/skills && cp -r /tmp/apollo-skills/skills/rust-best-practices ~/.gemini/config/skills/
Use this instead of the previous step. For the Antigravity CLI the global folder is ~/.gemini/antigravity-cli/skills/.
- 4. Check that Antigravity sees it
Antigravity 2.0 app: start a new conversation and ask "What skills do you have?"; rust-best-practices should be listed. Antigravity CLI: run /skills (/skills reload in a session that was already open).
The apollographql/skills README documents the Skills CLI, the Claude Code plugin and gh skill, and does not mention Antigravity. These steps copy the plain SKILL.md folder into Antigravity's standard skill folders. No API keys; you need cargo, rustc and rustfmt on PATH for the agent's checks.
Using Claude Code, Cursor or Codex? See other assistants below.
What is Rust Best Practices?
How to use Rust Best Practices?
Key features of Rust Best Practices
- ✓Quick reference in SKILL.md: &T over .clone(), &str / &[T] parameters, small Copy types by value, Cow when ownership is unclear
- ✓Error rules: Result over panic!, no unwrap()/expect() outside tests, thiserror for libraries, anyhow only for binaries, ? over match chains
- ✓Clippy discipline: the -D warnings command, 8 lints in a table (redundant_clone, large_enum_variant, needless_collect ...), #[expect] with a reason instead of #[allow]
- ✓Testing: sentence-style test names, one behaviour per test, doc tests, snapshot testing with cargo insta
- ✓Generics vs dyn Trait, the type state pattern, comments vs rustdoc, Send/Sync and pointer types
- ✓9 reference chapters, 2,533 lines in total (we counted)
When to use Rust Best Practices
- 1Review a Rust pull request against one consistent, written style guide
- 2Remove unnecessary clones and unwrap() calls from production paths
- 3Set up workspace-wide Clippy lints in Cargo.toml
- 4Design a library error enum with thiserror
- 5Add descriptive tests and rustdoc examples to a public API
Installation & Setup Guide
Agent Rules / Prompt SetupFollow these steps (taken from the project's own docs) to configure Rust Best Practices in your development environment.
npx skills add apollographql/skills@rust-best-practices
The README's per-skill install line. The interactive installer lets you pick target agents; the README lists Claude Code, Codex, Cursor, Gemini CLI, Goose and OpenCode.
/plugin marketplace add apollographql/skills /plugin install apollo-skills@apollo-marketplace
Installs the whole apollo-skills plugin (version 1.3.1 at our commit; 14 skill folders), then use /apollo-skills:rust-best-practices.
gh skill install apollographql/skills rust-best-practices --agent cursor
The README shows --agent claude-code and says --agent also supports Cursor and other hosts; add --pin vX.Y.Z to pin a release.
Usage Example & Verification
1) README example (Claude Code plugin): /apollo-skills:rust-best-practices -> What happens: the namespaced slash command loads the skill; in Antigravity there is no namespace, so just mention Rust best practices or the skill name in your request. 2) Our example: "Review src/parser.rs with the Rust best practices skill and fix unnecessary clones and unwrap() calls." -> What happens: the agent reads chapters 1, 3 and 4 (borrowing, performance, error handling), lists findings with the rule each one breaks, edits the file, and can run cargo clippy to confirm no new warnings. It writes to your file, so review the diff. 3) Our example: "Set up workspace lints for this Cargo workspace following the skill." -> What happens: the agent follows Chapter 2 (section 2.5, workspace/package lints) and adds [workspace.lints.rust] and [workspace.lints.clippy] sections to Cargo.toml, then runs cargo clippy to see what fails.
Ask "What skills do you have?" in a new Antigravity conversation (CLI: /skills) and look for rust-best-practices. Then ask "Which chapter of the Rust best practices skill covers thiserror vs anyhow?"; the answer should be Chapter 4 (Error Handling).
Security Review
Static reviewMarkdown-only Rust guide with no scripts or API keys; the agent may run cargo (including cargo install) and edit your files.
Full review: scope, findings, risks
Static review at commit fd9e4ba. skills/rust-best-practices holds SKILL.md and 9 Markdown chapters; there are no executable files. The frontmatter limits shell use to cargo, rustc, rustfmt and clippy plus the Read/Write/Edit/Glob/Grep file tools. A grep for curl, wget, subprocess, eval and exec found only Rust documentation text. The only install commands are cargo install flamegraph (Chapter 3, profiling) and cargo install cargo-insta (Chapter 5, snapshot review); both are allowed by Bash(cargo:*). URLs point to documentation sites (doc.rust-lang.org, rust-lang.github.io/rust-clippy, crates.io, insta.rs, docs.rs) and to examples in github.com/apollographql/rust-best-practices. The skill needs no environment variables or credentials. Building or testing your project with cargo compiles your dependencies, including their build.rs scripts, as any Rust build does.
Operational Notes & Known Limitations
Known Limitations
- •Needs a Rust toolchain with Cargo; SKILL.md frontmatter states compatibility Rust 1.70+, Cargo
- •Our note: the skill recommends #[expect(clippy::lint)] over #[allow], but the expect attribute only became stable in Rust 1.81, so on 1.70-1.80 that advice does not compile
- •allowed-tools Bash(cargo:*) also covers cargo install; Chapter 3 shows cargo install flamegraph and Chapter 5 suggests cargo install cargo-insta, so the agent may install crates from crates.io if it follows those sections
- •It is a style and review guide for existing code, not a Rust tutorial or a project generator
- •Apollo's own conventions (one assertion per test, anyhow only in binaries) may differ from your team's rules
- •The README does not mention Antigravity (we searched); the steps below copy the plain folder into Antigravity's skills folder. Difference from the clean-code page on our site: clean-code is language-agnostic; this skill is Rust-only and ships 9 chapters of Rust-specific rules
Frequently Asked Questions
Is the Rust best practices skill safe?
In our static review of commit fd9e4ba it is Markdown only, with no scripts. The agent may run cargo, rustc and rustfmt and edit files. A cargo build compiles your dependencies' build scripts, and cargo install (allowed by the same rule) downloads crates. No API keys.
How do I install it in Antigravity?
Clone apollographql/skills, copy skills/rust-best-practices (with its references/ folder) into .agents/skills/ or ~/.gemini/config/skills/, then ask "What skills do you have?" (CLI: /skills). The README does not mention Antigravity.
Is there a skill literally called "Rust Expert"?
Not in Apollo's repo. rust-pro in sickn33/antigravity-awesome-skills starts with "You are a Rust expert". We cover Apollo's skill because it is vendor-maintained, versioned and backed by 9 reference chapters.
Which Rust version does it need?
SKILL.md says Rust 1.70+. The #[expect] lint attribute it recommends needs Rust 1.81 or newer.
Supported Platforms
Keep exploring this topic
Browse the full Antigravity skills directory for more source-linked skills with install steps and static safety reviews.
Related Skills
Clean Code
@sickn33
A one-file Clean Code playbook (Robert C. Martin's rules on naming, functions, comments, errors, tests and classes) that AI coding agents follow when writing, reviewing or refactoring code.
Cursor Code Review (Superpowers)
@obra
Superpowers' requesting-code-review skill: the agent sends a git diff to a reviewer subagent and gets Critical/Important/Minor findings and a verdict.
Impeccable
@pbakaus
Paul Bakaus's Impeccable design skill: one /impeccable skill with 24 design commands, live browser iteration and a 59-rule detector for AI-generated frontend patterns.
Popular Skills
View All →Agent Manager
@sickn33
Manage multiple local CLI agents via tmux sessions.
Systematic Debugging
@sickn33
Debug systematically, not randomly. Find and fix bugs methodically.
Browser Automation (Playwright)
@sickn33
Expert browser automation for cleaning scraping and reliable testing.