rust-best-practices

Enforce Apollo GraphQL best practices for idiomatic Rust code.

102|12|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/apollographql/skills --skill rust-best-practices-apollographql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-best-practices
Source: https://github.com/apollographql/skills/tree/main/skills/rust-best-practices
Command: npx skills add https://github.com/apollographql/skills --skill rust-best-practices-apollographql

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill provides guidance and best practices for writing idiomatic, efficient, and maintainable Rust code, aligning with Apollo GraphQL's established standards.

Core Features & Use Cases

  • Code Quality: Enforces Rust best practices for borrowing, ownership, error handling, and performance.
  • Tooling Integration: Leverages clippy and rustfmt for automated code analysis and formatting.
  • Use Case: When developing a new Rust service or refactoring existing code, use this skill to ensure adherence to high-quality standards, improving code readability, performance, and reducing bugs.

Quick Start

Review the provided Rust code snippet against Apollo's best practices for idiomatic Rust.

Frequently Asked Questions about rust-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are the best practices for writing idiomatic Rust code?

Idiomatic Rust code best practices involve correctly managing borrowing and ownership, handling errors with Result types, and applying clippy linting to ensure high performance and maintainability.

How do I use clippy and rustfmt to enforce Rust coding standards?

You use clippy and rustfmt to enforce Rust coding standards by running automated code analysis and formatting, which aligns your project with established structural styles and reduces bugs.

How should I handle errors in Rust using Result types?

Handling errors in Rust using Result types involves returning explicit success or error enumerations instead of panicking, ensuring robust error propagation and code safety.

When do I need to use the type state pattern in Rust?

You need to use the type state pattern in Rust when you want to enforce valid state transitions at compile time, leveraging generics and the type system to prevent invalid code execution.

What is the best way to optimize Rust performance for a new service?

Optimizing Rust performance for a new service requires applying idiomatic borrowing patterns, minimizing unnecessary allocations, and following established guidelines to improve code execution speed.