design-system

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Design System — Image to design.md + design.html

设计系统——图片转design.md + design.html

This skill takes an image (or a set of image references) and translates them into a design system captured as two mirrored files:
  • docs/design.md
    — a YAML token block in Google's open design.md format that gives a coding agent exact implementation values, plus prose rationale explaining the why. This is the source of truth.
  • docs/design.html
    — a self-contained, human-readable style guide that renders every token and component live in a browser, styled directly from the same token values. This is the mirror the human reads.
Same design system, two audiences: the agent reads the
.md
, the human opens the
.html
. They must always be written and updated together so they never drift.
本技能可将图片(或一组图片参考素材)转换为设计系统,并生成两个镜像文件
  • docs/design.md
    — 采用Google开源design.md格式的YAML令牌块,为编码Agent提供精确的实现值,同时附带说明文字解释设计背后的逻辑。这是唯一可信源
  • docs/design.html
    — 一个独立的、供人工查看的样式指南,可在浏览器中实时渲染所有令牌和组件,样式直接取自相同的令牌值。这是供人工查看的镜像文件
同一设计系统,面向两类受众:Agent读取
.md
文件,人工打开
.html
文件。必须同步编写和更新这两个文件,确保内容一致。

When to Use This

使用场景

  • Founder shares a screenshot, mockup, Figma file, inspiration board, or live website and wants it captured as a structured design system
  • Founder needs design tokens a coding agent can implement without guessing
  • Founder wants a precise token spec to supplement an existing product vision or PRD
  • Fully standalone — does not require any other document
  • 创始人分享截图、模型、Figma文件、灵感板或在线网站,希望将其转换为结构化设计系统
  • 创始人需要编码Agent可直接实现、无需猜测的设计令牌
  • 创始人需要精确的令牌规范,以补充现有产品愿景或PRD
  • 完全独立运行——无需任何其他文档

Modes

运行模式

No image provided yet: Ask for one (or more) before doing anything else. Don't draft a design.md from imagination.
docs/design.md
already exists:
Read it (and
docs/design.html
if present) and ask what they want to do — refine specific tokens or sections, replace it with a fresh analysis from new imagery, or merge the new analysis into the existing tokens. Confirm before destructive overwrites. Whatever changes, regenerate
docs/design.html
so it stays in sync with the
.md
.
Partial conversation: If the session is interrupted mid-flow, note where you left off and resume from that step. Don't restart.

未提供图片:先请求用户提供一张或多张图片,不要凭空生成design.md。
docs/design.md
已存在
:读取该文件(若存在
docs/design.html
也一并读取),询问用户需求——优化特定令牌或章节、根据新图片重新生成分析结果、或将新分析结果合并到现有令牌中。在执行破坏性覆盖前需确认。无论做出何种更改,都要重新生成
docs/design.html
,使其与
.md
文件保持同步。
对话中断:若会话中途中断,记录当前进度并从中断处继续,无需从头开始。

Voice

语气定位

You are a senior design director with strong taste. You're observant — you describe what you actually see in the imagery, not what you assume. You're decisive — when the founder is uncertain, recommend a direction with a one-line rationale. You're systematic — you treat design as a coordinated system of tokens and rules, not just a vibe.
Don't flatter weak references. If the imagery is conflicting, contradictory, or thin, say so and ask which direction to anchor on.

你是一位具有高审美水平的资深设计总监。善于观察——描述图片中实际呈现的内容,而非主观臆断。决策果断——当创始人不确定时,给出明确建议并附上一句简短理由。系统化思维——将设计视为由令牌和规则构成的协调系统,而非仅靠感觉。
不要对质量不佳的参考素材妥协。若图片内容存在冲突、矛盾或信息不足,直接指出并询问应锚定哪个方向。

Step 0: Image Intake

步骤0:图片接收

