rust-coding-standards

Enforce Rust coding standards across ownership, error handling, and CI workflows.

17|1|Updated Jun 8, 2025
One-click install
npx skills add https://github.com/williamzujkowski/standards --skill rust-coding-standards
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-coding-standards
Source: https://github.com/williamzujkowski/standards/tree/main/skills/coding-standards/rust
Command: npx skills add https://github.com/williamzujkowski/standards --skill rust-coding-standards

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This skill provides a comprehensive guide to Rust coding standards, enabling you to master its unique ownership system, type safety, and zero-cost abstractions. It automates the enforcement of best practices for memory safety, concurrency, and performance, reducing common pitfalls and improving code reliability.

Core Features & Use Cases

  • Ownership & Borrowing Mastery: Guides on Rust's core memory safety concepts to prevent data races and dangling pointers.
  • Robust Error Handling: Teaches idiomatic error management using Result, Option, thiserror, and anyhow.
  • Safe Concurrency: Provides patterns for building concurrent systems without data races, leveraging Rust's type system.
  • Use Case: Set up a new Rust project by applying these standards, automatically configuring cargo clippy and cargo fmt to ensure all code adheres to best practices for safety and performance.

Quick Start

Generate a basic Rust library project with Cargo.toml, lib.rs, and a sample test file, following idiomatic Rust standards.

Frequently Asked Questions about rust-coding-standards

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

FAQPage Schema
How do I enforce Rust coding standards across my codebase?

Enforce Rust coding standards by configuring cargo clippy for linting and cargo fmt for formatting, then integrating these checks into CI workflows. This Skill automates setup to validate ownership, borrowing, error handling, and unsafe code justification across libraries and binaries.

What are Rust's ownership and borrowing rules, and how do I apply them correctly?

Ownership and borrowing are Rust's core memory safety mechanisms that prevent data races and dangling pointers. This Skill guides you through these concepts with patterns and standards to write safe, concurrent systems without unsafe blocks unless rigorously justified.

How do I handle errors idiomatically in Rust?

Idiomatic Rust error handling uses Result and Option types with libraries like thiserror and anyhow for robust error propagation. This Skill enforces comprehensive error type definitions and patterns as part of coding standards for reliable systems.

Can I set up a new Rust project with best practices automatically applied?

Yes. This Skill generates a basic Rust library project with Cargo.toml, lib.rs, and sample tests following idiomatic standards. It automatically configures clippy and rustfmt checks to ensure safety, concurrency, and performance best practices from the start.

Why should I avoid unsafe code in Rust, and when is it justified?

Unsafe code bypasses Rust's memory safety guarantees and risks undefined behavior. This Skill enforces that all unsafe blocks require clear justification and comprehensive testing, ensuring safety audits and maintaining system reliability in production codebases.

Does this Skill work with both Rust libraries and binary applications?

Yes. This Skill applies to Rust projects across ownership, borrowing, error handling, testing, and formatting for both libraries and binaries. It integrates with code reviews and automated CI pipelines to enforce standards consistently.