--- name: web-design description: Create distinctive, production-grade web interfaces — component architecture, responsive design, interaction patterns, avoiding generic aesthetics. Use when building web components, pages, or dashboards. For general principles, see /ui-ux. license: MIT --- This skill guides creation of distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices. The user provides frontend requirements: a component, page, application, or interface to build. They may include context about the purpose, audience, or technical constraints. For accessibility, typography, color, spacing, and other general UI/UX principles, see the `/ui-ux` skill. ## Design Thinking Before coding, understand the context and commit to a BOLD aesthetic direction: - **Purpose**: What problem does this interface solve? Who uses it? - **Tone**: Pick an extreme: brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. There are so many flavors to choose from. Use these for inspiration but design one that is true to the aesthetic direction. - **Constraints**: Technical requirements (framework, performance, accessibility). - **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember? **CRITICAL**: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work - the key is intentionality, not intensity. Then implement working code (HTML/CSS/JS, React, Vue, etc.) that is: - Production-grade and functional - Visually striking and memorable - Cohesive with a clear aesthetic point-of-view - Meticulously refined in every detail ## Frontend Aesthetics Guidelines Focus on: - **Typography**: Choose fonts that are beautiful, unique, and interesting. Avoid generic fonts like Arial and Inter; opt instead for distinctive choices that elevate the frontend's aesthetics; unexpected, characterful font choices. Pair a distinctive display font with a refined body font. - **Color & Theme**: Commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly-distributed palettes. - **Motion**: Use animations for effects and micro-interactions. Prioritize CSS-only solutions for HTML. Use Motion library for React when available. Focus on high-impact moments: one well-orchestrated page load with staggered reveals (animation-delay) creates more delight than scattered micro-interactions. Use scroll-triggering and hover states that surprise. - **Spatial Composition**: Unexpected layouts. Asymmetry. Overlap. Diagonal flow. Grid-breaking elements. Generous negative space OR controlled density. - **Backgrounds & Visual Details**: Create atmosphere and depth rather than defaulting to solid colors. Add contextual effects and textures that match the overall aesthetic. Apply creative forms like gradient meshes, noise textures, geometric patterns, layered transparencies, dramatic shadows, decorative borders, custom cursors, and grain overlays. NEVER use generic AI-generated aesthetics like overused font families (Inter, Roboto, Arial, system fonts), cliched color schemes (particularly purple gradients on white backgrounds), predictable layouts and component patterns, and cookie-cutter design that lacks context-specific character. Interpret creatively and make unexpected choices that feel genuinely designed for the context. No design should be the same. Vary between light and dark themes, different fonts, different aesthetics. NEVER converge on common choices (Space Grotesk, for example) across generations. **IMPORTANT**: Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate code with extensive animations and effects. Minimalist or refined designs need restraint, precision, and careful attention to spacing, typography, and subtle details. Elegance comes from executing the vision well. Remember: Claude is capable of extraordinary creative work. Don't hold back, show what can truly be created when thinking outside the box and committing fully to a distinctive vision. --- ## Pre-Delivery Checklist ### Visual Quality - [ ] No emojis used as icons (use SVG instead) - [ ] All icons from consistent icon set (Heroicons, Lucide, etc.) - [ ] Brand logos are correct (verified from official sources) - [ ] Hover states don't cause layout shift - [ ] Use theme colors directly (bg-primary) not var() wrappers ### Interaction - [ ] All clickable elements have cursor-pointer - [ ] Hover states provide clear visual feedback - [ ] Transitions are smooth (150-300ms for micro-interactions) - [ ] Focus states visible for keyboard navigation ### Light/Dark Mode - [ ] Light mode text has sufficient contrast (4.5:1 minimum) - [ ] Glass/transparent elements visible in light mode (use bg-white/80 not bg-white/10) - [ ] Borders visible in both modes (border-gray-200 light, border-white/10 dark) - [ ] Test both modes before delivery ### Layout - [ ] Floating elements have proper spacing from edges - [ ] No content hidden behind fixed navbars - [ ] Responsive at 375px, 768px, 1024px, 1440px - [ ] No horizontal scroll on mobile ### Accessibility - [ ] All images have alt text - [ ] Form inputs have labels - [ ] Color is not the only indicator - [ ] prefers-reduced-motion respected - [ ] Minimum 4.5:1 contrast ratio --- ## Common Rules ### Icons & Visual Elements | Rule | Do | Don't | | ---------------------- | ----------------------------------------------- | -------------------------------------- | | No emoji icons | Use SVG icons (Heroicons, Lucide, Simple Icons) | Use emojis like 🎨 🚀 ⚙️ as UI icons | | Stable hover states | Use color/opacity transitions | Use scale transforms that shift layout | | Consistent icon sizing | Fixed viewBox (24x24) with consistent sizing | Mix different icon sizes | ### Interaction & Cursor | Rule | Do | Don't | | ------------------ | ----------------------------------------------- | ------------------------------------ | | Cursor pointer | Add cursor-pointer to all clickable/hoverable | Leave default cursor on interactive | | Hover feedback | Provide visual feedback (color, shadow, border) | No indication element is interactive | | Smooth transitions | Use transition-colors duration-200 | Instant changes or too slow (>500ms) | ### Light/Dark Mode Contrast | Rule | Do | Don't | | ------------------- | --------------------------------- | --------------------------------- | | Glass in light mode | Use bg-white/80 or higher opacity | Use bg-white/10 (too transparent) | | Text contrast light | Use slate-900 for text | Use slate-400 for body text | | Muted text light | Use slate-600 minimum | Use gray-400 or lighter | | Border visibility | Use border-gray-200 in light mode | Use border-white/10 (invisible) | ### Layout & Spacing | Rule | Do | Don't | | -------------------- | -------------------------------- | -------------------------------------- | | Floating navbar | Add top-4 left-4 right-4 spacing | Stick navbar to top-0 left-0 | | Content padding | Account for fixed navbar height | Let content hide behind fixed elements | | Consistent max-width | Use same max-w-6xl or max-w-7xl | Mix different container widths | --- ## Responsive Design ### Mobile-First Breakpoints ```css /* Base: Mobile (< 640px) */ @media (min-width: 640px) { /* sm: Landscape phones */ } @media (min-width: 768px) { /* md: Tablets */ } @media (min-width: 1024px) { /* lg: Laptops */ } @media (min-width: 1280px) { /* xl: Desktops */ } @media (min-width: 1536px) { /* 2xl: Large desktops */ } ``` ### Container Queries Component-level responsiveness independent of viewport: ```css /* Define containment context */ .card-container { container-type: inline-size; container-name: card; } /* Query the container, not viewport */ @container card (min-width: 400px) { .card { display: grid; grid-template-columns: 200px 1fr; } } /* Container query units */ .card-title { font-size: clamp(1rem, 5cqi, 2rem); } ``` ### Fluid Typography ```css :root { --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem); --text-xl: clamp(1.25rem, 1rem + 1.25vw, 1.5rem); --text-2xl: clamp(1.5rem, 1.25rem + 1.25vw, 2rem); } ``` ### Responsive Layout Patterns **Auto-fit grid:** ```css .grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); } ``` **Responsive grid areas:** ```css .page-layout { display: grid; grid-template-areas: "header" "main" "sidebar" "footer"; } @media (min-width: 768px) { .page-layout { grid-template-columns: 1fr 300px; grid-template-areas: "header header" "main sidebar" "footer footer"; } } ``` ### Responsive Navigation - Mobile: Hamburger menu, slide-out drawer - Desktop: Always visible horizontal nav - Use aria-expanded for accessibility ### Responsive Images ```tsx ... ; ``` ### Responsive Tables - Desktop: Standard table - Mobile: Card-based layout or horizontal scroll ### Dynamic Viewport Units ```css /* Use dvh for mobile (accounts for browser UI) */ .full-height { height: 100dvh; } ``` ### Common Responsive Issues | Issue | Fix | | ----------------------- | ------------------------- | | Horizontal overflow | Content breaking viewport | | Fixed widths | Use relative units | | 100vh on mobile | Use 100dvh | | Text too small | Min 16px body | | Touch targets too small | Min 44x44px | | Images squishing | Use aspect-ratio | --- ## Interaction Design ### Core Principles **Purposeful Motion:** - Feedback: Confirm user actions occurred - Orientation: Show where elements come from/go to - Focus: Direct attention to important changes - Continuity: Maintain context during transitions ### Timing Guidelines | Duration | Use Case | | --------- | ----------------------------------------- | | 100-150ms | Micro-feedback (hovers, clicks) | | 200-300ms | Small transitions (toggles, dropdowns) | | 300-500ms | Medium transitions (modals, page changes) | | 500ms+ | Complex choreographed animations | ### Easing Functions ```css --ease-out: cubic-bezier(0.16, 1, 0.3, 1); /* Decelerate - entering */ --ease-in: cubic-bezier(0.55, 0, 1, 0.45); /* Accelerate - exiting */ --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1); /* Both - moving between */ --spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* Overshoot - playful */ ``` ### Loading States **Skeleton Screen:** ```tsx function CardSkeleton() { return (
); } ``` ### State Transitions ```tsx function Toggle({ checked, onChange }) { return ( ); } ``` ### Feedback Patterns - Button click feedback - Form validation feedback - Success/error states - Toast notifications ### Gestures - Swipe to dismiss - Drag and drop - Pull to refresh ### Accessibility ```css @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } } ``` ### Common Issues | Issue | Fix | | --------------------- | --------------------------------------- | | Janky animations | Use transform/opacity, not width/height | | Over-animation | Motion fatigue - use sparingly | | Blocking interactions | Never prevent input during animations | | Memory leaks | Clean up on unmount | --- ## Visual Design Foundations ### Typography Scale **Modular scale (8px base):** ```css :root { --text-xs: 0.75rem; /* 12px */ --text-sm: 0.875rem; /* 14px */ --text-base: 1rem; /* 16px */ --text-lg: 1.125rem; /* 18px */ --text-xl: 1.25rem; /* 20px */ --text-2xl: 1.5rem; /* 24px */ --text-3xl: 1.875rem; /* 30px */ --text-4xl: 2.25rem; /* 36px */ } ``` **Line Height:** | Text Type | Line Height | | --------- | ----------- | | Headings | 1.1 - 1.3 | | Body | 1.5 - 1.7 | | UI labels | 1.2 - 1.4 | ### Spacing System **8-point grid:** ```css :root { --space-1: 0.25rem; /* 4px */ --space-2: 0.5rem; /* 8px */ --space-3: 0.75rem; /* 12px */ --space-4: 1rem; /* 16px */ --space-6: 1.5rem; /* 24px */ --space-8: 2rem; /* 32px */ --space-12: 3rem; /* 48px */ --space-16: 4rem; /* 64px */ } ``` ### Color System **Semantic tokens:** ```css :root { /* Brand */ --color-primary: #2563eb; --color-primary-hover: #1d4ed8; /* Semantic */ --color-success: #16a34a; --color-warning: #ca8a04; --color-error: #dc2626; /* Neutral */ --color-bg: #ffffff; --color-text: #111827; --color-muted: #6b7280; } ``` ### Dark Mode ```css :root { --color-bg: #ffffff; --color-text: #111827; } [data-theme="dark"] { --color-bg: #111827; --color-text: #f9fafb; } ``` ### Contrast Requirements (WCAG) | Element | Minimum Ratio | | ------------- | ------------- | | Body text | 4.5:1 (AA) | | Large text | 3:1 (AA) | | UI components | 3:1 (AA) | ### Icon Sizing ```css :root { --icon-sm: 16px; --icon-md: 24px; --icon-lg: 32px; } ``` ### Design Token Example (Tailwind) ```js // tailwind.config.js module.exports = { theme: { extend: { colors: { primary: { 500: "#3b82f6", 600: "#2563eb" }, }, spacing: { 18: "4.5rem", }, }, }, }; ``` ### Common Issues | Issue | Fix | | -------------------- | ----------------- | | Inconsistent spacing | Use defined scale | | Poor contrast | Test with WCAG | | Font overload | Limit families | | Magic numbers | Use tokens | --- ## Component Architecture ### Token Hierarchy **3-layer system:** ```css /* Layer 1: Primitive tokens (raw values) */ :root { --color-blue-500: #3b82f6; --space-1: 0.25rem; } /* Layer 2: Semantic tokens (meaning) */ :root { --text-primary: var(--color-gray-900); --surface-default: white; } /* Layer 3: Component tokens (specific usage) */ :root { --button-bg: var(--text-primary); --button-padding: var(--space-4); } ``` ### Variant System (CVA Pattern) ```tsx import { cva } from "class-variance-authority"; const buttonVariants = cva( "inline-flex items-center justify-center rounded-md font-medium transition-colors", { variants: { variant: { default: "bg-primary text-white hover:bg-primary/90", destructive: "bg-red-500 text-white hover:bg-red-600", outline: "border border-gray-300 hover:bg-gray-100", }, size: { sm: "h-8 px-3 text-sm", md: "h-10 px-4", lg: "h-12 px-6 text-lg", }, }, defaultVariants: { variant: "default", size: "md", }, }, ); ``` ### Theme Provider (React) ```tsx function ThemeProvider({ children }) { const [theme, setTheme] = useState("dark"); useEffect(() => { document.documentElement.setAttribute("data-theme", theme); }, [theme]); return {children}; } ``` ### Common Patterns - Compound components - Polymorphic components (as prop) - Slot-based composition - Headless UI patterns ### Best Practices - Name tokens by purpose (text-primary, not dark-gray) - Maintain token hierarchy (primitives > semantic > component) - Version tokens like API changes - Test all theme combinations