Convert UI/UX designs (mockups, wireframes, screenshots) into technical specs, component architectures, and implementation guides. Use for design analysis, design system extraction, component specifications, and frontend documentation.
Your Goal: Understand the user's project, existing assets, and technical constraints.
Technology Stack Assessment:
Design Assets Collection:
Your Goal: Deconstruct visual designs into structured, technical specifications.
If user provides images, mockups, or links to design files:
Visual Decomposition (Systematic Analysis):
brand-primary, text-body).text-xs, text-base), weights (e.g., font-normal, font-bold), line heights.space-x-small, space-y-medium, gap-large).sm: 640px, md: 768px).Generate Comprehensive Design Schema (JSON):
{
"designSystem": {
"colors": {
"primary": "#FF6B35",
"secondary": "#004E89",
"textBody": "#2E2E2E",
"backgroundLight": "#FFFFFF"
// ... more semantic colors
},
"typography": {
"fontFamilies": {
"heading": "Montserrat, sans-serif",
"body": "Open Sans, sans-serif"
},
"fontSizes": {
"h1": "32pt",
"h2": "24pt",
"body": "11pt",
"sm": "0.875rem",
"base": "1rem"
},
"fontWeights": {
"regular": 400,
"bold": 700
},
"lineHeights": {
"tight": 1.2,
"normal": 1.5
}
},
"spacing": {
"unit": "8px", // Or similar base unit
"xs": "4px",
"sm": "8px",
"md": "16px",
"lg": "24px",
"xl": "32px"
// ... full spacing scale
},
"breakpoints": {
"sm": "640px",
"md": "768px",
"lg": "1024px",
"xl": "1280px"
},
"shadows": {
"sm": "0 1px 2px rgba(0,0,0,0.05)",
"md": "0 4px 6px rgba(0,0,0,0.1)"
},
"borderRadius": {
"sm": "4px",
"md": "8px",
"full": "9999px"
},
"animations": {
"transitionDefault": "all 0.2s ease-in-out"
}
},
"components": {
"Button": {
"purpose": "Interactive element to trigger actions.",
"variants": [
{"name": "primary", "styles": ["bg-primary", "text-white"]},
{"name": "secondary", "styles": ["bg-secondary", "text-white"]},
{"name": "outline", "styles": ["border", "border-primary", "text-primary"]}
],
"states": {
"default": {},
"hover": {"backgroundColor": "darken(primary, 10%)"},
"active": {"transform": "scale(0.98)"},
"focus": {"outline": "2px solid blue"},
"disabled": {"opacity": 0.6, "cursor": "not-allowed"}
},
"props": {
"children": {"type": "React.ReactNode", "description": "Button content"},
"onClick": {"type": "() => void", "description": "Event handler"},
"variant": {"type": "'primary' | 'secondary' | 'outline'", "default": "primary"},
"size": {"type": "'sm' | 'md' | 'lg'", "default": "md"},
"fullWidth": {"type": "boolean", "default": "false"}
},
"accessibility": {
"ariaRole": "button",
"keyboardNav": "Tab, Enter, Space",
"focusIndication": true,
"contrastRatio": "WCAG AA"
},
"responsive": {
"sizes": {"sm": "h-8 px-3", "md": "h-10 px-4", "lg": "h-12 px-5"},
"fullWidthAt": ["sm"] // e.g., button is full width on small screens
},
"interactions": {
"clickEffect": "slight scale down"
}
},
"Input": {
// ... detailed schema for Input component
},
"Card": {
// ... detailed schema for Card component
}
},
"layouts": {
"GridTwoColumn": {
"purpose": "A two-column responsive grid layout.",
"structure": "Uses CSS Grid. One column full-width on mobile, two columns on larger screens.",
"breakpoints": {"md": "grid-cols-2"}
}
},
"patterns": {
"FormValidation": {
"purpose": "Standardized client-side form validation display.",
"behavior": "Show error message below field, highlight field border red."
}
}
}
Utilize Tools for Research:
Your Goal: Generate a Markdown document (frontend-design-spec.md) that is a developer-ready guide.
Location: Always confirm with the user. Suggest /docs/design/ if no specific path is given.
Content Structure:
# Frontend Design Specification: [Project Name/Feature]
## 1. Project Overview
[Brief, concise description of the design goals, target audience, and key user needs addressed by this design.]
## 2. Technology Stack & Environment
- **Frontend Framework:** [User's specified framework, e.g., React v18.x]
- **Styling Approach:** [User's specified CSS approach, e.g., Tailwind CSS v3.x, Styled Components v5.x]
- **Component Libraries (if applicable):** [e.g., shadcn/ui, Radix UI]
- **State Management:** [e.g., Zustand]
- **Build Tools:** [e.g., Vite]
- **Version Control:** [e.g., Git]
## 3. Design System Foundation (Design Tokens)
*This section outlines the atomic design decisions, ensuring consistency across the application.*
### 3.1. Color Palette
| Name | Hex Code | Usage |
| :------------ | :---------- | :------------------------------------- |
| `primary` | `#FF6B35` | Main interactive elements, branding |
| `secondary` | `#004E89` | Secondary actions, contrasting accents |
| `text-body` | `#2E2E2E` | General body text |
| `background` | `#F9FAFB` | Page background |
| `error` | `#EF4444` | Error messages, destructive actions |
| `success` | `#22C55E` | Success feedback |
| `border-light`| `#E5E7EB` | Light borders, dividers |
`
### 3.2. Typography Scale
| Element | Font Family | Size | Weight | Line Height | Usage |
| :----------- | :-------------- | :------ | :------- | :---------- | :-------------------- |
| `h1` | Montserrat Bold | 32pt | 700 | 1.2 | Main page titles |
| `h2` | Montserrat Bold | 24pt | 700 | 1.3 | Section headings |
| `body-text` | Open Sans Reg. | 11pt | 400 | 1.5 | Paragraphs, lists |
| `caption` | Open Sans Reg. | 9pt | 400 | 1.4 | Small text, footnotes |
### 3.3. Spacing System
| Name | Value | Usage |
| :------ | :------ | :------------------------------------- |
| `xs` | 4px | Very small gaps, icon spacing |
| `sm` | 8px | Small padding, item spacing |
| `md` | 16px | Standard component padding, vertical rhythm |
| `lg` | 24px | Section spacing |
| `xl` | 32px | Large margins |
### 3.4. Breakpoints
| Name | Value | Usage |
| :------ | :-------- | :------------------------------------- |
| `sm` | `640px` | Mobile landscape, small tablets |
| `md` | `768px` | Tablets, small desktops |
| `lg` | `1024px` | Desktops |
| `xl` | `1280px` | Large desktops |
### 3.5. Shadows, Border Radii, Animations
- **Shadows:**
- `shadow-sm`: `0 1px 2px rgba(0,0,0,0.05)` (for inputs, small cards)
- `shadow-md`: `0 4px 6px rgba(0,0,0,0.1)` (for elevated cards, modals)
- **Border Radii:**
- `rounded-sm`: `4px`
- `rounded-md`: `8px`
- `rounded-full`: `9999px` (for avatars, pills)
- **Animations:**
- `transition-default`: `all 0.2s ease-in-out` (for hover states, small changes)
## 4. Component Architecture
*Detailed specifications for each reusable UI component.*
### 4.1. Button Component
**Purpose**: Interactive element to trigger actions.
**Visual Reference**: [Link to Figma/design file if available, or screenshot]
**Variants**:
- **Primary:** `bg-primary`, `text-white`, `font-bold`. Used for main call-to-actions.
- **Secondary:** `bg-secondary`, `text-white`. For less emphasized actions.
- **Outline:** `border-2`, `border-primary`, `text-primary`, `bg-transparent`. For tertiary actions.
- **Destructive:** `bg-error`, `text-white`. For irreversible actions (e.g., delete).
**States**:
- **Default:** `[base styles]`
- **Hover:** `[darken(primary, 10%)`, `scale(1.02)`, `cursor: pointer]`
- **Active:** `[scale(0.98)]`
- **Focus:** `[outline: 2px solid blue`, `outline-offset: 2px]` (for keyboard navigation)
- **Disabled:** `[opacity: 0.6`, `cursor: not-allowed]`
**Props Interface (TypeScript/JSDoc example)**:
```typescript
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: 'primary' | 'secondary' | 'outline' | 'destructive';
size?: 'sm' | 'md' | 'lg'; // 'sm': h-8 px-3, 'md': h-10 px-4, 'lg': h-12 px-5
fullWidth?: boolean; // Makes button take 100% width
isLoading?: boolean; // Displays a loading spinner
leftIcon?: React.ReactNode; // Icon before text
rightIcon?: React.ReactNode; // Icon after text
}
Accessibility Requirements:
role="button" (if not using native button element).aria-label for icon-only buttons.Tab, Enter, Space).WCAG AA minimum).aria-disabled for disabled state.Implementation Example (React/TailwindCSS):
// components/Button.tsx
import React from 'react';
import clsx from 'clsx'; // Utility for conditional classes
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: 'primary' | 'secondary' | 'outline' | 'destructive';
size?: 'sm' | 'md' | 'lg';
fullWidth?: boolean;
isLoading?: boolean;
leftIcon?: React.ReactNode;
rightIcon?: React.ReactNode;
}
const Button: React.FC<ButtonProps> = ({
children,
variant = 'primary',
size = 'md',
fullWidth = false,
isLoading = false,
leftIcon,
rightIcon,
className,
...props
}) => {
const baseStyles = 'inline-flex items-center justify-center font-semibold rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2';
const variantStyles = {
primary: 'bg-primary text-white hover:bg-opacity-90 active:bg-opacity-80 focus:ring-primary',
secondary: 'bg-secondary text-white hover:bg-opacity-90 active:bg-opacity-80 focus:ring-secondary',
outline: 'border-2 border-primary text-primary hover:bg-primary hover:text-white focus:ring-primary',
destructive: 'bg-error text-white hover:bg-red-700 active:bg-red-800 focus:ring-error',
};
const sizeStyles = {
sm: 'h-8 px-3 text-sm',
md: 'h-10 px-4 text-base',
lg: 'h-12 px-5 text-lg',
};
return (
<button
className={clsx(
baseStyles,
variantStyles[variant],
sizeStyles[size],
fullWidth && 'w-full',
isLoading && 'opacity-60 cursor-not-allowed',
className
)}
disabled={isLoading || props.disabled}
{...props}
>
{isLoading ? (
<svg className="animate-spin h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
) : (
<>
{leftIcon && <span className="mr-2">{leftIcon}</span>}
{children}
{rightIcon && <span className="ml-2">{rightIcon}</span>}
</>
)}
</button>
);
};
export default Button;
(Repeat for other critical components like Input, Card, Modal, Checkbox, etc.)
Common structural arrangements for content.
display: grid, grid-template-columns: 1fr 1fr (md and up), grid-template-columns: 1fr (sm and down).display: flex; justify-content: center; align-items: center;.Standardized behaviors for user interaction.
error color.aria-describedby linking input to error message.Escape key, closes on outside click (optional).role="dialog", aria-modal="true", focus management.aria-describedby linking trigger to tooltip content.A suggested phased approach for development.
WCAG 2.1 AA).This section is for ongoing collaboration and tracking changes.
lg size.isLoading prop to Button component.
Your Goal: Continuously improve the design specification based on user input and technical validation.
Gather Specific Feedback:
Refine Based on Feedback:
frontend-design-spec.md.Validate Technical Feasibility (Proactive Check):
WCAG compliance (aim for AA) should be integrated from the outset, not treated as an afterthought.Actively use all available tools to deliver the best outcome:
WebSearch: Indispensable for researching modern implementation patterns, accessibility best practices, framework-specific nuances, and design system examples (e.g., "Tailwind UI components," "Radix UI accessibility," "React context pattern for themes").Read, Write, MultiEdit, Bash, Grep, Glob, Context7: For detailed analysis of any provided code/text, creating the frontend-design-spec.md file, modifying existing files (if permission is given), and searching within provided repository structures.Remember: The ultimate goal of this Skill is to create a living design document that robustly bridges the gap between abstract design vision and tangible code reality, empowering developers to build exactly what was envisioned with clarity and minimal ambiguity.