Sistema de Design de UI
Resumo em PT-BR: Ajuda a estruturar componentes, padroes e governanca de design system.
Titulo original: UI Design System
Observacao: instrucoes detalhadas, referencias e scripts originais abaixo foram preservados em ingles.
Generate design tokens, create color palettes, calculate typography scales, build component systems, and prepare developer handoff documentation.
Table of Contents
Trigger Terms
Use this skill when you need to:
- "generate design tokens"
- "create color palette"
- "build typography scale"
- "calculate spacing system"
- "create design system"
- "generate CSS variables"
- "export SCSS tokens"
- "set up component architecture"
- "document component library"
- "calculate responsive breakpoints"
- "prepare developer handoff"
- "convert brand color to palette"
- "check WCAG contrast"
- "build 8pt grid system"
Workflows
Workflow 1: Generate Design Tokens
Situation: You have a brand color and need a complete design token system.
Steps:
Identify brand color and style
- Brand primary color (hex format)
- Style preference:
modern | classic | playful
Generate tokens using script
python scripts/design_token_generator.py "#0066CC" modern json
Review generated categories
- Colors: primary, secondary, neutral, semantic, surface
- Typography: fontFamily, fontSize, fontWeight, lineHeight
- Spacing: 8pt grid-based scale (0-64)
- Borders: radius, width
- Shadows: none through 2xl
- Animation: duration, easing
- Breakpoints: xs through 2xl
Export in target format
# CSS custom properties
python scripts/design_token_generator.py "#0066CC" modern css > design-tokens.css
# SCSS variables
python scripts/design_token_generator.py "#0066CC" modern scss > _design-tokens.scss
# JSON for Figma/tooling
python scripts/design_token_generator.py "#0066CC" modern json > design-tokens.json
Validate accessibility
- Check color contrast meets WCAG AA (4.5:1 normal, 3:1 large text)
- Verify semantic colors have contrast colors defined
Workflow 2: Create Component System
Situation: You need to structure a component library using design tokens.
Steps:
Define component hierarchy
- Atoms: Button, Input, Icon, Label, Badge
- Molecules: FormField, SearchBar, Card, ListItem
- Organisms: Header, Footer, DataTable, Modal
- Templates: DashboardLayout, AuthLayout
Map tokens to components
| Component |
Tokens Used |
| Button |
colors, sizing, borders, shadows, typography |
| Input |
colors, sizing, borders, spacing |
| Card |
colors, borders, shadows, spacing |
| Modal |
colors, shadows, spacing, z-index, animation |
Define variant patterns
Size variants:
sm: height 32px, paddingX 12px, fontSize 14px
md: height 40px, paddingX 16px, fontSize 16px
lg: height 48px, paddingX 20px, fontSize 18px
Color variants:
primary: background primary-500, text white
secondary: background neutral-100, text neutral-900
ghost: background transparent, text neutral-700
Document component API
- Props interface with types
- Variant options
- State handling (hover, active, focus, disabled)
- Accessibility requirements
Reference: See references/component-architecture.md
Workflow 3: Responsive Design
Situation: You need breakpoints, fluid typography, or responsive spacing.
Steps:
Define breakpoints
| Name |
Width |
Target |
| xs |
0 |
Small phones |
| sm |
480px |
Large phones |
| md |
640px |
Tablets |
| lg |
768px |
Small laptops |
| xl |
1024px |
Desktops |
| 2xl |
1280px |
Large screens |
Calculate fluid typography
Formula: clamp(min, preferred, max)
/* 16px to 24px between 320px and 1200px viewport */
font-size: clamp(1rem, 0.5rem + 2vw, 1.5rem);
Pre-calculated scales:
--fluid-h1: clamp(2rem, 1rem + 3.6vw, 4rem);
--fluid-h2: clamp(1.75rem, 1rem + 2.3vw, 3rem);
--fluid-h3: clamp(1.5rem, 1rem + 1.4vw, 2.25rem);
--fluid-body: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
Set up responsive spacing
| Token |
Mobile |
Tablet |
Desktop |
| --space-md |
12px |
16px |
16px |
| --space-lg |
16px |
24px |
32px |
| --space-xl |
24px |
32px |
48px |
| --space-section |
48px |
80px |
120px |
Reference: See references/responsive-calculations.md
Workflow 4: Developer Handoff
Situation: You need to hand off design tokens to development team.
Steps:
Export tokens in required formats
# For CSS projects
python scripts/design_token_generator.py "#0066CC" modern css
# For SCSS projects
python scripts/design_token_generator.py "#0066CC" modern scss
# For JavaScript/TypeScript
python scripts/design_token_generator.py "#0066CC" modern json
Prepare framework integration
React + CSS Variables:
import './design-tokens.css';
<button className="btn btn-primary">Click</button>
Tailwind Config:
const tokens = require('./design-tokens.json');
module.exports = {
theme: {
colors: tokens.colors,
fontFamily: tokens.typography.fontFamily
}
};
styled-components:
import tokens from './design-tokens.json';
const Button = styled.button`
background: ${tokens.colors.primary['500']};
padding: ${tokens.spacing['2']} ${tokens.spacing['4']};
`;
Sync with Figma
- Install Tokens Studio plugin
- Import design-tokens.json
- Tokens sync automatically with Figma styles
Handoff checklist
Reference: See references/developer-handoff.md
Tool Reference
design_token_generator.py
Generates complete design token system from brand color.
| Argument |
Values |
Default |
Description |
| brand_color |
Hex color |
#0066CC |
Primary brand color |
| style |
modern, classic, playful |
modern |
Design style preset |
| format |
json, css, scss, summary |
json |
Output format |
Examples:
# Generate JSON tokens (default)
python scripts/design_token_generator.py "#0066CC"
# Classic style with CSS output
python scripts/design_token_generator.py "#8B4513" classic css
# Playful style summary view
python scripts/design_token_generator.py "#FF6B6B" playful summary
Output Categories:
| Category |
Description |
Key Values |
| colors |
Color palettes |
primary, secondary, neutral, semantic, surface |
| typography |
Font system |
fontFamily, fontSize, fontWeight, lineHeight |
| spacing |
8pt grid |
0-64 scale, semantic (xs-3xl) |
| sizing |
Component sizes |
container, button, input, icon |
| borders |
Border values |
radius (per style), width |
| shadows |
Shadow styles |
none through 2xl, inner |
| animation |
Motion tokens |
duration, easing, keyframes |
| breakpoints |
Responsive |
xs, sm, md, lg, xl, 2xl |
| z-index |
Layer system |
base through notification |
Quick Reference Tables
Color Scale Generation
| Step |
Brightness |
Saturation |
Use Case |
| 50 |
95% fixed |
30% |
Subtle backgrounds |
| 100 |
95% fixed |
38% |
Light backgrounds |
| 200 |
95% fixed |
46% |
Hover states |
| 300 |
95% fixed |
54% |
Borders |
| 400 |
95% fixed |
62% |
Disabled states |
| 500 |
Original |
70% |
Base/default color |
| 600 |
Original × 0.8 |
78% |
Hover (dark) |
| 700 |
Original × 0.6 |
86% |
Active states |
| 800 |
Original × 0.4 |
94% |
Text |
| 900 |
Original × 0.2 |
100% |
Headings |
Typography Scale (1.25x Ratio)
| Size |
Value |
Calculation |
| xs |
10px |
16 ÷ 1.25² |
| sm |
13px |
16 ÷ 1.25¹ |
| base |
16px |
Base |
| lg |
20px |
16 × 1.25¹ |
| xl |
25px |
16 × 1.25² |
| 2xl |
31px |
16 × 1.25³ |
| 3xl |
39px |
16 × 1.25⁴ |
| 4xl |
49px |
16 × 1.25⁵ |
| 5xl |
61px |
16 × 1.25⁶ |
WCAG Contrast Requirements
| Level |
Normal Text |
Large Text |
| AA |
4.5:1 |
3:1 |
| AAA |
7:1 |
4.5:1 |
Large text: ≥18pt regular or ≥14pt bold
Style Presets
| Aspect |
Modern |
Classic |
Playful |
| Font Sans |
Inter |
Helvetica |
Poppins |
| Font Mono |
Fira Code |
Courier |
Source Code Pro |
| Radius Default |
8px |
4px |
16px |
| Shadows |
Layered, subtle |
Single layer |
Soft, pronounced |
Knowledge Base
Detailed reference guides in references/:
| File |
Content |
token-generation.md |
Color algorithms, HSV space, WCAG contrast, type scales |
component-architecture.md |
Atomic design, naming conventions, props patterns |
responsive-calculations.md |
Breakpoints, fluid typography, grid systems |
developer-handoff.md |
Export formats, framework setup, Figma sync |
Validation Checklist
Token Generation
Component System
Accessibility
Developer Handoff
1---2name: sistema-de-design-de-ui3description: Ajuda a estruturar componentes, padroes e governanca de design system.4---56# Sistema de Design de UI78Resumo em PT-BR: Ajuda a estruturar componentes, padroes e governanca de design system.9Titulo original: `UI Design System`10Observacao: instrucoes detalhadas, referencias e scripts originais abaixo foram preservados em ingles.111213Generate design tokens, create color palettes, calculate typography scales, build component systems, and prepare developer handoff documentation.1415---1617## Table of Contents1819- [Trigger Terms](#trigger-terms)20- [Workflows](#workflows)21 - [Workflow 1: Generate Design Tokens](#workflow-1-generate-design-tokens)22 - [Workflow 2: Create Component System](#workflow-2-create-component-system)23 - [Workflow 3: Responsive Design](#workflow-3-responsive-design)24 - [Workflow 4: Developer Handoff](#workflow-4-developer-handoff)25- [Tool Reference](#tool-reference)26- [Quick Reference Tables](#quick-reference-tables)27- [Knowledge Base](#knowledge-base)2829---3031## Trigger Terms3233Use this skill when you need to:3435- "generate design tokens"36- "create color palette"37- "build typography scale"38- "calculate spacing system"39- "create design system"40- "generate CSS variables"41- "export SCSS tokens"42- "set up component architecture"43- "document component library"44- "calculate responsive breakpoints"45- "prepare developer handoff"46- "convert brand color to palette"47- "check WCAG contrast"48- "build 8pt grid system"4950---5152## Workflows5354### Workflow 1: Generate Design Tokens5556**Situation:** You have a brand color and need a complete design token system.5758**Steps:**59601. **Identify brand color and style**61 - Brand primary color (hex format)62 - Style preference: `modern` | `classic` | `playful`63642. **Generate tokens using script**65 ```bash66 python scripts/design_token_generator.py "#0066CC" modern json67 ```68693. **Review generated categories**70 - Colors: primary, secondary, neutral, semantic, surface71 - Typography: fontFamily, fontSize, fontWeight, lineHeight72 - Spacing: 8pt grid-based scale (0-64)73 - Borders: radius, width74 - Shadows: none through 2xl75 - Animation: duration, easing76 - Breakpoints: xs through 2xl77784. **Export in target format**79 ```bash80 # CSS custom properties81 python scripts/design_token_generator.py "#0066CC" modern css > design-tokens.css8283 # SCSS variables84 python scripts/design_token_generator.py "#0066CC" modern scss > _design-tokens.scss8586 # JSON for Figma/tooling87 python scripts/design_token_generator.py "#0066CC" modern json > design-tokens.json88 ```89905. **Validate accessibility**91 - Check color contrast meets WCAG AA (4.5:1 normal, 3:1 large text)92 - Verify semantic colors have contrast colors defined9394---9596### Workflow 2: Create Component System9798**Situation:** You need to structure a component library using design tokens.99100**Steps:**1011021. **Define component hierarchy**103 - Atoms: Button, Input, Icon, Label, Badge104 - Molecules: FormField, SearchBar, Card, ListItem105 - Organisms: Header, Footer, DataTable, Modal106 - Templates: DashboardLayout, AuthLayout1071082. **Map tokens to components**109110 | Component | Tokens Used |111 |-----------|-------------|112 | Button | colors, sizing, borders, shadows, typography |113 | Input | colors, sizing, borders, spacing |114 | Card | colors, borders, shadows, spacing |115 | Modal | colors, shadows, spacing, z-index, animation |1161173. **Define variant patterns**118119 Size variants:120 ```121 sm: height 32px, paddingX 12px, fontSize 14px122 md: height 40px, paddingX 16px, fontSize 16px123 lg: height 48px, paddingX 20px, fontSize 18px124 ```125126 Color variants:127 ```128 primary: background primary-500, text white129 secondary: background neutral-100, text neutral-900130 ghost: background transparent, text neutral-700131 ```1321334. **Document component API**134 - Props interface with types135 - Variant options136 - State handling (hover, active, focus, disabled)137 - Accessibility requirements1381395. **Reference:** See `references/component-architecture.md`140141---142143### Workflow 3: Responsive Design144145**Situation:** You need breakpoints, fluid typography, or responsive spacing.146147**Steps:**1481491. **Define breakpoints**150151 | Name | Width | Target |152 |------|-------|--------|153 | xs | 0 | Small phones |154 | sm | 480px | Large phones |155 | md | 640px | Tablets |156 | lg | 768px | Small laptops |157 | xl | 1024px | Desktops |158 | 2xl | 1280px | Large screens |1591602. **Calculate fluid typography**161162 Formula: `clamp(min, preferred, max)`163164 ```css165 /* 16px to 24px between 320px and 1200px viewport */166 font-size: clamp(1rem, 0.5rem + 2vw, 1.5rem);167 ```168169 Pre-calculated scales:170 ```css171 --fluid-h1: clamp(2rem, 1rem + 3.6vw, 4rem);172 --fluid-h2: clamp(1.75rem, 1rem + 2.3vw, 3rem);173 --fluid-h3: clamp(1.5rem, 1rem + 1.4vw, 2.25rem);174 --fluid-body: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);175 ```1761773. **Set up responsive spacing**178179 | Token | Mobile | Tablet | Desktop |180 |-------|--------|--------|---------|181 | --space-md | 12px | 16px | 16px |182 | --space-lg | 16px | 24px | 32px |183 | --space-xl | 24px | 32px | 48px |184 | --space-section | 48px | 80px | 120px |1851864. **Reference:** See `references/responsive-calculations.md`187188---189190### Workflow 4: Developer Handoff191192**Situation:** You need to hand off design tokens to development team.193194**Steps:**1951961. **Export tokens in required formats**197 ```bash198 # For CSS projects199 python scripts/design_token_generator.py "#0066CC" modern css200201 # For SCSS projects202 python scripts/design_token_generator.py "#0066CC" modern scss203204 # For JavaScript/TypeScript205 python scripts/design_token_generator.py "#0066CC" modern json206 ```2072082. **Prepare framework integration**209210 **React + CSS Variables:**211 ```tsx212 import './design-tokens.css';213214 <button className="btn btn-primary">Click</button>215 ```216217 **Tailwind Config:**218 ```javascript219 const tokens = require('./design-tokens.json');220221 module.exports = {222 theme: {223 colors: tokens.colors,224 fontFamily: tokens.typography.fontFamily225 }226 };227 ```228229 **styled-components:**230 ```typescript231 import tokens from './design-tokens.json';232233 const Button = styled.button`234 background: ${tokens.colors.primary['500']};235 padding: ${tokens.spacing['2']} ${tokens.spacing['4']};236 `;237 ```2382393. **Sync with Figma**240 - Install Tokens Studio plugin241 - Import design-tokens.json242 - Tokens sync automatically with Figma styles2432444. **Handoff checklist**245 - [ ] Token files added to project246 - [ ] Build pipeline configured247 - [ ] Theme/CSS variables imported248 - [ ] Component library aligned249 - [ ] Documentation generated2502515. **Reference:** See `references/developer-handoff.md`252253---254255## Tool Reference256257### design_token_generator.py258259Generates complete design token system from brand color.260261| Argument | Values | Default | Description |262|----------|--------|---------|-------------|263| brand_color | Hex color | #0066CC | Primary brand color |264| style | modern, classic, playful | modern | Design style preset |265| format | json, css, scss, summary | json | Output format |266267**Examples:**268269```bash270# Generate JSON tokens (default)271python scripts/design_token_generator.py "#0066CC"272273# Classic style with CSS output274python scripts/design_token_generator.py "#8B4513" classic css275276# Playful style summary view277python scripts/design_token_generator.py "#FF6B6B" playful summary278```279280**Output Categories:**281282| Category | Description | Key Values |283|----------|-------------|------------|284| colors | Color palettes | primary, secondary, neutral, semantic, surface |285| typography | Font system | fontFamily, fontSize, fontWeight, lineHeight |286| spacing | 8pt grid | 0-64 scale, semantic (xs-3xl) |287| sizing | Component sizes | container, button, input, icon |288| borders | Border values | radius (per style), width |289| shadows | Shadow styles | none through 2xl, inner |290| animation | Motion tokens | duration, easing, keyframes |291| breakpoints | Responsive | xs, sm, md, lg, xl, 2xl |292| z-index | Layer system | base through notification |293294---295296## Quick Reference Tables297298### Color Scale Generation299300| Step | Brightness | Saturation | Use Case |301|------|------------|------------|----------|302| 50 | 95% fixed | 30% | Subtle backgrounds |303| 100 | 95% fixed | 38% | Light backgrounds |304| 200 | 95% fixed | 46% | Hover states |305| 300 | 95% fixed | 54% | Borders |306| 400 | 95% fixed | 62% | Disabled states |307| 500 | Original | 70% | Base/default color |308| 600 | Original × 0.8 | 78% | Hover (dark) |309| 700 | Original × 0.6 | 86% | Active states |310| 800 | Original × 0.4 | 94% | Text |311| 900 | Original × 0.2 | 100% | Headings |312313### Typography Scale (1.25x Ratio)314315| Size | Value | Calculation |316|------|-------|-------------|317| xs | 10px | 16 ÷ 1.25² |318| sm | 13px | 16 ÷ 1.25¹ |319| base | 16px | Base |320| lg | 20px | 16 × 1.25¹ |321| xl | 25px | 16 × 1.25² |322| 2xl | 31px | 16 × 1.25³ |323| 3xl | 39px | 16 × 1.25⁴ |324| 4xl | 49px | 16 × 1.25⁵ |325| 5xl | 61px | 16 × 1.25⁶ |326327### WCAG Contrast Requirements328329| Level | Normal Text | Large Text |330|-------|-------------|------------|331| AA | 4.5:1 | 3:1 |332| AAA | 7:1 | 4.5:1 |333334Large text: ≥18pt regular or ≥14pt bold335336### Style Presets337338| Aspect | Modern | Classic | Playful |339|--------|--------|---------|---------|340| Font Sans | Inter | Helvetica | Poppins |341| Font Mono | Fira Code | Courier | Source Code Pro |342| Radius Default | 8px | 4px | 16px |343| Shadows | Layered, subtle | Single layer | Soft, pronounced |344345---346347## Knowledge Base348349Detailed reference guides in `references/`:350351| File | Content |352|------|---------|353| `token-generation.md` | Color algorithms, HSV space, WCAG contrast, type scales |354| `component-architecture.md` | Atomic design, naming conventions, props patterns |355| `responsive-calculations.md` | Breakpoints, fluid typography, grid systems |356| `developer-handoff.md` | Export formats, framework setup, Figma sync |357358---359360## Validation Checklist361362### Token Generation363- [ ] Brand color provided in hex format364- [ ] Style matches project requirements365- [ ] All token categories generated366- [ ] Semantic colors include contrast values367368### Component System369- [ ] All sizes implemented (sm, md, lg)370- [ ] All variants implemented (primary, secondary, ghost)371- [ ] All states working (hover, active, focus, disabled)372- [ ] Uses only design tokens (no hardcoded values)373374### Accessibility375- [ ] Color contrast meets WCAG AA376- [ ] Focus indicators visible377- [ ] Touch targets ≥ 44×44px378- [ ] Semantic HTML elements used379380### Developer Handoff381- [ ] Tokens exported in required format382- [ ] Framework integration documented383- [ ] Design tool synced384- [ ] Component documentation complete