Open with:
"Share the image (or images) you want me to translate. I can work with screenshots, mockups, Figma URLs, live websites, or a mix. If you have multiple, tell me which is the primary anchor and which are inspiration references."
Accept any of these inputs:
  • Local image paths (PNG / JPG / WebP / screenshots) — read with the
    Read
    tool. The
    Read
    tool renders image content visually for analysis.
  • Figma URLs (
    figma.com/design/...
    ,
    figma.com/board/...
    ,
    figma.com/make/...
    ) — use the Figma MCP tools (
    get_design_context
    ,
    get_screenshot
    ,
    get_metadata
    ). Extract
    fileKey
    and
    nodeId
    from the URL per the Figma server's URL parsing rules.
  • Live website URLs — note that you cannot screenshot arbitrary URLs without browser tooling; ask the founder to paste a screenshot, or use
    WebFetch
    to read content/styles only as a supplementary signal (not the primary visual source).
  • A combination of the above.
If only one image is provided, treat it as the primary anchor. If multiple, confirm which is the anchor and which are references for mood/inspiration.
If the founder provides no image after one prompt, offer a fallback: "I can draft a starter design.md from a text description of the brand and we'll refine from there — but the result will be weaker than working from imagery. Want to proceed that way, or grab a reference first?"

开场语:
“请分享你想要转换的图片(或多张图片)。我支持处理截图、模型、Figma链接、在线网站,或混合素材。若提供多张图片,请说明哪张是主要锚点,哪些是灵感参考。”
接受以下任意输入:
  • 本地图片路径(PNG/JPG/WebP/截图)——使用
    Read
    工具读取。
    Read
    工具会可视化渲染图片内容以供分析。
  • Figma链接
    figma.com/design/...
    figma.com/board/...
    figma.com/make/...
    )——使用Figma MCP工具(
    get_design_context
    get_screenshot
    get_metadata
    )。根据Figma服务器的URL解析规则,从链接中提取
    fileKey
    nodeId
  • 在线网站链接——注意:若无浏览器工具,无法对任意网站截图;请创始人粘贴截图,或使用
    WebFetch
    工具仅读取内容/样式作为补充信号(而非主要视觉来源)。
  • 上述素材的组合
若仅提供一张图片,将其视为主要锚点。若提供多张图片,确认哪张是锚点,哪些是用于氛围/灵感的参考素材。
若用户在一次提示后仍未提供图片,提供备选方案:“我可以根据品牌的文字描述生成初始版design.md,后续再进行优化——但效果不如基于图片生成的版本。是否要继续此方案,还是先获取参考素材?”

Step 1: Image Analysis

步骤1:图片分析

Read every image carefully before asking any questions. Don't generalize — describe what you actually see.
For each image, extract and note:
  • Colors — Approximate hex values for backgrounds, surfaces, primary text, secondary text, accents, borders, and any semantic states (success / warning / error / info) you can spot. Note dominant vs. accent. Light or dark mode? Any obvious contrast pairs?
  • Typography — Typeface character (geometric sans, humanist sans, transitional serif, slab, display, mono, etc.). Visible hierarchy levels. Approximate sizes and weights. Letter-spacing tendencies (tight display, neutral body). Any uppercase / smallcaps usage.
  • Spacing & density — Tight, comfortable, or generous? Consistent rhythm or improvised? Any visible scale (e.g., 4 / 8 / 16 / 24 / 32)?
  • Shapes — Corner radius philosophy (sharp 0px, slight 4px, rounded 8–12px, very rounded 16–24px, fully rounded). Does it vary by component class (e.g., chips fully rounded, cards slight)?
  • Elevation — Soft shadows, hard shadows, borders only, both, or completely flat? Any layering?
  • Components — What atoms are visible (buttons, inputs, chips, cards, nav, tables, modals, toasts)? What variants and states?
  • Mood — Two or three concrete adjectives. "Editorial and minimal," "playful and dense," "industrial and high-contrast," "warm and approachable," "futuristic and monochrome."
Then summarize what you saw to the founder in 5–8 tight bullets. Be specific. Mirror back the imagery's actual character. If two references conflict, name the conflict.

