react-components
Installation
SKILL.md
React components
Build small, cohesive pieces of production UX. Apply DRY to shared behavior and domain rules without forcing unrelated use cases into one abstraction.
Core conventions
- Use named function declarations with a colocated
type ComponentNameProps. Infer return types unless an explicit contract provides a concrete benefit. Do not useReact.FC. - Declare children only when rendered; use
ReactNodefor ordinary content slots. - Keep one component per file. Keep private components inside their owner's folder; promote genuinely shared components to the appropriate shared folder.
- Review components around 100–150 lines for decomposition. Do not allow sprawling, unrelated responsibilities; do not split straightforward markup just to meet a line count.
- Extract cohesive stateful behavior into purpose-named
useName.tshooks. Use ordinary functions for logic that does not need React. Do not useComponentName.hooks.tscollections. - Keep state close to its consumers, derive values when possible, and use effects for external synchronization.
- Search existing components, hooks, utilities, and mocks before creating another implementation.