rc-rust

Guides writing and reviewing idiomatic Rust covering ownership, errors, async, traits, testing, and linting.

19|1|Updated Jun 27, 2026
One-click install
npx skills add https://github.com/rodolfochicone/rc-project --skill rc-rust-rodolfochicone
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rc-rust
Source: https://github.com/rodolfochicone/rc-project/tree/main/skills/stacks/rc-rust
Command: npx skills add https://github.com/rodolfochicone/rc-project --skill rc-rust-rodolfochicone

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Rust developers face recurring decisions about ownership vs. cloning, error type design, async task structure, and lint configuration, and inconsistent choices lead to borrow-checker fights, panics in production, and unmaintainable code. This Skill consolidates idiomatic Rust guidance into one reference so code is written and reviewed against consistent standards. ## Core Features & Use Cases - Language-wide guidance: Covers ownership and lifetimes, smart pointers, error hierarchies with thiserror/anyhow, trait design, generics, and the type state pattern. - Async and concurrency patterns: Tokio task management with JoinSet, channel selection (mpsc, broadcast, oneshot, watch), graceful shutdown with CancellationToken, and sync primitives like atomics and parking_lot. - Quality tooling: Testing with rstest, proptest, insta, mockall, and criterion; clippy lint configuration; rustdoc standards; and performance profiling with flamegraph. - Use Case: When reviewing a Rust pull request that clones data in a hot loop and swallows errors with unwrap, load this Skill to recommend borrowing, the ? operator with a thiserror hierarchy, and the relevant clippy lints. ## Quick Start Ask the assistant to review your Rust function for ownership, error handling, and clippy issues using the rc-rust guidelines.

Frequently Asked Questions about rc-rust

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 typed error enums with derive macros for libraries, and anyhow with context() for binaries where error type erasure is acceptable. Propagate errors with the ? operator and avoid unwrap() in production code.

When should I use borrowing vs cloning in Rust?▼

Prefer borrowing with &T, &str, and &[T] in function parameters by default. Clone only when ownership transfer is required, when sharing across threads via Arc, or when the API demands owned data, and clone at the last moment.

What is the difference between static and dynamic dispatch in Rust?▼

Static dispatch uses generics or impl Trait and monomorphizes at compile time with zero runtime cost. Dynamic dispatch uses dyn Trait with a vtable, trading speed for flexibility like heterogeneous collections and plugin architectures.

How do I structure async Rust code with Tokio?▼

Use JoinSet to manage concurrent tasks, select the right channel (mpsc, broadcast, oneshot, watch) for communication, and CancellationToken for graceful shutdown. Never hold locks across .await points or use std::thread::sleep in async contexts.

Which clippy lints should I enable for a Rust workspace?▼

Set clippy::all and clippy::pedantic to warn in workspace.lints, and run cargo clippy --all-targets --all-features --locked -- -D warnings in CI. Prefer #[expect] over #[allow] for suppressions with a justification comment.

When should I not use this Rust language skill?▼

Do not use it for framework-specific concerns: Axum routing and middleware belong to rc-axum, SQLx queries and migrations to rc-sqlx, and SvelteKit front ends to rc-sveltekit. It covers Rust the language only.