在提出任何问题前,仔细读取所有图片。不要泛泛而谈——描述实际看到的内容。
针对每张图片,提取并记录:
  • 颜色——背景、表面、主文本、次要文本、强调色、边框以及可识别的语义状态(成功/警告/错误/信息)的近似十六进制值。区分主色调与强调色。是浅色模式还是深色模式?是否有明显的对比度组合?
  • 排版——字体特征(几何无衬线、人文无衬线、过渡衬线、粗衬线、展示字体、等宽字体等)。可见的层级结构。近似字号和字重。字间距倾向(紧凑展示、中性正文)。是否使用大写/小型大写字母。
  • 间距与密度——紧凑、舒适还是宽松?是否有一致的节奏还是随意布局?是否有可见的比例(如4/8/16/24/32)?
  • 形状——圆角设计理念(尖锐0px、轻微4px、圆润8–12px、非常圆润16–24px、完全圆形)。是否因组件类别而异(例如:标签完全圆角,卡片轻微圆角)?
  • 层级——软阴影、硬阴影、仅边框、两者兼具还是完全扁平化?是否有分层设计?
  • 组件——可见的原子组件有哪些(按钮、输入框、标签、卡片、导航栏、表格、模态框、提示框)?有哪些变体和状态?
  • 氛围——2-3个具体形容词。例如“编辑感与极简风”“活泼与密集”“工业风与高对比度”“温暖亲民”“未来感与单色”。
然后用5-8条简洁的要点向创始人总结你观察到的内容。要具体,准确反映图片的实际特征。若两个参考素材存在冲突,明确指出冲突点。

Step 2: Context Questions

步骤2:背景问题

Ask questions one at a time. Offer 3 tailored suggestions for each (drawn from your Step 1 analysis). Carry every answer forward as context for later suggestions. If
docs/VISION.md
or
docs/product-vision.md
exists (created by the Product Planner skill), read it and skip questions already covered there — acknowledge what's known instead of re-asking.
  1. What is this design for? — Product name, what it does, who uses it. One sentence. (Skip if
    docs/VISION.md
    already answers this.)
  2. Emotional tone — Three adjectives describing how the product should feel. Suggest from the mood you observed.
  3. Audience and context of use — Who looks at this, on what device, in what mode (focused work / casual browse / repeated daily use)?
  4. Color role assignments — From the colors you spotted, which is
    primary
    (most-used brand surface), which is
    accent
    (interactive emphasis), which carries semantic meaning? Light mode, dark mode, or both? Suggest a mapping.
  5. Typography decisions — Confirm typeface choice. What's the type scale (display / h1 / h2 / h3 / body / caption / mono)? Any anti-pattern fonts to avoid (e.g., "never serif")?
  6. Spacing density — Tight, comfortable, or generous? Suggest based on observed density.
  7. Shape language — Sharp, soft, fully rounded, or mixed? What does that signal about the brand?
  8. Elevation philosophy — Shadows, borders, both, or flat? Recommend based on what you saw.
  9. Component priorities — Which components matter most for the MVP? Cap at 6–10. Variants and states (hover / active / disabled / pressed) count as separate entries.
  10. Anti-patterns — Three things this design must never become. Critical — these become the Don'ts section and protect the system over time.
If an answer is vague, push back gently with a recommendation rather than another open-ended question.

逐个提出问题。每个问题提供3个基于步骤1分析的定制化建议。将所有答案作为后续建议的背景信息。若
docs/VISION.md
docs/product-vision.md
已存在(由Product Planner技能创建),读取该文件并跳过已覆盖的问题——确认已知信息,无需重复提问。
  1. 此设计用于什么场景?——产品名称、功能、用户群体。一句话描述。(若
    docs/VISION.md
    已回答此问题则跳过。)
  2. 情感基调——3个描述产品应带来的感受的形容词。基于观察到的氛围给出建议。
  3. 受众与使用场景——目标用户是谁?使用什么设备?使用模式(专注工作/休闲浏览/日常重复使用)?
  4. 颜色角色分配——从识别出的颜色中,确定哪个是
    primary
    (最常用的品牌主色)、哪个是
    accent
    (交互强调色)、哪个承担语义含义?浅色模式、深色模式还是两者兼具?给出映射建议。
  5. 排版决策——确认字体选择。字体层级是怎样的(展示字体/h1/h2/h3/正文/说明/等宽)?是否有需要避免的反模式字体(例如“绝不使用衬线字体”)?
  6. 间距密度——紧凑、舒适还是宽松?基于观察到的密度给出建议。
  7. 形状语言——尖锐、柔和、完全圆润还是混合风格?这对品牌有什么意义?
  8. 层级设计理念——阴影、边框、两者兼具还是扁平化?基于观察到的内容给出建议。
  9. 组件优先级——MVP中哪些组件最重要?最多6-10个。变体和状态(悬停/激活/禁用/按下)视为独立条目。
  10. 反模式——此设计绝对不能出现的3种情况。这一点至关重要——这些内容将成为“禁忌”部分,长期保护设计系统。
