better-design

mcp
Security Audit
Pass
Health Pass
  • License Ò€” License: MIT
  • Description Ò€” Repository has a description
  • Active repo Ò€” Last push 0 days ago
  • Community trust Ò€” 147 GitHub stars
Code Pass
  • Code scan Ò€” Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
  • Permissions Ò€” No dangerous permissions requested

No AI report is available for this listing yet.

SUMMARY

🎨 Open-source design MCP server + shadcn/ui registry β€” AI design systems for Claude Code, Cursor, Codex, GitHub Copilot & any MCP client. 31 brand-grade themes (Linear, Stripe, Vercel, Notion, Apple, Supabase, Figma…) + design tokens, UI principles & WCAG rules. Install any component with one command.

README.md

Better Design: Open source Claude Design

Turn your AI coding IDE into a design engineer. Better Design works with MCP-compatible agents and editors like Claude Code, Cursor, VS Code/GitHub Copilot, Claude Desktop, and claude.ai. It is a design MCP server, AI design-system registry, and UI review layer for generating polished product interfaces from prompts.

Website Β· Design systems Β· Setup Β· Architecture

MCP server
Claude Code
Cursor
GitHub Copilot
AI design systems
WCAG

What is Better Design?

Better Design gives AI coding agents the design context they usually miss: design tokens, component code, UI principles, icon direction, accessibility checks, and visual-design review rules.

Think of it as a Claude Design-style workflow for your own codebase:

  1. Pick the product direction: Linear, Supabase, Vercel, Airbnb, Stripe, Apple, Notion, Figma, or another curated design system.
  2. Feed your AI agent the right globals.css, semantic tokens, component overrides, icon set, spacing, typography, shadows, radius, and motion language.
  3. Ask Claude Code, Cursor, VS Code/GitHub Copilot, Claude Desktop, claude.ai, or another MCP-compatible coding agent to build the interface.
  4. Have the MCP review the output against accessibility and design principles before you ship it.

Instead of β€œAI-looking UI,” you get interfaces that look like they were built from a real product design system.

Why Better Design?

  • Claude Design-style workflow, open MCP. Bring the artifact-first design loop people expect from Claude Design into Claude Code, Cursor, VS Code/GitHub Copilot, Claude Desktop, claude.ai, and any MCP-compatible client.
  • Design systems, not vague vibes. Each system includes semantic CSS tokens plus production component code, so generated UI uses real implementation details instead of guessed colors.
  • AI UI generation with guardrails. The MCP can load principles for hierarchy, spacing, typography, depth, motion, forms, and accessibility exactly when the agent needs them.
  • Self-review before handoff. get-review-rules gives your agent a WCAG and visual-design checklist so it can catch missing focus states, weak hierarchy, bad contrast, and inconsistent spacing.
  • Built for AI coding workflows. Better Design speaks the language agents already use to build modern product UI: tokens, components, accessibility, hierarchy, spacing, and motion.

How it works

Better Design has two layers: an always-on Design Intelligence layer and an on-demand Scaffold layer.

1. Design Intelligence β€” always active for UI work

When your agent builds UI, Better Design can load the relevant product-design principles and review rules:

You: "Add a settings page with a form"

AI: calls get-ui-principle("spacing") + get-ui-principle("hierarchy")
    β†’ writes the page
    β†’ calls get-review-rules("accessibility") + get-review-rules("visual-design")
    β†’ fixes contrast, labels, focus states, spacing, and hierarchy

Result: A settings page with accessible inputs, clear grouping, visible states, and consistent rhythm.

2. Scaffold β€” design-system matching for new UI

When starting a product, page, or component set, say "use better-design" and the MCP finds a matching design system:

You: "Build a fintech dashboard in the style of Stripe. use better-design"

AI: calls resolve-design-system("fintech dashboard, Stripe")
    β†’ loads design-system docs, CSS tokens, and component code
    β†’ resolves a matching icon library
    β†’ builds with semantic tokens instead of raw colors

Result: Indigo accents, premium shadows, fintech typography, consistent cards, inputs, buttons, and charts.

What the MCP gives your agent

