figma-designer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Figma Designer

Figma 设计分析工具

"Transform Figma designs into implementation-ready specifications with pixel-perfect accuracy"
"将Figma设计精准转换为可直接用于开发的规范,实现像素级精度"

Overview

概述

This skill analyzes Figma designs through the Figma MCP server and generates detailed PRDs with precise visual specifications. It extracts design tokens, component specifications, and layout information that developers can implement directly.
本技能通过Figma MCP服务器分析Figma设计,生成包含精准视觉规范的详细PRD。它提取可直接供开发人员使用的设计令牌、组件规范和布局信息。

Prerequisites

前置条件

Figma MCP Server

Figma MCP 服务器

Ensure the Figma MCP server is connected and accessible:
bash
undefined
确保Figma MCP服务器已连接且可访问:
bash
undefined

Check if Figma MCP is available

Check if Figma MCP is available

mcp-list

If not available, install from: https://github.com/modelcontextprotocol/servers

Required Figma MCP tools:
- `figma_get_file` - Get file metadata
- `figma_get_nodes` - Get node details
- `figma_get_components` - Get component information
mcp-list

如果未安装,请从以下地址获取:https://github.com/modelcontextprotocol/servers

所需的Figma MCP工具:
- `figma_get_file` - 获取文件元数据
- `figma_get_nodes` - 获取节点详情
- `figma_get_components` - 获取组件信息

When This Skill Activates

技能触发条件

Activates when you:
  • Provide a Figma link (
    https://www.figma.com/file/...
    )
  • Upload a design screenshot and mention "Figma"
  • Say "analyze this design" or "extract design specs"
  • Ask to "create PRD from Figma"