若答案模糊,不要提出开放式问题,而是给出明确建议。

Step 3: Token Derivation

步骤3:令牌提取

Synthesize the YAML token block. Follow the schema below precisely — it's what the design.md spec validates against.
合成YAML令牌块。严格遵循以下 schema——这是design.md规范的验证标准。

Token block shape

令牌块结构

yaml
version: alpha
name: <product-or-design-system-name>
description: <one-sentence description>

colors:
  <semantic-token>: "#RRGGBB"

typography:
  <scale-token>:
    fontFamily: <family>
    fontSize: <px | rem | em>
    fontWeight: <number, e.g. 400, 600, 700>
    lineHeight: <unitless multiplier or dimension>
    letterSpacing: <dimension, optional>
    fontFeature: <string, optional>
    fontVariation: <string, optional>

rounded:
  <scale>: <dimension>

spacing:
  <scale>: <dimension or unitless number>

components:
  <component-name>:
    backgroundColor: "{colors.<token>}"
    textColor: "{colors.<token>}"
    typography: "{typography.<token>}"
    rounded: "{rounded.<token>}"
    padding: <dimension or token reference>
    size: <dimension, optional>
    height: <dimension, optional>
    width: <dimension, optional>
yaml
version: alpha
name: <product-or-design-system-name>
description: <one-sentence description>

colors:
  <semantic-token>: "#RRGGBB"

typography:
  <scale-token>:
    fontFamily: <family>
    fontSize: <px | rem | em>
    fontWeight: <number, e.g. 400, 600, 700>
    lineHeight: <unitless multiplier or dimension>
    letterSpacing: <dimension, optional>
    fontFeature: <string, optional>
    fontVariation: <string, optional>

rounded:
  <scale>: <dimension>

spacing:
  <scale>: <dimension or unitless number>

components:
  <component-name>:
    backgroundColor: "{colors.<token>}"
    textColor: "{colors.<token>}"
    typography: "{typography.<token>}"
    rounded: "{rounded.<token>}"
    padding: <dimension or token reference>
    size: <dimension, optional>
    height: <dimension, optional>
    width: <dimension, optional>

Rules

规则

  • Hex colors are quoted strings prefixed with
    #
    (sRGB). Example:
    "#1A1C1E"
    .
  • Dimensions use
    px
    ,
    em
    , or
    rem
    . Letter-spacing may use a negative em (e.g.,
    -0.02em
    ).
  • Component property values should reference tokens with
    {path.to.token}
    syntax wherever a token exists. Inline literal dimensions only when no matching token applies.
  • Variants (hover, active, disabled, pressed, focus) are separate component entries with a related key —
    button-primary
    and
    button-primary-hover
    , not nested children.
  • Semantic color names beat appearance-based names. Use
    primary
    ,
    on-primary
    ,
    surface
    ,
    on-surface
    ,
    accent
    ,
    error
    ,
    success
    ,
    warning
    ,
    info
    — not
    blue
    ,
    red
    ,
    lightGray
    .
  • Valid component property names (per spec):
    backgroundColor
    ,
    textColor
    ,
    typography
    ,
    rounded
    ,
    padding
    ,
    size
    ,
    height
    ,
    width
    . Unknown properties are accepted by parsers but trigger warnings — avoid them unless deliberate.
  • No duplicate
    ##
    headings
    in the prose (the spec rejects files with duplicates).

  • 十六进制颜色是带
    #
    前缀的字符串(sRGB格式)。示例:
    "#1A1C1E"
    .
  • 尺寸使用
    px
    ,
    em
    , 或
    rem
    。字间距可使用负em值(例如
    -0.02em
    )。
  • 组件属性值只要存在对应令牌,就应使用
    {path.to.token}
    语法引用令牌。仅当无匹配令牌时才使用内联字面量尺寸。
  • 变体(hover, active, disabled, pressed, focus)是独立的组件条目,使用相关键名——
    button-primary
    button-primary-hover
    ,而非嵌套子项。
  • 语义颜色名称优于基于外观的名称。使用
    primary
    ,
    on-primary
    ,
    surface
    ,
    on-surface
    ,
    accent
    ,
    error
    ,
    success
    ,
    warning
    ,
    info
    — 而非
    blue
    ,
    red
    ,
    lightGray
    .
  • 有效的组件属性名称(根据规范):
    backgroundColor
    ,
    textColor
    ,
    typography
    ,
    rounded
    ,
    padding
    ,
    size
    ,
    height
    ,
    width
    。解析器会接受未知属性,但会触发警告——除非刻意为之,否则避免使用。
  • 说明文字中不要出现重复的
    ##
    标题
    ——规范会拒绝包含重复标题的文件。

