--- name: developing-ui description: Strict guidelines for building UI components, pages, and layouts. Ensures adherence to brand-identity tokens, technical constraints, and performance standards. --- # UI Development & Front-end Engineering This skill defines the standard operating procedure for front-end development. It ensures all UI code is consistent, performant, accessible, and robust, while strictly adhering to the `brand-identity` skill. ## When to use this skill - Creating new UI components (Framework agnostic: React, Vue, Svelte, etc.) - Styling new or existing pages - Debugging layout, visual, or performance issues - Refactoring CSS or component logic ## Workflow When building a new UI element, follow this process: 1. **Analyze & Plan** - Check `brand-identity/resources/design-tokens.json` for available tokens. - Define all component states: **Idle, Loading, Error, Empty, Success**. 2. **Scaffold** - Create the file structure. - Define the component interface (Props) with strict typing. 3. **Style** - Apply layout (Flex/Grid) first. - Apply spacing/sizing using design tokens. - **Optimization:** Use CSS variables for theming and avoid heavy animations on non-composite properties (stick to transform/opacity). 4. **Interact & Logic** - Add state and event handlers. - Implement accessible focus management. - Ensure error handling is graceful (e.g., Error Boundaries or fallback UI). 5. **Verify & Test** - Check responsiveness (Mobile -> Desktop). - Check accessibility (ARIA, keyboard navigation, screen reader). - **Performance:** Check for unnecessary re-renders or layout shifts (CLS). - [ ] Run the **Component Checklist** (see Resources). ## Instructions ### 1. Brand Alignment You **MUST** use the variables defined in the `brand-identity` skill. - ❌ `color: #ff0000;` - ✅ `color: var(--color-error-500);` ### 2. Semantic HTML & Accessibility - Use semantic tags (`