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:
Analyze & Plan
- Check
brand-identity/resources/design-tokens.json for available tokens.
- Define all component states: Idle, Loading, Error, Empty, Success.
Scaffold
- Create the file structure.
- Define the component interface (Props) with strict typing.
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).
Interact & Logic
- Add state and event handlers.
- Implement accessible focus management.
- Ensure error handling is graceful (e.g., Error Boundaries or fallback UI).
Verify & Test
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 (
<button>, <nav>, <article>) over <div>.
- Ensure strict ARIA compliance for interactive elements.
- All images must have
alt text or role="presentation".
- Touch targets must be at least 44x44px.
3. State Management (The "5 States" Rule)
Don't just build the "happy path." You must account for:
- Loading: Skeletons or spinners.
- Error: User-friendly error messages/retries.
- Empty: What happens when there is no data?
- Success: Feedback for successful actions.
- Idle: The default state.
4. Performance & Optimization
- Images: Use optimized formats (WebP/AVIF) and
loading="lazy" where appropriate.
- Animations: Aim for 60fps. Animate only
transform and opacity. Use will-change sparingly.
- Code: Avoid massive bundles. Lazy load heavy components or routes.
5. Testing Requirements
- Unit Tests: Logic and state changes must be tested (e.g., Jest/Vitest).
- Integration: Critical user flows must be verified.
- Cross-Browser: Verify functionality on Chrome, Firefox, Safari (latest 2 versions).
Resources
1---2name: developing-ui3description: Strict guidelines for building UI components, pages, and layouts. Ensures adherence to brand-identity tokens, technical constraints, and performance standards.4---5
6# UI Development & Front-end Engineering
7
8This 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.
9
10## When to use this skill
11- Creating new UI components (Framework agnostic: React, Vue, Svelte, etc.)
12- Styling new or existing pages
13- Debugging layout, visual, or performance issues
14- Refactoring CSS or component logic
15
16## Workflow
17When building a new UI element, follow this process:
18
191. **Analyze & Plan**
20 - Check `brand-identity/resources/design-tokens.json` for available tokens.
21 - Define all component states: **Idle, Loading, Error, Empty, Success**.
22
232. **Scaffold**
24 - Create the file structure.
25 - Define the component interface (Props) with strict typing.
26
273. **Style**
28 - Apply layout (Flex/Grid) first.
29 - Apply spacing/sizing using design tokens.
30 - **Optimization:** Use CSS variables for theming and avoid heavy animations on non-composite properties (stick to transform/opacity).
31
324. **Interact & Logic**
33 - Add state and event handlers.
34 - Implement accessible focus management.
35 - Ensure error handling is graceful (e.g., Error Boundaries or fallback UI).
36
375. **Verify & Test**
38 - Check responsiveness (Mobile -> Desktop).
39 - Check accessibility (ARIA, keyboard navigation, screen reader).
40 - **Performance:** Check for unnecessary re-renders or layout shifts (CLS).
41 - [ ] Run the **Component Checklist** (see Resources).
42
43## Instructions
44
45### 1. Brand Alignment
46You **MUST** use the variables defined in the `brand-identity` skill.
47- ❌ `color: #ff0000;`
48- ✅ `color: var(--color-error-500);`
49
50### 2. Semantic HTML & Accessibility
51- Use semantic tags (`<button>`, `<nav>`, `<article>`) over `<div>`.
52- Ensure strict ARIA compliance for interactive elements.
53- All images must have `alt` text or `role="presentation"`.
54- Touch targets must be at least 44x44px.
55
56### 3. State Management (The "5 States" Rule)
57Don't just build the "happy path." You must account for:
581. **Loading:** Skeletons or spinners.
592. **Error:** User-friendly error messages/retries.
603. **Empty:** What happens when there is no data?
614. **Success:** Feedback for successful actions.
625. **Idle:** The default state.
63
64### 4. Performance & Optimization
65- **Images:** Use optimized formats (WebP/AVIF) and `loading="lazy"` where appropriate.
66- **Animations:** Aim for 60fps. Animate only `transform` and `opacity`. Use `will-change` sparingly.
67- **Code:** Avoid massive bundles. Lazy load heavy components or routes.
68
69### 5. Testing Requirements
70- **Unit Tests:** Logic and state changes must be tested (e.g., Jest/Vitest).
71- **Integration:** Critical user flows must be verified.
72- **Cross-Browser:** Verify functionality on Chrome, Firefox, Safari (latest 2 versions).
73
74## Resources
75- **[Component Checklist](resources/component-checklist.md)**