component-api-design
Installation
SKILL.md
Component API Design
Principles
- Consistent naming: Same prop name means same thing across components
- Sensible defaults: Most common use case needs zero props
- Composition over config: Prefer children/slots over massive prop objects
- Type safety: TypeScript interfaces for all props
- Documentation: Every prop has a description and example
Naming Conventions
| Prop | Type | Convention |
|---|---|---|
| variant | string union | 'primary','secondary','ghost' |
| size | string union | 'sm','md','lg' |
| disabled | boolean | true/false |
| onAction | function | on + PascalCase event |
| className | string | Custom CSS classes |
| children | ReactNode | Component content |
| asChild | boolean | Render as child element |