rust-coding-standards

Enforces Rust ownership, error handling, and testing standards with templates and lint configurations.

4|Updated Mar 28, 2026
One-click install
npx skills add https://github.com/minexo79/coser-card-maker --skill rust-coding-standards-minexo79
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-coding-standards
Source: https://github.com/minexo79/coser-card-maker/tree/main/.kilo/skills/coding-standards/rust
Command: npx skills add https://github.com/minexo79/coser-card-maker --skill rust-coding-standards-minexo79

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Writing idiomatic, memory-safe Rust requires mastering ownership, lifetimes, and error handling patterns that are easy to get wrong. This Skill provides a structured reference and ready-to-use configurations so developers consistently apply Rust best practices without re-deriving them for every project. ## Core Features & Use Cases - Three-Level Standards Guide: Quick-reference cheat sheets, implementation guides for ownership/traits/async/testing, and a deep-dive REFERENCE.md covering advanced patterns like typestate, builders, and unsafe code guidelines. - Project Templates & Configs: Production-ready rustfmt.toml and clippy.toml configurations plus lib, binary, and test crate templates with thiserror/anyhow error handling built in. - Automated Project Setup: A setup script that scaffolds a new Rust project with CI workflows (test, clippy, fmt, audit), dependency baselines, and documentation structure. - Use Case: When starting a new Rust microservice, run the setup script to generate a project with linting, formatting, GitHub Actions CI, and testing infrastructure already configured, then consult the skill for async patterns and error type design. ## Quick Start Ask the AI to set up a new Rust project following the coding standards and explain the ownership and error handling patterns to apply.

Frequently Asked Questions about rust-coding-standards

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

FAQPage Schema
How do I handle errors in Rust with thiserror and anyhow?

Use thiserror to define custom error enums with #[derive(Error)] for libraries, and anyhow with .context() for application-level error propagation. The ? operator automatically converts between error types using #[from] attributes.

How do I set up a new Rust project with CI and linting?

Run the setup-rust-project.sh script with a project name and --lib or --bin flag. It creates the crate, copies rustfmt.toml and clippy.toml, adds standard dependencies, and generates a GitHub Actions workflow running tests, clippy, fmt, and cargo audit.

What is the difference between String and &str in Rust?

String is an owned, heap-allocated type while &str is a borrowed string slice. Prefer &str for function parameters to avoid unnecessary allocations, and use String when you need ownership or mutation.

How do I write async tests in Rust with tokio?

Use the #[tokio::test] attribute on async test functions instead of #[test]. This runs the test on a tokio runtime, allowing you to .await async operations directly inside the test body.

When should I use unsafe code in Rust?

Reserve unsafe for FFI calls, raw pointer manipulation, or implementing unsafe traits like Send and Sync. Always document safety invariants with a # Safety doc section, minimize unsafe block scope, and test with Miri to detect undefined behavior.

Why does the Rust borrow checker reject my code?

The borrow checker enforces one mutable reference XOR multiple immutable references at a time. Restructure code so borrows end before mutation, clone data when sharing is needed, or use Arc<Mutex<T>> for shared mutable state across tasks.