Design Engineering
Premium design engineering for agentic workflows. Produce distinctive, high-end interfaces — not generic AI output — using DESIGN.md as the portable design contract across three complementary tools.
DESIGN.md (contract) ─────────────────────────────────────────────────
│ │ │
▼ ▼ ▼
Stitch Pencil Figma
(explore) (design in IDE) (refine + handoff)
│ │ │
└─────────────────────────┴────────────────────────┘
│
▼
Production Code
(validated via screenshots)
Quick Start
1. Create or Load DESIGN.md
Every project needs a DESIGN.md at its root. Generate one from an existing project:
# From existing code (read globals.css, extract tokens)
# Agent analyzes CSS → generates DESIGN.md in Stitch spec format
# From a reference website (via Stitch)
# Use stitch-design skill → extract_design_context → synthesize DESIGN.md
# From a Figma file
# Use Figma MCP → get_variable_defs + get_design_context → synthesize DESIGN.md
2. Design Pipeline
| Stage |
Tool |
Action |
| Explore |
Stitch |
Vibe-design multiple directions from a goal/feeling/inspiration |
| Design |
Pencil MCP |
Create .pen files in IDE — batch_design, get_style_guide, set_variables |
| Refine |
Figma MCP |
Team review, design token management, Code Connect mapping |
| Build |
Coding Agent |
Generate production code referencing DESIGN.md tokens |
| Validate |
Screenshots |
get_screenshot (Pencil), visual diff, layout inspection |
3. Validate Design Quality
After every major design step, run the Premium Design Checklist:
The DESIGN.md Specification
DESIGN.md is a portable, agent-friendly markdown file following Google Stitch's five-section format. It captures a project's visual identity in terms readable by both humans and AI agents.
Required Sections
| # |
Section |
Content |
| 1 |
Visual Theme & Atmosphere |
Evocative mood descriptors, density, aesthetic philosophy |
| 2 |
Color Palette & Roles |
Descriptive Name + color value + functional purpose for every color |
| 3 |
Typography Rules |
Font families, weight/size hierarchy, rendering settings |
| 4 |
Component Stylings |
Buttons, cards, navigation, inputs — shape, color, behavior, states |
| 5 |
Layout Principles |
Spacing system, grid, whitespace, responsive behavior, animation |
| 6 |
Generation Notes (optional) |
Prompt templates, iteration constraints, tool-specific guidance |
Writing Rules
- Evocative names: "Resonant AI Blue" not "blue"; "Abyssal Indigo" not "dark background"
- Precise values in parens:
oklch(0.55 0.25 260) / #0066ff after every descriptive name
- Functional purpose: Every color/component explains what it's used for
- Physical descriptions: "Pill-shaped" not
rounded-full; "Whisper-soft shadows" not shadow-sm
- Never raw CSS class names: Translate all technical values into design language
How Agents Use DESIGN.md
- Read DESIGN.md at the start of every design or frontend task
- Apply tokens — use the exact color values, font stacks, spacing units, and animation timings
- Follow component patterns — buttons, cards, inputs should match the described styling
- Validate against it — every generated component should pass a visual audit against the spec
- Update it — when the design system evolves, keep DESIGN.md current
Multi-Tool Pipeline
Pencil MCP (Design in IDE)
Agent-native vector design on an infinite canvas. .pen files are JSON, live in Git, and are read/written via MCP tools.
Core workflow:
get_editor_state() — understand current context
get_guidelines("web-app") — load design rules for your project type
get_style_guide_tags → get_style_guide(tags) — choose aesthetic direction
set_variables(...) — set design tokens from DESIGN.md
find_empty_space_on_canvas(...) — locate placement for new frames
batch_design(operations) — create/modify design (max 25 ops per call)
get_screenshot(nodeId) — validate visually after every major step
snapshot_layout() — verify computed positions, detect clipping/overflow
Design-to-code: Agent reads .pen tree via batch_get, extracts layout/styling, generates React + Tailwind components referencing DESIGN.md tokens.
Key rules:
- Always take screenshots after major design steps
- Keep batch_design to max 25 operations per call
- Use realistic content, never "Lorem ipsum"
- Name layers semantically ("UserAvatarImage" not "Rectangle 12")
- Desktop-first at 1440px unless mobile-first specified
- Mark reusable patterns with
reusable: true
Figma MCP (Refine + Handoff)
Industry-standard design tool with official MCP server for agent integration.
Setup:
# Official Figma MCP (hosted, OAuth)
claude mcp add --transport http figma https://mcp.figma.com/mcp
# Framelink (community, most popular, 90% payload compression)
claude mcp add figma-framelink -- npx figma-developer-mcp --figma-api-key=YOUR_KEY
Core workflow:
get_design_context(url) — extract layout/styling for a frame (React + Tailwind default)
get_variable_defs(url) — read design tokens (colors, spacing, typography)
get_code_connect_map(url) — map Figma components → codebase components
get_screenshot(url) — visual snapshot for fidelity validation
create_design_system_rules(url) — generate agent-readable rules file
Design tokens pipeline:
Figma Variables → REST API / plugin → DTCG JSON → Style Dictionary → CSS / iOS / Android
Google Stitch (Vibe Exploration)
AI-native design platform for rapid UI exploration from natural language.
Setup:
# Install skills (already done globally)
npx skills add google-labs-code/stitch-skills --yes --global
# MCP server
npx @_davideast/stitch-mcp init
# or set STITCH_API_KEY and configure manually
Core workflow:
- Describe a goal, feeling, or inspiration — not a wireframe
- Stitch generates multiple high-fidelity UI directions
- Extract design DNA via
extract_design_context
- Synthesize into DESIGN.md via the
design-md skill
- Export to Figma (with Auto Layout) or download HTML/CSS
DESIGN.md generation pipeline (5 stages):
Retrieval → Extraction → Translation → Synthesis → Alignment
Premium Design Principles
What Makes Design Look Premium
- Deliberate restraint — every element earns its place; nothing is there by default
- Material metaphor — surfaces feel like glass, paper, stone, or metal — not flat rectangles
- Atmospheric hue — never pure gray; always a subtle color tint in neutrals (e.g., 275-hue blue-purple)
- Micro-detail precision — kerning, line spacing ratios, shadow angles, border opacities all consciously chosen
- Custom typography — distinctive font pairing that immediately separates from generic defaults
- Interaction choreography — tiered animation timing creates rhythm and hierarchy
- Light simulation — top-edge gradient highlights on glass surfaces simulate physical light
- Dominant + accent — one strong brand color with sharp accents, never evenly distributed
What Makes Design Look Generic AI (Avoid These)
| Anti-Pattern |
Fix |
| Purple gradients on white |
Commit to one atmospheric hue throughout |
| Inter/Roboto/Arial defaults |
Use distinctive font pairing (e.g., CalSans + Geist) |
| 3-column identical card grids |
Vary card treatment, use asymmetry, break the grid |
| Even color distribution |
Dominant/accent hierarchy with 2-3 saturated colors max |
| Stock team photos |
AI-generated contextual imagery or abstract patterns |
| Identical component treatment |
Vary emphasis with glass tiers, shadow depth, border weight |
| Over-detailed maximalism |
One effect per surface, not stacked gradients + shadows + blur |
| Missing atmospheric coherence |
Shared hue undertone + consistent token usage across all components |
Color System Principles
- Define all colors in OKLCH (perceptually uniform lightness)
- Provide hex fallbacks via
@supports not (color: oklch())
- Enhance brand colors on P3 displays via
@media (color-gamut: p3)
- Limit saturated colors to 2-3 brand + 4 semantic (success, warning, error, info)
- Maintain a consistent hue undertone across all neutral surfaces
Typography Principles
- Pair a confident display face (headings) with a precise body face
- Establish explicit weight hierarchy: Display (SemiBold), Body (Regular), UI Labels (Medium)
- Set
text-rendering: optimizeLegibility, antialiased smoothing
- Use
text-wrap: balance for headlines
- Minimum 16px font on mobile inputs to prevent iOS Safari zoom
Accessibility Enforcement (WCAG 2.2 AA)
These are non-negotiable in every design:
Color Contrast
- Normal text: 4.5:1 minimum contrast ratio
- Large text (18pt+ or 14pt+ bold): 3:1 minimum
- UI components and graphics: 3:1 minimum
Focus Indicators
- Visible focus on all interactive elements (2px solid outline, 2px offset)
- 3:1 contrast between focused and unfocused states
- Never trap or hide focus
Keyboard & Navigation
- All functionality available via keyboard
- Logical tab order
- Skip navigation links on content-heavy pages
Touch Targets
- Minimum 24x24 CSS pixels (WCAG 2.2 AA)
- Recommended 44x44px (Apple HIG) / 48x48dp (Material)
Motion
- Comprehensive
prefers-reduced-motion support
- Collapse all animation to
0.01ms duration
- Disable hover transforms in reduced motion mode
Semantic HTML
aria-invalid for error identification
required / aria-required for required fields
- ARIA live regions for status messages
Visual Validation Workflow
After Every Major Design Step:
- Screenshot — use Pencil
get_screenshot or browser screenshot tools
- Layout inspection — use Pencil
snapshot_layout(problemsOnly: true) to detect clipping/overflow
- Token audit — use
search_all_unique_properties to find raw hex values that should be tokenized
- Contrast check — verify all text/background combinations meet WCAG ratios
- Responsive test — validate at 375px (mobile), 768px (tablet), 1440px (desktop)
- Dark/light mode — verify both themes maintain contrast and readability
Design Token Audit
search_all_unique_properties → find leaked raw values
replace_all_matching_properties → tokenize to variable references
get_variables → verify all tokens are defined
Animation System
Timing Tiers
| Tier |
Duration |
Easing |
Use Case |
| Instant |
0ms |
— |
Reduced motion fallback |
| Fast |
150ms |
ease |
Button hover, link color, focus ring |
| Normal |
250ms |
ease |
Card lift, border change, surface shift |
| Slow |
350ms |
ease |
Panel expand, content reveal |
| Morph |
500ms |
cubic-bezier(0.4, 0, 0.2, 1) |
Shape/size transformation |
| Ambient |
1500ms |
ease-in-out |
Pulsing glow, loading state |
Rules
- Every animation must serve navigation, feedback, or attention — no decorative-only motion
- Use CSS transitions for standard elements; Motion library for React orchestration
- Never animate
width, height, top, left — use transform and opacity only
- Use
will-change sparingly and remove after animation completes
- Stagger entrance animations by 50-100ms per element for cascading reveals
Design Token Architecture
Three-layer token structure (Martin Fowler's framework):
| Layer |
Name |
Example |
| Option (what) |
Available choices |
--color-blue-500: oklch(0.55 0.25 260) |
| Decision (how) |
Semantic mapping |
--ag-ai-blue: var(--color-blue-500) |
| Component (where) |
Usage binding |
--button-primary-bg: var(--ag-ai-blue) |
Token Flow
DESIGN.md (specification)
↓
globals.css (CSS custom properties)
↓
@theme inline (Tailwind v4 mapping)
↓
Component code (utility classes + cva variants)
Cross-Tool Sync
| Direction |
Flow |
| DESIGN.md → Pencil |
set_variables with tokens from DESIGN.md |
| DESIGN.md → Code |
CSS custom properties in globals.css |
| Pencil → Code |
get_variables → generate CSS |
| Figma → Code |
get_variable_defs → Style Dictionary → CSS |
| Code → DESIGN.md |
Extract tokens from globals.css → regenerate DESIGN.md |
| Code → Figma |
generate_figma_design captures rendered UI |
Resources
references/
design-md-spec.md — Full DESIGN.md specification with examples and writing rules
pencil-mcp-reference.md — Complete Pencil MCP tool reference, batch_design syntax, .pen format
figma-mcp-reference.md — Figma MCP ecosystem (official + community), Code Connect, Variables API
stitch-integration.md — Stitch MCP server, SDK, skills, vibe design methodology
premium-design-principles.md — Anti-generic patterns, material metaphors, atmospheric coherence
accessibility-enforcement.md — WCAG 2.2 AA checklist, automated enforcement strategies
visual-validation.md — Screenshot workflows, layout inspection, token auditing, responsive testing
1---2name: design-engineering3description: Premium design engineering skill for agentic workflows — produces high-end, distinctive UI designs using DESIGN.md as the portable contract across Pencil MCP (in-IDE canvas), Figma MCP (team handoff + design tokens), and Google Stitch (vibe exploration + AI generation). Enforces anti-generic principles, WCAG 2.2 AA accessibility, perceptually uniform color, tiered animation timing, and screenshot-driven visual validation at every stage. Use when: (1) creating or reviewing UI designs from an agent, (2) generating DESIGN.md for a project, (3) implementing designs from Pencil .pen files or Figma URLs, (4) enforcing visual quality standards on AI-generated interfaces, (5) setting up a multi-tool design pipeline, (6) converting between design tools and production code. Triggers on: 'design engineering', 'design system', 'DESIGN.md', 'premium design', 'high-end UI', 'pencil design', 'figma to code', 'stitch design', 'vibe design', 'visual design review', 'glass design', 'design tokens', 'UI quality'.4---56# Design Engineering78Premium design engineering for agentic workflows. Produce distinctive, high-end interfaces — not generic AI output — using DESIGN.md as the portable design contract across three complementary tools.910```11DESIGN.md (contract) ─────────────────────────────────────────────────12 │ │ │13 ▼ ▼ ▼14 Stitch Pencil Figma15 (explore) (design in IDE) (refine + handoff)16 │ │ │17 └─────────────────────────┴────────────────────────┘18 │19 ▼20 Production Code21 (validated via screenshots)22```2324## Quick Start2526### 1. Create or Load DESIGN.md2728Every project needs a DESIGN.md at its root. Generate one from an existing project:2930```bash31# From existing code (read globals.css, extract tokens)32# Agent analyzes CSS → generates DESIGN.md in Stitch spec format3334# From a reference website (via Stitch)35# Use stitch-design skill → extract_design_context → synthesize DESIGN.md3637# From a Figma file38# Use Figma MCP → get_variable_defs + get_design_context → synthesize DESIGN.md39```4041### 2. Design Pipeline4243| Stage | Tool | Action |44|-------|------|--------|45| **Explore** | Stitch | Vibe-design multiple directions from a goal/feeling/inspiration |46| **Design** | Pencil MCP | Create .pen files in IDE — batch_design, get_style_guide, set_variables |47| **Refine** | Figma MCP | Team review, design token management, Code Connect mapping |48| **Build** | Coding Agent | Generate production code referencing DESIGN.md tokens |49| **Validate** | Screenshots | get_screenshot (Pencil), visual diff, layout inspection |5051### 3. Validate Design Quality5253After every major design step, run the **Premium Design Checklist**:5455- [ ] No generic AI aesthetic (purple gradients on white, stock photos, identical cards)56- [ ] Consistent atmospheric hue across all neutral surfaces (never pure gray)57- [ ] Maximum 2-3 saturated brand colors + semantic states58- [ ] Custom typography (not Inter/Roboto/Arial defaults)59- [ ] Glass/material metaphor with deliberate restraint (3-5 glass surfaces per viewport)60- [ ] Tiered animation timing (150ms hover → 250ms transition → 500ms morph → 1500ms ambient)61- [ ] WCAG 2.2 AA: 4.5:1 text contrast, visible focus indicators, 24x24px touch targets62- [ ] Reduced motion: `prefers-reduced-motion` disables all animation63- [ ] Mobile-first: 16px min font on inputs, responsive breakpoints tested6465## The DESIGN.md Specification6667DESIGN.md is a **portable, agent-friendly markdown file** following Google Stitch's five-section format. It captures a project's visual identity in terms readable by both humans and AI agents.6869### Required Sections7071| # | Section | Content |72|---|---------|---------|73| 1 | **Visual Theme & Atmosphere** | Evocative mood descriptors, density, aesthetic philosophy |74| 2 | **Color Palette & Roles** | Descriptive Name + color value + functional purpose for every color |75| 3 | **Typography Rules** | Font families, weight/size hierarchy, rendering settings |76| 4 | **Component Stylings** | Buttons, cards, navigation, inputs — shape, color, behavior, states |77| 5 | **Layout Principles** | Spacing system, grid, whitespace, responsive behavior, animation |78| 6 | **Generation Notes** (optional) | Prompt templates, iteration constraints, tool-specific guidance |7980### Writing Rules8182- **Evocative names**: "Resonant AI Blue" not "blue"; "Abyssal Indigo" not "dark background"83- **Precise values in parens**: `oklch(0.55 0.25 260)` / `#0066ff` after every descriptive name84- **Functional purpose**: Every color/component explains *what it's used for*85- **Physical descriptions**: "Pill-shaped" not `rounded-full`; "Whisper-soft shadows" not `shadow-sm`86- **Never raw CSS class names**: Translate all technical values into design language8788### How Agents Use DESIGN.md89901. **Read DESIGN.md** at the start of every design or frontend task912. **Apply tokens** — use the exact color values, font stacks, spacing units, and animation timings923. **Follow component patterns** — buttons, cards, inputs should match the described styling934. **Validate against it** — every generated component should pass a visual audit against the spec945. **Update it** — when the design system evolves, keep DESIGN.md current9596## Multi-Tool Pipeline9798### Pencil MCP (Design in IDE)99100Agent-native vector design on an infinite canvas. `.pen` files are JSON, live in Git, and are read/written via MCP tools.101102**Core workflow:**1031. `get_editor_state()` — understand current context1042. `get_guidelines("web-app")` — load design rules for your project type1053. `get_style_guide_tags` → `get_style_guide(tags)` — choose aesthetic direction1064. `set_variables(...)` — set design tokens from DESIGN.md1075. `find_empty_space_on_canvas(...)` — locate placement for new frames1086. `batch_design(operations)` — create/modify design (max 25 ops per call)1097. `get_screenshot(nodeId)` — validate visually after every major step1108. `snapshot_layout()` — verify computed positions, detect clipping/overflow111112**Design-to-code:** Agent reads .pen tree via `batch_get`, extracts layout/styling, generates React + Tailwind components referencing DESIGN.md tokens.113114**Key rules:**115- Always take screenshots after major design steps116- Keep batch_design to max 25 operations per call117- Use realistic content, never "Lorem ipsum"118- Name layers semantically ("UserAvatarImage" not "Rectangle 12")119- Desktop-first at 1440px unless mobile-first specified120- Mark reusable patterns with `reusable: true`121122### Figma MCP (Refine + Handoff)123124Industry-standard design tool with official MCP server for agent integration.125126**Setup:**127```bash128# Official Figma MCP (hosted, OAuth)129claude mcp add --transport http figma https://mcp.figma.com/mcp130131# Framelink (community, most popular, 90% payload compression)132claude mcp add figma-framelink -- npx figma-developer-mcp --figma-api-key=YOUR_KEY133```134135**Core workflow:**1361. `get_design_context(url)` — extract layout/styling for a frame (React + Tailwind default)1372. `get_variable_defs(url)` — read design tokens (colors, spacing, typography)1383. `get_code_connect_map(url)` — map Figma components → codebase components1394. `get_screenshot(url)` — visual snapshot for fidelity validation1405. `create_design_system_rules(url)` — generate agent-readable rules file141142**Design tokens pipeline:**143```144Figma Variables → REST API / plugin → DTCG JSON → Style Dictionary → CSS / iOS / Android145```146147### Google Stitch (Vibe Exploration)148149AI-native design platform for rapid UI exploration from natural language.150151**Setup:**152```bash153# Install skills (already done globally)154npx skills add google-labs-code/stitch-skills --yes --global155156# MCP server157npx @_davideast/stitch-mcp init158# or set STITCH_API_KEY and configure manually159```160161**Core workflow:**1621. Describe a *goal*, *feeling*, or *inspiration* — not a wireframe1632. Stitch generates multiple high-fidelity UI directions1643. Extract design DNA via `extract_design_context`1654. Synthesize into DESIGN.md via the `design-md` skill1665. Export to Figma (with Auto Layout) or download HTML/CSS167168**DESIGN.md generation pipeline (5 stages):**169Retrieval → Extraction → Translation → Synthesis → Alignment170171## Premium Design Principles172173### What Makes Design Look Premium1741751. **Deliberate restraint** — every element earns its place; nothing is there by default1762. **Material metaphor** — surfaces feel like glass, paper, stone, or metal — not flat rectangles1773. **Atmospheric hue** — never pure gray; always a subtle color tint in neutrals (e.g., 275-hue blue-purple)1784. **Micro-detail precision** — kerning, line spacing ratios, shadow angles, border opacities all consciously chosen1795. **Custom typography** — distinctive font pairing that immediately separates from generic defaults1806. **Interaction choreography** — tiered animation timing creates rhythm and hierarchy1817. **Light simulation** — top-edge gradient highlights on glass surfaces simulate physical light1828. **Dominant + accent** — one strong brand color with sharp accents, never evenly distributed183184### What Makes Design Look Generic AI (Avoid These)185186| Anti-Pattern | Fix |187|---|---|188| Purple gradients on white | Commit to one atmospheric hue throughout |189| Inter/Roboto/Arial defaults | Use distinctive font pairing (e.g., CalSans + Geist) |190| 3-column identical card grids | Vary card treatment, use asymmetry, break the grid |191| Even color distribution | Dominant/accent hierarchy with 2-3 saturated colors max |192| Stock team photos | AI-generated contextual imagery or abstract patterns |193| Identical component treatment | Vary emphasis with glass tiers, shadow depth, border weight |194| Over-detailed maximalism | One effect per surface, not stacked gradients + shadows + blur |195| Missing atmospheric coherence | Shared hue undertone + consistent token usage across all components |196197### Color System Principles198199- Define all colors in **OKLCH** (perceptually uniform lightness)200- Provide **hex fallbacks** via `@supports not (color: oklch())`201- Enhance brand colors on **P3 displays** via `@media (color-gamut: p3)`202- Limit saturated colors to **2-3 brand + 4 semantic** (success, warning, error, info)203- Maintain a **consistent hue undertone** across all neutral surfaces204205### Typography Principles206207- Pair a **confident display face** (headings) with a **precise body face**208- Establish explicit **weight hierarchy**: Display (SemiBold), Body (Regular), UI Labels (Medium)209- Set `text-rendering: optimizeLegibility`, antialiased smoothing210- Use `text-wrap: balance` for headlines211- Minimum **16px font on mobile inputs** to prevent iOS Safari zoom212213## Accessibility Enforcement (WCAG 2.2 AA)214215These are **non-negotiable** in every design:216217### Color Contrast218- Normal text: **4.5:1** minimum contrast ratio219- Large text (18pt+ or 14pt+ bold): **3:1** minimum220- UI components and graphics: **3:1** minimum221222### Focus Indicators223- Visible focus on all interactive elements (2px solid outline, 2px offset)224- **3:1** contrast between focused and unfocused states225- Never trap or hide focus226227### Keyboard & Navigation228- All functionality available via keyboard229- Logical tab order230- Skip navigation links on content-heavy pages231232### Touch Targets233- Minimum **24x24 CSS pixels** (WCAG 2.2 AA)234- Recommended **44x44px** (Apple HIG) / **48x48dp** (Material)235236### Motion237- Comprehensive `prefers-reduced-motion` support238- Collapse all animation to `0.01ms` duration239- Disable hover transforms in reduced motion mode240241### Semantic HTML242- `aria-invalid` for error identification243- `required` / `aria-required` for required fields244- ARIA live regions for status messages245246## Visual Validation Workflow247248### After Every Major Design Step:2492501. **Screenshot** — use Pencil `get_screenshot` or browser screenshot tools2512. **Layout inspection** — use Pencil `snapshot_layout(problemsOnly: true)` to detect clipping/overflow2523. **Token audit** — use `search_all_unique_properties` to find raw hex values that should be tokenized2534. **Contrast check** — verify all text/background combinations meet WCAG ratios2545. **Responsive test** — validate at 375px (mobile), 768px (tablet), 1440px (desktop)2556. **Dark/light mode** — verify both themes maintain contrast and readability256257### Design Token Audit258259```260search_all_unique_properties → find leaked raw values261replace_all_matching_properties → tokenize to variable references262get_variables → verify all tokens are defined263```264265## Animation System266267### Timing Tiers268269| Tier | Duration | Easing | Use Case |270|------|----------|--------|----------|271| **Instant** | 0ms | — | Reduced motion fallback |272| **Fast** | 150ms | ease | Button hover, link color, focus ring |273| **Normal** | 250ms | ease | Card lift, border change, surface shift |274| **Slow** | 350ms | ease | Panel expand, content reveal |275| **Morph** | 500ms | cubic-bezier(0.4, 0, 0.2, 1) | Shape/size transformation |276| **Ambient** | 1500ms | ease-in-out | Pulsing glow, loading state |277278### Rules279280- Every animation must serve **navigation, feedback, or attention** — no decorative-only motion281- Use **CSS transitions** for standard elements; Motion library for React orchestration282- Never animate `width`, `height`, `top`, `left` — use `transform` and `opacity` only283- Use `will-change` sparingly and remove after animation completes284- Stagger entrance animations by 50-100ms per element for cascading reveals285286## Design Token Architecture287288Three-layer token structure (Martin Fowler's framework):289290| Layer | Name | Example |291|-------|------|---------|292| **Option** (what) | Available choices | `--color-blue-500: oklch(0.55 0.25 260)` |293| **Decision** (how) | Semantic mapping | `--ag-ai-blue: var(--color-blue-500)` |294| **Component** (where) | Usage binding | `--button-primary-bg: var(--ag-ai-blue)` |295296### Token Flow297298```299DESIGN.md (specification)300 ↓301globals.css (CSS custom properties)302 ↓303@theme inline (Tailwind v4 mapping)304 ↓305Component code (utility classes + cva variants)306```307308### Cross-Tool Sync309310| Direction | Flow |311|-----------|------|312| DESIGN.md → Pencil | `set_variables` with tokens from DESIGN.md |313| DESIGN.md → Code | CSS custom properties in globals.css |314| Pencil → Code | `get_variables` → generate CSS |315| Figma → Code | `get_variable_defs` → Style Dictionary → CSS |316| Code → DESIGN.md | Extract tokens from globals.css → regenerate DESIGN.md |317| Code → Figma | `generate_figma_design` captures rendered UI |318319## Resources320321### references/322- `design-md-spec.md` — Full DESIGN.md specification with examples and writing rules323- `pencil-mcp-reference.md` — Complete Pencil MCP tool reference, batch_design syntax, .pen format324- `figma-mcp-reference.md` — Figma MCP ecosystem (official + community), Code Connect, Variables API325- `stitch-integration.md` — Stitch MCP server, SDK, skills, vibe design methodology326- `premium-design-principles.md` — Anti-generic patterns, material metaphors, atmospheric coherence327- `accessibility-enforcement.md` — WCAG 2.2 AA checklist, automated enforcement strategies328- `visual-validation.md` — Screenshot workflows, layout inspection, token auditing, responsive testing