MCPcopy Index your code
hub / github.com/CezarProX/designclaw

github.com/CezarProX/designclaw @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
396 symbols 987 edges 133 files 13 documented · 3%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

🐾 DesignClaw

Steal any website's design DNA — and teach your AI to build with it.

Paste a URL. DesignClaw crawls the site, reverse-engineers its colors, type, spacing, components, and motion, and streams back a production-ready SKILL.md that any AI coding assistant can use to reproduce that exact aesthetic — on completely different content.

License React Vite TypeScript Hono Claude Supabase


            ┌─────────────────────────────────────────────────────────┐
   paste    │   https://that-gorgeous-site.com                        │
   a URL ──▶│   ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░  [ Extract ] │
            └─────────────────────────────────────────────────────────┘
                                     │
   📸 screenshots  ·  🎨 computed styles  ·  🧬 DOM + CSS  ·  🧠 pattern detection
                                     │
                                     ▼
            ┌─────────────────────────────────────────────────────────┐
            │  SKILL.md  ·  600–1000 lines  ·  streamed live           │
            │  ── colors, type scale, spacing, radii, shadows          │
            │  ── copy-paste component recipes (buttons, cards, nav)   │
            │  ── motion + animation system, layout philosophy         │
            └─────────────────────────────────────────────────────────┘

✨ What it does

Extracting a design system from a live site by hand takes hours of DevTools spelunking. DesignClaw does it in seconds and hands you a structured brief your AI assistant actually understands.

  • 🎨 Real design extraction — colors, type scale, spacing, radii, shadows, buttons, cards, nav, and badges pulled from computed styles, not guesses.
  • 🧠 Pattern detection — classifies card systems, button styles, and color / typography / motion strategies into design archetypes.
  • 👁️ Live component preview — renders the extracted button, heading, and card using the site's real fonts (FontFace API + Google Fonts fallback).
  • Streaming generation — the SKILL.md streams in over SSE. Fast single-pass or higher-quality multi-pass mode.
  • 🕓 Extraction history — past runs, screenshots, and generated skills persisted to Supabase.
  • 🔁 Section regeneration — re-roll any single section with extra context.

🧩 How it works

Frontend (React + Vite)                     Backend (Node.js + Hono)
  InputPage  ──POST /api/extract──▶  5-step extraction pipeline
  ExtractPage ◀──── SSE stream ────    1. crawler         Puppeteer screenshots + DOM
                                       2. sourceExtractor raw CSS from stylesheets
                                       3. computedExtractor getComputedStyle on components
                                       4. htmlExtractor   DOM skeleton + class patterns
                                       5. patternDetector design-archetype classification
                                              │
                                              ▼
                                       skillGenerator ──▶ Anthropic Claude API
                                         (streams SKILL.md back over SSE)

The Claude prompt gets screenshots (base64), filtered source CSS, browser-computed style data (JSON), and the HTML skeleton — then writes a 10-section SKILL.md.

🛠 Tech stack

Layer Technology
Frontend React 18 · Vite · TypeScript
Styling Tailwind CSS · shadcn/ui (Radix)
State Zustand
Backend Node.js · Hono
Crawling Puppeteer (headless Chrome)
AI Anthropic Claude API (Sonnet / Opus)
Database Supabase (history · screenshots · auth)

🚀 Quick start

Prerequisites

  • Node.js 20+
  • Chrome / Chromium locally (Puppeteer downloads its own by default)
  • An Anthropic API key
  • A Supabase project (free tier works)

1 · Install

git clone <your-fork-url> designclaw
cd designclaw
npm install

2 · Configure

cp .env.example .env
Variable Required Description
ANTHROPIC_API_KEY Your Anthropic key (sk-ant-…).
ANTHROPIC_BASE_URL Point at an Anthropic-compatible proxy. Defaults to https://api.anthropic.com/v1.
ANTHROPIC_MODEL Single-pass model. Default claude-sonnet-4-6.
ANTHROPIC_MODEL_OPUS Multi-pass model. Default claude-opus-4-8.
PORT Backend port. Default 3001.
SUPABASE_URL / SUPABASE_SERVICE_ROLE_KEY Server-side access — service role, never expose to the client.
VITE_SUPABASE_URL / VITE_SUPABASE_ANON_KEY Client-side access — anon/publishable key only.

