web-design
Web design reference for building production-grade interfaces. Covers layout, typography, color, spacing, shadows, animation, accessibility, responsive design, components, performance, and UX psychology. Use when building UI, reviewing design quality, choosing design tokens, or making any visual design decision.
What this skill does
# Web Design
A practitioner-sourced reference for building web interfaces well. Synthesized from Refactoring UI, Tailwind CSS, shadcn/ui, Laws of UX, animations.dev, detail.design, Every Layout, Web Interface Guidelines, jakub.kr, userinterface.wiki (Raphael Salaja), and other authoritative sources.
Use this skill whenever you are building, reviewing, or improving a web interface.
## Implementation Priority
When building or reviewing a UI, work through these tiers in order. Each tier depends on the ones above it — fixing a shadow detail is wasted effort if the layout is broken.
### Tier 1: Structure (get this right first)
1. **Semantic HTML.** Correct elements (`<button>`, `<nav>`, `<main>`, headings in order). Everything else builds on this.
2. **Layout.** Grid/flex structure, spacing scale, content width constraints (`max-w-prose`, 12-col grid). Does the page hold together at every viewport?
3. **Responsive behavior.** Mobile-first, intrinsic sizing (`auto-fill` grids, `clamp()`, `flex-wrap`). No content hidden on small screens without reason.
4. **Typography fundamentals.** Type scale, line height (1.5 body, 1.1-1.25 headings), line length (`max-width: 65ch`), `rem` units for font sizes.
### Tier 2: Visual System (the design backbone)
5. **Color and contrast.** Palette applied, semantic tokens set, WCAG AA contrast met (4.5:1 text, 3:1 UI). Dark mode if needed.
6. **Visual hierarchy.** Four text levels working (foreground, muted, muted/70, muted/50). Primary action obvious. Squint test passes.
7. **Component states.** Every interactive element has hover, focus-visible, active, disabled, loading, error, and empty states accounted for.
8. **Spacing and proportion.** Outer padding >= inner padding. No ambiguous gaps. Button padding ratio (2x horizontal : 1x vertical). Input heights match button heights.
### Tier 3: Interaction and Motion (make it feel alive)
9. **Keyboard and accessibility.** Focus styles, tab order, skip links, `aria` attributes, touch targets (44px+). Test with keyboard only.
10. **Transitions.** Hover/active feedback (150ms ease-out), state transitions (200-300ms), correct easing per direction (ease-out for enter, ease-in for exit).
11. **Animation.** Stagger entrances, subtle exits, interruptible transitions, `prefers-reduced-motion` respected. Spring physics where appropriate.
### Tier 4: Polish (the last 10% that makes it feel crafted)
12. **Shadows and depth.** Layered shadows, shadows-instead-of-borders where appropriate, consistent light source. Dark mode: surface lightness instead of shadows.
13. **Optical adjustments.** Icon-side button padding, concentric border radii, play button offset, tabular-nums on data, image outlines.
14. **Micro-interactions.** Contextual icon animation, blur on stagger entrances, copy-to-clipboard feedback, optimistic updates.
15. **Defensive CSS.** `min-width: 0` on flex children, `overflow-wrap: break-word`, `scrollbar-gutter: stable`, text truncation, safe-area padding.
16. **Final checks.** Squint test, grayscale test, swap test, "would a human ship this?" test. No AI slop (gratuitous gradients, identical metric cards, centered everything).
**Rule of thumb:** If you're debating a shadow opacity while the layout breaks at 768px, stop and go back to Tier 1.
## Table of Contents
1. [Layout and Spacing](#1-layout-and-spacing)
2. [Typography](#2-typography)
3. [Color](#3-color)
4. [Shadows and Depth](#4-shadows-and-depth)
5. [Visual Hierarchy](#5-visual-hierarchy)
6. [Animation and Motion](#6-animation-and-motion)
7. [Components](#7-components)
8. [Responsive Design](#8-responsive-design)
9. [Accessibility](#9-accessibility)
10. [Performance](#10-performance)
11. [UX Psychology](#11-ux-psychology)
12. [Design Tokens](#12-design-tokens)
13. [Polish and Craft](#13-polish-and-craft)
14. [Microcopy and UX Writing](#14-microcopy-and-ux-writing)
15. [AI Slop Prevention](#15-ai-slop-prevention)
16. [Advanced Craft](#16-advanced-craft)
17. [Defensive CSS](#17-defensive-css)
18. [Modern CSS Reset](#18-modern-css-reset)
19. [Predictive Prefetching](#19-predictive-prefetching)
20. [Audio Feedback and Sound Design](#20-audio-feedback-and-sound-design)
---
## 1. Layout and Spacing
### Spacing Scale
Use a consistent mathematical scale rooted in a base unit. The standard base is **4px** (0.25rem). Every spacing value should be a multiple of this base.
| Token | Value | Use |
|-------|-------|-----|
| 0.5 | 2px | Hairline gaps, icon padding |
| 1 | 4px | Tight inline spacing |
| 1.5 | 6px | Small component internal padding |
| 2 | 8px | Default gap between related items |
| 3 | 12px | Compact card padding |
| 4 | 16px | Standard card/section padding |
| 5 | 20px | Comfortable padding |
| 6 | 24px | Section padding |
| 8 | 32px | Section gaps |
| 10 | 40px | Large section gaps |
| 12 | 48px | Page section spacing |
| 16 | 64px | Major page divisions |
| 20 | 80px | Hero spacing |
| 24 | 96px | Large hero spacing |
### Spacing Rules
- **Outer padding >= inner padding.** A card's outer margin must equal or exceed its internal padding. Interior elements relate more closely to each other than to external elements.
- **Proximity signals relationship.** Elements closer together are perceived as related (Gestalt Law of Proximity). Use spacing deliberately to group or separate.
- **Eliminate ambiguous spacing.** If the gap between two elements could belong to either, it's ambiguous. Make relationships clear through asymmetric spacing.
- **Eliminate dead zones.** Use padding on child elements instead of margins on containers. Every pixel between interactive items should be clickable.
- **Use consistent increments.** Don't pick arbitrary values. Constrain to the scale. Three similar spacings (14px, 16px, 18px) look like mistakes -- pick one.
### Layout Primitives
These CSS patterns create responsive layouts without media queries:
**Stack** -- Vertical flow with consistent gaps:
```css
.stack > * + * { margin-block-start: var(--space); }
```
**Cluster** -- Horizontal wrapping with gaps:
```css
.cluster { display: flex; flex-wrap: wrap; gap: var(--space); }
```
**Sidebar** -- Two columns where one is fixed:
```css
.sidebar { display: flex; flex-wrap: wrap; gap: var(--space); }
.sidebar > :first-child { flex-basis: 20rem; flex-grow: 1; }
.sidebar > :last-child { flex-basis: 0; flex-grow: 999; min-inline-size: 60%; }
```
**Grid (auto-fill)** -- Responsive columns without breakpoints:
```css
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: var(--space); }
```
**Center** -- Constrained width with centering:
```css
.center { max-inline-size: var(--measure); margin-inline: auto; padding-inline: var(--space); }
```
### Grid and Flex Guidance
- Use **CSS Grid** for two-dimensional layouts (rows and columns together).
- Use **Flexbox** for one-dimensional layouts (single row or column).
- Prefer `fr` units over percentages in Grid -- `fr` distributes space after gaps, preventing overflow.
- Use `gap` instead of margins between items.
- A **12-column grid** provides maximum flexibility (divisible by 1, 2, 3, 4, 6).
- Set `min-width: 0` on flex children to prevent content overflow.
- Use `align-self: start` on sticky sidebar elements inside grid layouts.
### In Practice: Tailwind Layout Patterns
**Page shell with sidebar:**
```tsx
<div className="flex min-h-screen">
<aside className="hidden lg:flex w-64 flex-col border-r bg-muted/40 p-4">
<nav className="flex flex-col gap-1">{/* nav items */}</nav>
</aside>
<main className="flex-1 p-6">
<div className="mx-auto max-w-4xl space-y-8">{children}</div>
</main>
</div>
```
**Card grid that adapts without breakpoints:**
```tsx
<div className="grid grid-cols-[repeat(auto-fill,minmax(min(100%,280px),1fr))] gap-4">
{items.map(item => <Card key={item.id} {...item} />)}
</div>
```
**Content section with consistent vertical rhythm:**
```tsx
<section className="space-y-6 py-12">
<h2 classNameRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.