UI Craftsman
When to Use
- User says /ui-ref, /ui-show, /ui-system, or /ui-share
- User asks to build UI inspired by a named website
- User asks for design options or directions for a component/page
- User asks to combine multiple sites into a design system
- User asks to browse or share UI designs
Before Generating Anything
Read ~/.claude/memory/ui-prefs.md if it exists. Use it to bias all aesthetic decisions.
If it does not exist, use Terminal Pro as the default aesthetic for all modes.
Mode Detection
Inspect the user message:
- Contains a URL and a UI description: Mode 1 (Reference)
- Contains a UI description but no URL: Mode 2 (Showcase)
- Contains 2+ URLs and "design system" or "combine": Mode 3 (Design System)
- Says /ui-share: Share flow
Mode 1 - Reference (/ui-ref )
- Run: python skills/ui-craftsman/scripts/validate.py
- Exit non-zero: tell user URL is blocked (private/internal address)
- Run: python skills/ui-craftsman/scripts/extract.py --out /tmp/ui-craftsman-/
- Exit non-zero: tell user extraction failed
- Read /tmp/ui-craftsman-/tokens.json
- Read ~/.claude/memory/ui-prefs.md if exists
- Generate preview.html — self-contained, no external scripts
- Run: python skills/ui-craftsman/scripts/serve.py /tmp/ui-craftsman-/preview.html
- Tell user the URL and describe what is visible (repeat every response)
- Iterate on feedback until user approves
- Generate production React/TypeScript component(s) — max 200 lines per file, split into sub-components if needed
- Update ~/.claude/memory/ui-prefs.md
Mode 2 - Showcase (/ui-show )
- Read ~/.claude/memory/ui-prefs.md if exists
- Create /tmp/ui-craftsman-/
- Generate 4 HTML files:
- direction-A.html: Terminal Pro (dark, monospace, sharp) — always
- direction-B/C/D.html: from aesthetic classes based on description + preferences
- Fallback when no prefs: Bold Brand, Data Rich, Minimal Light
- Run: python skills/ui-craftsman/scripts/serve.py --gallery direction-A.html direction-B.html direction-C.html direction-D.html
- Tell user URL and describe each direction in one sentence
- User picks direction: generate React/TypeScript
- Update ~/.claude/memory/ui-prefs.md
Mode 3 - Design System (/ui-system ...)
- validate.py on each URL — abort if any fail
- extract.py for each URL in order
- Synthesize tokens: url1 takes precedence for all conflicts
- Write to current project directory:
- tokens.css, components/Button.tsx, Card.tsx, Input.tsx, Badge.tsx, Nav.tsx, Table.tsx, README.md
- serve.py a preview page showing all components
- Update ~/.claude/memory/ui-prefs.md
Share Flow (/ui-share)
Run share.py with: --title, --prompt, --aesthetic, --mode, --screenshot, --author, --repo-dir
See scripts/share.py --help for full argument list.
Error Handling
- validate.py exits 1: "That URL is blocked for security reasons. Please use a public URL."
- extract.py exits 1: "Could not extract design tokens. The site may require login or block automation."
- serve.py exits 1: "Could not start preview server (all ports 8400-8500 in use). Close other servers and try again."
- playwright not installed: "Run: playwright install chromium from skills/ui-craftsman/scripts/ (after pip install -r requirements.txt)"
- gh not installed (share fallback): "Install GitHub CLI from https://cli.github.com then run: gh auth login"
During a Session
Always include the localhost preview URL in every response while a server is running.
Describe what is visible on screen in 1-2 sentences with every URL reminder.
After User Picks
- Generate React/TypeScript production code
- Keep each component file under 200 lines — split into sub-components if needed
- Use safe rendering patterns only (textContent, JSX, no raw markup injection)
- Update ~/.claude/memory/ui-prefs.md
Preference Memory Format
File: ~/.claude/memory/ui-prefs.md
Frontmatter: name: ui-preferences, type: user
Sections:
- Aesthetic Profile: base style, border radius, gradients, typography, accent, spacing, cards, nav
- Session History: one line per session: date, command, chosen direction
Update rule: append to Session History after each pick. After 3+ sessions, rewrite Aesthetic Profile.
Setup (first time)
cd skills/ui-craftsman
pip install -r scripts/requirements.txt
playwright install chromium
gh auth login # only for /ui-share PR fallback
1---2name: ui-craftsman3description: Use this skill when the user wants to generate UI, build a design system, clone a site's aesthetic, or browse the community UI gallery. Triggers on /ui-ref, /ui-show, /ui-system, /ui-share, or natural-language requests naming a reference site.4license: Apache-2.05---67# UI Craftsman89## When to Use1011- User says /ui-ref, /ui-show, /ui-system, or /ui-share12- User asks to build UI inspired by a named website13- User asks for design options or directions for a component/page14- User asks to combine multiple sites into a design system15- User asks to browse or share UI designs1617## Before Generating Anything1819Read ~/.claude/memory/ui-prefs.md if it exists. Use it to bias all aesthetic decisions.20If it does not exist, use Terminal Pro as the default aesthetic for all modes.2122## Mode Detection2324Inspect the user message:25- Contains a URL and a UI description: Mode 1 (Reference)26- Contains a UI description but no URL: Mode 2 (Showcase)27- Contains 2+ URLs and "design system" or "combine": Mode 3 (Design System)28- Says /ui-share: Share flow2930## Mode 1 - Reference (/ui-ref <url>)31321. Run: python skills/ui-craftsman/scripts/validate.py <url>33 - Exit non-zero: tell user URL is blocked (private/internal address)342. Run: python skills/ui-craftsman/scripts/extract.py <url> --out /tmp/ui-craftsman-<hash>/35 - Exit non-zero: tell user extraction failed363. Read /tmp/ui-craftsman-<hash>/tokens.json374. Read ~/.claude/memory/ui-prefs.md if exists385. Generate preview.html — self-contained, no external scripts396. Run: python skills/ui-craftsman/scripts/serve.py /tmp/ui-craftsman-<hash>/preview.html407. Tell user the URL and describe what is visible (repeat every response)418. Iterate on feedback until user approves429. Generate production React/TypeScript component(s) — max 200 lines per file, split into sub-components if needed4310. Update ~/.claude/memory/ui-prefs.md4445## Mode 2 - Showcase (/ui-show <description>)46471. Read ~/.claude/memory/ui-prefs.md if exists482. Create /tmp/ui-craftsman-<hash>/493. Generate 4 HTML files:50 - direction-A.html: Terminal Pro (dark, monospace, sharp) — always51 - direction-B/C/D.html: from aesthetic classes based on description + preferences52 - Fallback when no prefs: Bold Brand, Data Rich, Minimal Light534. Run: python skills/ui-craftsman/scripts/serve.py --gallery direction-A.html direction-B.html direction-C.html direction-D.html545. Tell user URL and describe each direction in one sentence556. User picks direction: generate React/TypeScript567. Update ~/.claude/memory/ui-prefs.md5758## Mode 3 - Design System (/ui-system <url1> <url2> ...)59601. validate.py on each URL — abort if any fail612. extract.py for each URL in order623. Synthesize tokens: url1 takes precedence for all conflicts634. Write to current project directory:64 - tokens.css, components/Button.tsx, Card.tsx, Input.tsx, Badge.tsx, Nav.tsx, Table.tsx, README.md655. serve.py a preview page showing all components666. Update ~/.claude/memory/ui-prefs.md6768## Share Flow (/ui-share)6970Run share.py with: --title, --prompt, --aesthetic, --mode, --screenshot, --author, --repo-dir71See scripts/share.py --help for full argument list.7273## Error Handling7475- validate.py exits 1: "That URL is blocked for security reasons. Please use a public URL."76- extract.py exits 1: "Could not extract design tokens. The site may require login or block automation."77- serve.py exits 1: "Could not start preview server (all ports 8400-8500 in use). Close other servers and try again."78- playwright not installed: "Run: playwright install chromium from skills/ui-craftsman/scripts/ (after pip install -r requirements.txt)"79- gh not installed (share fallback): "Install GitHub CLI from https://cli.github.com then run: gh auth login"8081## During a Session8283Always include the localhost preview URL in every response while a server is running.84Describe what is visible on screen in 1-2 sentences with every URL reminder.8586## After User Picks87881. Generate React/TypeScript production code892. Keep each component file under 200 lines — split into sub-components if needed903. Use safe rendering patterns only (textContent, JSX, no raw markup injection)914. Update ~/.claude/memory/ui-prefs.md9293## Preference Memory Format9495File: ~/.claude/memory/ui-prefs.md9697Frontmatter: name: ui-preferences, type: user9899Sections:100- Aesthetic Profile: base style, border radius, gradients, typography, accent, spacing, cards, nav101- Session History: one line per session: date, command, chosen direction102103Update rule: append to Session History after each pick. After 3+ sessions, rewrite Aesthetic Profile.104105## Setup (first time)106107 cd skills/ui-craftsman108 pip install -r scripts/requirements.txt109 playwright install chromium110 gh auth login # only for /ui-share PR fallback