rust-api-designlisted
Install: claude install-skill Lu1sDV/skillsmd
# Rust API Design
Choose functions, concrete types, enums, and composition before introducing an
abstraction. A pattern earns its place by enforcing an invariant or isolating an
actual variation point, not by completing a pattern checklist.
## Quick reference: route by decision
| Decision | Default | Read |
|---|---|---|
| Function, trait, generic, or trait object? | Concrete function until variability is real | [API contracts](references/api-contracts.md) |
| Ownership, errors, lifetimes, public compatibility | Express caller obligations in the signature | [API contracts](references/api-contracts.md) |
| Constructor, builder, factory, abstract factory | Associated constructor with required arguments | [Creation](references/creational.md) |
| Singleton or prototype | Pass configuration; use `Clone` deliberately | [Creation](references/creational.md) |
| Adapter, decorator, facade, composite | Newtype, std trait, module, or enum | [Composition](references/structural.md) |
| Proxy, flyweight, bridge | Explicit methods, scoped sharing, independent axes | [Composition](references/structural.md) |
| Strategy, observer, state, command | Function/closure, callback, enum, owned command | [Behavior](references/behavioral.md) |
| Iterator, chain, visitor, typestate, RAII | Std iterator, control flow, traversal, ownership | [Behavior](references/behavioral.md) |
Load only the reference needed for the current task. The references cover all
assigned pattern families; their tables are