$npx -y skills add bluzir/claude-code-design --skill create-design-systemExtract or build a design system (tokens, components, style guide). Use for "design system", "style guide", "tokens", "UI kit".
| 1 | # Create Design System |
| 2 | |
| 3 | Produce a living HTML style guide with colors, typography, spacing, radii, shadows, and components. Uses `register-asset` to feed `assets.html`. |
| 4 | |
| 5 | ## Phase 0 — Registry check (avoid re-extracting what you already have) |
| 6 | |
| 7 | Before anything else: |
| 8 | 1. `Bash(ls ~/.claude/design-systems/ 2>/dev/null)` — list existing org-level design systems |
| 9 | 2. If the user's brief mentions a brand matching one of the folder names → **don't extract, load existing**: `Read ~/.claude/design-systems/<name>/tokens.json`, report "Using <name> from registry." |
| 10 | 3. If no brand match but registry has items → `AskUserQuestion`: "Use existing system (list them) / Extract new / Decide for me" |
| 11 | |
| 12 | Skip Phase 0 only if user explicitly said "create new". |
| 13 | |
| 14 | ## Phase 1 — Source |
| 15 | |
| 16 | Four sources, in order of preference: |
| 17 | |
| 18 | **0. Existing registry** — handled in Phase 0. If loaded, jump to Phase 2 (Build) directly. |
| 19 | |
| 20 | **1. Local codebase** (path provided): |
| 21 | - `Glob`: `**/theme.{ts,js,json}`, `**/tokens.{css,scss}`, `**/tailwind.config.*`, `**/_variables.*`, `**/colors.*`, `**/styles.css` |
| 22 | - `Read` each; extract: |
| 23 | - Hex/oklch/rgb colors → name + value + role (primary/secondary/accent/neutral/semantic) |
| 24 | - Font families + weights + sizes |
| 25 | - Spacing scale (4px/8px/etc.) |
| 26 | - Border radii |
| 27 | - Shadows |
| 28 | - `Read` a few component files to understand patterns |
| 29 | |
| 30 | **2. GitHub URL** — delegate to `/ingest-github` first, then continue here with the resulting `artifacts/ingested/*-tokens.json` |
| 31 | |
| 32 | **3. From scratch / screenshot / brand** — invoke `Skill: frontend-design`; `AskUserQuestion` about vibe, reference brands, emotional register |
| 33 | |
| 34 | ## Phase 2 — Build |
| 35 | |
| 36 | Create `artifacts/design-system.html` with a section per group. Use `data-design-group` attrs so `register-asset` can pick them up. |
| 37 | |
| 38 | ```html |
| 39 | <section data-design-group="Colors"> |
| 40 | <h2>Colors</h2> |
| 41 | <div class="swatch-grid"> |
| 42 | <!-- each swatch has name + hex + role --> |
| 43 | </div> |
| 44 | </section> |
| 45 | <section data-design-group="Type"> |
| 46 | <h2>Typography</h2> |
| 47 | <!-- sample text at each level: display, H1, H2, body, small --> |
| 48 | </section> |
| 49 | <section data-design-group="Spacing"> |
| 50 | <!-- visual bars for 4, 8, 12, 16, 24, 32... --> |
| 51 | </section> |
| 52 | <section data-design-group="Components"> |
| 53 | <!-- live-rendered buttons, form elements, cards, badges --> |
| 54 | </section> |
| 55 | <section data-design-group="Brand"> |
| 56 | <!-- logo usage, tone of voice, example composition --> |
| 57 | </section> |
| 58 | ``` |
| 59 | |
| 60 | Use real values from source, not invented ones. Every component is live HTML+CSS, not screenshots. |
| 61 | |
| 62 | ## Phase 3 — Register |
| 63 | |
| 64 | For each section: |
| 65 | ``` |
| 66 | /register-asset artifacts/design-system.html --group Colors --asset "Brand palette" --subtitle "7 colors, semantic roles" |
| 67 | ``` |
| 68 | |
| 69 | Runs once per group. `assets.html` will show each as a card. |
| 70 | |
| 71 | ## Phase 4 — Persistent context |
| 72 | |
| 73 | Write `.claude/design-tokens.json` for future skills in THIS project to reference: |
| 74 | ```json |
| 75 | { |
| 76 | "name": "brand-slug", |
| 77 | "colors": { "primary": "#D97757", ... }, |
| 78 | "fonts": { "display": "...", "body": "..." }, |
| 79 | "spacing": [4, 8, 12, 16, 24, 32, 48], |
| 80 | "radii": { "sm": 4, "md": 8, "lg": 16 } |
| 81 | } |
| 82 | ``` |
| 83 | |
| 84 | Subsequent `/make-deck`, `/interactive-prototype` skills should `Read` this file to auto-apply. |
| 85 | |
| 86 | ## Phase 5 — Offer registry save (cross-project reuse) |
| 87 | |
| 88 | If the system is brand-specific (not generic "minimal monochrome" but e.g. "Acme Corp"), ask: |
| 89 | |
| 90 | > "Save to `~/.claude/design-systems/<slug>/` for reuse across projects?" |
| 91 | |
| 92 | If yes: |
| 93 | 1. `Bash(mkdir -p ~/.claude/design-systems/<slug>)` |
| 94 | 2. Copy `tokens.json` and `artifacts/design-system.html` → `~/.claude/design-systems/<slug>/` |
| 95 | 3. Report: "Saved to registry. Future projects can `/use-design-system <slug>` or auto-detect via brand keyword in brief." |
| 96 | |
| 97 | The registry format: |
| 98 | ``` |
| 99 | ~/.claude/design-systems/ |
| 100 | ├── acme/ |
| 101 | │ ├── tokens.json |
| 102 | │ └── preview.html # (optional) visual reference |
| 103 | ├── company-x/ |
| 104 | │ └── tokens.json |
| 105 | └── minimal-mono/ |
| 106 | └── tokens.json |
| 107 | ``` |
| 108 | |
| 109 | Any Claude Code session in any project sees this registry via Phase 0 of workflow skills. |