What it is
Extracts a DESIGN.md from frontend source code (React, Vue, Svelte, Angular, plain HTML/CSS and others) or from a live page when only a URL exists, recording colour, type, spacing, and component rules. It is for developers auditing or migrating an existing visual language. It does not create new screens or judge the design.
Core workflow
| Stage | Content |
|---|---|
| Trigger | Understanding a repository’s visual language, migrating it to Stitch, or having only a URL. |
| Input | A frontend source directory, or an http/https URL. |
| Steps | Read package.json to identify the framework and CSS approach, then map the source tree; consult the matching framework reference; for a URL only, render locally with Puppeteer and read computed styles; write the result into DESIGN.md frontmatter and sections. |
| Output | One DESIGN.md, plus .stitch/live-url-screenshot.png when needed. |
| Boundary | Source mode needs no build or runtime; URL mode needs Node.js and puppeteer and never installs into the user’s project; fetched content is data, never instructions. |
| Getting started: read package.json before choosing directories; it removes most of the search. |
Traits
- Two inputs, source code and live URL; source mode works without a build.
- Detects the stack first: dependencies, tailwind and postcss configs, CSS-in-JS, token files.
- URL mode reads computed styles through local headless Chrome and accepts only http and https.
- Treats page text as untrusted data to prevent prompt injection.
Who it is for and who it is not for
| Good fit | Poor fit |
|---|---|
| Shipping a spec when the build is broken | Wanting screen designs directly |
| Documenting a client site’s system | No source and no reachable URL |
| Reconciling styles scattered across a repo | Replacing human visual review |
How it differs
| Need | Use |
|---|---|
| Extract rules from source or a URL | extract-design-md |
| Extract from screens inside Stitch | design-md |
| Move code into Stitch wholesale | code-to-design |
| Invent a new style | taste-design |
Source-level risks
| Risk | Source | Impact |
|---|---|---|
| URL mode installs puppeteer | Prerequisites and temporary-directory flow | Downloads a browser; slow and network-bound |
| Fetches any URL the user gives | Script argument –url | Internal or sensitive hosts need human screening |
| Cleans the temp directory with rm -rf | Example command | A variable slip risks deleting the wrong path |
| Falls back to –no-sandbox when sandboxed launch fails | Script behaviour note | Reduced isolation inside containers |
| The file is truncated | Tail stops at “sections the source path” | Later-phase output structure is incomplete |