Generate a DESIGN.md file that conforms to the Stitch (Google Labs) design.md alpha spec. Auto-discovers the project's design tokens, components, and brand context, then emits YAML frontmatter (machine-readable) + 8 standard markdown sections (human-readable). Single source of design truth that Claude Code, Cursor, Stitch, and any AI coding agent understand the same way. Triggers: "create DESIGN.md", "design system docs", "design.md spec", "Stitch-format design doc", "DESIGN.md 만들어줘", "디자인 시스템 문서화", "design.md 스펙", "Stitch 포맷 디자인 문서"
How this skill is triggered — by the user, by Claude, or both
Slash command
/moonklabs-design-system:design-mdThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill follows the **Google Labs [`@google/design.md`](https://github.com/google-labs-code/design.md) alpha spec** verbatim.
This skill follows the Google Labs @google/design.md alpha spec verbatim.
The generated DESIGN.md has two layers:
| Layer | Format | Purpose |
|---|---|---|
| YAML Frontmatter | YAML wrapped in --- | Machine-readable (Stitch, linters, automated exports) |
| Markdown Body | Eight ## h2 sections | Human-readable (design intent, usage guidance) |
Must-haves:
{colors.primary}, {typography.h1}, {spacing.4} (curly braces + dot notation)# + hex (sRGB); dimensions carry px|rem|em unitsWhen invoked, execute the five phases in order.
Scan these patterns in parallel:
# Design-token source candidates
src/design-system/**/*.{ts,js,json}
src/theme/**/*.{ts,js}
src/**/tokens*.{ts,js,json}
tailwind.config.{js,ts,cjs,mjs}
src/**/design-tokens.*
tokens.json
tokens-studio.json
src/**/variables.css
src/**/theme.{ts,js}
# Component location candidates
src/design-system/ui/**/*.{tsx,ts}
src/components/ui/**/*.{tsx,ts}
src/components/**/*.{tsx,ts}
packages/ui/**/*.{tsx,ts}
# Existing design docs
DESIGN.md
docs/design.md
docs/DESIGN-SYSTEM.md
STYLEGUIDE.md
Classify what you find:
source.js, tokens.ts, theme.ts)theme.extend:root { --color-* }createTheme({ palette, typography })From the discovered source, extract:
| Category | Minimum required | Collect if present |
|---|---|---|
| colors | primary | secondary, accent, success, warning, error, info, text/bg/border |
| typography | h1, body | h2–h6, caption, display, numeric |
| spacing | base scale (4/8/16px etc.) | full scale |
| rounded | sm/md/lg | full, xl+ |
| components | button, input, card | project-specific components |
Use AskUserQuestion with up to 4 grouped questions:
Follow this exact order and field set:
---
version: alpha
name: <product-name>
description: >
<2–4 lines. Product identity, target user, core design language.>
colors:
# Brand
primary: "#xxxxxx"
primary-dark: "#xxxxxx"
primary-light: "#xxxxxx"
secondary: "#xxxxxx"
accent: "#xxxxxx"
# Status (4 required)
success: "#xxxxxx"
warning: "#xxxxxx"
error: "#xxxxxx"
info: "#xxxxxx"
# Text (primary/secondary/muted/disabled/inverse — at least 5)
text-primary: "#xxxxxx"
text-secondary: "#xxxxxx"
text-muted: "#xxxxxx"
text-disabled: "#xxxxxx"
text-inverse: "#xxxxxx"
# Background (primary/secondary/hover/selected — at least 4)
bg-primary: "#xxxxxx"
bg-secondary: "#xxxxxx"
bg-hover: "#xxxxxx"
# Border
border: "#xxxxxx"
border-focus: "#xxxxxx"
typography:
# At minimum base + h1–h3; prefer 9–15 levels
caption:
fontFamily: <Font>
fontSize: 1.2rem
fontWeight: 400
lineHeight: 1.4
body:
fontFamily: <Font>
fontSize: 1.4rem
fontWeight: 400
lineHeight: 1.5
h1:
fontFamily: <DisplayFont>
fontSize: 3.2rem
fontWeight: 700
lineHeight: 1.2
letterSpacing: -0.02em
# … h2, h3, numeric variants
rounded:
none: 0
sm: 2px
DEFAULT: 4px
md: 6px
lg: 8px
full: 9999px
spacing:
"0": 0
"1": 4px
"2": 8px
"3": 12px
"4": 16px
"6": 24px
"8": 32px
components:
# One entry per discovered component
button-primary:
backgroundColor: "{colors.primary}"
textColor: "{colors.text-inverse}"
typography: "{typography.body}"
rounded: "{rounded.md}"
height: 40px
padding: 0 16px
button-secondary:
backgroundColor: "{colors.bg-primary}"
textColor: "{colors.primary}"
borderColor: "{colors.primary}"
rounded: "{rounded.md}"
input:
backgroundColor: "{colors.bg-primary}"
borderColor: "{colors.border}"
rounded: "{rounded.DEFAULT}"
height: 40px
card:
backgroundColor: "{colors.bg-primary}"
rounded: "{rounded.lg}"
padding: 20px
---
Token-reference rules:
"{category.name}" formRequired contents per section:
For each major component:
{components.xxx})Order: Button → Input/Field → Select/Combobox → Checkbox → Radio → Modal → Card → Tag → Table → Navigation → Custom
Category coverage:
Include in the Appendix:
npx @google/design.md lint DESIGN.md
npx @google/design.md export --format tailwind DESIGN.md
npx @google/design.md diff DESIGN.md DESIGN-v2.md
Self-validation checklist (must pass before emitting):
---name, colors.primary, and typography are defined{...} token reference points at an existing token# + 6 digits## is the main section levelDefault: <project-root>/DESIGN.md or <project-root>/src/design-system/DESIGN.md
Decision rules:
src/design-system/ already exists → write inside itCLAUDE.md or README/design-md
Scan the current directory → generate DESIGN.md.
/design-md --output src/design-system/DESIGN.md
/design-md --update
Preserve existing DESIGN.md sections, re-extract tokens and components, and merge.
/design-md --skeleton
Skip the interview and generate a placeholder-filled empty template.
{colors.xxx} token references that point at undefined tokensDESIGN.md without backup (confirm before overwriting unless in update mode)On completion, report back in this format:
## ✅ DESIGN.md generated
**Path:** <path>
**Size:** <NNkb, NN lines>
**Spec:** Stitch design.md alpha
### 📊 Extraction results
- Colors: <n> tokens (primary/status/text/bg/border/chart)
- Typography: <n> levels
- Spacing: <n> steps
- Components: <n> components
### ✔️ Self-validation passed
- [x] Frontmatter `---` valid
- [x] Required tokens present (primary)
- [x] 8-section order respected
- [x] Token-reference integrity
- [x] WCAG AA contrast
### 🔍 Next steps
\`\`\`bash
npx @google/design.md lint <path>
\`\`\`
npx claudepluginhub moonklabs/skills --plugin moonklabs-design-systemCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.