Tool What it does Why it matters
resolve-design-system Semantically matches the right design system for a prompt Stops agents from guessing a visual direction
get-design-system-docs Loads tokens, components, usage notes, and install context Gives the agent implementation-ready design context
get-ui-principle Fetches focused guidance for hierarchy, spacing, typography, depth, motion, forms, and more Makes UI decisions principled instead of random
get-review-rules Returns accessibility and visual-design review checklists Helps the agent critique and fix its own output
resolve-icon-library Picks an icon family that matches the design personality Keeps icon style consistent with the UI
search-icons Finds specific icons through Iconify Speeds up implementation without mixing icon styles

Available Design Systems

Better Design ships with curated design systems for common product categories: developer tools, fintech dashboards, marketplaces, productivity apps, consumer apps, media products, and enterprise software.

System Theme Vibe Best For
Linear Dark Minimal, professional, purple accents Developer tools, productivity apps
Linear Quality Dark Precision-crafted, multi-layer shadows High-polish developer tools
Supabase Dark Technical, modern, green accents Backend dashboards, dev portals
Vercel Dark Pure black, Geist font, minimal Deployment, developer platforms
Airbnb Light Warm, friendly, coral primary Marketplaces, consumer apps
Notion Light Minimal, flat blue, rgba shadow Productivity, note-taking apps
Stripe Light Fintech, indigo accents, premium shadows Payments, financial products
Apple Light Premium, SF Pro, pill buttons Consumer apps, marketing sites
Figma Light Design tool, electric violet, purple glow Design/creative tooling
Light Marketplace Light Charcoal buttons, flat cards, no shadows E-commerce, listings
Precision Light Light Charcoal primary, precision layered shadows B2B SaaS, enterprise
Minimal Light Light Black primary, no shadows, border-only cards Clean utilities, productivity
Dark Orange Dark Brand orange, 10px radius, layered shadows Modern SaaS, dashboards
Vibrant Dark Dark Vibrant blue, color-bloom shadows Consumer apps, social
Neutral Monochrome Dark White on near-black, no color Understated, data-heavy tools
Cinematic Dark Dark Ultra-dark, content-first media Streaming, media platforms
Editorial Dark Dark Serif display, flat, content-first Publishing, editorial
Corporate Fintech Light Blue accents, data-dense layouts Banking, enterprise, fintech

Each design system includes a full globals.css token layer plus overriding component code.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Your AI agent or IDE: Claude Code / Cursor / GitHub Copilot    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚
                          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              MCP Server (packages/shared/src/mcp)               β”‚
β”‚                                                                 β”‚
β”‚  Design Intelligence, always active for UI work:                β”‚
β”‚  β€’ get-ui-principle β†’ load relevant design principles           β”‚
β”‚  β€’ get-review-rules β†’ accessibility + visual design checklist   β”‚
β”‚                                                                 β”‚
β”‚  Scaffold, on demand with "use better-design":                  β”‚
β”‚  β€’ resolve-design-system β†’ semantic search with embeddings      β”‚
β”‚  β€’ get-design-system-docs β†’ fetch tokens + component code       β”‚
β”‚  β€’ resolve-icon-library β†’ match icon set to design personality  β”‚
β”‚  β€’ search-icons β†’ find specific icons via Iconify               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Stdio Transport     β”‚  β”‚  Remote Transport    β”‚
β”‚  Claude Desktop,     β”‚  β”‚  /api/mcp            β”‚
β”‚  Claude Code, Cursor,β”‚  β”‚  claude.ai, cloud    β”‚
β”‚  VS Code/Copilot     β”‚  β”‚                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Setup

Prerequisites

  • Bun for local development
  • A Neon Postgres database (free tier works)
  • Gemini API key for design-system embeddings

1. Clone and install

git clone https://github.com/marvkr/better-design.git
cd better-design
bun install

2. Configure environment

cp packages/web/.env.example packages/web/.env
DATABASE_URL=postgresql://[email protected]/...?sslmode=require
GEMINI_API_KEY=your-gemini-key

3. Push the database schema

cd packages/web && bun db:push

4. Run the dev server

bun dev

5. Optional: connect the stdio MCP to Claude Desktop

cd packages/mcp && bun run build