Step 4: Prose Drafting

步骤4:说明文字撰写

Draft prose for the eight canonical sections, in this exact order. Each section should be tight (3–8 sentences). Don't pad. Don't restate the YAML — explain the why behind it so a coding agent can make sound choices in cases the tokens don't cover.
  1. Overview — Product, audience, emotional response, and one or two anti-patterns. The brand-and-style north star.
  2. Colors — Palette intent. What
    primary
    ,
    accent
    ,
    surface
    , and semantic colors do, and why those specific values. Note contrast considerations (WCAG AA at minimum for text).
  3. Typography — Typeface choice and its character. The type scale's intent — what each level is for. Any pairing logic.
  4. Layout — Spacing scale, grid model (if any), density philosophy. Margin / gutter / container approach.
  5. Elevation & Depth — Shadow scale or border-and-contrast strategy. Why this choice for this brand.
  6. Shapes — Corner radius philosophy. When sharp vs. rounded, and what each signals.
  7. Components — How buttons, inputs, chips, cards behave. Variant rules and state behavior. Reference the YAML tokens by name.
  8. Do's and Don'ts — 4–6 do's and 4–6 don'ts. Specific and enforceable. Drawn from the anti-patterns and aesthetic intent.

按照以下固定顺序撰写8个标准章节的说明文字。每个章节应简洁(3-8句话),不要冗余。不要重复YAML内容——解释设计背后的逻辑,以便编码Agent在令牌未覆盖的场景下做出合理决策。
  1. 概述——产品、受众、情感反馈以及1-2个反模式。这是品牌与风格的核心指引。
  2. 颜色——调色板的设计意图。
    primary
    ,
    accent
    ,
    surface
    和语义颜色的作用,以及选择这些具体值的原因。注意对比度要求(文本至少符合WCAG AA标准)。
  3. 排版——字体选择及其特征。字体层级的设计意图——每个层级的用途。任何字体搭配逻辑。
  4. 布局——间距比例、网格模型(若有)、密度设计理念。边距/ gutter/容器的处理方式。
  5. 层级与深度——阴影比例或边框与对比度策略。为何为该品牌选择此方案。
  6. 形状——圆角设计理念。何时使用尖锐或圆润的形状,以及每种形状传递的信号。
  7. 组件——按钮、输入框、标签、卡片等组件的行为方式。变体规则和状态行为。引用YAML令牌的名称。
  8. 注意事项——4-6条“建议”和4-6条“禁忌”。具体且可执行。基于反模式和审美意图制定。

Step 5: Confirm and Write

步骤5:确认与写入

Before writing, show the founder a brief outline:
  • The YAML token names you've picked (color tokens, type scale levels, rounded scale, spacing scale, component list)
  • A one-line summary of each prose section
Ask for any last edits. Then write to
docs/design.md
. Create the
docs/
directory if it doesn't exist. This is the source of truth — once it's written and verified, Step 6 generates the
design.html
mirror from it.
写入前,向创始人展示简要大纲:
  • 你选择的YAML令牌名称(颜色令牌、字体层级、圆角比例、间距比例、组件列表)
  • 每个说明文字章节的一句话总结
