- New commands: /define-design, /update-design, /generate-app (web | flutter | winui3) - New skills: ui-design, design-tokens, platform-ui-generation - /add-feature: check design spec before implementation (Step 3.5) and reconcile all six persistent docs after implementation (Step 8) - /setup-project: automatic document creation with self-check checkpoints - CLAUDE.md: document docs/design/, .claude/ configuration, and the design phase in the development process - Enrich subagent descriptions; allowlist new skills in settings.json - Add docs/design/README.md Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5.6 KiB
5.6 KiB
| name | description | allowed-tools |
|---|---|---|
| platform-ui-generation | Guide for converting the design files (design-tokens.json + ui-blueprint.json) into application code for Web, Flutter, or WinUI 3. Use when running /generate-app or implementing UI against the design spec. | Read, Write, Edit, Bash |
Platform UI Generation Skill
This skill explains how to convert the design files under docs/design/ into application code. It is used by /generate-app and by /add-feature when implementing UI.
Core Principles
- Source of truth:
docs/design/ui-blueprint.jsondefines structure;docs/design/design-tokens.jsondefines values. - No hard-coded values: every color, size, spacing, radius, and duration in generated code must come from a token.
- Reusable components first: extract reusable components; do not inline the entire tree into screens.
- No feature logic during scaffolding:
/generate-appcreates the shell, theme, routes, screens, and shared components only. Features come from/add-feature. - Respect the platform mapping:
docs/design/platform-mapping.mddocuments how each artifact maps to each platform.
Inputs
docs/design/design-brief.md— directiondocs/design/design-tokens.json— valuesdocs/design/ui-blueprint.json— structure (source of truth)docs/design/platform-mapping.md— per-platform conversion rulesdocs/architecture.md— technology choices (framework, language)
General Conversion Rules
- One screen in the blueprint → one screen/page in the target platform.
- One route in the blueprint → one route entry in the navigation config.
- A reusable component referenced in multiple screens → a shared component file/widget/control.
- Component
variant→ a variant/style modifier on the shared component. - Component
state→ visual states the component must support (default, hover, pressed, disabled, etc.). action: navigate:<screen-id>→ navigation to the corresponding route.- Other
action:values → wire to a handler/placeholder; do not implement feature logic.
Web Mapping
- design tokens → CSS variables, a Tailwind config, or a theme object.
color.*→ CSS custom properties (--color-background-primary) or Tailwind theme colors.spacing.*,radius.*,typography.*→ CSS variables / Tailwind theme keys.breakpoint.*→ responsive breakpoints.
- ui-blueprint →
screens→ pages/routes.layout→ layout components (vertical/horizontal stack, grid).components→ React (or framework) components, one file per reusable component.
- Use semantic HTML (
<header>,<main>,<nav>,<button>,<label>) where possible. - Respect responsive layout requirements using the breakpoint tokens.
- If no framework is specified in
architecture.md, choose a simple default suitable for the repository and note the choice.
Flutter Mapping
- design tokens →
color.*→ColorScheme+ a color constants file.typography.*→TextTheme/ text styles.spacing.*,radius.*→ constants (spacing_md,radiusCard).shadow.*→BoxShadow/ elevation.motion.duration.*→Durationconstants.- Assemble into a
ThemeData.
- ui-blueprint →
screens→Screenwidgets + routes (named routes or a router).layout.type→Column/Row/Wrap/ListViewwithpaddingandSizedBoxgaps from spacing tokens.components→ reusable widgets, one file per widget.
- Keep clean separation between:
screens/,widgets/,theme/,models/,services/.
WinUI 3 Mapping
- design tokens →
color.*,spacing.*,radius.*,typography.*→ aResourceDictionary(.xaml) withColor,Thickness,CornerRadius,FontFamily,Styleresources.- Assemble theme resources and styles keyed by the token names.
- ui-blueprint →
screens→ XAML pages (Page).layout.type→StackPanel/GridwithPadding/Marginfrom token resources.components→UserControls, one file per reusable component.- Navigation →
Frame+ navigation entries per route.
- Use C# and XAML.
- Keep UI logic separated from business logic (code-behind stays thin; logic goes to services/viewmodels).
Shared Component Contract
Each generated reusable component must:
- Accept the
variantas a parameter/prop/style modifier. - Support the
statesdeclared in the blueprint (default, hover, pressed, disabled). - Reference tokens for all visual values — no hard-coded literals.
- Stay presentational: no feature/business logic.
Scaffolding Scope (what /generate-app creates)
- App entry point and shell
- Theme/styling system from tokens
- Router/navigation config from routes
- One screen per blueprint screen (layout + components wired, but no feature logic)
- One shared component file per reusable component in
components
Out of Scope (handled by /add-feature)
- Feature/business logic
- Data fetching and state management for features
- Form validation and submission behavior
- Anything not described in the current project documents
Generation Checklist
Before finishing a generation:
- Every screen in the blueprint has a corresponding generated screen.
- Every route is wired in the navigation config.
- Every reusable component in
componentshas a generated file. - No hard-coded color/size/spacing in generated code — all from tokens.
- Components accept
variantand support declaredstates. - No feature logic was implemented beyond the project documents.
docs/repository-structure.mdupdated if the layout changed.