Add the local MCP server to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "better-design": {
      "command": "node",
      "args": ["/absolute/path/to/better-design/packages/mcp/dist/index.js"]
    }
  }
}

Restart Claude Desktop. You can now ask Claude to use Better Design while building UI.

Remote MCP: The web app also exposes a remote MCP endpoint at /api/mcp. Connect any MCP-compatible AI tool or coding IDE with an API key from /settings when you do not want local stdio setup.

Usage examples

Once connected, ask your agent for design help directly:

"Use better-design. Build a Linear-style project settings page with billing, team members, and API keys."
"Find a design system for a developer tools startup, then build the dashboard with matching components."
"Review this form with Better Design's accessibility and visual-design rules, then fix the issues."

Your AI assistant can search design systems, load implementation details, choose matching icons, scaffold components, and self-review generated UI before presenting the final code.

Web App Architecture

The web app (packages/web) provides an interactive UI for generating styled components. Here's the full workflow:

flowchart TD
    subgraph Frontend["Frontend (React)"]
        A[User submits message] --> B[Create message in DB]
        B --> C{Trigger Inngest event}
        P[Poll every 2s] --> Q[Show currentStep]
    end

    subgraph Inngest["Inngest (Background Jobs)"]
        C --> D[design-system/recommend]
        D --> E[Semantic search design systems]
        E --> F{Match score >= 85%?}

        F -->|Yes| G[Auto-select & trigger code-agent]
        F -->|No| H[Show recommendations to user]
        H --> I[User selects design system]
        I --> G

        G --> J[code-agent/run]
    end

    subgraph CodeAgent["Code Agent"]
        J --> K[Create E2B sandbox]
        K --> L[Set status: GENERATING]
        L --> M[Load design system context]
        M --> N[Apply globals.css]
        N --> O[scaffoldDesignSystemComponents]

        subgraph Scaffolding["Component Scaffolding"]
            O --> O1[Update currentStep: Button...]
            O1 --> O2[Write component to sandbox]
            O2 --> O3[Next component...]
            O3 --> O1
        end

        O --> R[Build user's request]
        R --> S[Generate page.tsx]
        S --> T[Save fragment & files]
        T --> U[Set status: COMPLETED]
    end

    subgraph Database["PostgreSQL"]
        V[(projects)]
        W[(messages)]
        X[(fragments)]
        Y[(design_systems)]
        Z[(components)]
    end

    L -.-> V
    O1 -.-> V
    T -.-> W
    T -.-> X
    M -.-> Y
    O -.-> Z
    P -.-> V

Key Components

Component Purpose
inngest/functions.ts Background job definitions (code-agent, design-system-recommender)
lib/design-systems/ Design system search & formatting
lib/foundational-docs/ UI guidance search (animations, spacing, colors, etc.)
prompt.ts AI agent system prompt
modules/projects/ Frontend project views & components

UI Design Guidance Flow

The code agent discovers relevant design guidelines via semantic searchβ€”no hardcoded rules:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  User: "Build a modal with smooth open/close animations"           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Agent analyzes task β†’ identifies: "modal + animation"              β”‚
β”‚                                                                     β”‚
β”‚  Calls: getUIGuidance({ topic: "modal animation interruptible" })   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Semantic Search (pgvector)                                         β”‚
β”‚                                                                     β”‚
β”‚  Searches ALL foundational_docs by embedding similarity:            β”‚
β”‚  β”œβ”€β”€ animation-patterns.md β†’ Interruptible animations with Motion  β”‚
β”‚  β”œβ”€β”€ animation.md β†’ Easing curves, duration, springs               β”‚
β”‚  β”œβ”€β”€ depth.md β†’ Shadows, layering                                  β”‚
β”‚  └── ... other relevant docs                                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Returns top matches with scores:                                   β”‚
β”‚                                                                     β”‚
β”‚  1. Animation Patterns (92% match)                                  β”‚
β”‚     β†’ Make animations interruptible with Motion's delay()           β”‚
β”‚     β†’ Cancel pending animations on close                            β”‚
β”‚                                                                     β”‚
β”‚  2. Animation Guidelines (88% match)                                β”‚
β”‚     β†’ Use spring animations, 200-300ms duration                     β”‚
β”‚     β†’ ease-out for entering, ease-in-out for movement               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Agent builds modal WITH:                                           β”‚
β”‚  βœ“ delay() from motion with cancelDelayRef                          β”‚
β”‚  βœ“ Interruptible open/close states                                  β”‚
β”‚  βœ“ Spring transitions (stiffness: 400, damping: 25)                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Adding new guidelines:

  1. Create a markdown file in docs/ (e.g., docs/accessibility.md)
  2. Add it to packages/mcp/src/lib/seed.ts:
    { file: "accessibility.md", id: "accessibility", title: "Accessibility Guidelines" }
    
  3. Run bun run seed in packages/mcp

The agent discovers new guidelines automatically via semantic searchβ€”no prompt changes needed.

Component Catalog Pattern

The catalog pattern ensures the AI generates complete, production-ready design systems with all required components:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Code Agent receives user request                                   β”‚
β”‚  "Build a Linear-style dashboard"                                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  System Prompt includes Component Catalog                           β”‚
β”‚                                                                     β”‚
β”‚  πŸ“‹ 77 Required shadcn Components:                                  β”‚
β”‚  β”œβ”€β”€ Layout: Accordion, Card, Collapsible, ScrollArea...           β”‚
β”‚  β”œβ”€β”€ Navigation: Breadcrumb, Tabs, Pagination...                   β”‚
β”‚  β”œβ”€β”€ Forms: Button, Input, Select, Checkbox...                     β”‚
β”‚  β”œβ”€β”€ Data Display: Avatar, Badge, Table, Chart...                  β”‚
β”‚  β”œβ”€β”€ Feedback: Alert, Toast, Dialog...                             β”‚
β”‚  └── Overlays: Modal, Drawer, Tooltip...                           β”‚
β”‚                                                                     β”‚
β”‚  ✨ Custom Component Templates:                                     β”‚
β”‚  β”œβ”€β”€ Voice (Card + Animation)                                       β”‚
β”‚  β”œβ”€β”€ BentoGrid (Grid + Cards)                                      β”‚
β”‚  β”œβ”€β”€ MetricCard (Card + Typography + Icon)                         β”‚
β”‚  └── ... based on user's use case                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  AI generates Storybook-like documentation site with 3 sections:    β”‚
β”‚                                                                     β”‚
β”‚  app/                                                               β”‚
β”‚  β”œβ”€β”€ layout.tsx              # Root layout with sidebar             β”‚
β”‚  β”œβ”€β”€ page.tsx                # Homepage/introduction                β”‚
β”‚  β”œβ”€β”€ components/                                                    β”‚
β”‚  β”‚   β”œβ”€β”€ sidebar.tsx         # Three-section navigation             β”‚
β”‚  β”‚   └── code-block.tsx      # Code display with copy               β”‚
β”‚  β”‚                                                                  β”‚
β”‚  β”œβ”€β”€ foundations/            # Section 1: Basic elements            β”‚
β”‚  β”‚   β”œβ”€β”€ colors/page.tsx     # Color palette showcase              β”‚
β”‚  β”‚   β”œβ”€β”€ surfaces/page.tsx   # Shadows, borders, depth             β”‚
β”‚  β”‚   └── typography/page.tsx # Font scales, weights                β”‚
β”‚  β”‚                                                                  β”‚
β”‚  β”œβ”€β”€ primitives/             # Section 2: All 77 shadcn components β”‚
β”‚  β”‚   β”œβ”€β”€ accordion/page.tsx                                         β”‚
β”‚  β”‚   β”œβ”€β”€ alert/page.tsx                                             β”‚
β”‚  β”‚   β”œβ”€β”€ button/page.tsx                                            β”‚
β”‚  β”‚   └── ... (77 component pages)                                  β”‚
β”‚  β”‚                                                                  β”‚
β”‚  └── custom/                 # Section 3: Icons + custom componentsβ”‚
β”‚      β”œβ”€β”€ icons/page.tsx      # Icon library showcase (required)    β”‚
β”‚      β”œβ”€β”€ metric-card/page.tsx                                       β”‚
β”‚      └── dashboard-grid/page.tsx                                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Validation Step (packages/web/src/lib/validate-design-system.ts)   β”‚
β”‚                                                                     β”‚
β”‚  βœ“ Documentation site structure complete                           β”‚
β”‚  βœ“ All 77 primitive component pages generated                      β”‚
β”‚  βœ“ All 3 foundation pages present                                  β”‚
β”‚  βœ“ Icons page exists (required)                                    β”‚
β”‚  βœ“ Identify custom components created                              β”‚
β”‚                                                                     β”‚
β”‚  Console Output:                                                    β”‚
β”‚  Generated 82 component pages:                                      β”‚
β”‚  - 77 primitive components                                          β”‚
β”‚  - 5 custom components (including icons)                            β”‚
β”‚                                                                     β”‚
β”‚  βœ“ Custom component pages:                                          β”‚
β”‚    - icons (icon library showcase)                                  β”‚
β”‚    - metric-card                                                    β”‚
β”‚    - dashboard-grid                                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Benefits:

  • Completeness: All 77 shadcn components generated every time
  • Browsable Interface: Storybook-like sidebar navigation
  • Live Examples: Each component page shows variants and code
  • Custom Components: AI creates domain-specific components by remixing base components
  • Validation: Automatically checks for missing components

Implementation Files:

  • packages/web/src/lib/catalogs/shadcn-catalog.ts - Complete catalog of 77 components
  • packages/web/src/lib/validate-design-system.ts - Validation utilities
  • packages/web/src/prompt.ts - System prompt with catalog
  • packages/web/src/inngest/functions.ts - Validation integration

Status Flow

stateDiagram-v2
    [*] --> PENDING: User submits message
    PENDING --> SELECTED: Design system chosen
    SELECTED --> GENERATING: Code agent starts
    GENERATING --> COMPLETED: Success
    GENERATING --> ERROR: Failure
    COMPLETED --> [*]
    ERROR --> [*]

Project Structure

better-design/
β”œβ”€β”€ design-systems/          # Source of truth for each design system
β”‚   β”œβ”€β”€ linear/
β”‚   β”‚   β”œβ”€β”€ globals.css      # CSS variables (colors, spacing, radius)
β”‚   β”‚   β”œβ”€β”€ components/      # Component TSX overrides
β”‚   β”‚   └── utils.ts         # cn() helper
β”‚   β”œβ”€β”€ supabase/
β”‚   β”œβ”€β”€ airbnb/
β”‚   └── ...                  # 31 systems total
β”œβ”€β”€ docs/                    # Design foundations (colors, animation, principles)
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ shared/              # Shared MCP server definition (tools, instructions, types)
β”‚   β”‚   └── src/mcp/         # createMcpServer() + DataProvider interface
β”‚   β”œβ”€β”€ mcp/                 # Stdio transport (Cursor, Claude Code)
β”‚   └── web/                 # Next.js app + remote MCP transport (claude.ai)
β”‚       └── src/
β”‚           β”œβ”€β”€ app/         # App Router pages
β”‚           β”œβ”€β”€ db/schema.ts # Drizzle schema
β”‚           β”œβ”€β”€ inngest/     # Background job functions
β”‚           β”œβ”€β”€ lib/         # Design system search, catalogs, validation
β”‚           └── server/api/  # Hono routes (/api/v1, /api/mcp, /api/projects...)
└── README.md

Adding a Design System

  1. Create a folder in design-systems/:

    design-systems/my-system/
    β”œβ”€β”€ globals.css      # CSS variables
    β”œβ”€β”€ components/      # TSX component files
    └── utils.ts         # cn() helper
    
  2. Add metadata in packages/mcp/src/lib/seed.ts

  3. Seed:

    cd packages/mcp && npm run seed
    

Why Keep Full Component Code?

Design nuances live in the components, not just CSS variables:

  • Shadow layers (Linear's subtle stacked shadows)
  • Focus states (ring vs glow vs color shift)
  • Border thickness per component type
  • Hover/active transitions
  • Radius variations by context

CSS variables alone can't capture these details.

License

MIT

Reviews (0)

No results found