跳到正文
cccskills
Google 官方免费在 GitHub 公开

stitch::extract-design-md

Read frontend source code to document colors, typography, spacing, components, and layout rules in DESIGN.md. Use it to understand an existing interface or prepare design guidance for Stitch without building or running the app.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

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."

查看安装方法

适用场景

  • Document an existing app's design system
  • Review styling when the app cannot run
  • Prepare an existing visual identity for Stitch
  • Review inconsistent colors and component styles

包含的文件(7)

  • SKILL.md13.7 KB
  • examples/DESIGN.md6.8 KB
  • references/angular.md5.1 KB
  • references/plain-css.md3.9 KB
  • references/react-tailwind.md4.5 KB
  • references/svelte.md2.7 KB
  • references/vue.md3.0 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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

  • User has a frontend codebase and wants to extract or document its design system
  • User wants to migrate a project's visual identity into Stitch
  • User asks to "audit the styling" or "understand the design language" of a repo
  • User wants to create a DESIGN.md from existing source code
  • The app can't be built/rendered but the source is available
  • User wants to unify or reconcile inconsistent styles across a codebase

Prerequisites

  • Access to the frontend project's source directory
  • No build or runtime dependencies needed — this skill reads source files only

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:

  • tailwind.config.js / tailwind.config.ts — Custom colors, fonts, spacing
  • globals.css / global.css — CSS custom properties (variables)
  • Any theme.* or tokens.* files
  • Component library config (e.g., chakra-theme.ts, vuetify.config.ts)

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:

  • Root background: What's the body or root element background? Light cream (#f-range) signals airy/clean; dark (#0-#2 range) signals moody/dramatic.
  • Whitespace philosophy: Are spacing values generous (32px+) or tight? Check padding/margin values on root containers, section wrappers, and card components.
  • Density: Count the components per page/section. Few with space = minimal; many packed tight = information-dense.
  • Color temperature: Are the neutrals warm (creams, tans) or cool (blue-grays, slates)?
  • Overall feel: Synthesize into 1-2 rich sentences that capture the 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:

  • ❌ #294056 → "Blue"
  • ✅ #294056 → "Deep Muted Teal-Navy" — Primary CTA, active navigation

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:

  • Check CSS font-family, Tailwind fontFamily, Google Fonts links, or local @font-face declarations.
  • Note the character of each font: geometric vs humanist, serif vs sans, the feeling it evokes.

Type scale (hierarchy):

  • Find every heading level (H1-H6) and body text, noting:
    • font-size (in rem or px)
    • font-weight (numeric value + descriptive name)
    • letter-spacing (and why — elegance? compactness?)
    • line-height (generous for readability? tight for display?)
  • Map component usage: Which heading level do product cards use? What about hero sections?

Spacing principles:

  • How does text spacing relate to the overall spacing scale?
  • Letter-spacing patterns on headings vs body
  • Line-height philosophy (generous/relaxed for body, tighter for display)

4. Component Stylings

Analyze the 4-5 most important UI primitives:

Buttons:

  • Corner radius (and what it communicates — playful? professional? minimal?)
  • Color scheme for primary, secondary, and ghost variants
  • Hover/focus/active states and transition timing
  • Padding ratios (horizontal vs vertical)

Cards / Containers:

  • Corner radius (often different from buttons — slightly rounder)
  • Shadow strategy: flat, subtle hover shadows, or always elevated?
  • Border treatment: hairline borders, colored accents, or none?
  • Internal padding (generous or compact?)
  • Image treatment within cards (full-bleed, padded, rounded?)

Navigation:

  • Layout pattern (horizontal bar, vertical sidebar, drawer)
  • Typography treatment (uppercase, letter-spacing, weight)
  • Active/hover state indicators (underline, color, background)
  • Mobile behavior (hamburger, bottom nav, drawer)

Inputs & Forms:

  • Border style and focus state behavior
  • Corner style consistency with buttons
  • Padding and touch-target sizing

Domain-Specific Components:

  • Identify 1-2 components unique to this project (e.g., product cards, dashboard widgets, chat bubbles) and describe their styling patterns.

5. Layout Principles

Extract the structural system:

Grid & Structure:

  • Max content width (from max-width on containers)
  • Column system (CSS Grid, Flexbox patterns, defined breakpoints)
  • Responsive breakpoints (from media queries or Tailwind config)

Whitespace Strategy:

  • Base spacing unit (8px grid? 4px? custom?)
  • Section margins (how much space between major sections)
  • Edge padding (page margins at different breakpoints)

Alignment & Visual Balance:

  • Text alignment patterns (centered heroes, left-aligned body)
  • Image-to-text ratios
  • Visual weight distribution

Responsive Behavior:

  • Mobile-first or desktop-first?
  • How do grids collapse? Padding scale?
  • Touch target sizing

6. Stitch Generation Notes

Synthesize the extraction into actionable prompts for Stitch:

  • Atmosphere language: Translate the mood into natural descriptors
  • Color references: List colors by descriptive name + hex
  • Component prompts: Write 2-3 example prompts that would recreate key components in Stitch
  • Iteration guidance: Tips for refining screens in this design system

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:

  • Every color has a descriptive name, hex code, and functional role
  • Typography includes font family, character description, and full hierarchy
  • Component styles describe shape, color, states, and transitions
  • Layout includes max-width, grid, breakpoints, and spacing strategy
  • Stitch generation notes use natural language, not CSS syntax
  • The atmosphere section reads like editorial copy, not technical docs
  • Near-duplicate colors are consolidated
  • The document captures the intent behind styling, not just raw values

Tips for Better Extraction

  • Read comments and commit messages. Developers often document design intent in code comments (/* hero section — breathable */) and commit messages. These are gold for understanding the why.
  • Check for design-token libraries. If the project uses style-dictionary, @tokens-studio, or similar, these files are the most authoritative source of design values.
  • Theme files are higher-signal than component styles. A theme.ts that defines a palette tells you the intended design system; scattered inline styles in components tell you what actually shipped. Both matter, but start from the theme.
  • Tailwind config is a design system. If a project has a customized tailwind.config.js, that is the design system — extract from it first, then spot-check components for overrides.
  • CSS custom properties are intentional. If a developer defined --brand-primary, they're telling you this is a design token. Respect that.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

design-md

Google 官方免费

Analyze existing Stitch screens and document their colors, typography, components, and layout in DESIGN.md. The resulting design reference combines plain visual descriptions with precise color values to guide requests for new screens.

中文简介正在准备中。当前显示英语简介。

  • Document design rules from an existing screen
  • Prepare a design reference for new screen prompts
  • Record color codes and their functional roles
google-labs-code/stitch-skills85392026年8月18日 更新

enhance-prompt

Google 官方免费

Turn a rough interface idea into a structured prompt for Stitch, with clear page sections, colors, and component details. When available, existing design rules are included to guide consistent screens or focused edits.

中文简介正在准备中。当前显示英语简介。

  • Turn a rough screen idea into a clear prompt
  • Revise a prompt that produced an unsuitable design
  • Include existing design rules in a screen request
google-labs-code/stitch-skills85392026年8月18日 更新

react-vite-dashboard

Google 官方免费

Turn Stitch designs into React and Vite dashboards with reusable components and asynchronous data fetching. It applies shared design settings from DESIGN.md, includes accessibility checks, and supports optional blockchain data reads.

中文简介正在准备中。当前显示英语简介。

  • Build a React dashboard from a Stitch screen
  • Apply shared design settings from DESIGN.md
  • Add data fetching and loading states
google-labs-code/stitch-skills85392026年8月18日 更新

remotion

Google 官方免费

Create walkthrough videos from Stitch app screens using Remotion. Arrange screenshots in sequence, add fades, slides, zoom effects, and explanatory text, then preview the timing and render a video such as an MP4.

中文简介正在准备中。当前显示英语简介。

  • Create an app introduction from Stitch screens
  • Explain a user journey through a sequence of screens
  • Highlight interface features with zoom and labels
google-labs-code/stitch-skills85392026年8月18日 更新

shadcn-ui

Google 官方免费

Find, install, and customize shadcn/ui components for React applications. The skill guides project setup, theme changes, forms, dialogs, and dashboard layouts, with checks for keyboard access, screen reader support, and responsive behavior.

中文简介正在准备中。当前显示英语简介。

  • Add UI components to an existing React project
  • Customize themes and component variants
  • Build forms and dashboard layouts
google-labs-code/stitch-skills85392026年8月18日 更新

site-md

Google 官方免费

Turn site requirements or existing content into a SITE.md project guide for the Stitch Build Loop. It records the site's purpose, visual direction, navigation, file structure, and prioritized tasks to guide successive development rounds.

中文简介正在准备中。当前显示英语简介。

  • Organize a site brief before development
  • Record site purpose and visual direction
  • List completed and planned pages
google-labs-code/stitch-skills85392026年8月18日 更新

查看 google-labs-code 的全部技能

报告此技能的问题