| name | component-creation |
| description | Step-by-step workflow for creating accessible, tested UI components. Use when the user asks to create a new UI component. |
Skill: Create UI Component
Trigger
When the user asks to create a new UI component.
Prerequisites
Steps
Step 1: Define Component
Step 2: Create Component Directory
src/components/{category}/{ComponentName}/
├── {ComponentName}.tsx # Component implementation
├── {ComponentName}.test.tsx # Unit tests
├── {ComponentName}.stories.tsx # Storybook story (optional)
└── index.ts # Public export
Step 3: Define Props Interface
Step 4: Implement Component
Step 5: Add Accessibility
Step 6: Add Styling
Step 7: Write Tests
Step 8: Create Export
Completion Checklist
If Step Fails
- Step 2 (directory): Match existing structure in
src/components/ (ui/, features/, layout/)
- Step 5 (a11y): Use
aria-label on icon buttons; role only when semantic HTML insufficient
- Step 7 (tests): Run single file:
npm test -- ComponentName.test.tsx. Fix type errors first with {{CONFIG.testing.typeCheckCommand}}
Example
Step 1: OrderSummary — displays order total and item count. Props: items, taxRate. Step 4: Functional component, useMemo for total calculation, loading/empty states.