skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
pedronauck/skills245 installs

rust-best-practices

Write, review, refactor, or optimize Rust, including ownership, errors, Tokio, traits, tests, benchmarks, Clippy, and documentation. Excludes other languages and architecture unrelated to Rust idioms.

How do I install this agent skill?

npx skills add https://github.com/pedronauck/skills --skill rust-best-practices
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    This skill provides a set of comprehensive references and guidelines for Rust development. It contains no malicious code, obfuscation, or unauthorized data access patterns. It is categorized as safe for use.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

What does this agent skill do?

Rust Best Practices

Use the existing crate design, edition, rust-toolchain.toml, and Cargo.toml rust-version (MSRV). Reference examples may use newer features: confirm support before adopting them; do not upgrade the toolchain or add a crate just to follow an example.

Read the reference for the Rust concern being changed. A local edit does not require every category, a new test framework, or a workspace-wide audit.

TopicReferenceLoad When
Coding Stylereferences/coding-style.mdNaming, imports, iterators, comments, string handling, macros
Error Handlingreferences/error-handling.mdResult, Option, ?, thiserror, anyhow, custom errors, async errors
Ownership & Pointersreferences/ownership-and-pointers.mdLifetimes, borrowing, smart pointers, Pin, Cow, interior mutability
Traits & Genericsreferences/traits-and-generics.mdTrait design, dispatch, GATs, sealed traits, type state pattern
Async & Concurrencyreferences/async-and-concurrency.mdTokio, channels, streams, shutdown, runtime config, async traits
Sync Concurrencyreferences/concurrency-sync.mdAtomics, Mutex, RwLock, lock ordering, Send/Sync, memory ordering
Testingreferences/testing.mdUnit/integration/doc tests, snapshot, proptest, mockall, benchmarks, fuzz
Performancereferences/performance.mdProfiling, flamegraph, cloning, stack vs heap, iterators, allocation
Clippy & Lintingreferences/clippy-and-linting.mdClippy config, key lints, workspace setup, #[expect] vs #[allow]
Documentationreferences/documentation.mdDoc comments, rustdoc, doc lints, coverage checklist

Engineering floor

  • Borrow or transfer ownership deliberately; clone when independent ownership is needed. Prefer clear ownership over numeric size rules or avoiding every allocation.
  • Handle fallible operations with Result and preserve useful error context. Reserve panic/assertions for violated programmer invariants; validate external input with recoverable errors.
  • Match error types, dispatch, and dependencies to the existing public contract. thiserror, anyhow, Tokio, and third-party synchronization crates are options, not mandatory additions.
  • Keep lock lifetimes short, maintain lock order, and reason about cancellation, shutdown, and spawned-task ownership. Do not hold a synchronous lock across .await.
  • Treat Send/Sync bounds and atomic orderings as correctness properties. Choose weaker ordering only with a valid synchronization argument; benchmark before performance-driven rewrites.
  • Put behavior tests in the suite that owns the invariant. Add type-level, property, fuzz, snapshot, or benchmark tests when that contract or risk warrants them.
  • Run the repository's required scoped format, lint, and test commands; reuse valid evidence. Full workspace/all-feature runs and documentation coverage rules follow project policy. Check feature combinations actually supported by the crate.

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/pedronauck/skills/rust-best-practices">View rust-best-practices on skillZs</a>