rust-design-patterns
Installation
SKILL.md
Rust Design Patterns
Start from the compiler error, API decision, or code under review. Read only the reference sections that match; the catalog is not a checklist to apply everywhere.
Establish applicability
- Check the crate's edition, MSRV, and whether it is a library or binary. Library crates carry compatibility constraints (
non_exhaustive, lint policy, public types) that binaries do not. - Follow the crate's existing conventions for errors, builders, and unsafe boundaries before introducing a new pattern.
- For borrow checker errors, reshape ownership before reaching for
clone,Rc, orArc. Treat a clone as a deliberate cost, not a way to silence the compiler. - When a lifetime is too short and no borrow reshaping fits, prefer an owned type over widening lifetimes or adding
'staticbounds.