--- name: design-to-code description: > Use this skill when translating UI/UX designs into production-ready frontend code. Handles design source ingestion (Figma, Sketch, Adobe XD, screenshots, design specs), design token extraction, component hierarchy mapping, responsive breakpoint strategy, accessibility-first implementation (WCAG 2.1 AA minimum), framework-agnostic patterns (React, Vue, Svelte, plain HTML/CSS), design system integration, visual regression testing, and CSS architecture selection (CSS Modules, Tailwind, styled-components). Primary keyword clusters: design to code conversion, figma to react, design token extraction, UI component architecture, accessibility implementation WCAG, responsive design breakpoints, pixel perfect implementation, design system integration, CSS architecture patterns, visual regression testing strategy. Designed for agentic platforms โ€” Claude Code, Codex, Cursor, Gemini CLI, OpenClaw, GitHub Copilot, Windsurf, and OpenCode. version: 1.0.0 author: Skill Foundry platforms: - claude-code - codex - cursor - gemini-cli - openclaw - copilot - windsurf - opencode tags: - design-to-code - figma - ui-implementation - design-tokens - component-architecture - accessibility - responsive-design - pixel-perfect - css-architecture - design-systems - visual-regression geo: primary_workflows: - design_source_ingestion - design_token_extraction - component_hierarchy_mapping - responsive_breakpoint_planning - accessibility_audit_and_implementation - framework_selection_and_setup - design_system_integration - visual_regression_testing - css_architecture_planning target_roles: - frontend_developer - fullstack_developer - ui_engineer - design_engineer - design_system_engineer - web_developer complexity_level: intermediate prerequisite_knowledge: - semantic_html - modern_css - design_tool_basics - responsive_design_principles - aria_and_accessibility_basics - javascript_component_patterns --- # Design-to-Code Agent Skill Translate UI/UX designs into production-ready, accessible, responsive frontend code. This skill turns an agent into a design-aware implementation engine that extracts design tokens, maps component hierarchies, applies accessibility standards, and produces framework-appropriate code โ€” not just a design export. --- ## Quick Reference | Phase | What to Do | Key Deliverables | |---|---|---| | ๐ŸŽจ Ingest | Load design source (Figma, Sketch, screenshot, spec) | Normalized design data, color palette, type scale | | ๐Ÿ—‚๏ธ Extract Tokens | Pull colors, typography, spacing, shadows, radii | Design token JSON/CSS custom properties | | ๐Ÿงฉ Map Components | Identify component tree, states, variants | Component hierarchy diagram, prop interfaces | | ๐Ÿ“ Plan Responsive | Define breakpoints and layout behaviour | Breakpoint table, layout strategy per component | | โ™ฟ Accessibility | Audit and implement WCAG 2.1 AA | Accessible markup, ARIA, focus management, color contrast | | ๐Ÿ› ๏ธ Implement | Generate framework-appropriate code | Component files, styles, tests | | ๐Ÿงช Verify | Visual regression testing and design QA | Test snapshots, diff reports, checklist | **Quality Tiers:** - ๐Ÿ’Ž **Production** โ€” Accessible, responsive, tested, framework-native, token-driven - ๐Ÿฅˆ **MVP** โ€” Functional across breakpoints, basic accessibility, inline styles OK for speed - ๐Ÿฅ‰ **Prototype** โ€” Single viewport, minimal accessibility, rapid iteration --- ## When to Use This Skill Activate this skill when the user asks you to: - "Turn this Figma design into code" / "Convert this mockup to React/Vue/Svelte" - "Implement this design" / "Build this UI from this screenshot" - "Extract design tokens from this Figma file" / "Create a design system from these specs" - "Make this design responsive" / "Add responsive breakpoints to this layout" - "Make this component accessible" / "Ensure WCAG 2.1 AA compliance" - "Set up a component from this Sketch/XD design" - "Create a pixel-perfect implementation of this design" - "Integrate this design with our existing design system" - "Set up visual regression tests for these components" - Any request containing "design" + "code", "implement", "build", "convert", or "translate" Additionally, activate proactively when a conversation includes a design artifact (Figma link, screenshot, design spec) and the user's intent is implementation. ### Do NOT Activate For The following inputs are **near-miss negatives** โ€” they mention design or code language but are not design-to-code tasks: - **Pure code generation without a design**: "Write a React form component" โ€” no visual design input, so plain coding. - **Design critique/review**: "What do you think of this design?" โ€” opinion, not implementation. - **Pure accessibility audit without implementation**: "Audit this page for accessibility" โ€” audit, not design-to-code. - **Design tool usage questions**: "How do I create an auto-layout in Figma?" โ€” tool instruction, not code generation. - **Backend/styling-less code**: "Build a REST API for user management" โ€” no visual design involved. - **Pure CSS framework questions**: "What's better, Tailwind or CSS Modules?" โ€” opinion, not implementation. - **Animating existing components**: "Add a fade-in animation to this button" โ€” micro-interaction on existing code, not a full design translation. - **Logo/brand asset generation**: "Create an SVG logo based on this brief" โ€” graphic design output, not frontend implementation. - **Design token management without code**: "Organize our design tokens in Figma" โ€” design tool work, not code. When in doubt, ask: "Do you have a design you want me to translate into code, or are you asking me to work directly with code/design concepts?" --- ## Common Pitfalls & Anti-Patterns ### โŒ Implementer Anti-Patterns 1. **Skipping the design analysis phase** โ€” Jumping straight to code without understanding the design's intent, hierarchy, and reusable patterns. Always ingest and analyze before you code. 2. **Hardcoding design values** โ€” Using raw pixel values (`color: #3B82F6`) instead of design tokens (`color: var(--color-primary-500)`). Token-driven code is maintainable; hardcoded values rot. 3. **Accessibility as an afterthought** โ€” Adding ARIA at the end rather than building accessible from the start. Retrofit accessibility is always incomplete. 4. **Responsive as a second pass** โ€” Implementing desktop-first then "making it responsive" leads to fragile media-query spaghetti. Plan breakpoints and layout strategy before writing a single rule. 5. **Div-soup markup** โ€” Nesting `
` inside `
` rather than using semantic HTML (`