UI Design Workflow
Manage the full UI design workflow: Demo → Spec → Implement → Check → Iterate.
Supports both custom components and component libraries (shadcn/ui, Ant Design, Element Plus, etc.).
Command Reference
| Command |
Purpose |
When to Use |
demo |
Analyze project + generate UI showcase |
Early stage: establish style & component solution |
spec |
Generate spec document |
After Demo is confirmed |
implement |
Build features per spec |
Daily development |
check |
Audit spec compliance |
Before PR, periodic review |
iterate |
Update the spec |
When gaps are discovered |
Command Details
demo - Generate UI Components + Showcase Page
Input: User's UI style requirements (e.g., "minimal modern", "techy")
Output:
- Real component files in
src/components/ui/ (reusable across the project)
- Two showcase pages (separate pages, NOT tabs):
- Product Demo (
/ui-showcase) - Realistic demo of the actual product, adapts to project type (see below)
- Component Library (
/ui-components) - All components rendered in various states, independently iterable
Flow selection (auto-detect):
- Project has existing spec → Flow B (import existing components, generate demo)
- User specified a library → Flow C (use specified library, still confirm style)
- Project has significant existing UI (5+ components or 3+ pages) but no spec → Flow D (extract and document, see below)
- Otherwise → Flow A (from scratch)
Flow D: Adopt Existing UI (for projects with existing UI code but no spec):
- Deep scan: Extract design tokens (colors, fonts, spacing, radius, shadows) and component inventory from existing code
- Present extraction results: Show findings to user via
AskUserQuestion for confirmation
- Gap analysis: Identify missing tokens, inconsistent values, missing components
- User decides: Fix gaps now or defer to
iterate
- Generate spec:
doc/ui-design-spec.md based on extracted data (not invented)
- Optional showcase: Ask if user wants a showcase page for existing components
- Update agent config: Write spec reference to CLAUDE.md / AGENTS.md
- See references/modes.md for detailed steps.
Product Demo adapts to project type:
- Website / Landing Page → Demo shows the actual website (hero, features, CTA, etc.)
- Web App / SaaS / Dashboard → Demo shows main app screens (dashboard, list page, detail page, etc.)
- E-commerce → Demo shows product listing, product detail, cart overview
- Blog / Content site → Demo shows article list, article detail
- Portfolio → Demo shows portfolio grid, project detail
- If project type is unclear from code analysis, ask the user what they are building
Flow A (from scratch):
- Project Analysis + Product Understanding:
- Read
package.json to identify framework and existing dependencies
- Scan code directory to identify existing patterns and tech stack
- Determine project type (website, web app, SaaS, e-commerce, blog, etc.)
- ⛔ If project type is unclear: Ask the user what they are building (e.g., "Is this a website, a web app, a dashboard...? What are the main pages/features?"). This determines what the demo page will show.
- Scan existing components: Find all components in the project, assess their consistency
- Present findings and auto-select component solution:
- Show existing component inventory and consistency assessment to user
- Auto-select a component solution based on analysis (custom / shadcn/ui / Ant Design / other)
- Auto-detect existing library dependencies and continue with them
- If user already specified a library in the command, use it directly
- Do NOT ask the user to choose — use the recommended solution by default. Advanced users will override if needed.
- ⛔ Visual Style Preview (BLOCKING) — Generate
style-preview.html (standalone HTML, opens in any browser) with 3 diverse style direction previews. Each preview shows real fonts (Google Fonts), actual color palette, a mini Hero section, and atmosphere effects. User opens in browser, picks A/B/C, asks for a new batch, or describes their own direction. Then ask theme mode (light/dark/toggle). DO NOT proceed without user's confirmed choice. See assets/style-preview-template.md for the HTML template.
- Design Thinking (read references/frontend-aesthetics.md):
- Refine the user's chosen style direction into detailed design tokens
- Define the memorable element — what makes this design unforgettable?
- Finalize typography, color palette, atmospheric details — all coherent with the confirmed visual preview
- Create real component files (the single source of truth):
- Set up design tokens as CSS variables
- Create each component as a real file in
src/components/ui/
- Components support all variants, states, transitions, and accessibility
- Skip components that already exist in the project
- Create two showcase pages (separate pages, NOT tabs):
- Product Demo (
/ui-showcase): Realistic demo adapted to the project type — website shows the website, app shows main app screens, etc. Built with real components.
- Component Library (
/ui-components): All components in every variant/state.
- Both pages share a navigation bar with links to each other.
- Include existing project components in Component Library page (do not modify them)
- Apply motion: Orchestrate page load animations with staggered reveals
- Apply atmosphere: Add background textures, gradients, or visual depth
- Run anti-AI-slop checklist (see references/frontend-aesthetics.md)
- Iterate with user
Existing component handling:
- Preserve existing components as-is; do not modify during demo phase
- Only suggest fixes for severe issues (accessibility violations, broken layouts)
- Minor inconsistencies are noted for future
iterate updates
Output locations:
- Components:
src/components/ui/*.tsx
- Product Demo (Next.js):
app/ui-showcase/page.tsx | (Vite): src/pages/UIShowcase.tsx
- Component Library (Next.js):
app/ui-components/page.tsx | (Vite): src/pages/UIComponents.tsx
Templates: See assets/components.md for component library structure
Library guide: See assets/library-guide.md
spec - Generate Spec Document
Prerequisite: Confirmed Demo exists (component files + showcase page)
Output:
- Spec document:
doc/ui-design-spec.md (includes Component Registry)
- Project integration: Update CLAUDE.md with spec reference
Flow:
- Read component files and showcase code, extract design decisions
- Build Component Registry: Scan all component files, record name → path → variants → states
- Record component solution: Document the chosen solution in the spec
- Solution type (custom / library name)
- Library version (if applicable)
- Theme configuration method and file path
- Generate structured spec document (design tokens + registry, NOT code examples)
- Update CLAUDE.md with spec reference
implement - Build Features Per Spec
Prerequisite: Project has a UI spec with Component Registry
Flow:
- Must read the project's UI spec document first
- Check Component Registry: Find existing components that can be reused
- If a needed component exists → read its source file, import and use it
- If a needed component does NOT exist → create it following the spec's design tokens, then notify user to run
iterate to register it
- Implement the user's requested feature per spec
- Ensure colors, spacing, and component styles comply with the spec
Key: Always check the Component Registry before creating any UI element. Reuse existing components — do not duplicate.
check - Audit Spec Compliance
Input: File or directory to check
Flow:
- Read the project's UI spec (including Component Registry)
- Scan the specified code
- Check for:
- Component reuse: Are registry components being imported and used, or duplicated inline?
- Design tokens: Are CSS variables used instead of hardcoded values?
- Spacing/radius: Do values conform to the spec's grid system?
- Library compliance (if applicable): Are library components used correctly?
- Output violation report with component reuse rate
iterate - Update the Spec
Trigger: New component created during implement, missing registry entry, design token change, or switching component solution
Flow:
- Confirm with user what needs to be added/modified
- If adding a new component: verify the file exists, add to Component Registry, add to showcase
- If switching component solution, flag components that need migration
- Update spec document (registry / tokens)
- Update Demo showcase page (if needed)
- Sync related implementation code (if needed)
Design Principles (General)
Full details: assets/design-principles.md — Must read before demo phase.
Aesthetics guide: references/frontend-aesthetics.md — Core creative reference for all design work.
Intentional Design (Core Principle)
- Every design must have a clear aesthetic direction and point of view
- Choose a bold tone: brutally minimal, luxury refined, editorial, organic, retro-futuristic, etc.
- Define the memorable element — the ONE thing someone will remember
- NEVER produce generic AI aesthetics: no Inter/Roboto fonts, no purple-on-white gradients, no cookie-cutter layouts
Less is More (Token Principle)
- Default to the minimum viable set of design tokens
- Fewer named levels: border-radius 3, spacing 4, shadows 3, font weights 2
- Minimal tokens ≠ minimal aesthetics — a small set of well-chosen tokens creates more cohesion
Component Solution
- Custom components: Hand-write all UI components, full control
- Component library: Use an existing library (shadcn/ui, Ant Design, Element Plus, etc.)
- Choice is made during demo stage, recorded in the spec document
- All subsequent stages automatically follow this choice
Typography
- Choose distinctive, characterful fonts — never generic defaults
- Pair a display/heading font with a refined body font for contrast
- Vary font choices across different projects — never converge on the same "safe" pick
- Clear type scale hierarchy (Display → H1 → H2 → Body → Small)
Color System
- Dominant + accent model: One dominant color for mood, sharp accents for focal points
- Build palettes that evoke an emotion — if you can't name the feeling, it's too generic
- Avoid: purple-blue gradients, teal/coral combos, unmodified Tailwind gray scales
- System feedback: Success, Error, Warning, Info
Motion & Atmosphere
- Orchestrate page load with staggered reveals (highest impact)
- Add scroll-triggered reveals, surprising hover states
- Create atmospheric depth: gradient meshes, noise textures, radial highlights
- Avoid: solid white/dark backgrounds with no visual interest
Responsive
- Mobile-first design
- Key breakpoints: sm(640px), md(768px), lg(1024px)
File Structure
ui-design-workflow/
├── SKILL.md # This file (overview)
├── README.md # User documentation
├── assets/
│ ├── website.md # Landing page reference (NOT used in demo flow — AI designs freely)
│ ├── components.md # Component library template
│ ├── style-preview-template.md # Visual style preview page (HTML + server)
│ ├── design-principles.md # UI design principles (references aesthetics guide)
│ ├── spec-template.md # Spec document template
│ └── library-guide.md # Component library integration guide
└── references/
├── modes.md # Detailed mode specifications
└── frontend-aesthetics.md # ⭐ Core creative aesthetics guide (anti-AI-slop)
Quick Decision Guide
User says "design UI" → Use demo (analyze project, recommend component solution)
User says "use shadcn/ui" → Use demo (skip recommendation, use specified library)
User says "generate spec" → Use spec
User says "implement feature" → Use implement (read spec first, identify component solution)
User says "check code" → Use check
User says "add component spec" → Use iterate
User says "switch to Ant Design" → Use iterate (switch component solution)
1---2name: ui-design-workflow3description: MUST use when implementing UI components or frontend pages in this project. Triggers: designing UI, implement page, develop UI, write component, frontend development, create component, build interface, style page, button, form, modal, toast, card, input, styling, interface, shadcn, ant design, antd, element plus, component library, UI library, 设计UI, 实现页面, 开发UI, 写组件, 前端开发, 创建组件, 构建界面, 页面样式, 按钮, 表单, 弹窗, 提示, 卡片, 输入框, 样式, 界面, 组件库, UI组件, 设计规范, 生成规范, 实现功能, 检查代码, 迭代规范, 切换组件库. Before writing any UI code, load this skill to read the project's design spec.4---56# UI Design Workflow78Manage the full UI design workflow: Demo → Spec → Implement → Check → Iterate.9Supports both custom components and component libraries (shadcn/ui, Ant Design, Element Plus, etc.).1011## Command Reference1213| Command | Purpose | When to Use |14|---------|---------|-------------|15| `demo` | Analyze project + generate UI showcase | Early stage: establish style & component solution |16| `spec` | Generate spec document | After Demo is confirmed |17| `implement` | Build features per spec | Daily development |18| `check` | Audit spec compliance | Before PR, periodic review |19| `iterate` | Update the spec | When gaps are discovered |2021---2223## Command Details2425### demo - Generate UI Components + Showcase Page2627**Input**: User's UI style requirements (e.g., "minimal modern", "techy")2829**Output**:30- **Real component files** in `src/components/ui/` (reusable across the project)31- **Two showcase pages** (separate pages, NOT tabs):32 - **Product Demo** (`/ui-showcase`) - Realistic demo of the actual product, adapts to project type (see below)33 - **Component Library** (`/ui-components`) - All components rendered in various states, independently iterable3435**Flow selection** (auto-detect):36- Project has existing spec → **Flow B** (import existing components, generate demo)37- User specified a library → **Flow C** (use specified library, still confirm style)38- Project has significant existing UI (5+ components or 3+ pages) but no spec → **Flow D** (extract and document, see below)39- Otherwise → **Flow A** (from scratch)4041**Flow D: Adopt Existing UI** (for projects with existing UI code but no spec):421. **Deep scan**: Extract design tokens (colors, fonts, spacing, radius, shadows) and component inventory from existing code432. **Present extraction results**: Show findings to user via `AskUserQuestion` for confirmation443. **Gap analysis**: Identify missing tokens, inconsistent values, missing components454. **User decides**: Fix gaps now or defer to `iterate`465. **Generate spec**: `doc/ui-design-spec.md` based on extracted data (not invented)476. **Optional showcase**: Ask if user wants a showcase page for existing components487. **Update agent config**: Write spec reference to CLAUDE.md / AGENTS.md49- See [references/modes.md](references/modes.md) for detailed steps.5051**Product Demo adapts to project type**:52- **Website / Landing Page** → Demo shows the actual website (hero, features, CTA, etc.)53- **Web App / SaaS / Dashboard** → Demo shows main app screens (dashboard, list page, detail page, etc.)54- **E-commerce** → Demo shows product listing, product detail, cart overview55- **Blog / Content site** → Demo shows article list, article detail56- **Portfolio** → Demo shows portfolio grid, project detail57- If project type is unclear from code analysis, **ask the user** what they are building5859**Flow A (from scratch):**601. **Project Analysis + Product Understanding**:61 - Read `package.json` to identify framework and existing dependencies62 - Scan code directory to identify existing patterns and tech stack63 - Determine project type (website, web app, SaaS, e-commerce, blog, etc.)64 - **⛔ If project type is unclear**: Ask the user what they are building (e.g., "Is this a website, a web app, a dashboard...? What are the main pages/features?"). This determines what the demo page will show.65 - **Scan existing components**: Find all components in the project, assess their consistency662. **Present findings and auto-select component solution**:67 - Show existing component inventory and consistency assessment to user68 - Auto-select a component solution based on analysis (custom / shadcn/ui / Ant Design / other)69 - Auto-detect existing library dependencies and continue with them70 - If user already specified a library in the command, use it directly71 - **Do NOT ask the user to choose** — use the recommended solution by default. Advanced users will override if needed.723. **⛔ Visual Style Preview (BLOCKING)** — Generate `style-preview.html` (standalone HTML, opens in any browser) with 3 diverse style direction previews. Each preview shows real fonts (Google Fonts), actual color palette, a mini Hero section, and atmosphere effects. User opens in browser, picks A/B/C, asks for a new batch, or describes their own direction. Then ask theme mode (light/dark/toggle). **DO NOT proceed without user's confirmed choice.** See [assets/style-preview-template.md](assets/style-preview-template.md) for the HTML template.734. **Design Thinking** (read [references/frontend-aesthetics.md](references/frontend-aesthetics.md)):74 - Refine the user's chosen style direction into detailed design tokens75 - Define the memorable element — what makes this design unforgettable?76 - Finalize typography, color palette, atmospheric details — all coherent with the confirmed visual preview775. **Create real component files** (the single source of truth):78 - Set up design tokens as CSS variables79 - Create each component as a real file in `src/components/ui/`80 - Components support all variants, states, transitions, and accessibility81 - Skip components that already exist in the project826. **Create two showcase pages** (separate pages, NOT tabs):83 - **Product Demo** (`/ui-showcase`): Realistic demo adapted to the project type — website shows the website, app shows main app screens, etc. Built with real components.84 - **Component Library** (`/ui-components`): All components in every variant/state.85 - Both pages share a **navigation bar** with links to each other.86 - **Include existing project components** in Component Library page (do not modify them)87 - **Apply motion**: Orchestrate page load animations with staggered reveals88 - **Apply atmosphere**: Add background textures, gradients, or visual depth897. **Run anti-AI-slop checklist** (see [references/frontend-aesthetics.md](references/frontend-aesthetics.md))908. Iterate with user9192**Existing component handling**:93- Preserve existing components as-is; do not modify during demo phase94- Only suggest fixes for severe issues (accessibility violations, broken layouts)95- Minor inconsistencies are noted for future `iterate` updates9697**Output locations**:98- Components: `src/components/ui/*.tsx`99- Product Demo (Next.js): `app/ui-showcase/page.tsx` | (Vite): `src/pages/UIShowcase.tsx`100- Component Library (Next.js): `app/ui-components/page.tsx` | (Vite): `src/pages/UIComponents.tsx`101102**Templates**: See [assets/components.md](assets/components.md) for component library structure103**Library guide**: See [assets/library-guide.md](assets/library-guide.md)104105---106107### spec - Generate Spec Document108109**Prerequisite**: Confirmed Demo exists (component files + showcase page)110111**Output**:1121. Spec document: `doc/ui-design-spec.md` (includes Component Registry)1132. Project integration: Update CLAUDE.md with spec reference114115**Flow**:1161. Read component files and showcase code, extract design decisions1172. **Build Component Registry**: Scan all component files, record name → path → variants → states1183. **Record component solution**: Document the chosen solution in the spec119 - Solution type (custom / library name)120 - Library version (if applicable)121 - Theme configuration method and file path1224. Generate structured spec document (design tokens + registry, NOT code examples)1235. Update CLAUDE.md with spec reference124125---126127### implement - Build Features Per Spec128129**Prerequisite**: Project has a UI spec with Component Registry130131**Flow**:1321. **Must** read the project's UI spec document first1332. **Check Component Registry**: Find existing components that can be reused134 - If a needed component exists → read its source file, import and use it135 - If a needed component does NOT exist → create it following the spec's design tokens, then notify user to run `iterate` to register it1363. Implement the user's requested feature per spec1374. Ensure colors, spacing, and component styles comply with the spec138139**Key**: Always check the Component Registry before creating any UI element. Reuse existing components — do not duplicate.140141---142143### check - Audit Spec Compliance144145**Input**: File or directory to check146147**Flow**:1481. Read the project's UI spec (including Component Registry)1492. Scan the specified code1503. Check for:151 - **Component reuse**: Are registry components being imported and used, or duplicated inline?152 - **Design tokens**: Are CSS variables used instead of hardcoded values?153 - **Spacing/radius**: Do values conform to the spec's grid system?154 - **Library compliance** (if applicable): Are library components used correctly?1554. Output violation report with component reuse rate156157---158159### iterate - Update the Spec160161**Trigger**: New component created during `implement`, missing registry entry, design token change, or switching component solution162163**Flow**:1641. Confirm with user what needs to be added/modified1652. If adding a new component: verify the file exists, add to Component Registry, add to showcase1663. If switching component solution, flag components that need migration1674. Update spec document (registry / tokens)1685. Update Demo showcase page (if needed)1696. Sync related implementation code (if needed)170171---172173## Design Principles (General)174175> **Full details**: [assets/design-principles.md](assets/design-principles.md) — Must read before demo phase.176> **Aesthetics guide**: [references/frontend-aesthetics.md](references/frontend-aesthetics.md) — Core creative reference for all design work.177178### Intentional Design (Core Principle)179- Every design must have a clear aesthetic direction and point of view180- Choose a bold tone: brutally minimal, luxury refined, editorial, organic, retro-futuristic, etc.181- Define the memorable element — the ONE thing someone will remember182- **NEVER produce generic AI aesthetics**: no Inter/Roboto fonts, no purple-on-white gradients, no cookie-cutter layouts183184### Less is More (Token Principle)185- Default to the minimum viable set of design tokens186- Fewer named levels: border-radius 3, spacing 4, shadows 3, font weights 2187- Minimal tokens ≠ minimal aesthetics — a small set of well-chosen tokens creates more cohesion188189### Component Solution190- **Custom components**: Hand-write all UI components, full control191- **Component library**: Use an existing library (shadcn/ui, Ant Design, Element Plus, etc.)192- Choice is made during demo stage, recorded in the spec document193- All subsequent stages automatically follow this choice194195### Typography196- Choose **distinctive, characterful fonts** — never generic defaults197- Pair a display/heading font with a refined body font for contrast198- Vary font choices across different projects — never converge on the same "safe" pick199- Clear type scale hierarchy (Display → H1 → H2 → Body → Small)200201### Color System202- **Dominant + accent model**: One dominant color for mood, sharp accents for focal points203- Build palettes that evoke an emotion — if you can't name the feeling, it's too generic204- **Avoid**: purple-blue gradients, teal/coral combos, unmodified Tailwind gray scales205- **System feedback**: Success, Error, Warning, Info206207### Motion & Atmosphere208- Orchestrate page load with staggered reveals (highest impact)209- Add scroll-triggered reveals, surprising hover states210- Create atmospheric depth: gradient meshes, noise textures, radial highlights211- Avoid: solid white/dark backgrounds with no visual interest212213### Responsive214- Mobile-first design215- Key breakpoints: sm(640px), md(768px), lg(1024px)216217---218219## File Structure220221```222ui-design-workflow/223├── SKILL.md # This file (overview)224├── README.md # User documentation225├── assets/226│ ├── website.md # Landing page reference (NOT used in demo flow — AI designs freely)227│ ├── components.md # Component library template228│ ├── style-preview-template.md # Visual style preview page (HTML + server)229│ ├── design-principles.md # UI design principles (references aesthetics guide)230│ ├── spec-template.md # Spec document template231│ └── library-guide.md # Component library integration guide232└── references/233 ├── modes.md # Detailed mode specifications234 └── frontend-aesthetics.md # ⭐ Core creative aesthetics guide (anti-AI-slop)235```236237---238239## Quick Decision Guide240241**User says "design UI"** → Use `demo` (analyze project, recommend component solution)242**User says "use shadcn/ui"** → Use `demo` (skip recommendation, use specified library)243**User says "generate spec"** → Use `spec`244**User says "implement feature"** → Use `implement` (read spec first, identify component solution)245**User says "check code"** → Use `check`246**User says "add component spec"** → Use `iterate`247**User says "switch to Ant Design"** → Use `iterate` (switch component solution)