extract-design-md

视觉设计 / 插画 界面 · 动效 · 设计品味 7 文件 EN 原文

Extract a comprehensive design system (DESIGN.md

Extract a comprehensive design system (DESIGN.md) directly from frontend source code — React, Vue, Svelte, Angular, plain HTML/CSS, or any web framework. Analyzes component files, stylesheets, Tailwind configs, theme definitions, and design tokens to produce a rich, Stitch-compatible design system document. Use this skill whenever the user wants to reverse-engineer a design system from an existing codebase, audit the visual language of a project, extract design tokens from source files, or understand the styling patterns in a frontend repo — even if they just say "what does this app look like?" or "pull out the design from this code."

说明语言:英文

来源google-labs-codestitch-skills ↗ 查看原文件 ↗版权归原作者,请遵循原仓库许可
安装
npx skills add https://github.com/google-labs-code/stitch-skills --skill extract-design-md

需要已安装 skills CLI。也可以直接从源仓库 clone。

在星云中查看 ↗
SKILL.md 原文

name: stitch::extract-design-md description: >- Extract a comprehensive design system (DESIGN.md) directly from frontend source code — React, Vue, Svelte, Angular, plain HTML/CSS, or any web framework. Analyzes component files, stylesheets, Tailwind configs, theme definitions, and design tokens to produce a rich, Stitch-compatible design system document. Use this skill whenever the user wants to reverse-engineer a design system from an existing codebase, audit the visual language of a project, extract design tokens from source files, or understand the styling patterns in a frontend repo — even if they just say "what does this app look like?" or "pull out the design from this code." allowed-tools:


Extract Design System from Frontend Code

Analyze frontend source code to extract a comprehensive design system document (DESIGN.md) that captures the project's visual language — colors, typography, spacing, component patterns, and layout principles — directly from the source files, without needing to build or render the application.

Why This Exists

The design-md skill works from rendered HTML. But often you have a codebase and want to understand its design system before you can even run the app — maybe dependencies are missing, the build is broken, or you just want a quick audit. This skill reads the source files themselves: stylesheets, component files, theme configs, and Tailwind setups. It's faster and works anywhere.

When to Use

Prerequisites


Workflow

Phase 1: Project Discovery

Start by understanding what you're working with. This determines which extraction patterns to use.

1. Detect the Framework and Stack

Scan the project root for telltale files:

Signal FileFramework / Tool
package.json with reactReact / Next.js
package.json with vueVue / Nuxt
package.json with svelteSvelte / SvelteKit
package.json with @angular/coreAngular
tailwind.config.js/tsTailwind CSS
postcss.config.jsPostCSS pipeline
styled-components or @emotion in depsCSS-in-JS
.css / .scss / .less files onlyPlain CSS / SASS
theme.js / theme.ts / tokens.jsDesign token files

Read package.json first — it reveals the framework, CSS tooling, and any design-token libraries (e.g., style-dictionary, @chakra-ui/react, @mui/material, ant-design). This context tells you where to look for styling information.

2. Map the Source Tree

Identify the key directories and files you'll analyze:

src/
├── components/     ← Component-level styles
├── styles/         ← Global stylesheets
├── theme/          ← Theme definitions, tokens
├── assets/         ← Fonts, images
├── app.css         ← Root styles
└── index.css       ← Entry CSS

Also check for:

3. Read Framework-Specific Guidance

Consult the appropriate reference for extraction patterns:

These references contain framework-specific patterns for locating colors, typography, spacing, and component styles. Read the one that matches before proceeding.


Phase 2: Deep Extraction

Work through each design dimension systematically. For each one, gather raw data from the source files, then synthesize it into descriptive language.

The goal isn't to dump every CSS property — it's to understand the intent behind the styling choices and describe them in human, editorial language that another designer (or Stitch) can use to recreate the same visual feel.

1. Visual Theme & Atmosphere

Read the broadest styling first to understand the overall mood:

Look for these signals in the source:

Source LocationWhat It Tells You
Root background-color or Tailwind bg-* on layoutsOverall lightness/darkness
Spacing scale in Tailwind config or CSS varsWhitespace philosophy
Number of components vs. wrapper paddingDensity
Custom property naming (--warm- vs --cool-)Color temperature intent
Comments in theme filesDesign intent in the developer's own words

2. Color Palette & Roles

Extract every unique color from the codebase and assign functional roles. Search across all layers:

Where to find colors:

LayerWhat to Search
CSS custom properties--color-, --primary, --bg-
Tailwind configtheme.extend.colors
Theme/token filesColor objects, palettes
Component stylesbackground-color, color, border-color
Inline/scoped stylesbg-, text- classes in templates
CSS-in-JS theme objectscolors, palette keys

How to organize: Group colors by function, not by hue:

  1. Primary Foundation — Background and surface colors
  2. Accent & Interactive — CTA buttons, active states, links
  3. Typography & Text Hierarchy — Primary, secondary, tertiary text
  4. Functional States — Success, error, warning, info

For each color, create a descriptive name that evokes the color's character rather than its raw hex value:

Deduplication matters. Codebases often have near-duplicate colors (e.g., #333 and #2C2C2C). Consolidate them under one name that best represents the intended color.

3. Typography Rules

Extract the complete typographic system:

Font families:

Type scale (hierarchy):

Spacing principles:

4. Component Stylings

Analyze the 4-5 most important UI primitives:

Buttons:

Cards / Containers:

Navigation:

Inputs & Forms:

Domain-Specific Components:

5. Layout Principles

Extract the structural system:

Grid & Structure:

Whitespace Strategy:

Alignment & Visual Balance:

Responsive Behavior:

6. Stitch Generation Notes

Synthesize the extraction into actionable prompts for Stitch:


Phase 3: Write the DESIGN.md

Assemble everything into the standard DESIGN.md format. Place it at .stitch/DESIGN.md in the project directory (create the .stitch/ directory if it doesn't exist).

[!IMPORTANT] You MUST include the YAML frontmatter at the top of the file with name and colors mapping, exactly as shown in the example at examples/DESIGN.md. This structured data is required for other skills to parse the design system. Failure to include this YAML block with at least the core color tokens is a failure to use this skill correctly.

Use the format from the example at examples/DESIGN.md as your template. The file must start with the YAML block, followed by the markdown sections:

# Design System: [Project Name]
**Project ID:** [If known, otherwise omit]

## 1. Visual Theme & Atmosphere
[Rich 2-paragraph description of mood, philosophy, and key characteristics]

## 2. Color Palette & Roles
### Primary Foundation
### Accent & Interactive
### Typography & Text Hierarchy
### Functional States

## 3. Typography Rules
### Hierarchy & Weights
### Spacing Principles

## 4. Component Stylings
### Buttons
### Cards & [Domain-Specific Containers]
### Navigation
### Inputs & Forms
### [Domain-Specific Components]

## 5. Layout Principles
### Grid & Structure
### Whitespace Strategy
### Alignment & Visual Balance
### Responsive Behavior & Touch

## 6. Design System Notes for Stitch Generation
### Language to Use
### Color References
### Component Prompts
### Incremental Iteration

Phase 4: Integration (Optional)

If the user wants to push the design system into Stitch:

  1. Hand off to the manage-design-system skill for the MCP create/update calls
  2. The DESIGN.md you wrote is the input — the manage-design-system skill handles the Stitch API integration

If the user just wants the document, you're done after Phase 3.


Quality Checklist

Before delivering the DESIGN.md, verify:

Tips for Better Extraction

同类技能
accessibilityaccessibility-complianceanimateanimate-expoanimation-performanceanimation-vocabularyanti-ui-slopapple-design
本页内容来自开源项目 google-labs-code, 版权归原作者所有。
本站仅作技能索引与分享,所有 Skill 版权归其原作者所有。