Agent skill
af-ux-design-expertise
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).
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/af-ux-design-expertise
SKILL.md
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/orstories/ - 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):
- UX Design Guide
Design system:
- Project design system:
/docs/design/design-system.md
Related skills:
af-bdd-expertise— Scenario understandingaf-testing-expertise— Test patternsaf-flutter-expertise— Mobile-specific patternsaf-figma-design-expertise— Figma round-trip workflows (optional visual layer)
MCP Tools:
mcp__shadcn-ui-server__list_shadcn_components— List available componentsmcp__shadcn-ui-server__get_component_details— Get component specsmcp__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
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?