Lang: Rust
Rules
- •Safety: NEVER use
.unwrap(). Use?propagation or.expect("msg"). - •Style: Prefer Iterators (
.map().collect()) overforloops. - •Async: Assume
tokio. Use.await. Never block async threads. - •Errors: Use
anyhow::Resultfor apps,thiserrorfor libs. - •Tests: Co-locate unit tests in
mod testswith#[cfg(test)]. - •Clippy: Code must be strictly
clippy-compliant (idiomatic).
Workflow
- •Use
skill workflow-envbefore build/run commands. - •Build:
cargo build --release - •Test:
cargo test - •Format:
cargo fmt
Documentation Access
When you need to verify ownership rules, async runtime behavior, or std library APIs:
- •Primary (Context7):
/websites/doc_rust-lang_stable_book - •Fallback: https://doc.rust-lang.org
Usage: Only use documentation lookup when you need to verify uncertain syntax, check breaking changes, or explore unfamiliar APIs. Apply this skill's established rules directly for routine tasks.