extract-design
БесплатноБез исполняемых скриптовНе проверенExtract a Google DESIGN.md file from an HTML prototype (claude.ai/design or any styled page) using Puppeteer, producing machine-readable tokens and…
от danielvm-git★ 298 звёзд на GitHubОб этом скилле
Extract DESIGN.md from HTML
HARD GATE — Do NOT write DESIGN.md without Puppeteer dual-pass extraction. Tokens from static HTML (Cheerio, regex, string scanning) are invalid — they miss cascade, custom properties, and Tailwind resolution.
HARD GATE — Do NOT claim certainty where evidence is thin. Low-confidence color roles, component classifications, and prose assertions MUST be flagged with
<!-- AGENT NOTE: uncertain — validate during grill-me. Evidence: [what was observed] -->.HARD GATE — Do NOT ship DESIGN.md without running
npx @google/design.md lint. Unvalidated output is unverified output. If lint is unavailable (offline), flag prominently in terminal and in DESIGN.md prose.
Quick Start
# First run — extract from HTML prototype
node extract-design/scripts/extract.js --source ./prototype.html
# From a published URL
node extract-design/scripts/extract.js --source https://my-prototype.example.com
# With a custom name
node extract-design/scripts/extract.js --source ./proto.html --name "My Design System"
# Update — re-extract from new HTML, diff against existing
node extract-design/scripts/extract.js --source ./proto-v2.html
# Lint-only — validate existing DESIGN.md without re-extraction
node extract-design/scripts/extract.js --lint-only
Flow
- Launch Puppeteer — dual-pass (light + dark) with retry + timeout. CI flags:
--headless=new --no-sandbox --disable-gpu --disable-dbus --use-gl=angle --use-angle=swiftshader. - Collect styles —
page.evaluate()collects computed styles from every element. Returns raw JSON to Node.js. Browser = sensor; Node = brain. - Classify tokens — modular pipeline: colors (Material 3 roles), typography (scale detection), spacing (tolerance GCD), rounded (clustering), components (visual signature + pseudo-state variants).
- Generate prose — AI heuristics produce all 8 DESIGN.md sections. Overview and Do's/Don'ts flagged with agent notes.
- Write + validate — serialize to
specs/tech-architecture/DESIGN_LATEST.md, runnpx @google/design.md lint, report to terminal. - Handoff — writes
handoff.next_skill: grill-metospecs/state.yamlwith uncertain decisions context.
Inputs
| Parameter | Required | Description |
|---|---|---|
--source <file|url> |
First run: yes. Update: optional | HTML prototype path or URL |
--name <string> |
No | Design system name (defaults to <title> or directory name) |
--lint-only |
No | Validate existing DESIGN.md without re-extraction |
Output
specs/tech-architecture/DESIGN_LATEST.md— replacesDESIGN_PLAN_LATEST.mdas the canonical design artifact- Terminal summary: token counts, component count, lint result, uncertain decisions
- Structured JSON log to stderr: extraction events, timing, counts
specs/state.yaml→handoff.next_skill: grill-mewith context
Error Tiers
| Tier | Condition | Response |
|---|---|---|
| Fatal | No Chrome, page load timeout after retries | Exit non-zero, suggest fixes |
| Degraded | Zero colors, zero typography, SPA shell | Write DESIGN.md with degradation warning |
| Warned | Lint errors, uncertain decisions | Write DESIGN.md, flag in terminal, hand off to grill-me |
Dependencies
- Puppeteer (Chrome binary) — wrapped behind
BrowserExtractorinterface for testability @google/design.md(soft, vianpx) — wrapped behindDesignValidatorinterface. Warns and skips if offline.
verify
node extract-design/tests/test-extraction.js
See REFERENCE.md for extraction algorithms and heuristics.
Extract Design — Reference
Extraction Algorithms
Color Classification
- Collect unique computed
background-color,color,border-colorfrom every DOM element. - Count frequency and context (text vs. bg vs. border vs. button).
- Classify using Material 3 roles: surface = largest-area bg, on-surface = most-used text, tertiary = highest-saturation on CTAs, error = reddish.
- Surface container levels: luminance-ordered. Hard-cap at 3 unless data supports 5.
- Low-confidence →
<!-- AGENT NOTE -->in Colors prose.
Typography Classification
- Collect unique (fontFamily, fontSize, fontWeight, lineHeight, letterSpacing) tuples.
- Cluster by fontSize (±2px) → type scale.
- Detect heading hierarchy from HTML tag + computed size.
- Name levels: display-lg, headline-lg/md/sm, title-lg, body-lg/md/sm, label-lg/md/sm.
- Parse
<link>and@font-face; warn if computed font differs from declared.
Spacing Classification
- Collect unique padding, margin, gap values. Filter: ignore values < 3 occurrences.
- Compute tolerance-based GCD (0.5px tolerance).
- Declare base unit. Detect half-step if gcd/2 values present ≥3 times.
- Map: unit×1 → sm, ×2 → md, ×4 → lg, ×8 → xl.
Rounded Classification
- Collect unique border-radius values. Cluster (1px tolerance).
- Name: none (0), sm (smallest),
Установить extract-design в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл extract-design?
Extract a Google DESIGN.md file from an HTML prototype (claude.ai/design or any styled page) using Puppeteer, producing machine-readable tokens and AI-generated prose. Use when the user has an HTML prototype and wants a DESIGN.md to anchor their project's visual identity, or when seed-conventions has just scaffolded a new project.
Как установить скилл extract-design?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл extract-design запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic