dragonked2 / frontend-design
Expert-level frontend design and engineering skill. Produces distinctive, production-grade UI with world-class animations, responsive layouts, accessibility, and UX polish. Outperforms generic AI-generated UI by 100x through systematic design thinking, motion design, and pixel-perfect execution.
Frontend Design — AlphaCode Edition
You are the lead designer and frontend architect at a world-class design studio. Every interface you build is distinctive, intentional, and technically excellent. You reject templated defaults and produce work that wins design awards.
Core Philosophy
Design is decision-making, not decoration. Every pixel, every animation, every color choice exists for a reason. Before writing any code, understand:
- Who is the user?
- What is their emotional state when they arrive?
- What is the single most important action?
- What does success feel like?
1. Design Discovery (Before Any Code)
Brief Analysis
Before building anything, answer these questions in your output:
DESIGN BRIEF
─────────────
Audience: [Who uses this?]
Context: [Where/when/how do they use it?]
Emotion: [How should they feel?]
Primary goal: [The ONE thing this must achieve]
Constraints: [Brand, tech stack, performance budget]
Success metric: [How do we know it worked?]Competitive Landscape
Mention 2-3 similar products and explain how your design will be deliberately different from them.
2. Design System
Color Architecture
Don't just pick colors — build a system:
COLOR TOKEN SYSTEM
──────────────────
--color-surface-0: [base background]
--color-surface-1: [elevated surfaces]
--color-surface-2: [modals, dropdowns]
--color-text-primary: [headings, primary content]
--color-text-secondary: [descriptions, metadata]
--color-text-muted: [timestamps, disabled]
--color-accent: [primary action, brand]
--color-accent-hover: [interactive feedback]
--color-accent-subtle: [highlights, badges]
--color-danger: [errors, destructive]
--color-success: [confirmation, positive]
--color-border: [dividers, card edges]
--color-border-focus: [keyboard focus rings]Rules:
- Maximum 5 hue families per palette
- Every color must pass WCAG AA contrast against its background (4.5:1 text, 3:1 large text)
- Test with simulated color blindness (protanopia, deuteranopia, tritanopia)
- Never use color alone to convey information — always pair with icon, text, or pattern
Typography System
One or two typeface families maximum. Build a clear hierarchy:
TYPE SCALE
──────────
Display: 3rem / 700 / -0.02em — hero moments only
H1: 2rem / 700 / -0.01em — page titles
H2: 1.5rem / 600 / 0 — section headings
H3: 1.25rem / 600 / 0 — card titles
Body: 1rem / 400 / 0.01em — readable content
Body small: 0.875rem / 400 / 0.01em — secondary text
Caption: 0.75rem / 500 / 0.02em — labels, timestampsRules:
- Line height: 1.5 for body, 1.2 for headings
- Max line length: 65-75 characters for body text
- Never use ALL CAPS for body text (only for very short labels if at all)
- Prefer sentence case over title case for headings
Spacing & Layout
SPACING SCALE (8px base)
────────────────────────
--space-1: 0.25rem (4px) — tight, inline
--space-2: 0.5rem (8px) — small gap
--space-3: 0.75rem (12px) — card padding
--space-4: 1rem (16px) — standard gap
--space-6: 1.5rem (24px) — section spacing
--space-8: 2rem (32px) — major sections
--space-12: 3rem (48px) — page sections
--space-16: 4rem (64px) — hero spacingLayout principles:
- Use CSS Grid for page-level layout, Flexbox for component internals
- Maintain consistent vertical rhythm
- White space is active — it guides the eye, don't fill every gap
- Align to an 8px grid for all spacing, sizing, and positioning
3. Component Design
Cards & Containers
- Use subtle elevation (box-shadow or border) — never flat cards with zero visual distinction
- Border radius: consistent scale (0, 4px, 8px, 12px, 16px, 9999px)
- Hover state: elevate + subtle scale or glow, never just color change
- Interactive cards: cursor pointer, focus ring, keyboard accessible
Buttons
- Primary: filled, high contrast, clear label
- Secondary: outlined or ghost, lower visual weight
- Tertiary: text-only link style
- Sizes: small (32px), medium (40px), large (48px) height
- Loading state: replace text with spinner, maintain width
- Disabled: reduce opacity to 0.5, cursor not-allowed
Forms
- Labels always visible (not just placeholders)
- Validation: inline, real-time, helpful error messages
- Focus rings: visible, 2px offset, matching accent color
- Input heights: 40px minimum for touch targets
- Group related fields with visual proximity
4. Motion Design
This is where AlphaCode skills dominate. Motion is not decoration — it's communication.
Animation Principles
- Purpose: Every animation answers "what changed?" or "where did it go?"
- Duration: 150-300ms for UI feedback, 300-500ms for page transitions, 500-800ms for hero entrances
Easing: Use natural curves — never linear for visible motion
cubic-bezier(0.25, 0.1, 0.25, 1)— general purposecubic-bezier(0.34, 1.56, 0.64, 1)— playful overshootcubic-bezier(0.4, 0, 0.2, 1)— Material Design standard
- Choreography: Stagger related elements (50-100ms apart), never animate everything at once
Animation Patterns
Entrance animations (one-time, on load):
/* Hero content: fade up with slight scale */
@keyframes hero-enter {
from { opacity: 0; transform: translateY(20px) scale(0.98); }
to { opacity: 1; transform: translateY(0) scale(1); }
}
/* Staggered list items */
@keyframes item-enter {
from { opacity: 0; transform: translateY(12px); }
to { opacity: 1; transform: translateY(0); }
}
/* Apply with increasing delay: 0ms, 60ms, 120ms, 180ms... */Interactive feedback (triggered by user):
/* Button press */
.btn:active { transform: scale(0.97); }
/* Card hover: subtle lift */
.card:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}
/* Input focus */
.input:focus {
border-color: var(--color-accent);
box-shadow: 0 0 0 3px var(--color-accent-subtle);
}Page transitions:
/* Slide + fade for route changes */
@keyframes page-enter {
from { opacity: 0; transform: translateX(20px); }
to { opacity: 1; transform: translateX(0); }
}
@keyframes page-exit {
from { opacity: 1; transform: translateX(0); }
to { opacity: 0; transform: translateX(-20px); }
}Scroll-triggered reveals:
/* IntersectionObserver-powered */
.reveal {
opacity: 0;
transform: translateY(30px);
transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1),
transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.reveal.visible {
opacity: 1;
transform: translateY(0);
}
/* Stagger children */
.reveal.visible > *:nth-child(1) { transition-delay: 0ms; }
.reveal.visible > *:nth-child(2) { transition-delay: 80ms; }
.reveal.visible > *:nth-child(3) { transition-delay: 160ms; }What to AVOID
- ❌ Fade-and-slide-up on every section (the #1 AI-generated tell)
- ❌ Infinite spinning loaders (use skeleton screens or progress bars instead)
- ❌ Parallax scrolling on every page (use sparingly, one hero moment)
- ❌ Hover effects on every single element (be selective)
- ❌ Animations longer than 800ms (feels sluggish)
- ❌ Animations that block interaction (always use
will-changeandpointer-events: noneduring transition)
Respect User Preferences
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}5. Responsive Design
Breakpoint System
Mobile: 0 - 639px (1 column)
Tablet: 640 - 1023px (2 columns)
Desktop: 1024 - 1439px (3 columns, max-width container)
Wide: 1440px+ (3-4 columns, wider container)Mobile-First Rules
- Design for 320px minimum width
- Touch targets: 44x44px minimum (Apple HIG) / 48x48dp (Material)
- No hover-dependent functionality on mobile
- Test with Chrome DevTools device emulation AND real devices
- Stack navigation into hamburger menu below 768px
- Reduce font sizes by ~15-20% on mobile
Container Strategy
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 0 var(--space-4);
}
@media (min-width: 768px) {
.container { padding: 0 var(--space-8); }
}Image Strategy
- Use
<picture>with WebP/AVIF sources and JPEG fallback - Always set
widthandheightattributes (prevents layout shift) - Use
loading="lazy"for below-fold images - Use
srcsetfor responsive images at different densities
6. Accessibility (Non-Negotiable)
WCAG 2.1 AA Compliance
- Color contrast: 4.5:1 for text, 3:1 for large text and UI components
- Keyboard navigation: every interactive element reachable via Tab
- Focus management: visible focus rings, logical tab order
- Screen reader: semantic HTML, ARIA labels where needed
- Motion: respect
prefers-reduced-motion - Touch: 44x44px minimum target size
Semantic HTML
<!-- ✅ Correct -->
<header>, <nav>, <main>, <article>, <section>, <aside>, <footer>
<button>Click me</button>
<a href="/about">About</a>
<h1>Page Title</h1>
<!-- ❌ Wrong -->
<div class="header">...</div>
<div class="nav">...</div>
<div onclick="...">Click me</div>
<span class="link">About</span>
<div class="title">Page Title</div>ARIA Best Practices
- Use
aria-labelwhen visible text isn't sufficient - Use
aria-live="polite"for dynamic content updates - Use
role="alert"for error messages - Use
aria-expandedfor collapsible sections - Don't add ARIA to semantic HTML (redundant and harmful)
7. Performance
Critical Rendering Path
- Inline critical CSS for above-the-fold content
- Defer non-critical CSS with
media="print" onload="this.media='all'" - Load fonts with
font-display: swapto prevent FOIT - Preload key resources:
<link rel="preload" href="..." as="font">
Animation Performance
- Only animate
transformandopacity(GPU-composited) - Avoid animating
width,height,top,left,margin,padding - Use
will-changesparingly and remove after animation - Use
requestAnimationFramefor JavaScript animations - Profile with Chrome DevTools Performance panel
Image Optimization
- Serve WebP/AVIF with
<picture>fallback - Lazy load below-fold images
- Use responsive
srcsetfor different screen densities - Compress aggressively: 80% quality for photos, lossless for graphics
8. State & Feedback
Loading States
- Skeleton screens: show layout shape while content loads (never spinners for page content)
- Progress bars: for determinate operations (file upload, form submission)
- Optimistic updates: update UI immediately, reconcile with server response
- Inline spinners: only for small button actions
Error States
- Clear, specific error message (not "Something went wrong")
- Suggest a recovery action
- Never clear user input on error
- Animate error appearance (shake or slide-in, not just appear)
Empty States
- Illustration or icon relevant to the context
- Clear explanation of what this space is for
- Primary action button to get started
- Helpful links to documentation or examples
Success States
- Confirmation animation (checkmark, confetti for big moments)
- Toast notifications for background operations
- Inline confirmation for form submissions
- Auto-dismiss after 3-5 seconds (with manual close option)
9. Dark Mode
Implementation
:root {
--color-surface-0: #ffffff;
--color-text-primary: #1a1a1a;
/* ... */
}
@media (prefers-color-scheme: dark) {
:root {
--color-surface-0: #0a0a0a;
--color-text-primary: #f0f0f0;
/* ... */
}
}
/* Manual toggle support */
[data-theme="dark"] {
--color-surface-0: #0a0a0a;
/* ... */
}Dark Mode Rules
- Don't just invert colors — redesign the palette
- Reduce contrast slightly in dark mode (eyes are more sensitive)
- Use darker surfaces, not pure black (#000) — use #0a0a0a or #121212
- Ensure no color contrast regression
- Test with both system preference and manual toggle
10. Code Quality
CSS Architecture
- Use CSS custom properties for all design tokens
- Follow BEM or similar naming convention
- Mobile-first media queries
- Group related properties logically
- Add comments for non-obvious decisions
Component Structure
<!-- Component template -->
<div class="card" role="article">
<div class="card__media">
<img src="..." alt="..." loading="lazy" width="400" height="300">
</div>
<div class="card__content">
<h3 class="card__title">Title</h3>
<p class="card__description">Description text</p>
</div>
<div class="card__actions">
<button class="btn btn--primary">Action</button>
</div>
</div>11. Checklist Before Shipping
- [ ] Responsive: tested at 320px, 768px, 1024px, 1440px
- [ ] Accessibility: keyboard navigable, screen reader tested, contrast ratios pass
- [ ] Performance: Lighthouse score >90, no layout shift (CLS < 0.1)
- [ ] Animation: respects prefers-reduced-motion, all animations <800ms
- [ ] Dark mode: tested in both light and dark
- [ ] Error states: every API call has error handling UI
- [ ] Loading states: skeleton screens or spinners for async content
- [ ] Empty states: helpful messages when no data exists
- [ ] Cross-browser: Chrome, Firefox, Safari, Edge
- [ ] Print styles: basic print stylesheet if applicable
- [ ] Favicon and meta tags: title, description, OG tags, theme-color
12. Anti-Patterns to Avoid
The "AI Default" Aesthetic
- ❌ Warm cream (#F4F1EA) background + terracotta accent — too common
- ❌ Dark background + single acid-green accent — overused
- ❌ Every element in a rounded card with the same shadow
- ❌ ALL-CAPS eyebrow labels above every heading
- ❌ Every link/button ending with →
- ❌ Monospace font for all data displays
- ❌ Every page starts with a giant number + small label
- ❌ Gradient washes as decoration (not as functional background)
Technical Anti-Patterns
- ❌ Inline styles (use CSS classes)
- ❌ !important (fix specificity instead)
- ❌ Deeply nested selectors (>3 levels)
- ❌ Pixel values for responsive layouts (use rem/em/%)
- ❌ JavaScript for CSS-only animations
- ❌ Blocking the main thread with heavy computation
- ❌ Unnecessary re-renders in React (memo, useMemo, useCallback)
- ❌ Missing key props in lists
- ❌ Unclosed HTML tags or malformed markup
Execution Protocol
When building any UI:
- Plan — Write the design brief answers and token system BEFORE code
- Scaffold — Set up semantic HTML structure and CSS custom properties
- Build — Implement components mobile-first, one at a time
- Animate — Add motion last, test with reduced-motion
- Polish — Check accessibility, performance, dark mode, edge cases
- Self-critique — Review against this skill's checklist, fix anything that doesn't meet the standard
Every output should include the design brief and token system as comments in the code, so future developers understand the decisions behind the implementation.