Frontend Design Skill
When to use this skill
Use when building or modifying any user-facing interface: pages, components, layouts, forms, navigation, modals, or visual design.
Design Principles
1. Mobile-first, responsive always
- Design for the smallest screen first, enhance for larger screens
- Use responsive breakpoints consistently:
sm: 640px | md: 768px | lg: 1024px | xl: 1280px
- Test every UI change at all breakpoints before submitting
2. Visual hierarchy matters
- Use size, weight, color, and spacing to guide the user's eye
- Primary actions should be the most visually prominent
- Limit color palette to 2-3 primary colors + neutrals
- Use whitespace generously — don't crowd elements
3. Consistency over creativity
- Reuse existing components before creating new ones
- Follow the established design tokens (colors, spacing, typography)
- Match existing interaction patterns (how buttons, forms, modals work)
4. Accessibility is not optional
- All interactive elements must be keyboard navigable
- Images need
alt text, icons need aria-label
- Color contrast ratio: minimum 4.5:1 for normal text, 3:1 for large text
- Form inputs need associated labels
- Test with screen reader if possible
Component Architecture
Structure
ui/
├── components/ # Reusable UI components
│ ├── Button/
│ │ ├── Button.[ext]
│ │ ├── Button.styles.[ext]
│ │ └── Button.test.[ext]
│ └── ...
├── layouts/ # Page layout templates
├── pages/ # Full page components
└── hooks/ # UI-specific hooks/utilities
Component rules
- One component per file — no bundling unrelated components
- Co-locate styles — styles live next to their component
- Co-locate tests — test files next to what they test
- Props are the contract — type all props explicitly
- No business logic in components — components render, services compute
Component checklist
For every new component:
Layout Patterns
Common layouts
| Pattern |
When to use |
| Single column |
Simple content pages, forms, articles |
| Sidebar + content |
Dashboards, settings, admin panels |
| Grid |
Card listings, galleries, product catalogs |
| Split screen |
Comparison views, editor + preview |
| Stacked header/content/footer |
Marketing pages, landing pages |
Spacing system
Use a consistent spacing scale (multiples of a base unit):
4px → 8px → 12px → 16px → 24px → 32px → 48px → 64px → 96px
Forms
Rules
- Every input has a visible label (not just placeholder text)
- Show validation errors inline, next to the relevant field
- Disable submit button while processing (with loading indicator)
- Preserve user input on validation failure (don't clear the form)
- Use appropriate input types:
email, tel, number, date, etc.
Validation UX
- Validate on blur (when user leaves the field)
- Re-validate on change after first error
- Show success state (green check) after correction
- Summarize errors at the top if there are multiple
Animations & Transitions
Rules
- Subtle > flashy — animations should feel natural, not distracting
- Fast — most transitions should be 150-300ms
- Purposeful — every animation should communicate something (appearing, moving, feedback)
- Respect user preferences — honor
prefers-reduced-motion
Common transitions
| Action |
Animation |
Duration |
| Page/section enter |
Fade in + slight slide up |
200ms |
| Modal open |
Fade in + scale from 95% |
200ms |
| Hover feedback |
Color/shadow change |
150ms |
| Loading state |
Skeleton shimmer or spinner |
Continuous |
| Success feedback |
Brief green flash or checkmark |
300ms |
| Error feedback |
Brief red highlight + shake |
300ms |
Dark Mode
If the project supports dark mode:
- Use CSS custom properties (variables) for all colors
- Define a
light and dark theme set
- Never hardcode colors — always reference tokens
- Test all components in both themes
- Respect
prefers-color-scheme system setting
Performance
- Lazy load images and heavy components below the fold
- Optimize images — use WebP/AVIF, appropriate sizes, responsive srcset
- Minimize layout shifts — set explicit dimensions on images/videos
- Bundle size — monitor and limit JS/CSS bundle sizes
- Critical CSS — inline above-the-fold styles when possible
PR Checklist for UI Changes
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: frontend-design-1133description: Guidelines for building UI — components, layouts, responsive design, accessibility, and visual polish Use when this capability is needed.4---56# Frontend Design Skill78## When to use this skill910Use when building or modifying any user-facing interface: pages, components, layouts, forms, navigation, modals, or visual design.1112---1314## Design Principles1516### 1. Mobile-first, responsive always17- Design for the smallest screen first, enhance for larger screens18- Use responsive breakpoints consistently:19 - `sm`: 640px | `md`: 768px | `lg`: 1024px | `xl`: 1280px20- Test every UI change at all breakpoints before submitting2122### 2. Visual hierarchy matters23- Use size, weight, color, and spacing to guide the user's eye24- Primary actions should be the most visually prominent25- Limit color palette to 2-3 primary colors + neutrals26- Use whitespace generously — don't crowd elements2728### 3. Consistency over creativity29- Reuse existing components before creating new ones30- Follow the established design tokens (colors, spacing, typography)31- Match existing interaction patterns (how buttons, forms, modals work)3233### 4. Accessibility is not optional34- All interactive elements must be keyboard navigable35- Images need `alt` text, icons need `aria-label`36- Color contrast ratio: minimum 4.5:1 for normal text, 3:1 for large text37- Form inputs need associated labels38- Test with screen reader if possible3940---4142## Component Architecture4344### Structure45```46ui/47├── components/ # Reusable UI components48│ ├── Button/49│ │ ├── Button.[ext]50│ │ ├── Button.styles.[ext]51│ │ └── Button.test.[ext]52│ └── ...53├── layouts/ # Page layout templates54├── pages/ # Full page components55└── hooks/ # UI-specific hooks/utilities56```5758### Component rules59- **One component per file** — no bundling unrelated components60- **Co-locate styles** — styles live next to their component61- **Co-locate tests** — test files next to what they test62- **Props are the contract** — type all props explicitly63- **No business logic in components** — components render, services compute6465### Component checklist66For every new component:67- [ ] Props are typed with clear names68- [ ] Has sensible defaults for optional props69- [ ] Handles loading, empty, and error states70- [ ] Responsive at all breakpoints71- [ ] Keyboard accessible72- [ ] Tested with at least 3 cases (default, edge, error)7374---7576## Layout Patterns7778### Common layouts79| Pattern | When to use |80|---------|------------|81| **Single column** | Simple content pages, forms, articles |82| **Sidebar + content** | Dashboards, settings, admin panels |83| **Grid** | Card listings, galleries, product catalogs |84| **Split screen** | Comparison views, editor + preview |85| **Stacked header/content/footer** | Marketing pages, landing pages |8687### Spacing system88Use a consistent spacing scale (multiples of a base unit):89```904px → 8px → 12px → 16px → 24px → 32px → 48px → 64px → 96px91```9293---9495## Forms9697### Rules98- Every input has a visible label (not just placeholder text)99- Show validation errors inline, next to the relevant field100- Disable submit button while processing (with loading indicator)101- Preserve user input on validation failure (don't clear the form)102- Use appropriate input types: `email`, `tel`, `number`, `date`, etc.103104### Validation UX1051. Validate on blur (when user leaves the field)1062. Re-validate on change after first error1073. Show success state (green check) after correction1084. Summarize errors at the top if there are multiple109110---111112## Animations & Transitions113114### Rules115- **Subtle > flashy** — animations should feel natural, not distracting116- **Fast** — most transitions should be 150-300ms117- **Purposeful** — every animation should communicate something (appearing, moving, feedback)118- **Respect user preferences** — honor `prefers-reduced-motion`119120### Common transitions121| Action | Animation | Duration |122|--------|-----------|----------|123| Page/section enter | Fade in + slight slide up | 200ms |124| Modal open | Fade in + scale from 95% | 200ms |125| Hover feedback | Color/shadow change | 150ms |126| Loading state | Skeleton shimmer or spinner | Continuous |127| Success feedback | Brief green flash or checkmark | 300ms |128| Error feedback | Brief red highlight + shake | 300ms |129130---131132## Dark Mode133134If the project supports dark mode:135- Use CSS custom properties (variables) for all colors136- Define a `light` and `dark` theme set137- Never hardcode colors — always reference tokens138- Test all components in both themes139- Respect `prefers-color-scheme` system setting140141---142143## Performance144145- **Lazy load** images and heavy components below the fold146- **Optimize images** — use WebP/AVIF, appropriate sizes, responsive srcset147- **Minimize layout shifts** — set explicit dimensions on images/videos148- **Bundle size** — monitor and limit JS/CSS bundle sizes149- **Critical CSS** — inline above-the-fold styles when possible150151---152153## PR Checklist for UI Changes154155- [ ] Looks correct at all breakpoints (mobile, tablet, desktop)156- [ ] Keyboard navigation works157- [ ] Loading, empty, and error states are handled158- [ ] Colors meet contrast requirements159- [ ] Animations respect `prefers-reduced-motion`160- [ ] No hardcoded colors/sizes (uses design tokens)161- [ ] Screenshot or video attached to PR162- [ ] Dark mode tested (if applicable)163164---165> Converted and distributed by [TomeVault](https://tomevault.io/claim/xmenq) — claim your Tome and manage your conversions.166<!-- tomevault:4.0:skill_md:2026-04-14 -->