用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Aradotso/design-skills --skill figma-design-md-generator命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
AI-powered Figma enhancement toolkit with MCP integration for design automation, icon management, and creative workflows
AI SDLC patterns catalog for working effectively with AI coding agents
Decode Figma's binary Kiwi wire protocol to extract scenegraph, SVGs, and CSS from WebSocket frames, and write mutations back to live files.
基于 SOC 职业分类
正在显示 SKILL.md
| name | figma-design-md-generator |
| description | Generate DESIGN.md and SKILL.md files from Figma design systems for AI-assisted development |
| triggers | ["extract design tokens from Figma","generate DESIGN.md from Figma file","create design system documentation","export Figma styles to markdown","build SKILL.md for design system","document Figma design tokens","extract typography and color tokens","generate AI-ready design guidelines"] |
Skill by ara.so — Design Skills collection.
A Figma plugin that extracts local style guidelines, variables, and component families from Figma files and generates DESIGN.md and SKILL.md files. These outputs provide AI tools (Claude Code, Cursor, Codex) with structured design-system blueprints for building consistent interfaces.
The plugin reads Figma's local styles and variables—colors, typography, spacing, radius, effects, grids, and component sets—and converts them into editable markdown files following the TypeUI DESIGN.md format.
Key capabilities:
DESIGN.md (reference documentation)SKILL.md (agent instructions)Clone the repository:
git clone https://github.com/bergside/design-md-figma.git
cd design-md-figma
Install dependencies:
npm install
Build the plugin:
npm run build
Import into Figma Desktop:
manifest.json from the project directory# Watch mode for live development
npm run watch
# Type checking
npm run typecheck
# Production build
npm run build
| Action | Description |
|---|---|
| Auto-extract | Reads local styles and variables from active Figma file |
| Generate DESIGN.md | Creates design-guideline markdown from extracted signals |
| Generate SKILL.md | Creates agent-ready markdown with implementation rules |
| Toggle view | Switches between DESIGN.md and SKILL.md in editor |
| Refresh | Re-runs extraction for current file state |
| Download | Saves generated output as .md file |
code.ts – Plugin backend (runs in Figma sandbox):
figma.showUI(__html__, { width: 800, height: 600 });
// Listen for extraction requests
figma.ui.onmessage = (msg) => {
if (msg.type === 'extract-styles') {
const styles = extractLocalStyles();
const variables = extractVariables();
const components = extractComponentFamilies();
figma.ui.postMessage({
type: 'extraction-complete',
data: { styles, variables, components }
});
}
};
function extractLocalStyles() {
const paintStyles = figma.getLocalPaintStyles();
const textStyles = figma.getLocalTextStyles();
const effectStyles = figma.getLocalEffectStyles();
const gridStyles = figma.getLocalGridStyles();
return {
colors: paintStyles.map(s => ({
name: s.name,
type: s.paints[0]?.type,
value: paintToHex(s.[])
})),
: textStyles.( ({
: s.,
: s..,
: s.,
: s.
})),
: effectStyles.( ({
: s.,
: s.
})),
: gridStyles.( ({
: s.,
: s.
}))
};
}
() {
collections = figma..();
collections.( ({
: collection.,
: collection.,
: collection..( {
variable = figma..(id);
{
: variable?.,
: variable?.,
: variable?.
};
})
}));
}
() {
components = figma..(
node. ===
) [];
components.( ({
: comp.,
: comp..,
: .(comp. || {})
}));
}
ui.html – Plugin UI (React-based):
// Send extraction request
window.parent.postMessage(
{ pluginMessage: { type: 'extract-styles' } },
'*'
);
// Receive extraction results
window.onmessage = (event) => {
const msg = event.data.pluginMessage;
if (msg.type === 'extraction-complete') {
const designMd = generateDesignMd(msg.data);
const skillMd = generateSkillMd(msg.data);
setDesignContent(designMd);
setSkillContent(skillMd);
}
};
# Design System – [File Name]
## Source
- **File**: [Figma file name]
- **Page**: [Current page]
- **Extracted**: [ISO timestamp]
## Variable Collections
- **Collection Name** (2 modes: Light, Dark)
## Color Tokens
| Token | Value | Type |
|-------|-------|------|
| primary/500 | #3B82F6 | solid |
| neutral/900 | #111827 | solid |
## Typography Tokens
| Token | Font Family | Size | Line Height | Weight |
|-------|-------------|------|-------------|--------|
| heading/xl | Inter | 32px | 1.2 | 700 |
| body/md | Inter | 16px | 1.5 | 400 |
## Spacing Tokens
| Token | Value |
|-------|-------|
| spacing/xs | 4px |
| spacing/md | 16px |
## Component Families
- Button (variants: 8)
- Input (variants: 6)
- Card (variants: 4)
# AI Design System Agent – [File Name]
## Mission
Implement UI components that strictly follow the extracted design system from [File Name].
## Brand
- **Product**: [Inferred from file]
- **Audience**: [Inferred context]
- **Surface**: Web/Mobile
## Style Foundations
### Colors
- Primary: #3B82F6
- Semantic: Success (#10B981), Error (#EF4444)
### Typography
- Heading scale: 32/24/20/16px
- Body scale: 16/14/12px
- Font stack: Inter, system-ui, sans-serif
## Accessibility
- WCAG 2.2 AA contrast (4.5:1 text, 3:1 UI)
- Minimum touch target: 44×44px
- Focus indicators required
## Rules: Do
- Use extracted color tokens exactly
- Apply typography tokens for all text
- Respect spacing scale for layout
- Implement all component variants
## Rules: Don't
- Don't invent new colors outside token set
- Don't use arbitrary font sizes
- Don't skip accessibility requirements
// In plugin code
async function extractAndGenerate() {
// Extract all design tokens
const styles = extractLocalStyles();
const variables = extractVariables();
const components = extractComponentFamilies();
// Generate markdown
const designMd = formatDesignMd({ styles, variables, components });
const skillMd = formatSkillMd({ styles, variables, components });
// Send to UI for download
figma.ui.postMessage({
type: 'download-ready',
designMd,
skillMd
});
}
function paintToHex(paint: Paint): string {
if (paint.type === 'SOLID') {
const r = Math.round(paint.color.r * 255);
const g = Math.round(paint.color.g * 255);
const b = Math.round(paint.color.b * 255);
return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`.toUpperCase();
}
return 'gradient';
}
function formatTypographyToken(style: TextStyle) {
const lineHeight = style.lineHeight.unit === 'PIXELS'
? `${style.lineHeight.value}px`
: style.lineHeight.value;
return {
name: style.name,
fontFamily: style.fontName.family,
fontSize: `${style.fontSize}px`,
fontWeight: style.fontWeight,
lineHeight,
letterSpacing: style.letterSpacing
};
}
function extractComponentVariants(componentSet: ComponentSetNode) {
const variants = componentSet.children.map(child => {
if (child.type === 'COMPONENT') {
return {
name: child.name,
properties: child.variantProperties || {}
};
}
}).filter(Boolean);
return {
family: componentSet.name,
count: variants.length,
variants
};
}
DESIGN.md and SKILL.md in project root@SKILL.md implement a button component following the design system
Using the design tokens in DESIGN.md, create a React component
for [Component Name] that:
- Uses color tokens from primary palette
- Applies typography token heading/md
- Respects spacing/md for padding
- Implements all variants listed in Component Families
The plugin reads Figma's native structures—no external configuration required. All extraction is based on:
Problem: Plugin returns empty DESIGN.md
Solution: Ensure you have local styles created in Figma. Shared library styles are not extracted—only local file styles.
// Check for local styles
const paintStyles = figma.getLocalPaintStyles();
if (paintStyles.length === 0) {
console.warn('No local paint styles found in this file');
}
Problem: Variable collections missing from output
Solution: Verify variables are created as local collections, not external libraries.
const collections = figma.variables.getLocalVariableCollections();
console.log('Found collections:', collections.length);
Problem: TypeScript compilation fails
Solution: Ensure Figma plugin types are installed:
npm install --save-dev @figma/plugin-typings
Update tsconfig.json:
{
"compilerOptions": {
"types": ["@figma/plugin-typings"]
}
}
Problem: "Failed to load manifest" error
Solution: Check manifest.json structure:
{
"name": "Design MD Skill Generator",
"id": "YOUR_PLUGIN_ID",
"api": "1.0.0",
"main": "code.js",
"ui": "ui.html",
"editorType": ["figma"]
}
Run extraction on finalized designs – Ensure your local styles and variables are complete before generating files
Name tokens consistently – Use / separators for token hierarchy (e.g., color/primary/500)
Version control generated files – Commit DESIGN.md and SKILL.md alongside design system code
Update after design changes – Re-run extraction when design tokens change
Combine with component library – Use generated files as source of truth for design token implementation