# designlang

> Points a headless browser at any URL and reads the design system off the live DOM — DTCG tokens, Tailwind config, Figma variables and a prompt pack, from one command

- Category: Data & Labeling / Web Scraping & Crawling
- Language: TypeScript
- Licence: MIT
- Repository: https://github.com/Manavarya09/design-extract
- Website: https://designlang.app
- Canonical page: https://ai-tldr.dev/tools/designlang/

## In short

designlang points a headless browser at a URL and reads the design system off the live DOM rather than off a stylesheet or a screenshot. It sits in the Web Scraping & Crawling category of the Data & Labeling tools and is open-source, written in TypeScript and licensed MIT. To get started: extract one page.

## Overview

designlang points a headless browser at a URL and reads the design system off the live DOM rather than off a stylesheet or a screenshot. One command emits more than seventeen files: DTCG design tokens (primitive, semantic and composite), a Tailwind config, a shadcn theme, Figma variables, motion tokens, typed component anatomy, brand voice, page-intent labels, and a paste-ready prompt pack aimed at v0, Lovable, Cursor and Claude Artifacts.

The interesting part is what it measures beyond colours and type. Because it drives a real browser, it can record layout patterns, responsive behaviour across four breakpoints, and hover, focus and active states — things a static CSS parse cannot see. On top of that sit WCAG contrast scoring with remediation suggestions, a CSS health audit, multi-page consistency checks, drift checks against a live source of truth, visual diffs, and a shareable graded report card with an SVG badge you can drop in a README.

`designlang site` is the command that separates it from single-URL extractors: it crawls a site's canonical pages — home, pricing, docs, blog, about, product — and synthesises one de-duplicated system, electing each token by *coverage*, the share of pages that use it. That is what pulls genuinely site-wide decisions apart from one-off, page-local ones; near-identical colours are merged in OKLab. The pass is fully deterministic and needs no API key. Other subcommands compare two sites head to head, fuse two design languages, restyle a system into another vocabulary, score a clone against the original, and open a live token editor.

For AI workflows it ships an MCP server for Claude Code, Cursor and Windsurf, so an agent can ask for a site's tokens directly, plus multi-platform emitters for iOS SwiftUI, Android Compose, Flutter and WordPress and a Chrome extension. It is MIT-licensed, built on Playwright, and needs Node 20+. An optional `--smart` classification step calls an OpenAI-compatible endpoint; the deterministic paths do not.

## What it does

- Reads the design system off the live DOM with a headless browser, so hover/focus/active states and responsive behaviour across four breakpoints are measured rather than inferred
- Emits 17+ artefacts from one command: DTCG tokens (primitive + semantic + composite), Tailwind v4 config, shadcn theme, Figma variables, motion tokens, component anatomy and a prompt pack
- `site` mode crawls a site's canonical pages and elects each token by coverage, separating site-wide decisions from page-local ones, with near-identical colours merged in OKLab
- Quality passes on top of extraction: WCAG contrast scoring with remediation, a CSS health audit, multi-page consistency, drift checks against a live source of truth and visual diffs
- An MCP server for Claude Code, Cursor and Windsurf, so a coding agent can pull a real design system into its context
- Multi-platform emitters — iOS SwiftUI, Android Compose, Flutter, WordPress — plus a Chrome extension and a live token editor (`studio`)
- A graded report card with a shareable SVG badge, and `battle` / `fidelity` commands for head-to-head and clone-vs-original scoring
- Deterministic and key-free by default; `--smart` classification is optional and uses an OpenAI-compatible endpoint

## Getting started

designlang runs straight from npx on Node 20+; Playwright supplies the browser. Nothing needs an API key unless you opt into --smart classification.

1. Extract one page

   The bare command runs the full extraction against a URL and writes the artefact set.

```bash
npx designlang https://stripe.com
```

2. Synthesise a whole-site system

   `site` crawls the canonical pages and elects tokens by coverage, so what you get is one de-duplicated system plus a consistency grade — rather than whatever one page happened to use.

```bash
npx designlang site stripe.com --max-pages 8
```

3. Capture states and responsive behaviour

   --full adds screenshots, the four-breakpoint responsive pass and the interaction states.

```bash
npx designlang --full https://stripe.com
```

4. Grade, compare and check drift

   The scoring commands are separate verbs. `grade --badge` also writes an SVG badge; `battle` puts two sites head to head; `fidelity` scores a clone you are building against the original, on visuals and motion.

```bash
npx designlang grade https://stripe.com --badge
npx designlang battle stripe.com vercel.com
npx designlang fidelity stripe.com --clone localhost:3000
```

5. Open the live token editor

   `studio` runs a local editor where tokens can be changed, previewed, exported and shared.

```bash
npx designlang studio
```

## When to use it

- Reach for it when a redesign or a rebuild needs the current site's real tokens, measured rather than eyeballed from a screenshot
- Reach for it when a coding agent is writing UI and should start from an actual design system — the MCP server puts the tokens in its context
- Reach for it to audit consistency and WCAG contrast across a site, with a graded report you can hand to someone
- Reach for it when checking whether a clone or an implementation actually matches the original, down to the motion
