Windsurf rules
.windsurf/rules/extract-design.mdExtract 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.
Windsurf rules
Quality
82/100
Scores the file, not the repository.Length
838 words
25 headings · 2 code blocksRepository
114
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1234567# Extract DESIGN.md from HTML89> **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.10>11> **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] -->`.12>13> **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.1415## Quick Start1617```bash18# First run — extract from HTML prototype19node extract-design/scripts/extract.js --source ./prototype.html2021# From a published URL22node extract-design/scripts/extract.js --source https://my-prototype.example.com2324# With a custom name25node extract-design/scripts/extract.js --source ./proto.html --name "My Design System"2627# Update — re-extract from new HTML, diff against existing28node extract-design/scripts/extract.js --source ./proto-v2.html2930# Lint-only — validate existing DESIGN.md without re-extraction31node extract-design/scripts/extract.js --lint-only32```3334## Flow35361. **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`.372. **Collect styles** — `page.evaluate()` collects computed styles from every element. Returns raw JSON to Node.js. Browser = sensor; Node = brain.383. **Classify tokens** — modular pipeline: colors (Material 3 roles), typography (scale detection), spacing (tolerance GCD), rounded (clustering), components (visual signature + pseudo-state variants).394. **Generate prose** — AI heuristics produce all 8 DESIGN.md sections. Overview and Do's/Don'ts flagged with agent notes.405. **Write + validate** — serialize to `specs/tech-architecture/DESIGN_LATEST.md`, run `npx @google/design.md lint`, report to terminal.416. **Handoff** — writes `handoff.next_skill: grill-me` to `specs/state.yaml` with uncertain decisions context.4243## Inputs4445| Parameter | Required | Description |46|-----------|----------|-------------|47| `--source <file\|url>` | First run: yes. Update: optional | HTML prototype path or URL |48| `--name <string>` | No | Design system name (defaults to `<title>` or directory name) |49| `--lint-only` | No | Validate existing DESIGN.md without re-extraction |5051## Output5253- `specs/tech-architecture/DESIGN_LATEST.md` — replaces `DESIGN_PLAN_LATEST.md` as the canonical design artifact54- Terminal summary: token counts, component count, lint result, uncertain decisions55- Structured JSON log to stderr: extraction events, timing, counts56- `specs/state.yaml` → `handoff.next_skill: grill-me` with context5758## Error Tiers5960| Tier | Condition | Response |61|------|-----------|----------|62| Fatal | No Chrome, page load timeout after retries | Exit non-zero, suggest fixes |63| Degraded | Zero colors, zero typography, SPA shell | Write DESIGN.md with degradation warning |64| Warned | Lint errors, uncertain decisions | Write DESIGN.md, flag in terminal, hand off to grill-me |6566## Dependencies6768- **Puppeteer** (Chrome binary) — wrapped behind `BrowserExtractor` interface for testability69- **`@google/design.md`** (soft, via `npx`) — wrapped behind `DesignValidator` interface. Warns and skips if offline.7071## verify7273```bash74node extract-design/tests/test-extraction.js75```7677See [REFERENCE.md](REFERENCE.md) for extraction algorithms and heuristics.7879---8081# Extract Design — Reference8283## Extraction Algorithms8485### Color Classification861. Collect unique computed `background-color`, `color`, `border-color` from every DOM element.872. Count frequency and context (text vs. bg vs. border vs. button).883. Classify using Material 3 roles: surface = largest-area bg, on-surface = most-used text, tertiary = highest-saturation on CTAs, error = reddish.894. Surface container levels: luminance-ordered. Hard-cap at 3 unless data supports 5.905. Low-confidence → `<!-- AGENT NOTE -->` in Colors prose.9192### Typography Classification931. Collect unique (fontFamily, fontSize, fontWeight, lineHeight, letterSpacing) tuples.942. Cluster by fontSize (±2px) → type scale.953. Detect heading hierarchy from HTML tag + computed size.964. Name levels: display-lg, headline-lg/md/sm, title-lg, body-lg/md/sm, label-lg/md/sm.975. Parse `<link>` and `@font-face`; warn if computed font differs from declared.9899### Spacing Classification1001. Collect unique padding, margin, gap values. Filter: ignore values < 3 occurrences.1012. Compute tolerance-based GCD (0.5px tolerance).1023. Declare base unit. Detect half-step if gcd/2 values present ≥3 times.1034. Map: unit×1 → sm, ×2 → md, ×4 → lg, ×8 → xl.104105### Rounded Classification1061. Collect unique border-radius values. Cluster (1px tolerance).1072. Name: none (0), sm (smallest), md (median), lg (large), xl (largest), full (9999px).108109### Component Detection110- Button: w<300px, h<64px, bg+radius set, short text. cursor:pointer is bonus.111- Card: bg+radius+padding set, larger area.112- Input: `<input>` or `<textarea>` tag.113- Pseudo-state variants: force :hover, :active, :focus for high-confidence components.114115### Prose Generation116Generates all 8 DESIGN.md sections. Overview and Do's/Don'ts flagged with `<!-- AGENT NOTE: Generated from visual analysis. Grill-me should validate. -->`.117118## Material 3 Token Conventions119Colors: primary, on-primary, secondary, tertiary, error, surface, on-surface, surface-container-*, outline, background, on-background.120Typography: display-lg/md/sm, headline-lg/md/sm, title-lg/md/sm, body-lg/md/sm, label-lg/md/sm.121Rounded: none, xs, sm, md, lg, xl, full.122123## CI Compatibility124Chrome flags: `--headless=new --no-sandbox --disable-gpu --disable-dbus --use-gl=angle --use-angle=swiftshader`125126## Defensive Code127Retry with backoff (3 attempts, 1s/2s/4s), Timeout (30s page load, 10s pseudo-state), Graceful degradation (Tier 2 on empty extraction).128129## Known Risks130- DESIGN.md spec is alpha. Skill pins to current spec.131- Puppeteer is heavy (~300MB Chrome). Document requirement clearly.132- Prose quality depends on AI heuristics. grill-me is the validation gate.133
Also in danielvm-git/bigpowers
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| danielvm-git/bigpowers.cursor/rules/align-grid.mdc · 114 | Cursor rules | lint-formatdo-notagent-behaviour | 65/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/assess-impact.mdc · 114 | Cursor rules | testtesting-strategydeployment | 66/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/audit-code.mdc · 114 | Cursor rules | setuptestlint-formatstyle+4 | 66/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/audit-plan.mdc · 114 | Cursor rules | buildteststylegit | 74/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/build-epic.mdc · 114 | Cursor rules | buildgit | 58/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/change-request.mdc · 114 | Cursor rules | no sections | 48/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/commit-message.mdc · 114 | Cursor rules | lint-formatstyletypesgit+3 | 82/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/compose-workflow.mdc · 114 | Cursor rules | styledo-notagent-behaviour | 65/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/context7-mcp.mdc · 114 | Cursor rules | style | 54/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/craft-skill.mdc · 114 | Cursor rules | stylearchgitdo-not | 69/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/deepen-architecture.mdc · 114 | Cursor rules | testtesting-strategydo-not | 57/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/define-language.mdc · 114 | Cursor rules | lint-formatdo-not | 65/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/define-success.mdc · 114 | Cursor rules | no sections | 4/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/delegate-task.mdc · 114 | Cursor rules | git | 62/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/deploy.mdc · 114 | Cursor rules | setupbuildtestdeployment | 77/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/design-interface.mdc · 114 | Cursor rules | styleagent-behaviour | 58/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/develop-tdd.mdc · 114 | Cursor rules | teststylearchtesting-strategy+5 | 85/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/diagnose-root.mdc · 114 | Cursor rules | no sections | 39/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/diagnose-stall.mdc · 114 | Cursor rules | no sections | 44/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/dispatch-agents.mdc · 114 | Cursor rules | git | 54/100 | 3 days ago |
Diff against .cursor/rules/align-grid.mdc Diff against .cursor/rules/assess-impact.mdc Diff against .cursor/rules/audit-code.mdc Diff against .cursor/rules/audit-plan.mdc Diff against .cursor/rules/build-epic.mdc Diff against .cursor/rules/change-request.mdc Diff against .cursor/rules/commit-message.mdc Diff against .cursor/rules/compose-workflow.mdc Diff against .cursor/rules/context7-mcp.mdc Diff against .cursor/rules/craft-skill.mdc Diff against .cursor/rules/deepen-architecture.mdc Diff against .cursor/rules/define-language.mdc Diff against .cursor/rules/define-success.mdc Diff against .cursor/rules/delegate-task.mdc Diff against .cursor/rules/deploy.mdc Diff against .cursor/rules/design-interface.mdc Diff against .cursor/rules/develop-tdd.mdc Diff against .cursor/rules/diagnose-root.mdc Diff against .cursor/rules/diagnose-stall.mdc Diff against .cursor/rules/dispatch-agents.mdc
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| danielvm-git/bigpowers.windsurf/rules/organize-workspace.md · 114 | Windsurf rules | buildstylegitdeployment+2 | 89/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/guard-git.md · 114 | Windsurf rules | stylearchgitsecurity+2 | 89/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/quick-fix.md · 114 | Windsurf rules | teststylegitdeployment+1 | 85/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/develop-tdd.md · 114 | Windsurf rules | teststylearchtesting-strategy+5 | 85/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/session-state.md · 114 | Windsurf rules | lint-formatstyleagent-behaviour | 82/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/commit-message.md · 114 | Windsurf rules | lint-formatstyletypesgit+3 | 82/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/setup-environment.md · 114 | Windsurf rules | setupstylesecuritydo-not+1 | 81/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/wire-ci.md · 114 | Windsurf rules | buildtestlint-formatstyle+1 | 81/100 | 3 days ago |
