| name | brandmd |
| description | Extract a website's design system into a DESIGN.md file. Use when starting a new frontend project, rebuilding a site, or when the user wants AI-generated UI to match an existing brand. |
| allowed-tools | ["Bash(npx brandmd *)","Read","Write"] |
brandmd
You extract a website's design system into a DESIGN.md file that AI coding agents use for on-brand UI generation.
When to use
- User says "match this website's design" or "use the same style as [url]"
- Starting a new frontend project and the user has an existing site
- User wants design consistency across AI-generated components
- User asks to "extract design tokens" or "get the design system" from a URL
How to run
npx brandmd <url> -o DESIGN.md
Pass the most design-rich page (usually the homepage) for best results. The tool extracts from the visible viewport and lazy-loaded content on that single page.
What it extracts
The output follows Google Stitch's DESIGN.md format. Sections 1-5 are always present; 6-7 are conditional on flags.
- Visual Theme & Atmosphere - mood, shape language, depth
- Color Palette & Roles - colors with semantic roles (background, text, accent, border)
- Typography Rules - Primary font (role-aware: display > heading > body, skipping mono/fallback/icon fonts), per-role font breakdown (Headings, Display, Body, Buttons), all detected fonts with frequencies, size scale, weights, line heights, letter spacing
- Component Stylings - buttons, cards, inputs with radii, colors, shadows
- Layout Principles - spacing scale, base grid unit, border radii
- Dark Theme Overrides (with
--dark) - palette + atmosphere for dark mode
- Visual Identity Beyond CSS (with
--vision) - illustration style, photography mood, copywriting voice, microcopy patterns. Requires GEMINI_API_KEY (free tier: aistudio.google.com/apikey).
After extraction
- Read the generated DESIGN.md to confirm it looks right
- Summarize the key tokens for the user (primary colors, fonts, spacing scale)
- Use these tokens in all subsequent UI code generation
- Reference specific hex codes, font names, and spacing values from DESIGN.md when writing CSS/Tailwind/styled-components
Options
npx brandmd <url> - DESIGN.md to stdout
npx brandmd <url> -o DESIGN.md - DESIGN.md to file
npx brandmd <url> --dark - also extract dark-mode palette (Section 6)
npx brandmd <url> --vision - also extract illustration / photography / voice / microcopy via Gemini (Section 7). Needs GEMINI_API_KEY env var.
npx brandmd <url> --css - CSS custom properties output instead of DESIGN.md
npx brandmd <url> --tailwind - Tailwind v4 @theme block instead of DESIGN.md
npx brandmd <url> --html - HTML brand guide (visual, shareable)
npx brandmd <url> --json - raw tokens as JSON (programmatic use)
- Multiple URLs merge tokens:
npx brandmd <url1> <url2> <url3>
Limitations
- Extracts from a single page, not the entire site (multi-URL merges token frequencies but the vision screenshot is the first page only)
- Can't read Figma tokens or design tool files
- Color role assignment is heuristic (based on usage frequency and luminance)
- Requires a publicly accessible URL (no auth-gated pages)
- Cloudflare-protected sites: brandmd waits up to 20s for the JS challenge to auto-resolve (
--cf-wait-ms to tune). If the challenge persists, you get a clear error rather than garbage tokens. Hard-blocked sites (openai.com, perplexity.ai, discord.com, etc.) are correctly flagged as bot-protected and not bypassed.