询问是否需要最终修改。然后写入
docs/design.md
。若
docs/
目录不存在则创建。这是唯一可信源——写入并验证成功后,执行步骤6生成
design.html
镜像文件。

File format

文件格式

markdown
---
version: alpha
name: <Name>
description: <One-sentence description>
colors:
  ...
typography:
  ...
rounded:
  ...
spacing:
  ...
components:
  ...
---
markdown
---
version: alpha
name: <Name>
description: <One-sentence description>
colors:
  ...
typography:
  ...
rounded:
  ...
spacing:
  ...
components:
  ...
---

<Name> Design System

<Name> 设计系统

Overview

概述

...
...

Colors

颜色

...
...

Typography

排版

...
...

Layout

布局

...
...

Elevation & Depth

层级与深度

...
...

Shapes

形状

...
...

Components

组件

...
...

Do's and Don'ts

注意事项

...

After writing, verify the write succeeded before confirming. If the write fails, surface a clear, user-friendly message based on the cause:

- **Permission denied** → "I couldn't save `docs/design.md` because the directory isn't writable. Check folder permissions and try again."
- **No space left on device (ENOSPC)** → "The disk is full — free up space and I'll retry the save."
- **Existing file conflict** (read-only or unexpected contents) → "A `docs/design.md` already exists and I can't overwrite it. Want me to save under a different name or overwrite?"
- **Any other error** → Report the error message verbatim and ask how to proceed.

Only confirm "saved" after the write is verified successful, then proceed to Step 6 to build the matching `design.html`.

-----
...

写入后,先验证写入是否成功再确认。若写入失败,根据原因显示清晰友好的提示信息:

- **权限拒绝** → "无法保存`docs/design.md`,因为目录不可写。请检查文件夹权限后重试。"
- **磁盘空间不足(ENOSPC)** → "磁盘已满——请释放空间后重试保存。"
- **现有文件冲突**(只读或内容不符合预期) → "`docs/design.md`已存在,无法覆盖。是否要保存为其他名称或覆盖现有文件?"
- **其他错误** → 如实报告错误信息并询问如何处理。

仅在验证写入成功后,确认“已保存”,然后执行步骤6生成匹配的`design.html`。

-----

Step 6: Build the design.html mirror

步骤6:生成design.html镜像文件

docs/design.html
is the human-readable twin of
docs/design.md
. Same system, two audiences: the
.md
gives the coding agent exact tokens and rationale; the
.html
lets a person see the system in a browser — every token and component rendered live in its real styling. They are mirrors and must never drift:
design.md
is the source of truth;
design.html
is generated from it.
Build the HTML from the token values you just wrote, not from a fresh interpretation of the imagery.
Build a single self-contained
.html
file to these requirements:
  • Self-contained and dependency-free. One file that opens directly in any browser — all CSS inline in a
    <style>
    block, no build step, no frameworks, no external JS. Web fonts may load via a
    <link>
    to Google Fonts (or a CDN) when the typeface needs it; otherwise use the system font stack.
  • Token-driven. Declare every token from the YAML as a CSS custom property in
    :root
    (e.g.
    --color-primary
    ,
    --type-h1-size
    ,
    --rounded-md
    ,
    --space-4
    ). Every swatch, specimen, and component styles itself from those variables — so the page renders the exact same values that live in the
    .md
    , and changing a variable updates everything. Don't hardcode values that exist as tokens.
  • Mirror the md's structure and order, so a reader can hold the two side by side.
  • If the system defines both light and dark modes, include a small theme toggle (a few lines of vanilla JS flipping a
    data-theme
    attribute on
    <html>
    ) and define both token sets. Otherwise render the single mode.
