rust-api-design
Installation
SKILL.md
Rust API Design (Rust API Guidelines)
Authority: Rust API Guidelines — the de-facto standard checklist of ~100 C-* rules used by std, tokio, serde, bevy. See the full checklist for canonical wording of every rule.
This skill owns the shape of a public Rust API: types, traits, naming, conversions, and the boundaries that keep the API usable, ergonomic, and resistant to breakage. It does not own Cargo manifest (rust-cargo-build), workspace topology (rust-workspace), in-crate src/ layout (rust-module-layout), or semver/publish (rust-semver).
Capability Boundaries
✅ Strengths
- Translating API Guidelines' ~100 C-* rules into concrete design decisions for a public crate
- Naming types, functions, methods, and features to match std and ecosystem conventions
- Choosing between generics, trait objects, concrete types, and the newtype pattern
- Designing
From/Into/TryFrom/AsRef/Borrowconversions (rejectingDerefpolymorphism) - Picking which auto traits (
Debug,Clone,Eq,Hash,Send,Sync) to derive - Sealing traits, marking
#[non_exhaustive], hiding struct fields — to reserve room to evolve - Replacing bool parameters with enums, raw integers with newtypes,
Stringwith&str - Designing iterators,
Extend,Default,Display/FromStrcorrectly - Avoiding
panic!/unwrap/expectin public APIs in favor ofResult