agentleFS
danielvm-gitdanielvm-git/bigpowers/skills/extract-design/SKILL.md

extract-design

Skill288 starsChanged 7 days agoMITView on GitHub

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.

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

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

  1. 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.
  2. Collect styles — page.evaluate() collects computed styles from every element. Returns raw JSON to Node.js. Browser = sensor; Node = brain.
  3. Classify tokens — modular pipeline: colors (Material 3 roles), typography (scale detection), spacing (tolerance GCD), rounded (clustering), components (visual signature + pseudo-state variants).
  4. Generate prose — AI heuristics produce all 8 DESIGN.md sections. Overview and Do's/Don'ts flagged with agent notes.
  5. Write + validate — serialize to specs/tech-architecture/DESIGN_LATEST.md, run npx @google/design.md lint, report to terminal.
  6. Handoff — writes handoff.next_skill: grill-me to specs/state.yaml with uncertain decisions context.

Inputs

ParameterRequiredDescription
--source <file|url>First run: yes. Update: optionalHTML prototype path or URL
--name <string>NoDesign system name (defaults to <title> or directory name)
--lint-onlyNoValidate existing DESIGN.md without re-extraction

Output

  • specs/tech-architecture/DESIGN_LATEST.md — replaces DESIGN_PLAN_LATEST.md as 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-me with context

Error Tiers

TierConditionResponse
FatalNo Chrome, page load timeout after retriesExit non-zero, suggest fixes
DegradedZero colors, zero typography, SPA shellWrite DESIGN.md with degradation warning
WarnedLint errors, uncertain decisionsWrite DESIGN.md, flag in terminal, hand off to grill-me

Dependencies

  • Puppeteer (Chrome binary) — wrapped behind BrowserExtractor interface for testability
  • @google/design.md (soft, via npx) — wrapped behind DesignValidator interface. Warns and skips if offline.

verify

node extract-design/tests/test-extraction.js

See REFERENCE.md for extraction algorithms and heuristics.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.