UX Design Expertise
When to Use This Skill
Load this skill when you need to:
- Create or classify components using Atomic Design
- Transform BDD scenarios into Storybook stories
- Create RTL tests or Storybook play functions
- Define selector contracts for testing
- Perform UX review before PR approval
- Create or update brand guidelines
- Check the component catalog before creating new components
Common triggers:
- Refinement phase creates visual sub-tasks
- UI features need Storybook stories
- PR touches
src/components/ or stories/
- Discovery phase needs brand guidelines
- New feature may duplicate existing components
Quick Reference
Core principles:
- Design happens in code (Storybook) — Figma is an optional visual layer (see
af-figma-design-expertise)
- Atomic Design classifies components: Atoms → Molecules → Organisms → Templates
- Component Catalog Check before creating anything new
- Storybook play functions are PRIMARY for UI testing
- RTL tests are for non-visual logic only
The 7-Stage Design Flow:
- UX Intent Extraction → Understand requirements
- Visual Language + Base Tokens → Establish tokens from day one
- Component Design in Storybook → Build in atomic folders
- Behavior Locked with Tests → Play functions + RTL
- Design Sign-off → Storybook + tests complete
- Handoff to Engineering → Ownership transfer
- Pattern Tokenisation → Extract emergent patterns
Key deliverables:
- Storybook stories (all states, themes, viewports)
- Selector contract (
/tests/selectors/[capability].ts)
- Components in atomic folders (
src/components/{atoms,molecules,organisms,templates}/)
Rules
Atomic Design Rules
- MUST classify components — Atoms (primitives), Molecules (atom groups), Organisms (feature compositions), Templates (layouts)
- MUST check component catalog BEFORE creating — Browse Storybook sidebar, check shadcn/ui, compose before creating
- MUST use atomic folder structure —
src/components/{atoms,molecules,organisms,templates}/
- MUST mirror atomic levels in Storybook titles —
title: 'Atoms/Button', title: 'Organisms/Auth/SignupForm'
- SHOULD prefer shadcn/ui for atoms — Only create custom atoms when shadcn/ui doesn't cover the need
Component Rules
- MUST read design system FIRST —
/docs/design/design-system.md
- MUST map every BDD scenario to a story — 100% coverage
- MUST create selector contracts — Bridge between stories and tests
- MUST separate components from stories — Stories import from
src/components/, never embed code
- MUST check tsconfig.json paths before imports — Path aliases vary by project
Testing Rules
- Storybook play functions are PRIMARY for UI component testing (real browser)
- RTL tests are for non-visual logic ONLY — Hooks, utils, state machines
- MUST NOT duplicate assertions — If play function tests it, don't repeat in RTL
- MUST include accessibility assertions — Roles, labels, focus management
- Tests MUST pass before handoff — Engineering keeps them passing
Design Token Rules
- MUST establish base tokens in Stage 2 — Brand colors, typography, spacing, radius, shadows
- Stage 7 is for emergent patterns ONLY — Not base tokens
- MUST use design system tokens — Never hard-code values that have tokens
Accessibility Rules (WCAG 2.1 AA)
- Semantic HTML mandatory — Headings, ARIA roles, landmarks, form labels
- Keyboard navigation complete — Tab order, focus visible, Escape closes modals
- Screen reader support — ARIA labels, live regions, described-by
- Color contrast minimum 4.5:1 — Text on background
- Touch targets minimum 44px — Mobile-friendly
Story Variant Rules
- MUST create responsive variants — Mobile (320-768px), Tablet (768-1024px), Desktop (1024px+)
- MUST create theme variants — Light and Dark mode using decorators
- MUST use
tags: ['autodocs'] — Enable auto-generated component documentation
- SHOULD add JSDoc to props interfaces — Appears in autodocs as prop descriptions
- SHOULD use CSF 3 with
satisfies Meta — Modern Storybook pattern
Workflows
Workflow: Creating Stories from Scenarios
When: Refinement phase, after BDD scenarios.
- Read BDD scenarios from mini-PRD Section 4
- Component Catalog Check — Browse Storybook, check shadcn/ui
- Read design system at
/docs/design/design-system.md
- Create selector contract at
/tests/selectors/[capability].ts
- Classify and create components in atomic folders
- Create stories that import components (title uses atomic prefix)
- Write stories per scenario (happy, error, boundary, validation)
- Add responsive variants (Mobile, Tablet, Desktop)
- Add theme variants (Light, Dark)
- Add play functions for interaction testing
- Add
tags: ['autodocs'] and JSDoc on props
- Test locally:
npm run storybook
See UX Design Guide for detailed steps and examples.
Workflow: UX Review
When: Delivery phase, before PR approval for UI changes.
- Gather inputs: UI under review, brand guidelines, design decision log, reference class
- Run 7-point checklist: Structure, Component Discipline, Density, State/Feedback, Accessibility, Brand Alignment, Decision Log Compliance
- Classify findings as: Aligned | Tension | Violation
- Emit outputs: Implementation fixes, token evolution, guideline amendments, design decisions
Hard rule: If a reference class can't be stated, the review is invalid.
See UX Design Guide for full checklist.
Workflow: Component Catalog Check
When: Before creating ANY new component.
- Browse Storybook sidebar — does this component already exist?
- Check shadcn/ui —
mcp__shadcn-ui-server__list_shadcn_components
- Can you compose from existing atoms/molecules?
- Only create new if nothing exists at the right level
- Classify the new component: atom, molecule, organism, or template
Common Pitfalls
| Pitfall |
Solution |
| Creating duplicates |
Check Storybook catalog first |
| Embedding code in stories |
Stories import from src/components/ |
| RTL duplicating play functions |
Play functions are primary for UI |
| No theme variants |
Add Light/Dark mode stories |
| Missing autodocs |
Add JSDoc + tags: ['autodocs'] |
| Wrong import paths |
Read tsconfig.json first |
| Flat component structure |
Use atomic folders |
| Deferring all tokens |
Base tokens go in Stage 2 |
Integration with AgentFlow Phases
| Phase |
Activities |
| Discovery |
Brand guidelines, reference class, base design tokens |
| Refinement |
Catalog Check → Components → Stories → Tests → Sign-off |
| Delivery |
Engineering wires components, UX Review before PR |
| Post-Delivery |
Extract emergent pattern tokens |
Essential Reading
Comprehensive guide (workflows, examples, review checklists):
Design system:
- Project design system:
/docs/design/design-system.md
Related skills:
af-bdd-expertise — Scenario understanding
af-testing-expertise — Test patterns
af-flutter-expertise — Mobile-specific patterns
af-figma-design-expertise — Figma round-trip workflows (optional visual layer)
MCP Tools:
mcp__shadcn-ui-server__list_shadcn_components — List available components
mcp__shadcn-ui-server__get_component_details — Get component specs
mcp__shadcn-ui-server__get_component_examples — Get usage examples
Remember:
- Atomic Design: Atoms → Molecules → Organisms → Templates
- Check the component catalog BEFORE creating new components
- Play functions are PRIMARY for UI testing
- Base tokens established in Stage 2, emergent patterns in Stage 7
- Storybook is the source of truth, not Figma
1---2name: af-ux-design-expertise3description: Use when creating Storybook stories, component specifications, RTL tests, performing UX reviews, or aligning BDD scenarios with UI design. Covers Atomic Design, the 7-stage design flow, component catalog management, selector contracts, shadcn/ui components, and accessibility (WCAG 2.1 AA).4---5
6# UX Design Expertise
7
8## When to Use This Skill
9
10Load this skill when you need to:
11- Create or classify components using Atomic Design
12- Transform BDD scenarios into Storybook stories
13- Create RTL tests or Storybook play functions
14- Define selector contracts for testing
15- Perform UX review before PR approval
16- Create or update brand guidelines
17- Check the component catalog before creating new components
18
19**Common triggers:**
20- Refinement phase creates visual sub-tasks
21- UI features need Storybook stories
22- PR touches `src/components/` or `stories/`
23- Discovery phase needs brand guidelines
24- New feature may duplicate existing components
25
26## Quick Reference
27
28**Core principles:**
291. Design happens in code (Storybook) — Figma is an optional visual layer (see `af-figma-design-expertise`)
302. Atomic Design classifies components: Atoms → Molecules → Organisms → Templates
313. Component Catalog Check before creating anything new
324. Storybook play functions are PRIMARY for UI testing
335. RTL tests are for non-visual logic only
34
35**The 7-Stage Design Flow:**
361. UX Intent Extraction → Understand requirements
372. Visual Language + Base Tokens → Establish tokens from day one
383. Component Design in Storybook → Build in atomic folders
394. Behavior Locked with Tests → Play functions + RTL
405. Design Sign-off → Storybook + tests complete
416. Handoff to Engineering → Ownership transfer
427. Pattern Tokenisation → Extract emergent patterns
43
44**Key deliverables:**
45- Storybook stories (all states, themes, viewports)
46- Selector contract (`/tests/selectors/[capability].ts`)
47- Components in atomic folders (`src/components/{atoms,molecules,organisms,templates}/`)
48
49## Rules
50
51### Atomic Design Rules
52
531. **MUST classify components** — Atoms (primitives), Molecules (atom groups), Organisms (feature compositions), Templates (layouts)
542. **MUST check component catalog BEFORE creating** — Browse Storybook sidebar, check shadcn/ui, compose before creating
553. **MUST use atomic folder structure** — `src/components/{atoms,molecules,organisms,templates}/`
564. **MUST mirror atomic levels in Storybook titles** — `title: 'Atoms/Button'`, `title: 'Organisms/Auth/SignupForm'`
575. **SHOULD prefer shadcn/ui for atoms** — Only create custom atoms when shadcn/ui doesn't cover the need
58
59### Component Rules
60
616. **MUST read design system FIRST** — `/docs/design/design-system.md`
627. **MUST map every BDD scenario to a story** — 100% coverage
638. **MUST create selector contracts** — Bridge between stories and tests
649. **MUST separate components from stories** — Stories import from `src/components/`, never embed code
6510. **MUST check tsconfig.json paths before imports** — Path aliases vary by project
66
67### Testing Rules
68
6911. **Storybook play functions are PRIMARY** for UI component testing (real browser)
7012. **RTL tests are for non-visual logic ONLY** — Hooks, utils, state machines
7113. **MUST NOT duplicate assertions** — If play function tests it, don't repeat in RTL
7214. **MUST include accessibility assertions** — Roles, labels, focus management
7315. **Tests MUST pass before handoff** — Engineering keeps them passing
74
75### Design Token Rules
76
7716. **MUST establish base tokens in Stage 2** — Brand colors, typography, spacing, radius, shadows
7817. **Stage 7 is for emergent patterns ONLY** — Not base tokens
7918. **MUST use design system tokens** — Never hard-code values that have tokens
80
81### Accessibility Rules (WCAG 2.1 AA)
82
8319. **Semantic HTML mandatory** — Headings, ARIA roles, landmarks, form labels
8420. **Keyboard navigation complete** — Tab order, focus visible, Escape closes modals
8521. **Screen reader support** — ARIA labels, live regions, described-by
8622. **Color contrast minimum 4.5:1** — Text on background
8723. **Touch targets minimum 44px** — Mobile-friendly
88
89### Story Variant Rules
90
9124. **MUST create responsive variants** — Mobile (320-768px), Tablet (768-1024px), Desktop (1024px+)
9225. **MUST create theme variants** — Light and Dark mode using decorators
9326. **MUST use `tags: ['autodocs']`** — Enable auto-generated component documentation
9427. **SHOULD add JSDoc to props interfaces** — Appears in autodocs as prop descriptions
9528. **SHOULD use CSF 3 with `satisfies Meta`** — Modern Storybook pattern
96
97## Workflows
98
99### Workflow: Creating Stories from Scenarios
100
101**When:** Refinement phase, after BDD scenarios.
102
1031. Read BDD scenarios from mini-PRD Section 4
1042. **Component Catalog Check** — Browse Storybook, check shadcn/ui
1053. Read design system at `/docs/design/design-system.md`
1064. Create selector contract at `/tests/selectors/[capability].ts`
1075. Classify and create components in atomic folders
1086. Create stories that import components (title uses atomic prefix)
1097. Write stories per scenario (happy, error, boundary, validation)
1108. Add responsive variants (Mobile, Tablet, Desktop)
1119. Add theme variants (Light, Dark)
11210. Add play functions for interaction testing
11311. Add `tags: ['autodocs']` and JSDoc on props
11412. Test locally: `npm run storybook`
115
116See [UX Design Guide](../../docs/guides/ux-design-guide.md) for detailed steps and examples.
117
118### Workflow: UX Review
119
120**When:** Delivery phase, before PR approval for UI changes.
121
1221. Gather inputs: UI under review, brand guidelines, design decision log, reference class
1232. Run 7-point checklist: Structure, Component Discipline, Density, State/Feedback, Accessibility, Brand Alignment, Decision Log Compliance
1243. Classify findings as: Aligned | Tension | Violation
1254. Emit outputs: Implementation fixes, token evolution, guideline amendments, design decisions
126
127**Hard rule:** If a reference class can't be stated, the review is invalid.
128
129See [UX Design Guide](../../docs/guides/ux-design-guide.md#ux-review-workflow) for full checklist.
130
131### Workflow: Component Catalog Check
132
133**When:** Before creating ANY new component.
134
1351. Browse Storybook sidebar — does this component already exist?
1362. Check shadcn/ui — `mcp__shadcn-ui-server__list_shadcn_components`
1373. Can you compose from existing atoms/molecules?
1384. Only create new if nothing exists at the right level
1395. Classify the new component: atom, molecule, organism, or template
140
141## Common Pitfalls
142
143| Pitfall | Solution |
144|---------|----------|
145| Creating duplicates | Check Storybook catalog first |
146| Embedding code in stories | Stories import from `src/components/` |
147| RTL duplicating play functions | Play functions are primary for UI |
148| No theme variants | Add Light/Dark mode stories |
149| Missing autodocs | Add JSDoc + `tags: ['autodocs']` |
150| Wrong import paths | Read tsconfig.json first |
151| Flat component structure | Use atomic folders |
152| Deferring all tokens | Base tokens go in Stage 2 |
153
154## Integration with AgentFlow Phases
155
156| Phase | Activities |
157|-------|-----------|
158| **Discovery** | Brand guidelines, reference class, base design tokens |
159| **Refinement** | Catalog Check → Components → Stories → Tests → Sign-off |
160| **Delivery** | Engineering wires components, UX Review before PR |
161| **Post-Delivery** | Extract emergent pattern tokens |
162
163## Essential Reading
164
165**Comprehensive guide (workflows, examples, review checklists):**
166- [UX Design Guide](../../docs/guides/ux-design-guide.md)
167
168**Design system:**
169- Project design system: `/docs/design/design-system.md`
170
171**Related skills:**
172- `af-bdd-expertise` — Scenario understanding
173- `af-testing-expertise` — Test patterns
174- `af-flutter-expertise` — Mobile-specific patterns
175- `af-figma-design-expertise` — Figma round-trip workflows (optional visual layer)
176
177**MCP Tools:**
178- `mcp__shadcn-ui-server__list_shadcn_components` — List available components
179- `mcp__shadcn-ui-server__get_component_details` — Get component specs
180- `mcp__shadcn-ui-server__get_component_examples` — Get usage examples
181
182---
183
184**Remember:**
1851. Atomic Design: Atoms → Molecules → Organisms → Templates
1862. Check the component catalog BEFORE creating new components
1873. Play functions are PRIMARY for UI testing
1884. Base tokens established in Stage 2, emergent patterns in Stage 7
1895. Storybook is the source of truth, not Figma