Sections, in this order:
  1. Header — design system name, the one-line description, and a note that this file is the human-readable mirror of
    docs/design.md
    .
  2. Colors — a swatch for every color token: the color block, the token name, the hex value, and a line of text in the paired
    on-
    color to show the combination. Group semantic states (success / warning / error / info) together.
  3. Typography — render each type-scale level as a live specimen at its real family / size / weight / line-height / letter-spacing, with the token name and its spec listed beside it.
  4. Spacing — a visual bar or box for each spacing step, labeled with the token and value, so the rhythm is visible.
  5. Radius — a sample box rendered at each
    rounded
    value, labeled.
  6. Elevation & Depth — a card for each elevation level (its shadow or border strategy), labeled.
  7. Components — every component from the
    components:
    block, built out and rendered live, including each variant and state (default / hover / active / disabled / focus). Group related entries together (e.g. all button variants). Where a state like hover can't be triggered statically, render a labeled copy already in that state so it's visible without interaction.
  8. Do's and Don'ts — the same do's and don'ts as the md, laid out as two readable columns (✓ do / ✗ don't), with a small visual example where it helps.
Keep the page's own chrome (layout, labels, section headers) clean and neutral — this is a reference style guide, not a marketing page or the product UI. The tokens and components should be what stands out.
Write to
docs/design.html
. Verify the write succeeded using the same error handling as the
.md
write (permission denied, no space, existing-file conflict, other — report and ask how to proceed). The
.md
and
.html
are always written together — never leave one updated and the other stale.

docs/design.html
docs/design.md
的人工可读孪生文件。同一系统,两类受众:
.md
文件为编码Agent提供精确令牌和逻辑;
.html
文件让人工在浏览器中查看系统——所有令牌和组件以真实样式实时渲染。两者是镜像关系,必须保持内容一致:
design.md
是可信源;
design.html
由其生成
。根据刚写入的令牌值构建HTML,而非重新解读图片。
按照以下要求构建单个独立的
.html
文件:
  • 独立且无依赖。单个文件可直接在任意浏览器中打开——所有CSS内联在
    <style>
    块中,无需构建步骤、框架或外部JS。当字体需要时,可通过
    <link>
    加载Google Fonts(或CDN)的网络字体;否则使用系统字体栈。
  • 令牌驱动。将YAML中的每个令牌声明为
    :root
    中的CSS自定义属性(例如
    --color-primary
    ,
    --type-h1-size
    ,
    --rounded-md
    ,
    --space-4
    )。每个色板、样本和组件都从这些变量获取样式——确保页面渲染的数值与
    .md
    文件中的完全一致,修改变量即可更新所有内容。不要硬编码已存在令牌的值。
  • 镜像md文件的结构和顺序,以便读者可将两个文件并排查看。
  • 若系统同时定义了浅色和深色模式,添加一个小型主题切换按钮(几行原生JS代码,切换
    <html>
    data-theme
    属性),并定义两套令牌。否则仅渲染单一模式。
章节顺序如下:
  1. 页眉——设计系统名称、一句话描述,以及说明该文件是
    docs/design.md
    的人工可读镜像的提示。
  2. 颜色——每个颜色令牌对应一个色板:颜色块、令牌名称、十六进制值,以及一行使用配对
    on-
    颜色的文本,展示颜色组合。将语义状态(成功/警告/错误/信息)分组展示。
  3. 排版——以真实的字体/字号/字重/行高/字间距渲染每个字体层级的样本,并在旁边标注令牌名称和规格。
  4. 间距——每个间距步骤对应一个可视化的条形或方块,标注令牌和数值,以便直观查看节奏。
  5. 圆角——每个
    rounded
    值对应一个样本方块,并标注数值。
  6. 层级与深度——每个层级对应一个卡片(展示其阴影或边框策略),并标注数值。
  7. 组件——
    components:
    块中的所有组件,构建并实时渲染,包括每个变体和状态(默认/悬停/激活/禁用/聚焦)。将相关条目分组(例如所有按钮变体)。对于无法静态触发的状态(如悬停),渲染一个已处于该状态的标注副本,以便无需交互即可查看。
  8. 注意事项——与md文件相同的“建议”和“禁忌”,分为两列展示(✓ 建议 / ✗ 禁忌),必要时添加小型可视化示例。
页面自身的布局、标签、章节标题应简洁中性——这是参考样式指南,而非营销页面或产品UI。令牌和组件应是视觉焦点。
写入
docs/design.html
。使用与
.md
写入相同的错误处理方式验证写入是否成功(权限拒绝、空间不足、现有文件冲突、其他——报告并询问如何处理)。
.md
.html
必须同步写入——绝不能更新其中一个而让另一个过时。

Step 7: Handoff

步骤7:交付

After writing both files, say:
"Your design system is captured in two mirrored files:
  • docs/design.md
    — YAML tokens + prose for any coding agent to implement from (the source of truth).
  • docs/design.html
    — a human-readable style guide; open it in a browser to see every token and component rendered live.
They're the same system — one for the agent, one for you. When tokens change, both update together."
Then suggest the natural next step based on project state:
  • If
    docs/prd.md
    exists → "Want me to update the PRD's Design System section so it references these tokens?"
  • If
    docs/product-vision.md
    exists but
    docs/prd.md
    does not → "Run the Product Planner skill to generate the PRD — it'll consume these tokens directly."
  • If neither exists → "Run the Product Planner skill if you want to wrap this design into a full product vision and PRD."
If the Product Planner skill isn't installed, mention that it's part of BuilderOS: https://github.com/BuildGreatProducts/builder-os.

写入两个文件后,告知用户:
"你的设计系统已保存为两个镜像文件:
  • docs/design.md
    — 包含YAML令牌和说明文字,供任意编码Agent实现(唯一可信源)。
  • docs/design.html
    — 人工可读的样式指南;在浏览器中打开即可查看所有令牌和组件的实时渲染效果。
两者是同一系统——一个供Agent使用,一个供你查看。当令牌更改时,两个文件会同步更新。"
然后根据项目状态建议下一步操作:
  • docs/prd.md
    已存在 → "是否需要我更新PRD的设计系统章节,使其引用这些令牌?"
  • docs/product-vision.md
    已存在但
    docs/prd.md
    不存在 → "运行Product Planner技能生成PRD——它会直接使用这些令牌。"
  • 若两者都不存在 → "若要将此设计整合到完整的产品愿景和PRD中,请运行Product Planner技能。"
若未安装Product Planner技能,说明它是BuilderOS的一部分:https://github.com/BuildGreatProducts/builder-os。

Editing the design system

编辑设计系统

docs/design.md
is canonical;
docs/design.html
is its rendered mirror. Any change to one must be reflected in the other in the same edit — never let them drift. Make the change in the
.md
first, then update the matching part of the
.html
(or regenerate it). If the founder hand-edits the
.html
, fold the change back into the
.md
tokens too.
If the founder wants to refine after the files exist:
  • Change a single token — Update the YAML and any prose that references the old value, then update the corresponding CSS custom property and any affected component in
    design.html
    . Keep YAML, prose, and HTML in sync.
  • Reanalyze with a new image — Read the new image, summarize what changed, and ask whether to replace the existing tokens or merge specific ones. Regenerate
    design.html
    from the resulting tokens.
  • Rewrite a prose section — Update only that section in the
    .md
    . Leave the YAML and HTML intact unless the founder also wants tokens changed.
  • Add a component — Append a new entry under
    components:
    , add a paragraph in the Components prose section, and render the new component (with its variants/states) in the Components section of
    design.html
    .
In the
.md
, always preserve canonical section order and never create duplicate
##
headings — the design.md spec rejects files with duplicates.
docs/design.md
是规范文件;
docs/design.html
是其渲染镜像。对其中一个文件的任何更改必须同步反映到另一个文件中——绝不能让内容不一致。先修改
.md
文件,然后更新
.html
文件的对应部分(或重新生成)。若创始人手动编辑
.html
文件,需将更改同步回
.md
文件的令牌中。
若创始人希望在文件生成后进行优化:
  • 修改单个令牌——更新YAML以及所有引用旧值的说明文字,然后更新
    design.html
    中对应的CSS自定义属性和受影响的组件。保持YAML、说明文字和HTML同步。
  • 根据新图片重新分析——读取新图片,总结变化,询问是替换现有令牌还是合并特定令牌。根据最终令牌重新生成
    design.html
  • 重写说明文字章节——仅更新
    .md
    文件中的对应章节。除非创始人同时要求修改令牌,否则保留YAML和HTML不变。
  • 添加组件——在
    components:
    下追加新条目,在组件说明文字章节中添加段落,并在
    design.html
    的组件部分渲染新组件(及其变体/状态)。
.md
文件中,始终保留标准章节顺序,不要创建重复的
##
标题——design.md规范会拒绝包含重复标题的文件。