⚠️ VITE_-prefixed vars are bundled into the browser and are not secret. Only ever put the anon key there — never the service role key.

3 · Set up the database

The app uses these Supabase objects:

  • Tables: profiles · extractions · regenerations · screenshots
  • Storage buckets: screenshots · avatars

Create them in your project and add Row-Level Security so users only see their own rows. (A migration file isn't bundled — define columns to match the usage in server/ and src/stores/.)

4 · Run

npm run dev          # frontend + backend together
Script What it does
npm run dev Vite frontend and Hono backend
npm run dev:client frontend only
npm run dev:server backend only
npm run build build the frontend
npm run build:server build / type-check the backend
npm run lint eslint

Frontend → http://localhost:8080 · Backend → http://localhost:3001

☁️ Deployment

  • The backend needs Chrome (Puppeteer) — deploy to Railway or Fly.io, not Vercel serverless.
  • The frontend is a static build — Vercel, Netlify, etc. Point it at your backend via CORS origins.
  • Set the same env vars in your host's dashboard.

📁 Project structure

designclaw/
├── src/                  # React frontend — pages, components, stores, lib
├── server/               # Node.js + Hono backend
│   ├── routes/           # /api/extract, /api/history, /api/regenerate, …
│   ├── services/         # crawler, extractors, patternDetector, skillGenerator
│   ├── prompts/          # system + user prompt builders
│   └── utils/            # anthropic.ts (AI client), supabase.ts, cssFilter.ts
└── .claude/CLAUDE.md     # architecture notes for AI assistants

Deeper dive: .claude/CLAUDE.md — full architecture walkthrough.

🤝 Contributing

Issues and PRs welcome. Keep changes focused, run npm run lint before submitting, and never commit secrets (.env is gitignored).

📄 License

MIT — do whatever you want, just keep the notice.

Built for designers who'd rather ship than inspect-element.

Extension points exported contracts — how you extend this code

CrawlConfig (Interface)
(no doc)
src/types/extraction.ts
PatternBadgesProps (Interface)
(no doc)
src/components/PatternBadges.tsx
PersistedExtraction (Interface)
(no doc)
src/stores/extractionStore.ts
Stats (Interface)
(no doc)
src/pages/AdminPage.tsx
SSEEvent (Interface)
(no doc)
src/lib/sse.ts
State (Interface)
(no doc)
src/hooks/use-toast.ts
GenerationInput (Interface)
(no doc)
server/types.ts
CssFilterOptions (Interface)
(no doc)
server/utils/cssFilter.ts

Core symbols most depended-on inside this repo

cn
called by 196
src/lib/utils.ts
send
called by 30
server/routes/extract.ts
slog
called by 17
server/services/skillGenerator.ts
apiFetch
called by 16
src/lib/api.ts
emit
called by 16
server/services/jobRunner.ts
isVisible
called by 12
src/components/ComponentPreview.tsx
addToken
called by 12
server/services/skillGenerator.ts
useAnimatedNavigate
called by 10
src/hooks/use-animated-navigate.ts

Shape

Function 297
Interface 96
Class 2
Method 1

Languages

TypeScript100%

Modules by API surface

server/services/skillGenerator.ts26 symbols
src/types/extraction.ts23 symbols
src/components/MarkdownPreview.tsx21 symbols
server/types.ts19 symbols
server/services/crawler.ts14 symbols
src/components/ComponentPreview.tsx11 symbols
server/services/jobRunner.ts11 symbols
src/hooks/use-font-loader.ts10 symbols
server/services/patternDetector.ts10 symbols
src/hooks/use-toast.ts9 symbols
src/pages/admin/AdminDashboard.tsx8 symbols
src/pages/AdminPage.tsx8 symbols

For agents

$ claude mcp add designclaw \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact