UI Analyzer
This skill provides a systematic approach to analyzing UI design screenshots and translating them into production-ready React components using TypeScript and Tailwind CSS.
Purpose
Transform UI design screenshots into well-structured, accessible, and maintainable React components. The skill guides through analyzing layouts, extracting design tokens, identifying components, and generating clean code that matches the design while following best practices.
When to Use This Skill
Use this skill when:
- The user provides a UI design screenshot, mockup, or Figma export
- The user requests "implement this design" or "build this UI"
- The user asks to "analyze this screenshot"
- The user wants to convert a design to code
- The user needs help understanding a UI's structure
- The user requests matching an existing design
Analysis Workflow
Follow these steps systematically when analyzing a UI screenshot:
Step 1: Initial Observation and Screenshot Reading
Read the provided screenshot first using the Read tool if a file path is provided, or if the user has shared an image in the conversation.
After viewing the screenshot:
- Describe what you see in the UI
- Identify the screen/page type (login, dashboard, form, etc.)
- Determine the target device (desktop, mobile, responsive)
- Note the overall aesthetic (modern, minimal, colorful, etc.)
- Confirm understanding with the user before proceeding
Step 2: Layout Analysis
Identify the high-level layout structure:
Main layout type - Consult references/layout-patterns.md to identify:
- Single column
- Sidebar layout
- Header + content
- Grid layout
- Split screen
- Dashboard
- Master-detail
- Other patterns
Layout hierarchy - Break down into sections:
- Header/navigation
- Main content area
- Sidebar (if present)
- Footer (if present)
- Nested structures
Responsive considerations:
- How should layout adapt to mobile?
- Which elements stack or hide?
- Breakpoint strategy
Reference references/layout-patterns.md for Tailwind implementation patterns.
Step 3: Component Identification
Systematically identify all UI components using references/ui-analysis-checklist.md:
Navigation Components:
- Top nav, sidebar nav, breadcrumbs, tabs, etc.
Data Display Components:
- Cards, tables, lists, stats, badges, avatars, icons, etc.
Input Components:
- Text inputs, selects, checkboxes, radios, switches, date pickers, etc.
Action Components:
- Buttons (primary, secondary, etc.), icon buttons, links, etc.
Feedback Components:
- Alerts, toasts, progress bars, loading states, etc.
Overlay Components:
- Modals, drawers, tooltips, popovers, dropdowns, etc.
List all identified components with:
- Component type and purpose
- Location in the layout
- Approximate size and styling
- Interactive states (if visible)
Step 4: Design Token Extraction
Extract design system values using references/design-tokens.md:
Color Palette:
- Identify all unique colors in the design
- Categorize by usage:
- Primary brand color
- Secondary/accent colors
- Background colors (main, secondary)
- Text colors (primary, secondary, muted)
- Border colors
- State colors (success, warning, error, info)
- Map each color to nearest Tailwind color or note custom color needed
- Create a color reference table
Typography:
- Identify font family (serif, sans-serif, monospace)
- List all text sizes observed
- Map to Tailwind typography scale (
text-xs to text-6xl)
- Note font weights used (normal, medium, semibold, bold)
- Identify heading hierarchy (H1-H6)
Spacing:
- Observe padding patterns (card padding, button padding, etc.)
- Observe margin/gap patterns (between sections, between items)
- Map to Tailwind spacing scale (p-4, m-6, gap-8, etc.)
- Note the spacing unit (usually 4px or 8px base)
Other Tokens:
- Border radius (rounded-none to rounded-full)
- Shadows (shadow-sm to shadow-2xl)
- Border widths
- Icon sizes
Reference references/design-tokens.md for complete mapping tables.
Step 5: Detailed Component Analysis
For each major component identified:
- Component boundaries - Where does it start/end?
- Props/data - What data does it receive?
- Internal structure - Sub-components and elements
- Styling details:
- Background color
- Text color and size
- Padding and margins
- Border and radius
- Shadow
- Interactive states (if visible or inferable):
- Hover
- Active/pressed
- Focused
- Disabled
- Loading
- Error
- Accessibility needs:
- ARIA labels
- Semantic HTML
- Keyboard navigation
Step 6: Implementation Strategy
Plan the implementation approach:
- Component hierarchy - Which components to build first?
- Reusability - Which patterns repeat? Extract to reusable components
- State management - Does any component need Zustand or just local state?
- Integration with react-component-generator - Can existing templates be used?
- File structure - Where should components live?
If the react-component-generator skill is available:
- Reference its templates for common components (forms, cards, buttons, modals, etc.)
- Use its best practices for component structure
- Follow its naming conventions
Step 7: Code Generation
Generate React components following these principles:
Structure:
- Start with TypeScript interfaces for props
- Use functional components with React.FC
- Include JSDoc comments
- Export both named and default exports
Styling:
- Use Tailwind CSS exclusively for styling
- Apply extracted design tokens
- Organize classes logically (layout → spacing → colors → effects → states)
- Use responsive classes where needed (sm:, md:, lg:, xl:)
Best Practices:
- Use semantic HTML elements
- Include ARIA attributes for accessibility
- Handle loading and error states
- Support keyboard navigation
- Use proper TypeScript types (no
any)
- Keep components focused and composable
Example Component Template:
import React from 'react';
interface ComponentNameProps {
// Props based on analysis
title: string;
description?: string;
onClick?: () => void;
className?: string;
}
/**
* ComponentName - Brief description based on UI purpose
*
* @param props - Component props
* @returns JSX.Element
*/
export const ComponentName: React.FC<ComponentNameProps> = ({
title,
description,
onClick,
className = ''
}) => {
return (
<div className={`/* Tailwind classes from design */ ${className}`}>
{/* Implementation based on screenshot */}
</div>
);
};
export default ComponentName;
Step 8: Verification and Refinement
After generating code:
- Review against screenshot - Does it match the design?
- Check responsiveness - Will it work on different screen sizes?
- Verify accessibility - Are ARIA labels and semantic HTML present?
- Validate design tokens - Are colors, spacing, typography correct?
- Consider edge cases - Long text, empty states, loading states
- Note assumptions - Clearly state what was assumed vs confirmed
Step 9: Deliverables
Provide the user with:
Analysis Summary:
- Layout description
- Component breakdown
- Design tokens extracted
Generated Code:
- Complete React component(s)
- TypeScript interfaces
- Tailwind classes applied
Implementation Notes:
- Installation requirements (if any packages needed)
- Usage examples
- Customization suggestions
- Responsive behavior notes
Next Steps:
- Suggest improvements or variations
- Note areas that might need refinement
- Offer to generate additional related components
Common Scenarios
Scenario 1: Simple Form Screenshot
User: "Implement this login form design [screenshot]"
Approach:
- Read screenshot
- Identify: Centered card layout with form inputs and button
- Extract: Colors, input styling, button styling, spacing
- Reference
layout-patterns.md → "Centered Modal/Card" pattern
- Reference
react-component-generator → FormComponent template
- Generate: LoginForm.tsx with proper validation structure
- Apply Tailwind classes matching the design
Scenario 2: Dashboard Screenshot
User: "Build this dashboard UI [screenshot]"
Approach:
- Read screenshot
- Identify: Header + sidebar layout with grid of stat cards
- Break down into components:
- Header component
- Sidebar navigation
- StatCard component (repeated)
- Main dashboard layout
- Extract design tokens for consistency
- Reference
layout-patterns.md → "Dashboard Layout" pattern
- Generate components starting with reusable StatCard
- Compose into main Dashboard component
Scenario 3: Complex Page with Multiple Sections
User: "Implement this landing page [screenshot]"
Approach:
- Read screenshot
- Identify sections: Hero, features grid, testimonials, CTA
- Analyze each section separately using checklist
- Extract shared design tokens
- Generate section components one by one
- Show how sections compose into the full page
- Provide responsive behavior notes
Scenario 4: Component Library Screenshot
User: "Create components from this design system screenshot [screenshot]"
Approach:
- Read screenshot
- Identify: Multiple variations of buttons, inputs, cards shown
- Extract design tokens for the system
- Generate each component variant
- Document the prop variations
- Create a usage guide
- Suggest how to organize in the project
Reference Files Usage
references/ui-analysis-checklist.md
- When to use: During Step 3 (Component Identification) and as a comprehensive analysis guide
- Purpose: Ensures no components or details are missed
- How: Work through checklist sections systematically
references/layout-patterns.md
- When to use: During Step 2 (Layout Analysis) and Step 7 (Code Generation)
- Purpose: Quickly identify common patterns and get implementation code
- How: Match observed layout to pattern, adapt provided code
references/design-tokens.md
- When to use: During Step 4 (Design Token Extraction) and Step 7 (Code Generation)
- Purpose: Map visual elements to Tailwind classes accurately
- How: Use color tables, spacing scale, and component size guides
Tips for Accurate Analysis
- Be systematic - Follow the workflow steps in order, don't skip ahead
- Take measurements - Estimate sizes and spacing carefully
- Look for patterns - Repeated elements indicate design system consistency
- Note uncertainties - Clearly mark assumptions vs confirmed details
- Think responsive - Always consider mobile behavior
- Prioritize accessibility - Include ARIA labels and semantic HTML from the start
- Stay DRY - Extract reusable components when patterns repeat
- Consult references - Use the reference files liberally for accuracy
- Verify with user - Confirm understanding before extensive code generation
- Iterate - Expect refinement based on user feedback
Integration with Other Skills
With react-component-generator skill
When both skills are available:
- Use ui-analyzer to understand the design and extract requirements
- Reference react-component-generator templates for similar components
- Apply ui-analyzer's extracted design tokens to the templates
- Follow react-component-generator's naming and structure conventions
This creates a powerful workflow: analyze → identify template → customize → implement.
Example Full Workflow
User provides login page screenshot
- ✅ Read screenshot and describe the UI
- ✅ Identify: Centered card layout, split-screen with image
- ✅ Extract design tokens:
- Primary blue: #3B82F6 →
bg-blue-500
- Text: #1F2937 →
text-gray-800
- Background: #F9FAFB →
bg-gray-50
- Card padding: ~32px →
p-8
- Input height: ~40px →
h-10
- Button: blue background, white text, rounded-md
- ✅ Identify components:
- Logo/brand element
- Heading and subheading
- Email input (with label)
- Password input (with label, show/hide icon)
- "Remember me" checkbox
- "Forgot password?" link
- Submit button
- Sign up link at bottom
- ✅ Reference layout-patterns.md → Split Screen + Centered Card patterns
- ✅ Generate LoginForm.tsx:
- TypeScript interfaces for props
- Form validation structure
- Tailwind classes matching design
- Accessibility attributes
- Responsive behavior (stacked on mobile)
- ✅ Provide usage example and notes
- ✅ Offer to generate the accompanying image section or adjust styling
Notes
- Always read the screenshot first before any analysis
- Prioritize user confirmation of understanding before extensive code generation
- When in doubt about colors or spacing, choose the closest Tailwind default
- Document all assumptions clearly
- Provide complete, runnable code, not pseudocode
- Consider suggesting improvements while matching the design
- Be prepared to iterate based on user feedback
1---2name: ui-analyzer3description: Analyze UI design screenshots and generate React components with TypeScript and Tailwind CSS. Use this skill when the user provides UI mockups, design screenshots, or Figma exports and requests implementation. Provides detailed layout analysis, component breakdown, design token extraction, and production-ready code generation following best practices.4---5
6# UI Analyzer
7
8This skill provides a systematic approach to analyzing UI design screenshots and translating them into production-ready React components using TypeScript and Tailwind CSS.
9
10## Purpose
11
12Transform UI design screenshots into well-structured, accessible, and maintainable React components. The skill guides through analyzing layouts, extracting design tokens, identifying components, and generating clean code that matches the design while following best practices.
13
14## When to Use This Skill
15
16Use this skill when:
17- The user provides a UI design screenshot, mockup, or Figma export
18- The user requests "implement this design" or "build this UI"
19- The user asks to "analyze this screenshot"
20- The user wants to convert a design to code
21- The user needs help understanding a UI's structure
22- The user requests matching an existing design
23
24## Analysis Workflow
25
26Follow these steps systematically when analyzing a UI screenshot:
27
28### Step 1: Initial Observation and Screenshot Reading
29
30**Read the provided screenshot first** using the Read tool if a file path is provided, or if the user has shared an image in the conversation.
31
32After viewing the screenshot:
331. Describe what you see in the UI
342. Identify the screen/page type (login, dashboard, form, etc.)
353. Determine the target device (desktop, mobile, responsive)
364. Note the overall aesthetic (modern, minimal, colorful, etc.)
375. Confirm understanding with the user before proceeding
38
39### Step 2: Layout Analysis
40
41Identify the high-level layout structure:
42
431. **Main layout type** - Consult `references/layout-patterns.md` to identify:
44 - Single column
45 - Sidebar layout
46 - Header + content
47 - Grid layout
48 - Split screen
49 - Dashboard
50 - Master-detail
51 - Other patterns
52
532. **Layout hierarchy** - Break down into sections:
54 - Header/navigation
55 - Main content area
56 - Sidebar (if present)
57 - Footer (if present)
58 - Nested structures
59
603. **Responsive considerations**:
61 - How should layout adapt to mobile?
62 - Which elements stack or hide?
63 - Breakpoint strategy
64
65Reference `references/layout-patterns.md` for Tailwind implementation patterns.
66
67### Step 3: Component Identification
68
69Systematically identify all UI components using `references/ui-analysis-checklist.md`:
70
71**Navigation Components**:
72- Top nav, sidebar nav, breadcrumbs, tabs, etc.
73
74**Data Display Components**:
75- Cards, tables, lists, stats, badges, avatars, icons, etc.
76
77**Input Components**:
78- Text inputs, selects, checkboxes, radios, switches, date pickers, etc.
79
80**Action Components**:
81- Buttons (primary, secondary, etc.), icon buttons, links, etc.
82
83**Feedback Components**:
84- Alerts, toasts, progress bars, loading states, etc.
85
86**Overlay Components**:
87- Modals, drawers, tooltips, popovers, dropdowns, etc.
88
89List all identified components with:
90- Component type and purpose
91- Location in the layout
92- Approximate size and styling
93- Interactive states (if visible)
94
95### Step 4: Design Token Extraction
96
97Extract design system values using `references/design-tokens.md`:
98
99**Color Palette**:
1001. Identify all unique colors in the design
1012. Categorize by usage:
102 - Primary brand color
103 - Secondary/accent colors
104 - Background colors (main, secondary)
105 - Text colors (primary, secondary, muted)
106 - Border colors
107 - State colors (success, warning, error, info)
1083. Map each color to nearest Tailwind color or note custom color needed
1094. Create a color reference table
110
111**Typography**:
1121. Identify font family (serif, sans-serif, monospace)
1132. List all text sizes observed
1143. Map to Tailwind typography scale (`text-xs` to `text-6xl`)
1154. Note font weights used (normal, medium, semibold, bold)
1165. Identify heading hierarchy (H1-H6)
117
118**Spacing**:
1191. Observe padding patterns (card padding, button padding, etc.)
1202. Observe margin/gap patterns (between sections, between items)
1213. Map to Tailwind spacing scale (p-4, m-6, gap-8, etc.)
1224. Note the spacing unit (usually 4px or 8px base)
123
124**Other Tokens**:
125- Border radius (rounded-none to rounded-full)
126- Shadows (shadow-sm to shadow-2xl)
127- Border widths
128- Icon sizes
129
130Reference `references/design-tokens.md` for complete mapping tables.
131
132### Step 5: Detailed Component Analysis
133
134For each major component identified:
135
1361. **Component boundaries** - Where does it start/end?
1372. **Props/data** - What data does it receive?
1383. **Internal structure** - Sub-components and elements
1394. **Styling details**:
140 - Background color
141 - Text color and size
142 - Padding and margins
143 - Border and radius
144 - Shadow
1455. **Interactive states** (if visible or inferable):
146 - Hover
147 - Active/pressed
148 - Focused
149 - Disabled
150 - Loading
151 - Error
1526. **Accessibility needs**:
153 - ARIA labels
154 - Semantic HTML
155 - Keyboard navigation
156
157### Step 6: Implementation Strategy
158
159Plan the implementation approach:
160
1611. **Component hierarchy** - Which components to build first?
1622. **Reusability** - Which patterns repeat? Extract to reusable components
1633. **State management** - Does any component need Zustand or just local state?
1644. **Integration with react-component-generator** - Can existing templates be used?
1655. **File structure** - Where should components live?
166
167**If the react-component-generator skill is available**:
168- Reference its templates for common components (forms, cards, buttons, modals, etc.)
169- Use its best practices for component structure
170- Follow its naming conventions
171
172### Step 7: Code Generation
173
174Generate React components following these principles:
175
176**Structure**:
1771. Start with TypeScript interfaces for props
1782. Use functional components with React.FC
1793. Include JSDoc comments
1804. Export both named and default exports
181
182**Styling**:
1831. Use Tailwind CSS exclusively for styling
1842. Apply extracted design tokens
1853. Organize classes logically (layout → spacing → colors → effects → states)
1864. Use responsive classes where needed (sm:, md:, lg:, xl:)
187
188**Best Practices**:
1891. Use semantic HTML elements
1902. Include ARIA attributes for accessibility
1913. Handle loading and error states
1924. Support keyboard navigation
1935. Use proper TypeScript types (no `any`)
1946. Keep components focused and composable
195
196**Example Component Template**:
197```tsx
198import React from 'react';
199
200interface ComponentNameProps {
201 // Props based on analysis
202 title: string;
203 description?: string;
204 onClick?: () => void;
205 className?: string;
206}
207
208/**
209 * ComponentName - Brief description based on UI purpose
210 *
211 * @param props - Component props
212 * @returns JSX.Element
213 */
214export const ComponentName: React.FC<ComponentNameProps> = ({
215 title,
216 description,
217 onClick,
218 className = ''
219}) => {
220 return (
221 <div className={`/* Tailwind classes from design */ ${className}`}>
222 {/* Implementation based on screenshot */}
223 </div>
224 );
225};
226
227export default ComponentName;
228```
229
230### Step 8: Verification and Refinement
231
232After generating code:
233
2341. **Review against screenshot** - Does it match the design?
2352. **Check responsiveness** - Will it work on different screen sizes?
2363. **Verify accessibility** - Are ARIA labels and semantic HTML present?
2374. **Validate design tokens** - Are colors, spacing, typography correct?
2385. **Consider edge cases** - Long text, empty states, loading states
2396. **Note assumptions** - Clearly state what was assumed vs confirmed
240
241### Step 9: Deliverables
242
243Provide the user with:
244
2451. **Analysis Summary**:
246 - Layout description
247 - Component breakdown
248 - Design tokens extracted
249
2502. **Generated Code**:
251 - Complete React component(s)
252 - TypeScript interfaces
253 - Tailwind classes applied
254
2553. **Implementation Notes**:
256 - Installation requirements (if any packages needed)
257 - Usage examples
258 - Customization suggestions
259 - Responsive behavior notes
260
2614. **Next Steps**:
262 - Suggest improvements or variations
263 - Note areas that might need refinement
264 - Offer to generate additional related components
265
266## Common Scenarios
267
268### Scenario 1: Simple Form Screenshot
269
270**User**: "Implement this login form design [screenshot]"
271
272**Approach**:
2731. Read screenshot
2742. Identify: Centered card layout with form inputs and button
2753. Extract: Colors, input styling, button styling, spacing
2764. Reference `layout-patterns.md` → "Centered Modal/Card" pattern
2775. Reference `react-component-generator` → FormComponent template
2786. Generate: LoginForm.tsx with proper validation structure
2797. Apply Tailwind classes matching the design
280
281### Scenario 2: Dashboard Screenshot
282
283**User**: "Build this dashboard UI [screenshot]"
284
285**Approach**:
2861. Read screenshot
2872. Identify: Header + sidebar layout with grid of stat cards
2883. Break down into components:
289 - Header component
290 - Sidebar navigation
291 - StatCard component (repeated)
292 - Main dashboard layout
2934. Extract design tokens for consistency
2945. Reference `layout-patterns.md` → "Dashboard Layout" pattern
2956. Generate components starting with reusable StatCard
2967. Compose into main Dashboard component
297
298### Scenario 3: Complex Page with Multiple Sections
299
300**User**: "Implement this landing page [screenshot]"
301
302**Approach**:
3031. Read screenshot
3042. Identify sections: Hero, features grid, testimonials, CTA
3053. Analyze each section separately using checklist
3064. Extract shared design tokens
3075. Generate section components one by one
3086. Show how sections compose into the full page
3097. Provide responsive behavior notes
310
311### Scenario 4: Component Library Screenshot
312
313**User**: "Create components from this design system screenshot [screenshot]"
314
315**Approach**:
3161. Read screenshot
3172. Identify: Multiple variations of buttons, inputs, cards shown
3183. Extract design tokens for the system
3194. Generate each component variant
3205. Document the prop variations
3216. Create a usage guide
3227. Suggest how to organize in the project
323
324## Reference Files Usage
325
326### references/ui-analysis-checklist.md
327- **When to use**: During Step 3 (Component Identification) and as a comprehensive analysis guide
328- **Purpose**: Ensures no components or details are missed
329- **How**: Work through checklist sections systematically
330
331### references/layout-patterns.md
332- **When to use**: During Step 2 (Layout Analysis) and Step 7 (Code Generation)
333- **Purpose**: Quickly identify common patterns and get implementation code
334- **How**: Match observed layout to pattern, adapt provided code
335
336### references/design-tokens.md
337- **When to use**: During Step 4 (Design Token Extraction) and Step 7 (Code Generation)
338- **Purpose**: Map visual elements to Tailwind classes accurately
339- **How**: Use color tables, spacing scale, and component size guides
340
341## Tips for Accurate Analysis
342
3431. **Be systematic** - Follow the workflow steps in order, don't skip ahead
3442. **Take measurements** - Estimate sizes and spacing carefully
3453. **Look for patterns** - Repeated elements indicate design system consistency
3464. **Note uncertainties** - Clearly mark assumptions vs confirmed details
3475. **Think responsive** - Always consider mobile behavior
3486. **Prioritize accessibility** - Include ARIA labels and semantic HTML from the start
3497. **Stay DRY** - Extract reusable components when patterns repeat
3508. **Consult references** - Use the reference files liberally for accuracy
3519. **Verify with user** - Confirm understanding before extensive code generation
35210. **Iterate** - Expect refinement based on user feedback
353
354## Integration with Other Skills
355
356### With react-component-generator skill
357When both skills are available:
3581. Use ui-analyzer to understand the design and extract requirements
3592. Reference react-component-generator templates for similar components
3603. Apply ui-analyzer's extracted design tokens to the templates
3614. Follow react-component-generator's naming and structure conventions
362
363This creates a powerful workflow: analyze → identify template → customize → implement.
364
365## Example Full Workflow
366
367**User provides login page screenshot**
368
3691. ✅ Read screenshot and describe the UI
3702. ✅ Identify: Centered card layout, split-screen with image
3713. ✅ Extract design tokens:
372 - Primary blue: #3B82F6 → `bg-blue-500`
373 - Text: #1F2937 → `text-gray-800`
374 - Background: #F9FAFB → `bg-gray-50`
375 - Card padding: ~32px → `p-8`
376 - Input height: ~40px → `h-10`
377 - Button: blue background, white text, rounded-md
3784. ✅ Identify components:
379 - Logo/brand element
380 - Heading and subheading
381 - Email input (with label)
382 - Password input (with label, show/hide icon)
383 - "Remember me" checkbox
384 - "Forgot password?" link
385 - Submit button
386 - Sign up link at bottom
3875. ✅ Reference layout-patterns.md → Split Screen + Centered Card patterns
3886. ✅ Generate LoginForm.tsx:
389 - TypeScript interfaces for props
390 - Form validation structure
391 - Tailwind classes matching design
392 - Accessibility attributes
393 - Responsive behavior (stacked on mobile)
3947. ✅ Provide usage example and notes
3958. ✅ Offer to generate the accompanying image section or adjust styling
396
397## Notes
398
399- Always read the screenshot first before any analysis
400- Prioritize user confirmation of understanding before extensive code generation
401- When in doubt about colors or spacing, choose the closest Tailwind default
402- Document all assumptions clearly
403- Provide complete, runnable code, not pseudocode
404- Consider suggesting improvements while matching the design
405- Be prepared to iterate based on user feedback