当你进行以下操作时,本技能将触发:
  • 提供Figma链接(
    https://www.figma.com/file/...
  • 上传设计截图并提及“Figma”
  • 说出“分析此设计”或“提取设计规范”
  • 要求“从Figma创建PRD”

Design Analysis Workflow

设计分析流程

Phase 1: Fetch Design Data

阶段1:获取设计数据

yaml
Input: Figma URL or File Key
Extract File Key from URL
Call figma_get_file to get metadata
Call figma_get_nodes to get design tree
Parse frame, component, and text nodes
yaml
Input: Figma URL or File Key
Extract File Key from URL
Call figma_get_file to get metadata
Call figma_get_nodes to get design tree
Parse frame, component, and text nodes

Phase 2: Extract Design Tokens

阶段2:提取设计令牌

Create a comprehensive design token inventory:
typescript
// Design Token Structure
interface DesignTokens {
  colors: {
    primary: string[];
    secondary: string[];
    neutral: string[];
    semantic: {
      success: string;
      warning: string;
      error: string;
      info: string;
    };
  };
  typography: {
    fontFamilies: Record<string, string>;
    fontSizes: Record<string, number>;
    fontWeights: Record<string, number>;
    lineHeights: Record<string, number>;
    letterSpacing: Record<string, number>;
  };
  spacing: {
    scale: number;  // 4, 8, 12, 16, etc.
    values: Record<string, number>;
  };
  borders: {
    radii: Record<string, number>;
    widths: Record<string, number>;
  };
  shadows: Array<{
    name: string;
    values: string[];
  }>;
}
创建完整的设计令牌清单:
typescript
// 设计令牌结构
interface DesignTokens {
  colors: {
    primary: string[];
    secondary: string[];
    neutral: string[];
    semantic: {
      success: string;
      warning: string;
      error: string;
      info: string;
    };
  };
  typography: {
    fontFamilies: Record<string, string>;
    fontSizes: Record<string, number>;
    fontWeights: Record<string, number>;
    lineHeights: Record<string, number>;
    letterSpacing: Record<string, number>;
  };
  spacing: {
    scale: number;  // 如4、8、12、16等
    values: Record<string, number>;
  };
  borders: {
    radii: Record<string, number>;
    widths: Record<string, number>;
  };
  shadows: Array<{
    name: string;
    values: string[];
  }>;
}

Phase 3: Analyze Component Hierarchy

阶段3:分析组件层级

File
├── Frames (Pages/Screens)
│   ├── Component Instances
│   │   ├── Primary Button
│   │   ├── Input Field
│   │   └── Card
│   └── Text Layers
│       ├── Headings
│       ├── Body
│       └── Labels
For each component, extract:
  • Props: Size, variant, state
  • Layout: Flex direction, alignment, gap, padding
  • Styles: Fill, stroke, effects
  • Content: Text content, icons, images
  • Constraints: Responsive behavior
文件
├── 框架(页面/屏幕)
│   ├── 组件实例
│   │   ├── 主按钮
│   │   ├── 输入框
│   │   └── 卡片
│   └── 文本图层
│       ├── 标题
│       ├── 正文
│       └── 标签
针对每个组件,提取以下信息:
  • 属性:尺寸、变体、状态
  • 布局:弹性方向、对齐方式、间距、内边距
  • 样式:填充、描边、效果
  • 内容:文本内容、图标、图片
  • 约束:响应式行为

Phase 4: Generate Visual Specifications

阶段4:生成视觉规范

Use this template for each screen:
markdown
undefined
针对每个页面使用以下模板:
markdown
undefined

Screen: [Screen Name]

页面:[页面名称]

Layout Structure

布局结构

┌─────────────────────────────────────────┐
│ [Header/Nav]                              │
├─────────────────────────────────────────┤
│                                         │
│  [Main Content]                          │
│  ┌───────────┐  ┌───────────┐         │
│  │  Card 1   │  │  Card 2   │         │
│  └───────────┘  └───────────┘         │
│                                         │
├─────────────────────────────────────────┤
│ [Footer]                                 │
└─────────────────────────────────────────┘
┌─────────────────────────────────────────┐
│ [头部/导航栏]                              │
├─────────────────────────────────────────┤
│                                         │
│  [主要内容区]                          │
│  ┌───────────┐  ┌───────────┐         │
│  │  卡片1   │  │  卡片2   │         │
│  └───────────┘  └───────────┘         │
│                                         │
├─────────────────────────────────────────┤
│ [页脚]                                 │
└─────────────────────────────────────────┘

Design Specifications

设计规范

Colors

颜色

TokenValueUsage
Primary
#007AFF
Primary buttons, links
Background
#FFFFFF
Screen background
Surface
#F5F5F7
Cards, sections
Text Primary
#1C1C1E
Headings, body
Text Secondary
#8E8E93
Captions, labels
令牌取值用途
Primary
#007AFF
主按钮、链接
Background
#FFFFFF
页面背景
Surface
#F5F5F7
卡片、区块
Text Primary
#1C1C1E
标题、正文
Text Secondary
#8E8E93
说明文字、标签

Typography

排版

StyleFontSizeWeightLine HeightLetter Spacing
Display LargeSF Pro Display28pxBold (700)34px-0.5px
Heading 1SF Pro Display24pxBold (700)32px-0.3px
Heading 2SF Pro Display20pxSemibold (600)28px-0.2px
Body LargeSF Pro Text17pxRegular (400)24px-0.4px
BodySF Pro Text15pxRegular (400)22px-0.3px
CaptionSF Pro Text13pxRegular (400)18px-0.1px
样式字体尺寸字重行高字间距
Display LargeSF Pro Display28pxBold (700)34px-0.5px
Heading 1SF Pro Display24pxBold (700)32px-0.3px
Heading 2SF Pro Display20pxSemibold (600)28px-0.2px
Body LargeSF Pro Text17pxRegular (400)24px-0.4px
BodySF Pro Text15pxRegular (400)22px-0.3px
CaptionSF Pro Text13pxRegular (400)18px-0.1px

Spacing

间距

TokenValueUsage
xs4pxIcon padding
sm8pxTight spacing
md12pxCard padding
lg16pxSection spacing
xl24pxLarge gaps
2xl32pxPage margins
令牌取值用途
xs4px图标内边距
sm8px紧凑间距
md12px卡片内边距
lg16px区块间距
xl24px大间距
2xl32px页面边距

Component: Primary Button

组件:主按钮

typescript
interface PrimaryButtonProps {
  size?: 'small' | 'medium' | 'large';
  variant?: 'primary' | 'secondary' | 'tertiary';
  disabled?: boolean;
}

// Sizes
size.small = {
  height: 32px,
  paddingHorizontal: 12px,
  fontSize: 15,
  iconSize: 16,
}

size.medium = {
  height: 40px,
  paddingHorizontal: 16px,
  fontSize: 15,
  iconSize: 20,
}

size.large = {
  height: 48px,
  paddingHorizontal: 24px,
  fontSize: 17,
  iconSize: 24,
}

// Variants
variant.primary = {
  backgroundColor: '#007AFF',
  color: '#FFFFFF',
}

variant.secondary = {
  backgroundColor: '#F5F5F7',
  color: '#007AFF',
}

variant.tertiary = {
  backgroundColor: 'transparent',
  color: '#007AFF',
}
typescript
interface PrimaryButtonProps {
  size?: 'small' | 'medium' | 'large';
  variant?: 'primary' | 'secondary' | 'tertiary';
  disabled?: boolean;
}

// 尺寸
size.small = {
  height: 32px,
  paddingHorizontal: 12px,
  fontSize: 15,
  iconSize: 16,
}

size.medium = {
  height: 40px,
  paddingHorizontal: 16px,
  fontSize: 15,
  iconSize: 20,
}

size.large = {
  height: 48px,
  paddingHorizontal: 24px,
  fontSize: 17,
  iconSize: 24,
}

// 变体
variant.primary = {
  backgroundColor: '#007AFF',
  color: '#FFFFFF',
}

variant.secondary = {
  backgroundColor: '#F5F5F7',
  color: '#007AFF',
}

variant.tertiary = {
  backgroundColor: 'transparent',
  color: '#007AFF',
}

Constraints & Responsive Behavior

约束与响应式行为

ElementConstraintsResponsive Behavior
HeaderLeft, Right, TopSticky on scroll
SidebarLeft, Top, BottomCollapses to drawer on mobile
ContentLeft, Right (16px)Full width on mobile
元素约束条件响应式表现
头部左、右、顶部固定滚动时固定
侧边栏左、上、下固定在移动端折叠为抽屉
内容区左右边距16px移动端全屏显示

Interaction States

交互状态

ElementDefaultHoverPressedDisabled
Primary Buttonopacity: 1opacity: 0.8opacity: 0.6opacity: 0.4
Icon Buttonopacity: 1background: rgba(0,0,0,0.05)background: rgba(0,0,0,0.1)opacity: 0.3
Cardshadow: smshadow: md-opacity: 0.6
undefined
元素默认状态悬停状态点击状态禁用状态
主按钮透明度:1透明度:0.8透明度:0.6透明度:0.4
图标按钮透明度:1背景:rgba(0,0,0,0.05)背景:rgba(0,0,0,0.1)透明度:0.3
卡片阴影:sm阴影:md-透明度:0.6
undefined

Output Formats

输出格式

Option 1: Full PRD (Recommended)

选项1:完整PRD(推荐)

Generates a complete 4-file PRD:
  • docs/{feature}-notes.md
    - Design decisions
  • docs/{feature}-task-plan.md
    - Implementation tasks
  • docs/{feature}-prd.md
    - Product requirements
  • docs/{feature}-tech.md
    - Technical specifications
生成包含4个文件的完整PRD:
  • docs/{feature}-notes.md
    - 设计决策文档
  • docs/{feature}-task-plan.md
    - 开发任务计划
  • docs/{feature}-prd.md
    - 产品需求文档
  • docs/{feature}-tech.md
    - 技术规范文档

Option 2: Visual Spec Document

选项2:视觉规范文档

Generates a design specification document:
docs/{feature}-design-spec.md
生成设计规范文档:
docs/{feature}-design-spec.md

Option 3: Component Library

选项3:组件库

For design systems, generates:
src/components/
├── Button/
│   ├── Button.tsx
│   ├── Button.test.tsx
│   └── Button.stories.tsx
├── Input/
├── Card/
└── tokens.ts
针对设计系统,生成:
src/components/
├── Button/
│   ├── Button.tsx
│   ├── Button.test.tsx
│   └── Button.stories.tsx
├── Input/
├── Card/
└── tokens.ts

Quick Reference: Design Token Categories

快速参考:设计令牌分类

Always Extract These

必须提取的内容

CategoryWhat to ExtractWhy
ColorsHex/RGBA valuesTheme consistency
TypographyFont family, size, weight, spacingText hierarchy
SpacingPadding, margin, gap valuesLayout alignment
BordersRadius, width valuesShape consistency
ShadowsOffset, blur, spread, colorDepth perception
IconsName, size, colorVisual consistency
ImagesURL, dimensions, fit modeAsset management
分类提取内容原因
颜色Hex/RGBA值保证主题一致性
排版字体、尺寸、字重、间距构建文本层级
间距内边距、外边距、间隙值保证布局对齐
边框圆角、宽度值保证形状一致性
阴影偏移、模糊、扩散、颜色营造层次感
图标名称、尺寸、颜色保证视觉一致性
图片链接、尺寸、适配模式资产管理

Design Review Checklist

设计审核清单

Before generating PRD, verify:
  • All screens are accounted for
  • Design tokens are extracted
  • Component variants are documented
  • Responsive behavior is specified
  • Interaction states are defined
  • Accessibility (WCAG) is considered
    • Color contrast ratio ≥ 4.5:1
    • Touch targets ≥ 44x44px
    • Focus indicators visible
生成PRD前,请确认:
  • 所有页面均已覆盖
  • 已提取设计令牌
  • 已记录组件变体
  • 已明确响应式行为
  • 已定义交互状态
  • 已考虑无障碍访问(WCAG)标准
    • 颜色对比度≥4.5:1
    • 触控目标尺寸≥44x44px
    • 焦点指示器可见

Frame Analysis Template

页面框架分析模板

For each frame/screen in the Figma file:
markdown
undefined
针对Figma文件中的每个框架/页面:
markdown
undefined

Frame: {Frame Name}

框架:{框架名称}

Purpose

用途

{What this screen does}
{该页面的功能}

Elements

元素

ElementTypeStylesProps
{Name}{Component/Text/Vector}{css}{props}
{Name}{Component/Text/Vector}{css}{props}
元素名称类型样式属性
{名称}{组件/文本/矢量图}{css样式}{属性}
{名称}{组件/文本/矢量图}{css样式}{属性}

Layout

布局

  • Container: {width, height, fill}
  • Position: {absolute/relative}
  • Constraints: {left, right, top, bottom}
  • Auto Layout: {direction, spacing, padding, alignment}
  • 容器:{宽度、高度、填充方式}
  • 定位:{绝对/相对}
  • 约束:{左、右、上、下}
  • 自动布局:{方向、间距、内边距、对齐方式}

Content Hierarchy

内容层级

  1. {Primary element}
  2. {Secondary element}
  3. {Tertiary element}
  1. {主要元素}
  2. {次要元素}
  3. {三级元素}

Notes

备注

{Any special considerations}
undefined
{特殊注意事项}
undefined

Integration with Other Skills

与其他技能的集成

Typical Workflow

典型工作流程

Figma URL → figma-designer → Visual Specs
                           prd-planner → PRD
                           implementation → Code
                           code-reviewer → Quality Check
Figma链接 → figma-designer → 视觉规范
                           prd-planner → PRD
                           implementation → 代码开发
                           code-reviewer → 质量检查

Handoff to Development

开发交接

After generating specifications:
markdown
undefined
生成规范后,使用以下模板进行交接:
markdown
undefined

Developer Handoff

开发交接文档

Design Files

设计文件

  • Figma: {url}
  • Design Spec: {link}
  • Figma:{链接}
  • 设计规范:{链接}

Design Tokens

设计令牌

  • Generated:
    tokens.ts
  • Color palette:
    colors.ts
  • Typography:
    typography.ts
  • 生成文件:
    tokens.ts
  • 调色板:
    colors.ts
  • 排版规范:
    typography.ts

Component Library

组件库

  • Storybook: {url}
  • Component docs: {link}
  • Storybook:{链接}
  • 组件文档:{链接}

Assets

资源

  • Icons: {folder}
  • Images: {folder}
  • Exports: {format}
undefined
  • 图标:{文件夹路径}
  • 图片:{文件夹路径}
  • 导出格式:{格式}
undefined

Best Practices

最佳实践

DO

建议

✅ Extract exact pixel values for critical dimensions ✅ Document component variants and states ✅ Include responsive breakpoints ✅ Note any platform differences (iOS vs Android) ✅ Include accessibility considerations ✅ Export design tokens as constants
✅ 提取关键尺寸的精确像素值 ✅ 记录组件变体和状态 ✅ 包含响应式断点 ✅ 标注平台差异(iOS vs Android) ✅ 考虑无障碍访问要求 ✅ 将设计令牌导出为常量

DON'T

禁忌

❌ Round spacing values (use exact 4px/8px/12px) ❌ Ignore hover/focus states ❌ Skip constraint behavior ❌ Forget about empty states ❌ Omit loading states ❌ Assume platform defaults without verification
❌ 不要对间距值取整(请使用精确的4px/8px/12px) ❌ 不要忽略悬停/焦点状态 ❌ 不要跳过约束行为 ❌ 不要忘记空状态 ❌ 不要省略加载状态 ❌ 不要未经验证就假设平台默认值

Examples and Platform Notes

示例与平台说明

See
references/example-output.md
for a full sample output and platform-specific considerations.
请查看
references/example-output.md
获取完整示例输出和平台特定注意事项。