design-spec-extraction
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDesign Specification Extraction
设计规范提取
Extract comprehensive, production-ready JSON design specifications from visual inputs using a 7-pass serial subtask architecture that ensures complete coverage and cross-validation.
采用7阶段串行子任务架构,从视觉输入中提取全面、可用于生产环境的JSON设计规范,确保覆盖完整且经过交叉验证。
When to Use This Skill
适用场景
- Extracting design tokens from Figma exports or screenshots
- Converting visual mockups into structured component specifications
- Creating developer handoff documentation from designs
- Generating design system documentation from existing UIs
- Preparing design data for code generation tools
- Analyzing website screenshots for design reverse-engineering
- 从Figma导出文件或截图中提取设计令牌
- 将视觉原型图转换为结构化组件规范
- 基于设计内容创建开发者交接文档
- 从现有UI生成设计系统文档
- 为代码生成工具准备设计数据
- 分析网站截图以进行设计逆向工程
Output Format
输出格式
The extraction produces JSON following the W3C Design Tokens Community Group (DTCG) 2025.10 format with extensions:
- $version: Schema version
- $source: Metadata (type, dimensions, extraction timestamp)
- tokens: Design tokens (colors, typography, spacing, sizing, shadows, radii)
- components: Hierarchical component tree with bounding boxes
- accessibility: WCAG analysis, contrast issues, semantic structure
- $extensions: Layout, component catalog, confidence scores
提取结果为遵循W3C设计令牌社区组(DTCG)2025.10格式并带有扩展的JSON:
- $version:架构版本
- $source:元数据(类型、尺寸、提取时间戳)
- tokens:设计令牌(颜色、排版、间距、尺寸、阴影、圆角)
- components:带边界框的层级组件树
- accessibility:WCAG分析、对比度问题、语义结构
- $extensions:布局、组件目录、置信度评分
CRITICAL: File-Based Architecture
关键要求:基于文件的架构
EVERY pass MUST write its output to a JSON file on disk. This is non-negotiable.
每个阶段必须将输出写入磁盘上的JSON文件。这是硬性要求。
Directory Structure
目录结构
Before starting extraction, create the output directory:
bash
mkdir -p .tmp-design-specs/{project-name}开始提取前,创建输出目录:
bash
mkdir -p .tmp-design-specs/{project-name}Required File Outputs
必需的文件输出
| Pass | Output File | Description |
|---|---|---|
| 1 | | Layout and structure |
| 2 | | Color tokens |
| 3 | | Typography tokens |
| 4 | | Component tree |
| 5 | | Spacing and dimensions |
| 6 | | States and accessibility |
| 7 | | Final consolidated output |
| 阶段 | 输出文件 | 描述 |
|---|---|---|
| 1 | | 布局与结构 |
| 2 | | 颜色令牌 |
| 3 | | 排版令牌 |
| 4 | | 组件树 |
| 5 | | 间距与尺寸 |
| 6 | | 状态与可访问性 |
| 7 | | 最终合并输出 |
Why File-Based?
为何采用基于文件的架构?
- Persistence: Each pass result is saved, enabling resumption if interrupted
- Debugging: Intermediate files allow inspection of each extraction phase
- Validation: Each JSON file can be validated independently
- Context Passing: Subtask agents read previous pass files directly
- Audit Trail: Complete record of extraction process
- 持久性:每个阶段的结果都已保存,中断后可恢复
- 调试:中间文件允许检查每个提取阶段的情况
- 验证:每个JSON文件可独立验证
- 上下文传递:子任务代理直接读取前一阶段的文件
- 审计追踪:完整的提取过程记录
Multipass Architecture
多阶段架构
The extraction uses 7 serial passes. Each pass MUST:
- Read previous pass JSON files from disk
- Perform its analysis
- WRITE its output to the designated JSON file
- Complete before the next pass begins
Screenshot Input
|
v
[Pass 1] Source Analysis & Layout -----> pass-1-layout.json
|
v
[Pass 2] Color & Visual Style -----> pass-2-colors.json
|
v
[Pass 3] Typography Analysis -----> pass-3-typography.json
|
v
[Pass 4] Component Detection -----> pass-4-components.json
|
v
[Pass 5] Spacing & Dimensions -----> pass-5-spacing.json
|
v
[Pass 6] States & Accessibility -----> pass-6-states.json
|
v
[Pass 7] Consolidation -----> design-spec.json (FINAL)提取过程分为7个串行阶段。每个阶段必须:
- 从磁盘读取前一阶段的JSON文件
- 执行分析
- 将输出写入指定的JSON文件
- 完成后再进入下一阶段
截图输入
|
v
[Pass 1] 源分析与布局 -----> pass-1-layout.json
|
v
[Pass 2] 颜色与视觉样式 -----> pass-2-colors.json
|
v
[Pass 3] 排版分析 -----> pass-3-typography.json
|
v
[Pass 4] 组件检测 -----> pass-4-components.json
|
v
[Pass 5] 间距与尺寸 -----> pass-5-spacing.json
|
v
[Pass 6] 状态与可访问性 -----> pass-6-states.json
|
v
[Pass 7] 合并汇总 -----> design-spec.json (最终版本)Pass 1: Source Analysis & Layout Structure
Pass 1:源分析与布局结构
Objective: Establish foundational understanding of the design source and spatial organization.
目标:建立对设计源和空间组织的基础认知。
Subtask Agent Prompt
子任务代理提示词
You are Pass 1 of a 7-pass design specification extraction system. Your focus: LAYOUT AND STRUCTURE ONLY.你是7阶段设计规范提取系统的第1阶段处理程序。你的工作重点:仅关注布局与结构。CRITICAL REQUIREMENT
关键要求
You MUST write your output to a JSON file. This is mandatory - do not just return JSON in your response.
OUTPUT FILE:
.tmp-design-specs/{project}/pass-1-layout.jsonUse the Write tool to save your analysis as valid JSON to this file.
你必须将输出写入JSON文件。这是强制性要求 - 不要只在响应中返回JSON。
输出文件:
.tmp-design-specs/{project}/pass-1-layout.json使用Write工具将你的分析结果保存为有效的JSON文件。
Input
输入
- Screenshot: [attached image]
- 截图:[附加图片]
Your Task
你的任务
Analyze the screenshot and extract:
分析截图并提取以下内容:
1. Source Metadata
1. 源元数据
- Identify source type: Figma export, Sketch export, website screenshot, mockup, or wireframe
- Detect dimensions and estimate device class (mobile/tablet/desktop)
- Note any visible design tool artifacts (rulers, grids, selection boxes)
- 识别源类型:Figma导出文件、Sketch导出文件、网站截图、原型图或线框图
- 检测尺寸并估算设备类别(移动设备/平板/桌面设备)
- 记录任何可见的设计工具痕迹(标尺、网格、选择框)
2. Layout Type Detection
2. 布局类型检测
Determine the primary layout strategy:
- Single-column centered layout
- Multi-column grid (count columns, estimate gutters)
- Sidebar + main content
- Dashboard/admin layout
- Full-bleed/edge-to-edge
确定主要布局策略:
- 单列居中布局
- 多列网格(统计列数,估算间距)
- 侧边栏+主内容
- 仪表盘/后台布局
- 全宽/边缘到边缘
3. Region Identification
3. 区域识别
Map the major layout regions with bounding boxes:
- Header (position, height, sticky?)
- Navigation (type: sidebar, topnav, or none)
- Main content area
- Footer
- Any overlays, modals, or floating elements
用边界框映射主要布局区域:
- 页眉(位置、高度、是否固定?)
- 导航(类型:侧边栏、顶部导航或无)
- 主内容区域
- 页脚
- 任何覆盖层、模态框或浮动元素
4. Grid System Analysis
4. 网格系统分析
- Identify underlying grid (12-column, 4-column, etc.)
- Measure or estimate gutter width
- Note container max-width if visible
- 识别底层网格(12列、4列等)
- 测量或估算间距宽度
- 记录可见的容器最大宽度
Output Format
输出格式
Return JSON:
{
"$schema": "pass-1-layout",
"$source": {
"type": "figma-export|website-screenshot|mockup|...",
"dimensions": { "width": N, "height": N, "aspectRatio": "W:H", "deviceClass": "..." },
"confidence": 0.0-1.0
},
"layout": {
"type": "single-column|multi-column|sidebar|...",
"regions": [
{ "name": "header", "bounds": {"x":0,"y":0,"width":W,"height":H}, "sticky": true|false },
{ "name": "navigation", "type": "sidebar|topnav|none", "bounds": {...} },
{ "name": "main", "bounds": {...} },
{ "name": "footer", "bounds": {...}, "present": true|false }
],
"gridSystem": {
"columns": N,
"gutter": "Npx",
"margin": "Npx",
"maxWidth": "Npx"
}
},
"containers": [
{
"id": "container-N",
"bounds": { "x": N, "y": N, "width": N, "height": N },
"layout": "grid|flex|block",
"parent": "parent-id|null",
"childCount": N
}
],
"sections": [
{
"id": "section-N",
"purpose": "hero|features|testimonials|cta|...",
"bounds": {...}
}
]
}
Use pixel values. Be precise with bounds. Note confidence level for uncertain areas.
返回JSON:
{
"$schema": "pass-1-layout",
"$source": {
"type": "figma-export|website-screenshot|mockup|...",
"dimensions": { "width": N, "height": N, "aspectRatio": "W:H", "deviceClass": "..." },
"confidence": 0.0-1.0
},
"layout": {
"type": "single-column|multi-column|sidebar|...",
"regions": [
{ "name": "header", "bounds": {"x":0,"y":0,"width":W,"height":H}, "sticky": true|false },
{ "name": "navigation", "type": "sidebar|topnav|none", "bounds": {...} },
{ "name": "main", "bounds": {...} },
{ "name": "footer", "bounds": {...}, "present": true|false }
],
"gridSystem": {
"columns": N,
"gutter": "Npx",
"margin": "Npx",
"maxWidth": "Npx"
}
},
"containers": [
{
"id": "container-N",
"bounds": { "x": N, "y": N, "width": N, "height": N },
"layout": "grid|flex|block",
"parent": "parent-id|null",
"childCount": N
}
],
"sections": [
{
"id": "section-N",
"purpose": "hero|features|testimonials|cta|...",
"bounds": {...}
}
]
}
使用像素值。边界框要精确。对不确定的区域记录置信度。
FINAL STEP - MANDATORY
最终步骤 - 强制性要求
Use the Write tool to save this JSON to:
Do NOT proceed without writing the file. Confirm the file was written successfully.
.tmp-design-specs/{project}/pass-1-layout.json
---使用Write工具将此JSON保存到:
未写入文件前不要继续。确认文件已成功写入。
.tmp-design-specs/{project}/pass-1-layout.json
---Pass 2: Color & Visual Style Extraction
Pass 2:颜色与视觉样式提取
Objective: Extract complete color palette with semantic mappings.
目标:提取带有语义映射的完整调色板。
Subtask Agent Prompt
子任务代理提示词
You are Pass 2 of a 7-pass design specification extraction system. Your focus: COLOR EXTRACTION.你是7阶段设计规范提取系统的第2阶段处理程序。你的工作重点:颜色提取。CRITICAL REQUIREMENT
关键要求
You MUST write your output to a JSON file. This is mandatory - do not just return JSON in your response.
OUTPUT FILE:
.tmp-design-specs/{project}/pass-2-colors.jsonFirst, read the Pass 1 output:
Then use the Write tool to save your analysis as valid JSON.
.tmp-design-specs/{project}/pass-1-layout.json你必须将输出写入JSON文件。这是强制性要求 - 不要只在响应中返回JSON。
输出文件:
.tmp-design-specs/{project}/pass-2-colors.json首先读取第1阶段的输出:
然后使用Write工具将你的分析结果保存为有效的JSON。
.tmp-design-specs/{project}/pass-1-layout.jsonInput
输入
- Screenshot: [attached image]
- Layout data from Pass 1: Read from
.tmp-design-specs/{project}/pass-1-layout.json
- 截图:[附加图片]
- 第1阶段的布局数据:从读取
.tmp-design-specs/{project}/pass-1-layout.json
Your Task
你的任务
Extract ALL colors visible in this design:
提取此设计中所有可见的颜色:
1. Background Colors (by region)
1. 背景色(按区域)
- Page background
- Section/card backgrounds
- Header/footer backgrounds
- Modal/overlay backgrounds
- Input field backgrounds
- Button backgrounds (all variants)
- 页面背景
- 区块/卡片背景
- 页眉/页脚背景
- 模态框/覆盖层背景
- 输入框背景
- 按钮背景(所有变体)
2. Foreground Colors (text and icons)
2. 前景色(文本与图标)
- Primary heading text
- Body text
- Secondary/muted text
- Link text (if distinguishable)
- Icon colors
- Placeholder text
- 主标题文本
- 正文文本
- 次要/弱化文本
- 链接文本(若可区分)
- 图标颜色
- 占位符文本
3. Border Colors
3. 边框色
- Card/container borders
- Input field borders (default, focus, error states if visible)
- Divider/separator colors
- 卡片/容器边框
- 输入框边框(默认、聚焦、错误状态,若可见)
- 分隔线颜色
4. Feedback Colors
4. 反馈色
- Error/danger indicators
- Success indicators
- Warning indicators
- Info indicators
- 错误/危险指示色
- 成功指示色
- 警告指示色
- 信息指示色
5. Interactive Colors
5. 交互色
- Primary action color (main CTA buttons)
- Secondary action color
- Hover states (if visible)
- Focus indicators
- 主要操作色(主CTA按钮)
- 次要操作色
- 悬停状态(若可见)
- 聚焦指示色
Color Value Extraction
颜色值提取
For each color, provide:
- Hex value (best estimate: #RRGGBB)
- Where it appears (semantic context)
- Suggested token name following pattern: color.[category].[variant]
对于每种颜色,提供:
- 十六进制值(最佳估算:#RRGGBB)
- 出现位置(语义上下文)
- 建议的令牌名称,遵循格式:color.[category].[variant]
Output Format
输出格式
Return JSON:
{
"$schema": "pass-2-colors",
"tokens": {
"colors": {
"primitive": {
"blue": {
"500": { "$value": "#3B82F6", "$type": "color", "$description": "Primary blue" },
"600": { "$value": "#2563EB", "$type": "color", "$description": "Primary blue dark" }
},
"gray": {
"50": { "$value": "#F9FAFB", "$type": "color" },
"100": { "$value": "#F3F4F6", "$type": "color" },
"500": { "$value": "#6B7280", "$type": "color" },
"900": { "$value": "#111827", "$type": "color" }
}
},
"semantic": {
"background": {
"default": { "$value": "{colors.primitive.gray.50}", "$type": "color", "$description": "Page background" },
"elevated": { "$value": "#FFFFFF", "$type": "color", "$description": "Card surfaces" }
},
"foreground": {
"default": { "$value": "{colors.primitive.gray.900}", "$type": "color", "$description": "Primary text" },
"muted": { "$value": "{colors.primitive.gray.500}", "$type": "color", "$description": "Secondary text" }
},
"interactive": {
"primary": { "$value": "{colors.primitive.blue.500}", "$type": "color", "$description": "Primary buttons, links" },
"primary-hover": { "$value": "{colors.primitive.blue.600}", "$type": "color", "$description": "Primary hover" }
},
"border": {
"default": { "$value": "{colors.primitive.gray.200}", "$type": "color", "$description": "Subtle borders" },
"focus": { "$value": "{colors.primitive.blue.500}", "$type": "color", "$description": "Focus rings" }
},
"feedback": {
"error": { "$value": "#EF4444", "$type": "color", "$description": "Error states" },
"success": { "$value": "#22C55E", "$type": "color", "$description": "Success states" },
"warning": { "$value": "#F59E0B", "$type": "color", "$description": "Warning states" },
"info": { "$value": "#3B82F6", "$type": "color", "$description": "Info states" }
}
}
}
},
"shadows": [
{
"name": "elevation-sm",
"$type": "shadow",
"$value": {
"offsetX": "0px",
"offsetY": "1px",
"blur": "2px",
"spread": "0px",
"color": "rgba(0,0,0,0.05)"
},
"$description": "Subtle elevation"
}
],
"gradients": [],
"componentColorMap": {
"button-primary": {
"background": "{colors.semantic.interactive.primary}",
"text": "#FFFFFF",
"border": "transparent"
}
}
}
Use DTCG $value and $type syntax. Include $description for AI readability.
返回JSON:
{
"$schema": "pass-2-colors",
"tokens": {
"colors": {
"primitive": {
"blue": {
"500": { "$value": "#3B82F6", "$type": "color", "$description": "Primary blue" },
"600": { "$value": "#2563EB", "$type": "color", "$description": "Primary blue dark" }
},
"gray": {
"50": { "$value": "#F9FAFB", "$type": "color" },
"100": { "$value": "#F3F4F6", "$type": "color" },
"500": { "$value": "#6B7280", "$type": "color" },
"900": { "$value": "#111827", "$type": "color" }
}
},
"semantic": {
"background": {
"default": { "$value": "{colors.primitive.gray.50}", "$type": "color", "$description": "Page background" },
"elevated": { "$value": "#FFFFFF", "$type": "color", "$description": "Card surfaces" }
},
"foreground": {
"default": { "$value": "{colors.primitive.gray.900}", "$type": "color", "$description": "Primary text" },
"muted": { "$value": "{colors.primitive.gray.500}", "$type": "color", "$description": "Secondary text" }
},
"interactive": {
"primary": { "$value": "{colors.primitive.blue.500}", "$type": "color", "$description": "Primary buttons, links" },
"primary-hover": { "$value": "{colors.primitive.blue.600}", "$type": "color", "$description": "Primary hover" }
},
"border": {
"default": { "$value": "{colors.primitive.gray.200}", "$type": "color", "$description": "Subtle borders" },
"focus": { "$value": "{colors.primitive.blue.500}", "$type": "color", "$description": "Focus rings" }
},
"feedback": {
"error": { "$value": "#EF4444", "$type": "color", "$description": "Error states" },
"success": { "$value": "#22C55E", "$type": "color", "$description": "Success states" },
"warning": { "$value": "#F59E0B", "$type": "color", "$description": "Warning states" },
"info": { "$value": "#3B82F6", "$type": "color", "$description": "Info states" }
}
}
}
},
"shadows": [
{
"name": "elevation-sm",
"$type": "shadow",
"$value": {
"offsetX": "0px",
"offsetY": "1px",
"blur": "2px",
"spread": "0px",
"color": "rgba(0,0,0,0.05)"
},
"$description": "Subtle elevation"
}
],
"gradients": [],
"componentColorMap": {
"button-primary": {
"background": "{colors.semantic.interactive.primary}",
"text": "#FFFFFF",
"border": "transparent"
}
}
}
使用DTCG的$value和$type语法。为便于AI理解,包含$description。
FINAL STEP - MANDATORY
最终步骤 - 强制性要求
Use the Write tool to save this JSON to:
Do NOT proceed without writing the file. Confirm the file was written successfully.
.tmp-design-specs/{project}/pass-2-colors.json
---使用Write工具将此JSON保存到:
未写入文件前不要继续。确认文件已成功写入。
.tmp-design-specs/{project}/pass-2-colors.json
---Pass 3: Typography Analysis
Pass 3:排版分析
Objective: Extract complete typography system including fonts, sizes, weights, and text styles.
目标:提取完整的排版系统,包括字体、字号、字重和文本样式。
Subtask Agent Prompt
子任务代理提示词
You are Pass 3 of a 7-pass design specification extraction system. Your focus: TYPOGRAPHY.你是7阶段设计规范提取系统的第3阶段处理程序。你的工作重点:排版。CRITICAL REQUIREMENT
关键要求
You MUST write your output to a JSON file. This is mandatory - do not just return JSON in your response.
OUTPUT FILE:
.tmp-design-specs/{project}/pass-3-typography.jsonFirst, read previous pass outputs:
.tmp-design-specs/{project}/pass-1-layout.json.tmp-design-specs/{project}/pass-2-colors.json
Then use the Write tool to save your analysis as valid JSON.
你必须将输出写入JSON文件。这是强制性要求 - 不要只在响应中返回JSON。
输出文件:
.tmp-design-specs/{project}/pass-3-typography.json首先读取前一阶段的输出:
.tmp-design-specs/{project}/pass-1-layout.json.tmp-design-specs/{project}/pass-2-colors.json
然后使用Write工具将你的分析结果保存为有效的JSON。
Input
输入
- Screenshot: [attached image]
- Layout data from Pass 1: Read from
.tmp-design-specs/{project}/pass-1-layout.json - Color data from Pass 2: Read from
.tmp-design-specs/{project}/pass-2-colors.json
- 截图:[附加图片]
- 第1阶段的布局数据:从读取
.tmp-design-specs/{project}/pass-1-layout.json - 第2阶段的颜色数据:从读取
.tmp-design-specs/{project}/pass-2-colors.json
Your Task
你的任务
Extract ALL typography information:
提取所有排版信息:
1. Font Family Detection
1. 字体家族检测
Analyze visible text to identify:
- Primary font family (body text, UI elements)
- Secondary font family (headings, if different)
- Monospace font (code blocks, if present)
- Is it serif, sans-serif, or display?
- Best guess at specific font name
分析可见文本以识别:
- 主要字体家族(正文文本、UI元素)
- 次要字体家族(标题,若不同)
- 等宽字体(代码块,若存在)
- 是衬线、无衬线还是展示字体?
- 对具体字体名称的最佳猜测
2. Text Style Inventory
2. 文本样式清单
For EACH distinct text style visible, extract:
Headings:
- Display/Hero text (largest)
- H1, H2, H3, etc.
- Card titles
- Section headers
Body:
- Body large (lead paragraphs)
- Body regular (standard text)
- Body small (captions)
UI Text:
- Button labels
- Form labels
- Input text
- Link text
- Navigation items
- Badge/tag text
For each style, estimate:
- Font size (in px)
- Font weight (100-900 or light/regular/medium/bold)
- Line height (ratio like 1.5 or pixels)
- Letter spacing (normal, tight, wide)
- Text color (reference token from Pass 2)
- Text transform (none, uppercase, capitalize)
对于每种可见的独特文本样式,提取:
标题:
- 展示/主视觉文本(最大号)
- H1、H2、H3等
- 卡片标题
- 区块标题
正文:
- 大正文(引导段落)
- 常规正文(标准文本)
- 小正文(说明文字)
UI文本:
- 按钮标签
- 表单标签
- 输入文本
- 链接文本
- 导航项
- 徽章/标签文本
对于每种样式,估算:
- 字号(像素)
- 字重(100-900或light/regular/medium/bold)
- 行高(比例如1.5或像素)
- 字间距(正常、紧凑、宽松)
- 文本颜色(引用第2阶段的令牌)
- 文本转换(无、大写、首字母大写)
3. Typographic Hierarchy
3. 排版层级
- How many distinct size levels are there?
- What is the size scale ratio?
- 有多少种不同的字号层级?
- 字号比例是多少?
Output Format
输出格式
Return JSON:
{
"$schema": "pass-3-typography",
"tokens": {
"typography": {
"fontFamilies": {
"sans": { "$value": ["Inter", "system-ui", "sans-serif"], "$type": "fontFamily", "$description": "Primary font" },
"mono": { "$value": ["JetBrains Mono", "monospace"], "$type": "fontFamily", "$description": "Code font" }
},
"fontWeights": {
"regular": { "$value": 400, "$type": "fontWeight" },
"medium": { "$value": 500, "$type": "fontWeight" },
"semibold": { "$value": 600, "$type": "fontWeight" },
"bold": { "$value": 700, "$type": "fontWeight" }
},
"fontSizes": {
"xs": { "$value": "12px", "$type": "dimension" },
"sm": { "$value": "14px", "$type": "dimension" },
"base": { "$value": "16px", "$type": "dimension" },
"lg": { "$value": "18px", "$type": "dimension" },
"xl": { "$value": "20px", "$type": "dimension" },
"2xl": { "$value": "24px", "$type": "dimension" },
"3xl": { "$value": "30px", "$type": "dimension" },
"4xl": { "$value": "36px", "$type": "dimension" },
"5xl": { "$value": "48px", "$type": "dimension" }
},
"lineHeights": {
"tight": { "$value": 1.25, "$type": "number" },
"normal": { "$value": 1.5, "$type": "number" },
"relaxed": { "$value": 1.75, "$type": "number" }
},
"letterSpacing": {
"tighter": { "$value": "-0.05em", "$type": "dimension" },
"normal": { "$value": "0em", "$type": "dimension" },
"wide": { "$value": "0.05em", "$type": "dimension" }
},
"textStyles": {
"display": {
"$type": "typography",
"$value": {
"fontFamily": "{typography.fontFamilies.sans}",
"fontSize": "{typography.fontSizes.5xl}",
"fontWeight": "{typography.fontWeights.bold}",
"lineHeight": "{typography.lineHeights.tight}",
"letterSpacing": "{typography.letterSpacing.tighter}"
},
"$description": "Hero headlines"
},
"heading-1": {
"$type": "typography",
"$value": {
"fontFamily": "{typography.fontFamilies.sans}",
"fontSize": "{typography.fontSizes.4xl}",
"fontWeight": "{typography.fontWeights.bold}",
"lineHeight": "{typography.lineHeights.tight}"
},
"$description": "Page titles"
},
"heading-2": {
"$type": "typography",
"$value": {
"fontFamily": "{typography.fontFamilies.sans}",
"fontSize": "{typography.fontSizes.2xl}",
"fontWeight": "{typography.fontWeights.semibold}",
"lineHeight": "{typography.lineHeights.tight}"
},
"$description": "Section headings"
},
"body": {
"$type": "typography",
"$value": {
"fontFamily": "{typography.fontFamilies.sans}",
"fontSize": "{typography.fontSizes.base}",
"fontWeight": "{typography.fontWeights.regular}",
"lineHeight": "{typography.lineHeights.normal}"
},
"$description": "Standard body text"
},
"body-small": {
"$type": "typography",
"$value": {
"fontFamily": "{typography.fontFamilies.sans}",
"fontSize": "{typography.fontSizes.sm}",
"fontWeight": "{typography.fontWeights.regular}",
"lineHeight": "{typography.lineHeights.normal}"
},
"$description": "Secondary text, captions"
},
"button-label": {
"$type": "typography",
"$value": {
"fontFamily": "{typography.fontFamilies.sans}",
"fontSize": "{typography.fontSizes.sm}",
"fontWeight": "{typography.fontWeights.medium}",
"lineHeight": "{typography.lineHeights.tight}"
},
"$description": "Button text"
}
}
}
},
"typeScale": {
"ratio": 1.25,
"base": "16px",
"steps": [12, 14, 16, 20, 24, 30, 36, 48]
}
}
Reference tokens using {token.path} syntax per DTCG specification.
返回JSON:
{
"$schema": "pass-3-typography",
"tokens": {
"typography": {
"fontFamilies": {
"sans": { "$value": ["Inter", "system-ui", "sans-serif"], "$type": "fontFamily", "$description": "Primary font" },
"mono": { "$value": ["JetBrains Mono", "monospace"], "$type": "fontFamily", "$description": "Code font" }
},
"fontWeights": {
"regular": { "$value": 400, "$type": "fontWeight" },
"medium": { "$value": 500, "$type": "fontWeight" },
"semibold": { "$value": 600, "$type": "fontWeight" },
"bold": { "$value": 700, "$type": "fontWeight" }
},
"fontSizes": {
"xs": { "$value": "12px", "$type": "dimension" },
"sm": { "$value": "14px", "$type": "dimension" },
"base": { "$value": "16px", "$type": "dimension" },
"lg": { "$value": "18px", "$type": "dimension" },
"xl": { "$value": "20px", "$type": "dimension" },
"2xl": { "$value": "24px", "$type": "dimension" },
"3xl": { "$value": "30px", "$type": "dimension" },
"4xl": { "$value": "36px", "$type": "dimension" },
"5xl": { "$value": "48px", "$type": "dimension" }
},
"lineHeights": {
"tight": { "$value": 1.25, "$type": "number" },
"normal": { "$value": 1.5, "$type": "number" },
"relaxed": { "$value": 1.75, "$type": "number" }
},
"letterSpacing": {
"tighter": { "$value": "-0.05em", "$type": "dimension" },
"normal": { "$value": "0em", "$type": "dimension" },
"wide": { "$value": "0.05em", "$type": "dimension" }
},
"textStyles": {
"display": {
"$type": "typography",
"$value": {
"fontFamily": "{typography.fontFamilies.sans}",
"fontSize": "{typography.fontSizes.5xl}",
"fontWeight": "{typography.fontWeights.bold}",
"lineHeight": "{typography.lineHeights.tight}",
"letterSpacing": "{typography.letterSpacing.tighter}"
},
"$description": "Hero headlines"
},
"heading-1": {
"$type": "typography",
"$value": {
"fontFamily": "{typography.fontFamilies.sans}",
"fontSize": "{typography.fontSizes.4xl}",
"fontWeight": "{typography.fontWeights.bold}",
"lineHeight": "{typography.lineHeights.tight}"
},
"$description": "Page titles"
},
"heading-2": {
"$type": "typography",
"$value": {
"fontFamily": "{typography.fontFamilies.sans}",
"fontSize": "{typography.fontSizes.2xl}",
"fontWeight": "{typography.fontWeights.semibold}",
"lineHeight": "{typography.lineHeights.tight}"
},
"$description": "Section headings"
},
"body": {
"$type": "typography",
"$value": {
"fontFamily": "{typography.fontFamilies.sans}",
"fontSize": "{typography.fontSizes.base}",
"fontWeight": "{typography.fontWeights.regular}",
"lineHeight": "{typography.lineHeights.normal}"
},
"$description": "Standard body text"
},
"body-small": {
"$type": "typography",
"$value": {
"fontFamily": "{typography.fontFamilies.sans}",
"fontSize": "{typography.fontSizes.sm}",
"fontWeight": "{typography.fontWeights.regular}",
"lineHeight": "{typography.lineHeights.normal}"
},
"$description": "Secondary text, captions"
},
"button-label": {
"$type": "typography",
"$value": {
"fontFamily": "{typography.fontFamilies.sans}",
"fontSize": "{typography.fontSizes.sm}",
"fontWeight": "{typography.fontWeights.medium}",
"lineHeight": "{typography.lineHeights.tight}"
},
"$description": "Button text"
}
}
}
},
"typeScale": {
"ratio": 1.25,
"base": "16px",
"steps": [12, 14, 16, 20, 24, 30, 36, 48]
}
}
按照DTCG规范使用{token.path}语法引用令牌。
FINAL STEP - MANDATORY
最终步骤 - 强制性要求
Use the Write tool to save this JSON to:
Do NOT proceed without writing the file. Confirm the file was written successfully.
.tmp-design-specs/{project}/pass-3-typography.json
---使用Write工具将此JSON保存到:
未写入文件前不要继续。确认文件已成功写入。
.tmp-design-specs/{project}/pass-3-typography.json
---Pass 4: Component Detection & Classification
Pass 4:组件检测与分类
Objective: Build hierarchical component tree with atomic design classification.
目标:构建带有原子设计分类的层级组件树。
Subtask Agent Prompt
子任务代理提示词
You are Pass 4 of a 7-pass design specification extraction system. Your focus: COMPONENT DETECTION.你是7阶段设计规范提取系统的第4阶段处理程序。你的工作重点:组件检测。CRITICAL REQUIREMENT
关键要求
You MUST write your output to a JSON file. This is mandatory - do not just return JSON in your response.
OUTPUT FILE:
.tmp-design-specs/{project}/pass-4-components.jsonFirst, read previous pass outputs:
.tmp-design-specs/{project}/pass-1-layout.json.tmp-design-specs/{project}/pass-2-colors.json.tmp-design-specs/{project}/pass-3-typography.json
Then use the Write tool to save your analysis as valid JSON.
你必须将输出写入JSON文件。这是强制性要求 - 不要只在响应中返回JSON。
输出文件:
.tmp-design-specs/{project}/pass-4-components.json首先读取前一阶段的输出:
.tmp-design-specs/{project}/pass-1-layout.json.tmp-design-specs/{project}/pass-2-colors.json.tmp-design-specs/{project}/pass-3-typography.json
然后使用Write工具将你的分析结果保存为有效的JSON。
Input
输入
- Screenshot: [attached image]
- Layout data from Pass 1: Read from
.tmp-design-specs/{project}/pass-1-layout.json - Color data from Pass 2: Read from
.tmp-design-specs/{project}/pass-2-colors.json - Typography data from Pass 3: Read from
.tmp-design-specs/{project}/pass-3-typography.json
- 截图:[附加图片]
- 第1阶段的布局数据:从读取
.tmp-design-specs/{project}/pass-1-layout.json - 第2阶段的颜色数据:从读取
.tmp-design-specs/{project}/pass-2-colors.json - 第3阶段的排版数据:从读取
.tmp-design-specs/{project}/pass-3-typography.json
Your Task
你的任务
Identify and classify ALL UI components:
识别并分类所有UI组件:
1. Atomic Components (Atoms)
1. 原子组件(Atoms)
Simple, indivisible elements:
- Buttons (all variants: primary, secondary, icon, ghost)
- Icons (note semantic meaning)
- Inputs (text, password, search)
- Checkboxes, radios, toggles
- Labels and text elements
- Images and avatars
- Badges and tags
- Dividers
简单、不可分割的元素:
- 按钮(所有变体:主要、次要、图标、幽灵按钮)
- 图标(记录语义含义)
- 输入框(文本、密码、搜索)
- 复选框、单选框、开关
- 标签和文本元素
- 图片和头像
- 徽章和标签
- 分隔线
2. Molecular Components (Molecules)
2. 分子组件(Molecules)
Simple combinations of atoms:
- Form fields (label + input + helper)
- Search bars
- Navigation items
- Breadcrumbs
- Menu items
- List items
原子组件的简单组合:
- 表单字段(标签+输入框+辅助说明)
- 搜索栏
- 导航项
- 面包屑
- 菜单项
- 列表项
3. Organism Components (Organisms)
3. 组织体组件(Organisms)
Complex, distinct UI sections:
- Navigation bars
- Headers
- Cards (all variants)
- Forms
- Tables
- Footers
- Hero sections
复杂、独立的UI区块:
- 导航栏
- 页眉
- 卡片(所有变体)
- 表单
- 表格
- 页脚
- 主视觉区块
4. For Each Component, Extract:
4. 对于每个组件,提取:
- Unique ID (generated)
- Component type name
- Atomic level (atom/molecule/organism)
- Bounding box (x, y, width, height)
- Visual styles (link to tokens where possible)
- Content (text, icons)
- Current state (default, hover, active, disabled)
- Child components (for molecules/organisms)
- 唯一ID(自动生成)
- 组件类型名称
- 原子层级(atom/molecule/organism)
- 边界框(x, y, width, height)
- 视觉样式(尽可能链接到令牌)
- 内容(文本、图标)
- 当前状态(默认、悬停、激活、禁用)
- 子组件(针对分子/组织体组件)
5. Component Catalog
5. 组件目录
Create definitions for reusable component types:
- Suggested HTML element
- ARIA role
- Props/variants
- Token mappings
为可复用的组件类型创建定义:
- 建议的HTML元素
- ARIA角色
- 属性/变体
- 令牌映射
Output Format
输出格式
Return JSON:
{
"$schema": "pass-4-components",
"components": {
"$root": {
"id": "root",
"type": "Page",
"bounds": {"x":0,"y":0,"width":W,"height":H},
"children": [
{
"id": "header-1",
"type": "Header",
"name": "Main Navigation Header",
"atomicLevel": "organism",
"bounds": {"x":0,"y":0,"width":W,"height":80},
"styles": {
"background": { "color": "#FFFFFF", "tokenRef": "{colors.semantic.background.elevated}" },
"shadow": { "tokenRef": "{shadows.elevation-sm}" }
},
"children": [
{
"id": "logo-1",
"type": "Image",
"atomicLevel": "atom",
"bounds": {"x":24,"y":24,"width":120,"height":32},
"content": { "alt": "Company Logo" }
},
{
"id": "nav-1",
"type": "Navigation",
"atomicLevel": "molecule",
"bounds": {...},
"children": [
{
"id": "nav-item-1",
"type": "NavItem",
"atomicLevel": "atom",
"content": { "text": "Home" },
"states": { "current": "active" }
}
]
},
{
"id": "btn-signin",
"type": "Button",
"atomicLevel": "atom",
"bounds": {...},
"content": { "text": "Sign In" },
"variants": { "variant": "secondary", "size": "md" },
"states": { "current": "default" }
}
]
}
]
},
"catalog": {
"Button": {
"name": "Button",
"category": "action",
"atomicLevel": "atom",
"htmlElement": "button",
"ariaRole": "button",
"variants": [
{ "name": "variant", "values": ["primary", "secondary", "ghost", "destructive"] },
{ "name": "size", "values": ["sm", "md", "lg"] }
],
"tokens": {
"background": "{colors.semantic.interactive.primary}",
"color": "#FFFFFF",
"borderRadius": "{radii.md}",
"paddingX": "{spacing.4}",
"paddingY": "{spacing.2}"
},
"instances": ["btn-signin", "btn-cta-1"]
},
"Card": {
"name": "Card",
"category": "layout",
"atomicLevel": "organism",
"htmlElement": "article",
"ariaRole": "article",
"variants": [
{ "name": "variant", "values": ["default", "elevated", "outlined"] }
],
"tokens": {
"background": "{colors.semantic.background.elevated}",
"borderRadius": "{radii.lg}",
"shadow": "{shadows.elevation-md}",
"padding": "{spacing.6}"
},
"instances": ["card-1", "card-2"]
}
}
},
"statistics": {
"totalComponents": N,
"byType": {
"Button": N,
"Card": N,
"Input": N
},
"byAtomicLevel": {
"atom": N,
"molecule": N,
"organism": N
}
}
}
Be exhaustive. Every visible interactive or content element must be cataloged.
返回JSON:
{
"$schema": "pass-4-components",
"components": {
"$root": {
"id": "root",
"type": "Page",
"bounds": {"x":0,"y":0,"width":W,"height":H},
"children": [
{
"id": "header-1",
"type": "Header",
"name": "Main Navigation Header",
"atomicLevel": "organism",
"bounds": {"x":0,"y":0,"width":W,"height":80},
"styles": {
"background": { "color": "#FFFFFF", "tokenRef": "{colors.semantic.background.elevated}" },
"shadow": { "tokenRef": "{shadows.elevation-sm}" }
},
"children": [
{
"id": "logo-1",
"type": "Image",
"atomicLevel": "atom",
"bounds": {"x":24,"y":24,"width":120,"height":32},
"content": { "alt": "Company Logo" }
},
{
"id": "nav-1",
"type": "Navigation",
"atomicLevel": "molecule",
"bounds": {...},
"children": [
{
"id": "nav-item-1",
"type": "NavItem",
"atomicLevel": "atom",
"content": { "text": "Home" },
"states": { "current": "active" }
}
]
},
{
"id": "btn-signin",
"type": "Button",
"atomicLevel": "atom",
"bounds": {...},
"content": { "text": "Sign In" },
"variants": { "variant": "secondary", "size": "md" },
"states": { "current": "default" }
}
]
}
]
},
"catalog": {
"Button": {
"name": "Button",
"category": "action",
"atomicLevel": "atom",
"htmlElement": "button",
"ariaRole": "button",
"variants": [
{ "name": "variant", "values": ["primary", "secondary", "ghost", "destructive"] },
{ "name": "size", "values": ["sm", "md", "lg"] }
],
"tokens": {
"background": "{colors.semantic.interactive.primary}",
"color": "#FFFFFF",
"borderRadius": "{radii.md}",
"paddingX": "{spacing.4}",
"paddingY": "{spacing.2}"
},
"instances": ["btn-signin", "btn-cta-1"]
},
"Card": {
"name": "Card",
"category": "layout",
"atomicLevel": "organism",
"htmlElement": "article",
"ariaRole": "article",
"variants": [
{ "name": "variant", "values": ["default", "elevated", "outlined"] }
],
"tokens": {
"background": "{colors.semantic.background.elevated}",
"borderRadius": "{radii.lg}",
"shadow": "{shadows.elevation-md}",
"padding": "{spacing.6}"
},
"instances": ["card-1", "card-2"]
}
}
},
"statistics": {
"totalComponents": N,
"byType": {
"Button": N,
"Card": N,
"Input": N
},
"byAtomicLevel": {
"atom": N,
"molecule": N,
"organism": N
}
}
}
要全面覆盖。每个可见的交互或内容元素都必须被分类记录。
FINAL STEP - MANDATORY
最终步骤 - 强制性要求
Use the Write tool to save this JSON to:
Do NOT proceed without writing the file. Confirm the file was written successfully.
.tmp-design-specs/{project}/pass-4-components.json
---使用Write工具将此JSON保存到:
未写入文件前不要继续。确认文件已成功写入。
.tmp-design-specs/{project}/pass-4-components.json
---Pass 5: Spacing & Dimensions
Pass 5:间距与尺寸
Objective: Extract spacing scale, sizing tokens, borders, and radii.
目标:提取间距比例、尺寸令牌、边框和圆角。
Subtask Agent Prompt
子任务代理提示词
You are Pass 5 of a 7-pass design specification extraction system. Your focus: SPACING AND DIMENSIONS.你是7阶段设计规范提取系统的第5阶段处理程序。你的工作重点:间距与尺寸。CRITICAL REQUIREMENT
关键要求
You MUST write your output to a JSON file. This is mandatory - do not just return JSON in your response.
OUTPUT FILE:
.tmp-design-specs/{project}/pass-5-spacing.jsonFirst, read previous pass outputs:
.tmp-design-specs/{project}/pass-1-layout.json.tmp-design-specs/{project}/pass-4-components.json
Then use the Write tool to save your analysis as valid JSON.
你必须将输出写入JSON文件。这是强制性要求 - 不要只在响应中返回JSON。
输出文件:
.tmp-design-specs/{project}/pass-5-spacing.json首先读取前一阶段的输出:
.tmp-design-specs/{project}/pass-1-layout.json.tmp-design-specs/{project}/pass-4-components.json
然后使用Write工具将你的分析结果保存为有效的JSON。
Input
输入
- Screenshot: [attached image]
- Layout data from Pass 1: Read from
.tmp-design-specs/{project}/pass-1-layout.json - Component data from Pass 4: Read from
.tmp-design-specs/{project}/pass-4-components.json
- 截图:[附加图片]
- 第1阶段的布局数据:从读取
.tmp-design-specs/{project}/pass-1-layout.json - 第4阶段的组件数据:从读取
.tmp-design-specs/{project}/pass-4-components.json
Your Task
你的任务
Measure and systematize ALL spacing and dimension values:
测量并系统化所有间距和尺寸值:
1. Spacing Scale
1. 间距比例
Analyze gaps between elements to find the base spacing unit:
- Measure space between text and container edges (padding)
- Measure space between stacked elements (stack spacing)
- Measure space between inline elements (inline spacing)
- Measure grid/flex gaps
Identify the spacing scale:
- What is the base unit? (4px, 8px typical)
- What multipliers are used? (1x, 2x, 3x, 4x, 6x, 8x, 12x, 16x)
分析元素间的间隙以找到基础间距单位:
- 测量文本与容器边缘的距离(内边距)
- 测量堆叠元素间的距离(堆叠间距)
- 测量行内元素间的距离(行内间距)
- 测量网格/弹性布局的间隙
识别间距比例:
- 基础单位是什么?(通常是4px、8px)
- 使用了哪些倍数?(1x、2x、3x、4x、6x、8x、12x、16x)
2. Component Sizing
2. 组件尺寸
Extract size patterns:
- Button heights (small, medium, large)
- Input field heights
- Icon sizes
- Avatar sizes
- Container max-widths
提取尺寸模式:
- 按钮高度(小、中、大)
- 输入框高度
- 图标尺寸
- 头像尺寸
- 容器最大宽度
3. Border Properties
3. 边框属性
For each border type:
- Border width (1px, 2px, etc.)
- Border radius values (small, medium, large, full/circular)
对于每种边框类型:
- 边框宽度(1px、2px等)
- 圆角值(小、中、大、全圆角/圆形)
4. Map to Component Styles
4. 映射到组件样式
Link spacing values to specific components from Pass 4
将间距值链接到第4阶段的特定组件
Output Format
输出格式
Return JSON:
{
"$schema": "pass-5-spacing",
"tokens": {
"spacing": {
"scale": {
"0": { "$value": "0px", "$type": "dimension" },
"1": { "$value": "4px", "$type": "dimension", "$description": "Minimal spacing, icon gaps" },
"2": { "$value": "8px", "$type": "dimension", "$description": "Tight spacing, inline elements" },
"3": { "$value": "12px", "$type": "dimension" },
"4": { "$value": "16px", "$type": "dimension", "$description": "Default component padding" },
"5": { "$value": "20px", "$type": "dimension" },
"6": { "$value": "24px", "$type": "dimension", "$description": "Card padding, form gaps" },
"8": { "$value": "32px", "$type": "dimension", "$description": "Section spacing" },
"10": { "$value": "40px", "$type": "dimension" },
"12": { "$value": "48px", "$type": "dimension", "$description": "Large section gaps" },
"16": { "$value": "64px", "$type": "dimension", "$description": "Hero section padding" }
},
"semantic": {
"inset": {
"card": { "$value": "{spacing.scale.6}", "$type": "dimension", "$description": "Card internal padding" },
"section": { "$value": "{spacing.scale.8}", "$type": "dimension", "$description": "Section padding" }
},
"stack": {
"tight": { "$value": "{spacing.scale.2}", "$type": "dimension", "$description": "Compact vertical spacing" },
"default": { "$value": "{spacing.scale.4}", "$type": "dimension", "$description": "Standard vertical spacing" }
},
"gap": {
"grid": { "$value": "{spacing.scale.6}", "$type": "dimension", "$description": "Card grid gap" }
}
}
},
"sizing": {
"component": {
"button-sm": { "$value": "32px", "$type": "dimension" },
"button-md": { "$value": "40px", "$type": "dimension" },
"button-lg": { "$value": "48px", "$type": "dimension" },
"input-md": { "$value": "40px", "$type": "dimension" }
},
"icon": {
"sm": { "$value": "16px", "$type": "dimension" },
"md": { "$value": "20px", "$type": "dimension" },
"lg": { "$value": "24px", "$type": "dimension" }
},
"avatar": {
"sm": { "$value": "32px", "$type": "dimension" },
"md": { "$value": "40px", "$type": "dimension" },
"lg": { "$value": "48px", "$type": "dimension" }
}
},
"radii": {
"none": { "$value": "0px", "$type": "dimension" },
"sm": { "$value": "4px", "$type": "dimension" },
"md": { "$value": "8px", "$type": "dimension", "$description": "Default for cards, buttons" },
"lg": { "$value": "12px", "$type": "dimension" },
"xl": { "$value": "16px", "$type": "dimension" },
"full": { "$value": "9999px", "$type": "dimension", "$description": "Pills, avatars" }
},
"borders": {
"width": {
"thin": { "$value": "1px", "$type": "dimension", "$description": "Default borders" },
"medium": { "$value": "2px", "$type": "dimension", "$description": "Focus rings, emphasis" }
}
},
"container": {
"maxWidth": {
"sm": { "$value": "640px", "$type": "dimension" },
"md": { "$value": "768px", "$type": "dimension" },
"lg": { "$value": "1024px", "$type": "dimension" },
"xl": { "$value": "1280px", "$type": "dimension" }
}
}
},
"componentSpacing": {
"button": {
"paddingX": "{spacing.scale.4}",
"paddingY": "{spacing.scale.2}",
"gap": "{spacing.scale.2}"
},
"card": {
"padding": "{spacing.scale.6}",
"gap": "{spacing.scale.4}"
},
"input": {
"paddingX": "{spacing.scale.3}",
"paddingY": "{spacing.scale.2}"
}
}
}
Detect patterns and express them. Use 4px or 8px base unit convention.
返回JSON:
{
"$schema": "pass-5-spacing",
"tokens": {
"spacing": {
"scale": {
"0": { "$value": "0px", "$type": "dimension" },
"1": { "$value": "4px", "$type": "dimension", "$description": "Minimal spacing, icon gaps" },
"2": { "$value": "8px", "$type": "dimension", "$description": "Tight spacing, inline elements" },
"3": { "$value": "12px", "$type": "dimension" },
"4": { "$value": "16px", "$type": "dimension", "$description": "Default component padding" },
"5": { "$value": "20px", "$type": "dimension" },
"6": { "$value": "24px", "$type": "dimension", "$description": "Card padding, form gaps" },
"8": { "$value": "32px", "$type": "dimension", "$description": "Section spacing" },
"10": { "$value": "40px", "$type": "dimension" },
"12": { "$value": "48px", "$type": "dimension", "$description": "Large section gaps" },
"16": { "$value": "64px", "$type": "dimension", "$description": "Hero section padding" }
},
"semantic": {
"inset": {
"card": { "$value": "{spacing.scale.6}", "$type": "dimension", "$description": "Card internal padding" },
"section": { "$value": "{spacing.scale.8}", "$type": "dimension", "$description": "Section padding" }
},
"stack": {
"tight": { "$value": "{spacing.scale.2}", "$type": "dimension", "$description": "Compact vertical spacing" },
"default": { "$value": "{spacing.scale.4}", "$type": "dimension", "$description": "Standard vertical spacing" }
},
"gap": {
"grid": { "$value": "{spacing.scale.6}", "$type": "dimension", "$description": "Card grid gap" }
}
}
},
"sizing": {
"component": {
"button-sm": { "$value": "32px", "$type": "dimension" },
"button-md": { "$value": "40px", "$type": "dimension" },
"button-lg": { "$value": "48px", "$type": "dimension" },
"input-md": { "$value": "40px", "$type": "dimension" }
},
"icon": {
"sm": { "$value": "16px", "$type": "dimension" },
"md": { "$value": "20px", "$type": "dimension" },
"lg": { "$value": "24px", "$type": "dimension" }
},
"avatar": {
"sm": { "$value": "32px", "$type": "dimension" },
"md": { "$value": "40px", "$type": "dimension" },
"lg": { "$value": "48px", "$type": "dimension" }
}
},
"radii": {
"none": { "$value": "0px", "$type": "dimension" },
"sm": { "$value": "4px", "$type": "dimension" },
"md": { "$value": "8px", "$type": "dimension", "$description": "Default for cards, buttons" },
"lg": { "$value": "12px", "$type": "dimension" },
"xl": { "$value": "16px", "$type": "dimension" },
"full": { "$value": "9999px", "$type": "dimension", "$description": "Pills, avatars" }
},
"borders": {
"width": {
"thin": { "$value": "1px", "$type": "dimension", "$description": "Default borders" },
"medium": { "$value": "2px", "$type": "dimension", "$description": "Focus rings, emphasis" }
}
},
"container": {
"maxWidth": {
"sm": { "$value": "640px", "$type": "dimension" },
"md": { "$value": "768px", "$type": "dimension" },
"lg": { "$value": "1024px", "$type": "dimension" },
"xl": { "$value": "1280px", "$type": "dimension" }
}
}
},
"componentSpacing": {
"button": {
"paddingX": "{spacing.scale.4}",
"paddingY": "{spacing.scale.2}",
"gap": "{spacing.scale.2}"
},
"card": {
"padding": "{spacing.scale.6}",
"gap": "{spacing.scale.4}"
},
"input": {
"paddingX": "{spacing.scale.3}",
"paddingY": "{spacing.scale.2}"
}
}
}
检测模式并进行表达。遵循4px或8px基础单位的惯例。
FINAL STEP - MANDATORY
最终步骤 - 强制性要求
Use the Write tool to save this JSON to:
Do NOT proceed without writing the file. Confirm the file was written successfully.
.tmp-design-specs/{project}/pass-5-spacing.json
---使用Write工具将此JSON保存到:
未写入文件前不要继续。确认文件已成功写入。
.tmp-design-specs/{project}/pass-5-spacing.json
---Pass 6: Interactive States & Accessibility
Pass 6:交互状态与可访问性
Objective: Analyze interactive states and accessibility compliance.
目标:分析交互状态与可访问性合规性。
Subtask Agent Prompt
子任务代理提示词
You are Pass 6 of a 7-pass design specification extraction system. Your focus: STATES AND ACCESSIBILITY.你是7阶段设计规范提取系统的第6阶段处理程序。你的工作重点:状态与可访问性。CRITICAL REQUIREMENT
关键要求
You MUST write your output to a JSON file. This is mandatory - do not just return JSON in your response.
OUTPUT FILE:
.tmp-design-specs/{project}/pass-6-states.jsonFirst, read previous pass outputs:
.tmp-design-specs/{project}/pass-2-colors.json.tmp-design-specs/{project}/pass-4-components.json
Then use the Write tool to save your analysis as valid JSON.
你必须将输出写入JSON文件。这是强制性要求 - 不要只在响应中返回JSON。
输出文件:
.tmp-design-specs/{project}/pass-6-states.json首先读取前一阶段的输出:
.tmp-design-specs/{project}/pass-2-colors.json.tmp-design-specs/{project}/pass-4-components.json
然后使用Write工具将你的分析结果保存为有效的JSON。
Input
输入
- Screenshot: [attached image]
- Component data from Pass 4: Read from
.tmp-design-specs/{project}/pass-4-components.json - Color data from Pass 2: Read from
.tmp-design-specs/{project}/pass-2-colors.json
- 截图:[附加图片]
- 第4阶段的组件数据:从读取
.tmp-design-specs/{project}/pass-4-components.json - 第2阶段的颜色数据:从读取
.tmp-design-specs/{project}/pass-2-colors.json
Your Task
你的任务
1. Interactive States (infer from visual cues)
1. 交互状态(从视觉线索推断)
For each interactive component type, define state variations:
- Default/rest state
- Hover state (if visible or inferable - darken 5-10%)
- Active/pressed state (darken 10-15%, reduce shadow)
- Focus state (focus ring, 2px outline)
- Disabled state (opacity 0.5-0.6, muted colors)
- Loading state
State Changes:
- Color changes
- Shadow changes
- Border changes
- Opacity changes
- Transform effects
对于每种交互组件类型,定义状态变体:
- 默认/休息状态
- 悬停状态(若可见或可推断 - 加深5-10%)
- 激活/按下状态(加深10-15%,减少阴影)
- 聚焦状态(聚焦环,2px轮廓)
- 禁用状态(透明度0.5-0.6,颜色弱化)
- 加载状态
状态变化:
- 颜色变化
- 阴影变化
- 边框变化
- 透明度变化
- 变换效果
2. Accessibility Analysis
2. 可访问性分析
Contrast Ratios:
For each text-on-background combination:
- Calculate/estimate contrast ratio
- Check against WCAG AA (4.5:1 normal, 3:1 large)
- Check against WCAG AAA (7:1 normal, 4.5:1 large)
- Flag any failures
Color Accessibility:
- Red/green combinations (protanopia/deuteranopia)
- Blue/yellow combinations (tritanopia)
- Information conveyed by color alone
对比度:
对于每种文本-背景组合:
- 计算/估算对比度
- 对照WCAG AA标准检查(普通文本4.5:1,大文本3:1)
- 对照WCAG AAA标准检查(普通文本7:1,大文本4.5:1)
- 标记任何不符合的情况
颜色可访问性:
- 红/绿组合(红色盲/绿色盲)
- 蓝/黄组合(蓝色盲)
- 仅通过颜色传递信息
3. Semantic Hierarchy
3. 语义层级
- What should be the h1? (single per page)
- Heading hierarchy (h1 > h2 > h3, no skips)
- Landmark regions (header, nav, main, aside, footer)
- 哪个应该是h1?(每页一个)
- 标题层级(h1 > h2 > h3,不要跳过层级)
- 地标区域(header、nav、main、aside、footer)
4. Interactive Element Analysis
4. 交互元素分析
For each interactive element:
- Does it have visible text or clear label?
- What ARIA label might be needed?
- Is the clickable area sufficient (44x44px touch target)?
- Is there a visible focus indicator?
对于每个交互元素:
- 是否有可见文本或清晰标签?
- 可能需要什么ARIA标签?
- 可点击区域是否足够(44x44px触摸目标)?
- 是否有可见的聚焦指示器?
Output Format
输出格式
Return JSON:
{
"$schema": "pass-6-states",
"states": {
"button": {
"primary": {
"default": {
"background": "{colors.semantic.interactive.primary}",
"text": "#FFFFFF",
"border": "transparent",
"shadow": "{shadows.elevation-sm}"
},
"hover": {
"background": "{colors.semantic.interactive.primary-hover}",
"shadow": "{shadows.elevation-md}",
"$description": "Darken 10%, increase elevation"
},
"active": {
"background": "{colors.primitive.blue.700}",
"shadow": "none",
"transform": "scale(0.98)"
},
"focus": {
"outline": "2px solid {colors.semantic.interactive.primary}",
"outlineOffset": "2px"
},
"disabled": {
"background": "{colors.primitive.gray.300}",
"text": "{colors.primitive.gray.500}",
"cursor": "not-allowed",
"opacity": 0.6
}
}
},
"input": {
"default": {
"border": "{colors.semantic.border.default}",
"background": "#FFFFFF"
},
"hover": {
"border": "{colors.primitive.gray.400}"
},
"focus": {
"border": "{colors.semantic.border.focus}",
"outline": "2px solid {colors.semantic.interactive.primary}",
"outlineOffset": "-1px"
},
"error": {
"border": "{colors.semantic.feedback.error}",
"background": "#FEF2F2"
},
"disabled": {
"background": "{colors.primitive.gray.100}",
"opacity": 0.6
}
}
},
"transitions": {
"fast": {
"$type": "transition",
"$value": {
"duration": "150ms",
"timingFunction": [0.4, 0, 0.2, 1]
},
"$description": "Micro-interactions, hovers"
},
"normal": {
"$type": "transition",
"$value": {
"duration": "200ms",
"timingFunction": [0.4, 0, 0.2, 1]
},
"$description": "Standard transitions"
},
"slow": {
"$type": "transition",
"$value": {
"duration": "300ms",
"timingFunction": [0.4, 0, 0.2, 1]
},
"$description": "Page transitions, modals"
}
},
"accessibility": {
"contrastIssues": [
{
"element": "components.btn-secondary",
"foreground": "#9CA3AF",
"background": "#FFFFFF",
"ratio": 2.8,
"required": 4.5,
"wcagLevel": "AA",
"passes": false,
"recommendation": "Darken text to #6B7280 for 4.5:1 ratio"
}
],
"colorBlindnessIssues": [
{
"type": "deuteranopia",
"affectedElements": ["error-state", "success-state"],
"recommendation": "Add icons alongside color indicators"
}
],
"semanticHierarchy": {
"headings": [
{ "level": 1, "text": "Welcome to Our Platform", "componentRef": "hero-title" },
{ "level": 2, "text": "Features", "componentRef": "features-heading" }
],
"landmarks": [
{ "role": "banner", "componentRef": "header-1" },
{ "role": "navigation", "componentRef": "nav-1" },
{ "role": "main", "componentRef": "main-content" },
{ "role": "contentinfo", "componentRef": "footer-1" }
]
},
"touchTargets": {
"minimumSize": "44px",
"violations": [
{
"componentRef": "icon-btn-close",
"actualSize": "32x32",
"recommendation": "Increase to 44x44px minimum"
}
]
},
"interactiveElements": [
{
"componentRef": "icon-btn-menu",
"type": "IconButton",
"hasVisibleLabel": false,
"suggestedAriaLabel": "Open menu"
}
]
}
}
Infer states from visual context. When states are not visible, provide reasonable defaults.
返回JSON:
{
"$schema": "pass-6-states",
"states": {
"button": {
"primary": {
"default": {
"background": "{colors.semantic.interactive.primary}",
"text": "#FFFFFF",
"border": "transparent",
"shadow": "{shadows.elevation-sm}"
},
"hover": {
"background": "{colors.semantic.interactive.primary-hover}",
"shadow": "{shadows.elevation-md}",
"$description": "Darken 10%, increase elevation"
},
"active": {
"background": "{colors.primitive.blue.700}",
"shadow": "none",
"transform": "scale(0.98)"
},
"focus": {
"outline": "2px solid {colors.semantic.interactive.primary}",
"outlineOffset": "2px"
},
"disabled": {
"background": "{colors.primitive.gray.300}",
"text": "{colors.primitive.gray.500}",
"cursor": "not-allowed",
"opacity": 0.6
}
}
},
"input": {
"default": {
"border": "{colors.semantic.border.default}",
"background": "#FFFFFF"
},
"hover": {
"border": "{colors.primitive.gray.400}"
},
"focus": {
"border": "{colors.semantic.border.focus}",
"outline": "2px solid {colors.semantic.interactive.primary}",
"outlineOffset": "-1px"
},
"error": {
"border": "{colors.semantic.feedback.error}",
"background": "#FEF2F2"
},
"disabled": {
"background": "{colors.primitive.gray.100}",
"opacity": 0.6
}
}
},
"transitions": {
"fast": {
"$type": "transition",
"$value": {
"duration": "150ms",
"timingFunction": [0.4, 0, 0.2, 1]
},
"$description": "Micro-interactions, hovers"
},
"normal": {
"$type": "transition",
"$value": {
"duration": "200ms",
"timingFunction": [0.4, 0, 0.2, 1]
},
"$description": "Standard transitions"
},
"slow": {
"$type": "transition",
"$value": {
"duration": "300ms",
"timingFunction": [0.4, 0, 0.2, 1]
},
"$description": "Page transitions, modals"
}
},
"accessibility": {
"contrastIssues": [
{
"element": "components.btn-secondary",
"foreground": "#9CA3AF",
"background": "#FFFFFF",
"ratio": 2.8,
"required": 4.5,
"wcagLevel": "AA",
"passes": false,
"recommendation": "Darken text to #6B7280 for 4.5:1 ratio"
}
],
"colorBlindnessIssues": [
{
"type": "deuteranopia",
"affectedElements": ["error-state", "success-state"],
"recommendation": "Add icons alongside color indicators"
}
],
"semanticHierarchy": {
"headings": [
{ "level": 1, "text": "Welcome to Our Platform", "componentRef": "hero-title" },
{ "level": 2, "text": "Features", "componentRef": "features-heading" }
],
"landmarks": [
{ "role": "banner", "componentRef": "header-1" },
{ "role": "navigation", "componentRef": "nav-1" },
{ "role": "main", "componentRef": "main-content" },
{ "role": "contentinfo", "componentRef": "footer-1" }
]
},
"touchTargets": {
"minimumSize": "44px",
"violations": [
{
"componentRef": "icon-btn-close",
"actualSize": "32x32",
"recommendation": "Increase to 44x44px minimum"
}
]
},
"interactiveElements": [
{
"componentRef": "icon-btn-menu",
"type": "IconButton",
"hasVisibleLabel": false,
"suggestedAriaLabel": "Open menu"
}
]
}
}
从视觉上下文推断状态。当状态不可见时,提供合理的默认值。
FINAL STEP - MANDATORY
最终步骤 - 强制性要求
Use the Write tool to save this JSON to:
Do NOT proceed without writing the file. Confirm the file was written successfully.
.tmp-design-specs/{project}/pass-6-states.json
---使用Write工具将此JSON保存到:
未写入文件前不要继续。确认文件已成功写入。
.tmp-design-specs/{project}/pass-6-states.json
---Pass 7: Consolidation & Validation
Pass 7:合并汇总与验证
Objective: Merge all passes into final spec, validate completeness, resolve conflicts.
目标:将所有阶段的结果合并为最终规范,验证完整性,解决冲突。
Subtask Agent Prompt
子任务代理提示词
You are Pass 7 (FINAL) of a 7-pass design specification extraction system. Your focus: CONSOLIDATION.你是7阶段设计规范提取系统的第7阶段(最终阶段)处理程序。你的工作重点:合并汇总。CRITICAL REQUIREMENT
关键要求
You MUST write your final output to a JSON file. This is mandatory - do not just return JSON in your response.
OUTPUT FILE:
.tmp-design-specs/{project}/design-spec.jsonFirst, read ALL previous pass outputs:
.tmp-design-specs/{project}/pass-1-layout.json.tmp-design-specs/{project}/pass-2-colors.json.tmp-design-specs/{project}/pass-3-typography.json.tmp-design-specs/{project}/pass-4-components.json.tmp-design-specs/{project}/pass-5-spacing.json.tmp-design-specs/{project}/pass-6-states.json
Then use the Write tool to save your consolidated analysis as valid JSON.
你必须将最终输出写入JSON文件。这是强制性要求 - 不要只在响应中返回JSON。
输出文件:
.tmp-design-specs/{project}/design-spec.json首先读取所有前一阶段的输出:
.tmp-design-specs/{project}/pass-1-layout.json.tmp-design-specs/{project}/pass-2-colors.json.tmp-design-specs/{project}/pass-3-typography.json.tmp-design-specs/{project}/pass-4-components.json.tmp-design-specs/{project}/pass-5-spacing.json.tmp-design-specs/{project}/pass-6-states.json
然后使用Write工具将你的合并分析结果保存为有效的JSON。
Input
输入
- All previous pass outputs (Passes 1-6) - Read from the JSON files listed above
- 所有前一阶段的输出(阶段1-6)- 从上面列出的JSON文件读取
Your Task
你的任务
Create the final, validated design specification:
创建最终的、经过验证的设计规范:
1. Merge Token Groups
1. 合并令牌组
Combine all token extractions into unified structure:
- Resolve any duplicate tokens
- Ensure consistent naming
- Verify all references resolve correctly
将所有令牌提取结果合并为统一结构:
- 解决重复令牌
- 确保命名一致
- 验证所有引用都能正确解析
2. Validate Component Tree
2. 验证组件树
- Check all components have required fields
- Verify parent-child relationships
- Ensure style references link to valid tokens
- Check bounding boxes don't overlap incorrectly
- 检查所有组件都有必填字段
- 验证父子关系
- 确保样式引用链接到有效的令牌
- 检查边界框是否有不正确的重叠
3. Cross-Reference Validation
3. 交叉引用验证
- Every color used in components should exist in tokens
- Every font used should be in typography tokens
- Every spacing value should map to spacing scale
- 组件中使用的每种颜色都应存在于令牌中
- 使用的每种字体都应在排版令牌中
- 每个间距值都应映射到间距比例
4. Quality Scoring
4. 质量评分
Assign confidence scores:
- Overall extraction confidence
- Per-section confidence
- Flag areas of uncertainty
分配置信度:
- 整体提取置信度
- 各部分的置信度
- 标记不确定的区域
5. Generate Recommendations
5. 生成建议
Based on analysis:
- Accessibility fixes needed
- Token consolidation opportunities
- Component naming suggestions
基于分析结果:
- 需要的可访问性修复
- 令牌合并的机会
- 组件命名建议
Final Output Format
最终输出格式
Return complete JSON matching the schema at references/design-tokens-schema.json:
{
"$schema": "https://design-tokens.org/schema.json",
"$version": "1.0.0",
"$source": {
"type": "<figma-export|website-screenshot|mockup>",
"dimensions": { "width": N, "height": N, "aspectRatio": "W:H", "deviceClass": "..." },
"extractedAt": "<ISO timestamp>",
"confidence": 0.0-1.0
},
"tokens": {
"colors": {
"primitive": {...},
"semantic": {...}
},
"typography": {
"fontFamilies": {...},
"fontWeights": {...},
"fontSizes": {...},
"lineHeights": {...},
"letterSpacing": {...},
"textStyles": {...}
},
"spacing": {
"scale": {...},
"semantic": {...}
},
"sizing": {...},
"radii": {...},
"borders": {...},
"shadows": {...},
"transitions": {...}
},
"components": {
"$root": {...},
"catalog": {...}
},
"layout": {
"type": "...",
"regions": [...],
"gridSystem": {...}
},
"accessibility": {
"contrastIssues": [...],
"colorBlindnessIssues": [...],
"semanticHierarchy": {...},
"touchTargets": {...}
},
"semantics": {
"designPatterns": [
{ "pattern": "Hero Section", "confidence": 0.95, "instances": [...] },
{ "pattern": "Card Grid", "confidence": 0.9, "instances": [...] }
],
"contentTypes": ["marketing", "e-commerce"],
"brandPersonality": {
"traits": ["modern", "professional"],
"tone": "friendly"
}
},
"$extensions": {
"com.design-spec.extraction": {
"passesCompleted": 7,
"confidence": {
"overall": 0.85,
"layout": 0.9,
"colors": 0.95,
"typography": 0.8,
"components": 0.85,
"spacing": 0.9,
"accessibility": 0.75
},
"recommendations": [
"Increase contrast on secondary buttons",
"Add aria-labels to icon-only buttons"
]
}
}
}
The final file MUST be valid JSON. Validate all references resolve correctly.
返回符合references/design-tokens-schema.json架构的完整JSON:
{
"$schema": "https://design-tokens.org/schema.json",
"$version": "1.0.0",
"$source": {
"type": "<figma-export|website-screenshot|mockup>",
"dimensions": { "width": N, "height": N, "aspectRatio": "W:H", "deviceClass": "..." },
"extractedAt": "<ISO timestamp>",
"confidence": 0.0-1.0
},
"tokens": {
"colors": {
"primitive": {...},
"semantic": {...}
},
"typography": {
"fontFamilies": {...},
"fontWeights": {...},
"fontSizes": {...},
"lineHeights": {...},
"letterSpacing": {...},
"textStyles": {...}
},
"spacing": {
"scale": {...},
"semantic": {...}
},
"sizing": {...},
"radii": {...},
"borders": {...},
"shadows": {...},
"transitions": {...}
},
"components": {
"$root": {...},
"catalog": {...}
},
"layout": {
"type": "...",
"regions": [...],
"gridSystem": {...}
},
"accessibility": {
"contrastIssues": [...],
"colorBlindnessIssues": [...],
"semanticHierarchy": {...},
"touchTargets": {...}
},
"semantics": {
"designPatterns": [
{ "pattern": "Hero Section", "confidence": 0.95, "instances": [...] },
{ "pattern": "Card Grid", "confidence": 0.9, "instances": [...] }
],
"contentTypes": ["marketing", "e-commerce"],
"brandPersonality": {
"traits": ["modern", "professional"],
"tone": "friendly"
}
},
"$extensions": {
"com.design-spec.extraction": {
"passesCompleted": 7,
"confidence": {
"overall": 0.85,
"layout": 0.9,
"colors": 0.95,
"typography": 0.8,
"components": 0.85,
"spacing": 0.9,
"accessibility": 0.75
},
"recommendations": [
"Increase contrast on secondary buttons",
"Add aria-labels to icon-only buttons"
]
}
}
}
最终文件必须是有效的JSON。验证所有引用都能正确解析。
FINAL STEP - MANDATORY
最终步骤 - 强制性要求
Use the Write tool to save this JSON to:
This is the FINAL deliverable. Do NOT proceed without writing the file. Confirm the file was written successfully.
.tmp-design-specs/{project}/design-spec.json
---使用Write工具将此JSON保存到:
这是最终交付物。未写入文件前不要继续。确认文件已成功写入。
.tmp-design-specs/{project}/design-spec.json
---Execution Instructions
执行说明
IMPORTANT: File-Based Workflow
重要提示:基于文件的工作流
Before launching any pass:
- Create the output directory:
bash
mkdir -p .tmp-design-specs/{project-name}- Each pass MUST write to its designated file - Subtask agents will use the Write tool
- Verify file exists before proceeding to next pass - Read the file to confirm
启动任何阶段前:
- 创建输出目录:
bash
mkdir -p .tmp-design-specs/{project-name}- 每个阶段必须写入指定文件 - 子任务代理将使用Write工具
- 进入下一阶段前验证文件存在 - 读取文件确认
Delegating Extraction Passes
分配提取阶段任务
Execute each pass as a delegated worker. Replace with actual project name in ALL prompts.
{project}javascript
// Step 0: Create directory for intermediate files
mkdir -p .tmp-design-specs/my-design
// Steps 1-6: Delegate each pass sequentially
teams(action: 'delegate', tasks: [{
text: '[Pass 1 prompt - worker MUST write to .tmp-design-specs/my-design/pass-1-layout.json]',
assignee: 'design-pass-1'
}])
// VERIFY: Read .tmp-design-specs/my-design/pass-1-layout.json exists
// Continue for Passes 2-6, verifying each file exists ...
// Step 7: Final Consolidation
teams(action: 'delegate', tasks: [{
text: '[Pass 7 prompt - worker reads ALL pass files, MUST write to design-spec.json]',
assignee: 'design-consolidator'
}])
// VERIFY: Read .tmp-design-specs/my-design/design-spec.json exists
// Step 8: Save final spec as a ticket
todos_oneshot(
title: "Design spec: my-design",
description: "<contents of design-spec.json>",
tags: "design-spec",
type: "task"
)将每个阶段作为委托任务执行。在所有提示词中将替换为实际项目名称。
{project}javascript
// 步骤0:为中间文件创建目录
mkdir -p .tmp-design-specs/my-design
// 步骤1-6:依次委托每个阶段
teams(action: 'delegate', tasks: [{
text: '[Pass 1提示词 - 处理程序必须写入.tmp-design-specs/my-design/pass-1-layout.json]',
assignee: 'design-pass-1'
}])
// 验证:读取.tmp-design-specs/my-design/pass-1-layout.json确认存在
// 继续执行阶段2-6,验证每个文件存在...
// 步骤7:最终合并汇总
teams(action: 'delegate', tasks: [{
text: '[Pass 7提示词 - 处理程序读取所有阶段文件,必须写入design-spec.json]',
assignee: 'design-consolidator'
}])
// 验证:读取.tmp-design-specs/my-design/design-spec.json确认存在
// 步骤8:将最终规范保存为工单
todos_oneshot(
title: "Design spec: my-design",
description: "<contents of design-spec.json>",
tags: "design-spec",
type: "task"
)Verification After Each Pass
每个阶段后的验证
After each subtask completes, verify the output file was written:
javascript
// After Pass N completes:
Read(".tmp-design-specs/{project}/pass-N-{type}.json")
// If file doesn't exist or is invalid JSON, re-run the pass每个子任务完成后,验证输出文件已写入:
javascript
// 阶段N完成后:
Read(".tmp-design-specs/{project}/pass-N-{type}.json")
// 如果文件不存在或不是有效的JSON,重新运行该阶段Model Recommendations
模型推荐
- Passes 1-6: Use Sonnet for focused visual analysis tasks
- Pass 7 (Consolidation): Use Opus for complex synthesis and validation
- 阶段1-6:使用Sonnet处理聚焦的视觉分析任务
- 阶段7(合并汇总):使用Opus处理复杂的合成与验证任务
Output Delivery
输出交付
After extraction, provide:
- Summary: Key statistics and findings
- Complete JSON: Full spec matching schema
- Recommendations: Suggested improvements
- Confidence Report: Areas of uncertainty
提取完成后,提供:
- 摘要:关键统计数据和发现
- 完整JSON:符合架构的完整规范
- 建议:建议的改进措施
- 置信度报告:不确定的区域
Example Summary Output
示例摘要输出
markdown
undefinedmarkdown
undefinedDesign Spec Extraction Complete
设计规范提取完成
Statistics
统计数据
- Colors extracted: 24 (8 primitive, 16 semantic)
- Typography styles: 12
- Components detected: 47 (18 atoms, 15 molecules, 14 organisms)
- Spacing values: 11
- Accessibility issues: 2 (contrast)
- 提取的颜色:24种(8种基础色,16种语义色)
- 排版样式:12种
- 检测到的组件:47个(18个原子组件,15个分子组件,14个组织体组件)
- 间距值:11个
- 可访问性问题:2个(对比度)
Key Findings
关键发现
- Layout: 12-column grid with 24px gutters
- Primary font: Inter (sans-serif)
- Design patterns: Hero, Card Grid, Feature List, CTA
- Device class: Desktop (1440px width)
- 布局:12列网格,间距24px
- 主要字体:Inter(无衬线)
- 设计模式:主视觉、卡片网格、功能列表、CTA
- 设备类别:桌面设备(宽度1440px)
Accessibility Notes
可访问性说明
- 2 contrast failures requiring attention
- Recommend adding icons to status indicators
- 2个对比度不符合要求的问题需要处理
- 建议为状态指示器添加图标
Confidence
置信度
- Overall: 0.89
- Colors: 0.95
- Typography: 0.88
- Components: 0.85
- Spacing: 0.90
[Full JSON spec attached]
---- 整体:0.89
- 颜色:0.95
- 排版:0.88
- 组件:0.85
- 间距:0.90
[完整JSON规范已附加]
---Best Practices
最佳实践
For Accurate Extraction
确保提取准确
- Use highest resolution source available
- Prefer Figma exports over screenshots when possible
- Ensure design shows actual content (not lorem ipsum)
- Include multiple states if analyzing interactions
- Provide context about target platform
- 使用最高分辨率的源文件
- 优先选择Figma导出文件而非截图
- 确保设计显示实际内容(不要使用Lorem Ipsum占位文本)
- 分析交互时包含多种状态
- 提供目标平台的上下文
For AI-Readable Output
确保AI可读的输出
- Use semantic naming (intent over appearance)
- Include $description explaining when/how to use tokens
- Document token relationships and pairings
- Show which tokens apply to which components
- Include usage examples for complex tokens
- 使用语义命名(基于意图而非外观)
- 包含$description说明何时/如何使用令牌
- 记录令牌之间的关系和配对
- 显示哪些令牌适用于哪些组件
- 为复杂令牌提供使用示例
For Processing Efficiency
提高处理效率
- Start with layout pass to establish structure
- Use component IDs consistently across passes
- Pass only relevant previous results to each subtask
- Validate incrementally, not just at end
- 从布局阶段开始建立结构
- 跨阶段一致使用组件ID
- 仅将相关的前一阶段结果传递给每个子任务
- 逐步验证,而不仅仅在最后验证
Reference Files
参考文件
- - Complete JSON Schema for output validation
references/design-tokens-schema.json - - Detailed patterns for visual analysis
references/extraction-patterns.md
Load these references as needed during extraction for detailed guidance on specific analysis tasks.
- - 用于输出验证的完整JSON架构
references/design-tokens-schema.json - - 视觉分析的详细模式
references/extraction-patterns.md
提取过程中可根据需要加载这些参考文件,获取特定分析任务的详细指导。
Schema Compliance
架构合规性
Output follows W3C Design Tokens Community Group format (2025.10):
- All tokens use ,
$value,$typeproperties$description - Token references use syntax
{group.token} - Extensions use reverse domain notation in
$extensions
- 所有令牌使用、
$value、$type属性$description - 令牌引用使用语法
{group.token} - 扩展使用反向域名表示法在中
$extensions