design-system-extraction
Identify design tokens and recurring visual patterns from mockups or screenshots, extract candidate colors, typography, spacing, radii, and shadows, and map them to the host project's existing design system.
- License 许可
- MIT
- 最近更新
- 2026-10-21
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- design-system-extraction
- description
- Identify design tokens and recurring visual patterns from mockups or screenshots, extract candidate colors, typography, spacing, radii, and shadows, and map them to the host project's existing design system.
02 资源文件 3
- 参考文档references/token-mapping-guide.md2.0 KB
- 参考文档references/token-schema.json1.6 KB
- 脚本scripts/inspect-tokens.js1.9 KB
03 SKILL.md 正文
Design System Extraction Skill
Use this skill to extract reusable design tokens and recurring UI patterns from visual references, and harmonize them with the target codebase's existing styling system.
Core Responsibilities
- Token Discovery: Extract candidate colors, spacing, typography scales, radii, and shadows.
- System Harmonization: Inspect the host repository using inspect-tokens.js to reuse existing Tailwind configurations or CSS custom properties.
- Sprawl Prevention: Avoid generating one-off arbitrary values or duplicate variables.
- Structured Token Spec: Output tokens adhering to token-schema.json.
Step-by-Step Procedure
1. Scan Host Codebase for Existing Tokens
Run the token discovery script to locate Tailwind configs and CSS variables:
node skills/design-system-extraction/scripts/inspect-tokens.js [path-to-workspace]
2. Extract Candidate Tokens
Follow the Token Mapping Guide:
- Colors: Isolate primary brand, secondary, neutral surfaces, text contrasts, borders, and status cues.
- Spacing: Align observed paddings and margins to a 4px or 8px grid (
4, 8, 12, 16, 24, 32, 48px). - Typography: Record font families, size ladder, line heights, and weights.
- Radii & Shadows: Record surface corner roundings and elevation depths.
3. Reconcile with Host Design System
- If Tailwind CSS is present: Map colors to Tailwind classes (e.g.
bg-slate-900,text-blue-600) or extendtailwind.config.jstheme tokens cleanly. - If CSS Variables are present: Map properties to
var(--primary),var(--background),var(--radius). - If no system exists: Define a consolidated set of CSS variables in the project's root stylesheet.
4. Output Design Token Specification
Format the extracted tokens into a clear specification matching token-schema.json for consumption by frontend-implementation.
04 同仓库更多 Skills
valid-skill
A valid sample skill used for automated manifest testing and verification.
missing-name
Missing name field
missing-desc
暂无简介
broken-link
Skill containing a broken relative link.
visual-regression-triage
Compare reference mockups against rendered screenshots at matching viewport dimensions, calculate quantitative pixel difference metrics, isolate bounding boxes, filter rendering noise, and triage discrepancies by severity.
visual-refinement-loop
Coordinate the end-to-end visual refinement loop across reconstruction, implementation, browser capture, regression triage, and accessibility auditing, with configurable iteration caps, stagnation detection, and verified run artifacts.