Frontend Aesthetics Skill
Use this skill when building UI components to ensure visual quality.
Overview
Ensure visual consistency and quality when building UI components.
When to Use
Use this skill when:
- Creating UI components
- Implementing pixel-perfect designs
- Ensuring consistent styling
- Working with design systems
Workflow
Step 1: Gather Design Context
Before writing any code:
If a design reference (image/Figma/mockup) is provided, ANALYZE IT CAREFULLY:
Visual Analysis (examine design image step 1):
- Layout Structure: Header? Sidebar? Grid? Flexbox? Absolute positioning?
- Colors (extract exact values): Background (#000000?), Text (#ffffff?), Accents (#b7f205?)
- Typography: Font families? Heading sizes (48px? 72px?)? Weights (bold/normal)?
- Spacing: Padding between elements? Section gaps? Component spacing?
- Components Visible: Buttons, badges, cards, images, icons - list them ALL
- Button Styles: Shape? Border radius? Padding? Colors? Hover states?
- Images/Assets: What images are shown? Logos? Icons? Photos? Illustrations?
- Effects: Shadows? Gradients? Blur? Opacity? Animations?
- Responsive Clues: Any mobile/tablet elements visible?
Write detailed observations:
## Design Analysis (from reference image)
- Layout: [Exact structure, e.g., "Fixed header, two-column hero, services ribbon"]
- Background: [Color, e.g., "#0a0a0a dark with subtle gradient"]
- Header: [Logo position, nav items, CTA button style]
- Hero: [Title size/weight, subtitle, CTA buttons, image placement]
- Colors: Primary: #color1, Accent: #color2, Text: #color3
- Typography: Headings: [size/weight], Body: [size/weight]
- Spacing: [Pattern, e.g., "8px grid, 64px section gaps"]
- Components: [List every element: badge, buttons, image container, etc.]
- Assets needed: [logo.svg, hero-image.png, icons, etc.]
Then check for existing patterns:
- Check for existing design system/components
- Look for style guides or theme files
- Identify color palette, typography, spacing
- Note existing UI patterns
Step 2: Review Design Requirements
Ask or identify:
- What is the component's purpose?
- What states does it need? (hover, active, disabled, loading)
- What sizes/variants are needed?
- What is the responsive behavior?
- Any animations/transitions?
Step 3: Build Component Structure
- Start with semantic HTML
- Add accessibility attributes (ARIA)
- Structure for all states
- Plan responsive breakpoints
Step 4: Apply Styles
Follow these principles:
- Use existing design tokens
- Maintain consistent spacing (4px grid)
- Ensure sufficient contrast
- Add smooth transitions
Spacing scale:
- xs: 4px
- sm: 8px
- md: 16px
- lg: 24px
- xl: 32px
Typography:
- Consistent font family
- Clear hierarchy
- Readable line height (1.5)
- Appropriate font sizes
Step 5: Add Interactivity
- Hover states
- Focus states (keyboard accessibility)
- Active states
- Disabled states
- Loading states
Focus checklist:
- Visible focus ring
- Focus within (for compound components)
- Skip link if needed
Step 6: Test Responsively
Check at breakpoints:
- Mobile: 320px, 375px
- Tablet: 768px
- Desktop: 1024px, 1440px
Step 7: Accessibility Check
- Color contrast ≥ 4.5:1
- Focus visible
- Screen reader friendly
- Keyboard navigable
- No motion issues
Design Principles
- Consistency: Match existing patterns
- Hierarchy: Clear visual importance
- Affordance: Interactive elements look clickable
- Feedback: State changes are visible
- Accessibility: Works for everyone
Anti-Patterns
❌ Don't do:
- Inline styles
- Magic numbers (use tokens)
- Missing hover/focus states
- Breaking existing patterns
- Ignoring mobile
- Inconsistent styling
✅ Do instead:
- Use design tokens
- Consistent patterns
- All states (hover, focus, active, disabled, loading)
- Match existing design system
- Mobile-first responsive design
Verification
- Component matches design reference
- Consistent with existing patterns
- Responsive at all breakpoints
- Accessible (contrast, focus, keyboard)
- All states implemented
Related Skills
- Component Design - Component structure
- Accessibility - Ensure accessible design
Related Commands
- Implement Command - Build components
- Test Command - Test UI components
Next Steps
- Component Design - Design component structure
- Accessibility - Ensure WCAG compliance