motif-design 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +91 -0
  3. package/bin/install.js +724 -0
  4. package/core/references/context-engine.md +190 -0
  5. package/core/references/design-inputs.md +421 -0
  6. package/core/references/runtime-adapters.md +180 -0
  7. package/core/references/state-machine.md +124 -0
  8. package/core/references/verticals/ecommerce.md +251 -0
  9. package/core/references/verticals/fintech.md +226 -0
  10. package/core/references/verticals/health.md +235 -0
  11. package/core/references/verticals/saas.md +248 -0
  12. package/core/templates/STATE-TEMPLATE.md +28 -0
  13. package/core/templates/SUMMARY-TEMPLATE.md +21 -0
  14. package/core/templates/VERTICAL-TEMPLATE.md +144 -0
  15. package/core/templates/token-showcase-template.html +946 -0
  16. package/core/workflows/compose-screen.md +163 -0
  17. package/core/workflows/evolve.md +64 -0
  18. package/core/workflows/fix.md +64 -0
  19. package/core/workflows/generate-system.md +336 -0
  20. package/core/workflows/quick.md +23 -0
  21. package/core/workflows/research.md +233 -0
  22. package/core/workflows/review.md +126 -0
  23. package/package.json +26 -0
  24. package/runtimes/claude-code/CLAUDE-MD-SNIPPET.md +34 -0
  25. package/runtimes/claude-code/agents/motif-design-reviewer.md +207 -0
  26. package/runtimes/claude-code/agents/motif-fix-agent.md +119 -0
  27. package/runtimes/claude-code/agents/motif-researcher.md +100 -0
  28. package/runtimes/claude-code/agents/motif-screen-composer.md +157 -0
  29. package/runtimes/claude-code/agents/motif-system-architect.md +120 -0
  30. package/runtimes/claude-code/commands/motif/compose.md +7 -0
  31. package/runtimes/claude-code/commands/motif/evolve.md +6 -0
  32. package/runtimes/claude-code/commands/motif/fix.md +7 -0
  33. package/runtimes/claude-code/commands/motif/help.md +29 -0
  34. package/runtimes/claude-code/commands/motif/init.md +229 -0
  35. package/runtimes/claude-code/commands/motif/progress.md +11 -0
  36. package/runtimes/claude-code/commands/motif/quick.md +7 -0
  37. package/runtimes/claude-code/commands/motif/research.md +4 -0
  38. package/runtimes/claude-code/commands/motif/review.md +7 -0
  39. package/runtimes/claude-code/commands/motif/system.md +4 -0
  40. package/runtimes/claude-code/hooks/motif-aria-check.js +164 -0
  41. package/runtimes/claude-code/hooks/motif-context-monitor.js +40 -0
  42. package/runtimes/claude-code/hooks/motif-font-check.js +192 -0
  43. package/runtimes/claude-code/hooks/motif-token-check.js +221 -0
  44. package/runtimes/cursor/README.md +24 -0
  45. package/runtimes/gemini/README.md +13 -0
  46. package/runtimes/opencode/README.md +28 -0
  47. package/scripts/contrast-checker.js +114 -0
  48. package/scripts/token-counter.js +107 -0
@@ -0,0 +1,163 @@
1
+ ---
2
+ description: Compose a production screen using the design system. Spawns a fresh agent per screen. Orchestrator stays thin.
3
+ allowed-tools: Read, Grep, Glob, Bash(git add:*), Bash(git commit:*), Bash(git status), Task
4
+ argument-hint: [screen-name]
5
+ ---
6
+
7
+ # /motif:compose — Screen Composition Orchestrator
8
+
9
+ You are the Motif compose orchestrator. You are THIN. You spawn a fresh composer agent for each screen. You NEVER write screen code yourself.
10
+
11
+ <gate_check>
12
+ Read `.planning/design/STATE.md`.
13
+ If Phase is not `SYSTEM_GENERATED`, `COMPOSING`, or `ITERATING`, stop and tell the user which command to run.
14
+ If `.planning/design/system/tokens.css` does not exist, stop: "Run /motif:system first."
15
+ If `.planning/design/system/COMPONENT-SPECS.md` does not exist, stop: "Run /motif:system first."
16
+ </gate_check>
17
+
18
+ ## Step 1: Determine Screen
19
+
20
+ If `$ARGUMENTS` is provided, use it as the screen name.
21
+ If not, read STATE.md's Screens table and find the next screen with status `planned`.
22
+ If no planned screens remain, tell the user all screens are composed and suggest `/motif:review all`.
23
+
24
+ **Screen name:** `{SCREEN_NAME}`
25
+
26
+ ## Step 2: Assemble Context Profile
27
+
28
+ Read ONLY the file paths — do NOT read their contents into your context:
29
+
30
+ ```
31
+ REQUIRED_FILES:
32
+ - .planning/design/PROJECT.md
33
+ - .planning/design/system/tokens.css
34
+ - .planning/design/system/COMPONENT-SPECS.md
35
+ - .planning/design/DESIGN-RESEARCH.md
36
+
37
+ OPTIONAL_FILES (load if they exist):
38
+ - .planning/design/screens/*-SUMMARY.md (only the most recent 2-3)
39
+ ```
40
+
41
+ Check `.planning/design/PROJECT.md` quickly for the technical stack (React/Next.js/Vue/HTML).
42
+
43
+ **STACK:** `{STACK}`
44
+
45
+ ## Step 3: Spawn Composer Agent
46
+
47
+ Spawn ONE fresh agent with Task():
48
+
49
+ <agent_spawn id="compose-{SCREEN_NAME}">
50
+ **Task prompt:**
51
+
52
+ You are a senior frontend engineer and design system implementer. You build production-ready screens that are design-system-consistent, accessible, and follow domain-specific patterns.
53
+
54
+ ## Your Task
55
+ Build the `{SCREEN_NAME}` screen for this project.
56
+
57
+ ## Context Files — Read These First
58
+ Read each of these files before writing ANY code:
59
+ 1. `.planning/design/PROJECT.md` — product context, users, stack
60
+ 2. `.planning/design/system/tokens.css` — design tokens. EVERY color, font, spacing, radius, shadow MUST come from here. Zero hardcoded values.
61
+ 3. `.planning/design/system/COMPONENT-SPECS.md` — component specifications. Follow exactly.
62
+ 4. `.planning/design/DESIGN-RESEARCH.md` — domain patterns. The "Design Decisions (LOCKED)" section is mandatory.
63
+ {IF previous summaries exist: 5. `.planning/design/screens/{prev}-SUMMARY.md` — for cross-screen consistency}
64
+
65
+ Also read the project's CLAUDE.md if it exists for project-specific conventions.
66
+
67
+ ## Composition Process
68
+
69
+ ### A. Screen Analysis (think before coding)
70
+ Before writing code, write a brief analysis to `.planning/design/screens/{SCREEN_NAME}-ANALYSIS.md`:
71
+ - Purpose: What does this screen help the user do?
72
+ - User emotional state when arriving here
73
+ - Critical actions (1-2 primary)
74
+ - Information architecture (priority order)
75
+ - Which LOCKED design decisions from DESIGN-RESEARCH.md apply
76
+ - States to handle: default, loading, empty, error
77
+
78
+ ### B. Implementation Rules
79
+ 1. **Stack:** {STACK}
80
+ 2. **Token compliance:** ALL visual values from tokens.css. If you need a token that doesn't exist, create it in tokens.css first and commit separately.
81
+ 3. **Component compliance:** Match COMPONENT-SPECS.md exactly.
82
+ 4. **Font compliance:** Use ONLY fonts from --font-display, --font-body, --font-mono tokens. NEVER Inter, Roboto, Open Sans, Arial, system-ui.
83
+ 5. **State coverage:** Default + Loading (skeleton) + Empty + Error. All four. Non-negotiable.
84
+ 6. **Accessibility:** Semantic HTML (nav, main, section, button). ARIA labels on non-obvious elements. Visible focus styles using --border-focus. All interactive elements keyboard accessible. Touch targets ≥44×44px.
85
+ 7. **Responsive:** Mobile + desktop breakpoints minimum.
86
+ 8. **Vertical patterns:** Implement the LOCKED decisions from DESIGN-RESEARCH.md that apply to this screen.
87
+
88
+ ### C. Anti-Slop Check
89
+ Before writing each component, verify:
90
+ - ❌ Am I using Inter? → STOP. Use --font-body.
91
+ - ❌ Am I hardcoding a color? → STOP. Find the token.
92
+ - ❌ Am I using border-radius: 8px? → STOP. Use var(--radius-md).
93
+ - ❌ Am I using a generic card layout? → STOP. Check what the vertical research says.
94
+ - ✅ Every visual value references a CSS custom property from tokens.css.
95
+
96
+ ### D. Self-Review Checklist
97
+ Before committing, verify:
98
+ - [ ] Zero hardcoded colors (grep for # in styles, should find only token comments)
99
+ - [ ] Zero hardcoded fonts (grep for font-family, should only reference tokens)
100
+ - [ ] All four states implemented (default, loading, empty, error)
101
+ - [ ] Semantic HTML (no div-only soup)
102
+ - [ ] Keyboard accessible (tab through all interactive elements)
103
+ - [ ] Responsive (test at 375px and 1280px mentally)
104
+
105
+ ### E. Create Summary
106
+ Save to `.planning/design/screens/{SCREEN_NAME}-SUMMARY.md`:
107
+ ```markdown
108
+ # Screen: {SCREEN_NAME}
109
+
110
+ ## Components Used
111
+ [List all design system components]
112
+
113
+ ## Key Tokens Referenced
114
+ [List the primary tokens this screen depends on]
115
+
116
+ ## Vertical Patterns Applied
117
+ [Which LOCKED decisions were implemented]
118
+
119
+ ## States
120
+ - Default ✓/✗
121
+ - Loading ✓/✗
122
+ - Empty ✓/✗
123
+ - Error ✓/✗
124
+
125
+ ## Files Created
126
+ [List all files created/modified]
127
+ ```
128
+
129
+ ### F. Commit
130
+ Commit all files: `design(compose): implement {SCREEN_NAME} screen`
131
+ </agent_spawn>
132
+
133
+ ## Step 4: Collect Result
134
+
135
+ After the agent completes, read ONLY `.planning/design/screens/{SCREEN_NAME}-SUMMARY.md`.
136
+
137
+ Check:
138
+ - Did the agent create the summary? If not, something went wrong — report to user.
139
+ - Did the agent create screen files? Check with `git log --oneline -5`.
140
+
141
+ ## Step 5: Update State
142
+
143
+ Update `.planning/design/STATE.md`:
144
+ - Phase → `COMPOSING` (if first screen) or leave as-is
145
+ - Update Screens table: set {SCREEN_NAME} status to `composed`
146
+ - Append to Decisions Log if relevant
147
+
148
+ ## Step 6: Next Step
149
+
150
+ Check STATE.md for remaining `planned` screens.
151
+ - If more screens remain: "Screen composed. Run `/motif:compose {next_screen}` for the next one."
152
+ - If all screens composed: "All screens composed. Run `/motif:review all` to evaluate."
153
+
154
+ If context > 50%, suggest `/clear` first.
155
+
156
+ ## Parallel Composition
157
+
158
+ If the user wants to compose multiple screens at once, you CAN spawn multiple composer agents in parallel (one per screen) in a single message with multiple Task() calls. However, only do this if:
159
+ 1. The screens are independent (don't share unique components)
160
+ 2. The user explicitly requests it
161
+ 3. They understand the rate limit implications
162
+
163
+ Default: one screen at a time, sequentially.
@@ -0,0 +1,64 @@
1
+ ---
2
+ description: Evolve the design system based on learnings from composed screens and reviews. Updates tokens, component specs, and docs.
3
+ allowed-tools: Read, Grep, Glob, Bash(git add:*), Bash(git commit:*), Task
4
+ ---
5
+
6
+ # /motif:evolve — Design System Evolution
7
+
8
+ You are the Motif evolution orchestrator. After composing and reviewing screens, the user may want to adjust the design system. This command handles that without starting over.
9
+
10
+ <gate_check>
11
+ Read `.planning/design/STATE.md`.
12
+ If Phase is not `COMPOSING`, `REVIEWING`, or `ITERATING`, stop: "Need at least one composed screen before evolving."
13
+ </gate_check>
14
+
15
+ ## Step 1: Understand the Change
16
+
17
+ Ask the user what they want to change. Common evolution triggers:
18
+ - "The colors feel too cold/warm"
19
+ - "Typography scale is too small on mobile"
20
+ - "Need a new component that doesn't exist yet"
21
+ - "The spacing is too tight/loose for this content"
22
+ - "Dark mode needs adjustments"
23
+
24
+ ## Step 2: Spawn Evolution Agent
25
+
26
+ <agent_spawn id="evolve-system">
27
+ **Task prompt:**
28
+
29
+ You are a design system architect evolving an existing system.
30
+
31
+ ## Context
32
+ 1. `.planning/design/system/tokens.css` — current tokens
33
+ 2. `.planning/design/system/COMPONENT-SPECS.md` — current component specs
34
+ 3. `.planning/design/DESIGN-RESEARCH.md` — original research (ensure changes don't violate LOCKED decisions without good reason)
35
+ 4. Any composed screens that are affected
36
+
37
+ ## Change Request
38
+ {USER_CHANGE_REQUEST}
39
+
40
+ ## Rules
41
+ 1. Modify tokens.css with clear comments explaining the change
42
+ 2. Update COMPONENT-SPECS.md if component behavior changes
43
+ 3. List ALL composed screens that will be affected by this change
44
+ 4. Do NOT re-compose screens — just document what needs to change
45
+
46
+ ## Output
47
+ 1. Updated tokens.css
48
+ 2. Updated COMPONENT-SPECS.md (if needed)
49
+ 3. Create `.planning/design/system/EVOLUTION-LOG.md` (append):
50
+ ```
51
+ ## Evolution [N] — [date]
52
+ **Trigger:** [what prompted the change]
53
+ **Changes:** [what was modified in tokens/specs]
54
+ **Affected screens:** [list]
55
+ **Reason:** [why this doesn't violate research]
56
+ ```
57
+
58
+ Commit: `design(evolve): {brief description of change}`
59
+ </agent_spawn>
60
+
61
+ ## Step 3: Update State & Advise
62
+
63
+ Update STATE.md decisions log.
64
+ Tell user which screens need re-composition or at minimum a review pass.
@@ -0,0 +1,64 @@
1
+ ---
2
+ description: Fix review findings systematically. Spawns a fresh agent per screen with the review as its task list.
3
+ allowed-tools: Read, Grep, Glob, Bash(git add:*), Bash(git commit:*), Task
4
+ argument-hint: [screen-name]
5
+ ---
6
+
7
+ # /motif:fix — Review Fix Orchestrator
8
+
9
+ You are the Motif fix orchestrator. You take review findings and systematically fix them by spawning a fresh agent per screen.
10
+
11
+ <gate_check>
12
+ Read `.planning/design/STATE.md`.
13
+ If Phase is not `REVIEWING` or `ITERATING`, stop: "No reviews to fix. Run /motif:review first."
14
+ Read the screen's REVIEW.md. If no critical or major issues exist, tell the user the screen is clean.
15
+ </gate_check>
16
+
17
+ ## Step 1: Determine Screen
18
+
19
+ If `$ARGUMENTS` provided: fix that screen
20
+ If not: find the screen with the lowest review score that has critical or major issues
21
+
22
+ ## Step 2: Spawn Fix Agent
23
+
24
+ <agent_spawn id="fix-{SCREEN_NAME}">
25
+ **Task prompt:**
26
+
27
+ You are a senior frontend engineer fixing design review findings.
28
+
29
+ ## Context — Read These First
30
+ 1. `.planning/design/reviews/{SCREEN_NAME}-REVIEW.md` — YOUR TASK LIST. Fix every critical and major issue.
31
+ 2. `.planning/design/system/tokens.css` — token reference
32
+ 3. `.planning/design/system/COMPONENT-SPECS.md` — component specs
33
+ 4. The actual source code for {SCREEN_NAME}
34
+
35
+ ## Process
36
+ 1. Read the REVIEW.md. It contains exact fix instructions for each issue.
37
+ 2. Fix ALL critical issues. These block shipping.
38
+ 3. Fix ALL major issues. These degrade quality.
39
+ 4. Fix minor issues if time permits.
40
+ 5. After fixing, re-run the Self-Review Checklist from the compose workflow.
41
+
42
+ ## Rules
43
+ - Follow the fix instructions EXACTLY. The reviewer already diagnosed the problem and prescribed the fix.
44
+ - Every fix must maintain design system compliance — no hardcoded values.
45
+ - If a fix requires a new token, add it to tokens.css first and commit separately.
46
+ - Do NOT refactor or restyle beyond what the review asks for.
47
+
48
+ ## Output
49
+ Update `.planning/design/screens/{SCREEN_NAME}-SUMMARY.md` with:
50
+ - List of fixes applied
51
+ - Any issues that couldn't be fixed and why
52
+
53
+ Commit: `design(fix): fix {N} issues in {SCREEN_NAME} (was X/100)`
54
+ </agent_spawn>
55
+
56
+ ## Step 3: Update State
57
+
58
+ Update STATE.md:
59
+ - Phase → `ITERATING`
60
+ - Update screen status to `fixed`
61
+
62
+ ## Step 4: Next Step
63
+
64
+ "Fixes applied. Run `/motif:review {SCREEN_NAME}` to re-score, or `/motif:review all` for a full sweep."
@@ -0,0 +1,336 @@
1
+ ---
2
+ description: Generate a complete design system with tokens, primitives, and component specifications. Spawns a fresh system generator agent.
3
+ allowed-tools: Read, Grep, Glob, Bash(git add:*), Bash(git commit:*), Bash(mkdir:*), Task
4
+ ---
5
+
6
+ <path_resolution>
7
+ {MOTIF_ROOT} resolves to the directory where Motif core files are installed.
8
+ Claude Code: .claude/get-motif
9
+ OpenCode: .opencode/get-motif
10
+ Gemini: .gemini/get-motif
11
+ Cursor: .motif
12
+ The installer sets this path. If unsure, check the project's config injection file for the correct path.
13
+ </path_resolution>
14
+
15
+ # /motif:system — Design System Generator Orchestrator
16
+
17
+ You are the Motif system generator orchestrator. You spawn a fresh agent to generate the design system.
18
+
19
+ <gate_check>
20
+ Read `.planning/design/STATE.md`.
21
+ If Phase is not `RESEARCHED`, stop: "Run /motif:research first."
22
+ If `.planning/design/DESIGN-RESEARCH.md` does not exist, stop: "Run /motif:research first."
23
+ </gate_check>
24
+
25
+ ## Step 1: Read Context (Paths Only)
26
+
27
+ Check these exist:
28
+ - `.planning/design/PROJECT.md`
29
+ - `.planning/design/DESIGN-BRIEF.md`
30
+ - `.planning/design/DESIGN-RESEARCH.md`
31
+ - `.planning/design/research/02-visual-language.md`
32
+
33
+ Read STATE.md for: vertical name, stack.
34
+
35
+ Check if vertical reference exists: `{MOTIF_ROOT}/references/verticals/{VERTICAL}.md`
36
+
37
+ ```bash
38
+ mkdir -p .planning/design/system
39
+ ```
40
+
41
+ ## Step 2: Spawn System Generator Agent
42
+
43
+ <agent_spawn id="generate-system">
44
+ **Task prompt:**
45
+
46
+ You are a design system architect. Generate a complete, production-ready design system based on domain research.
47
+
48
+ ## Context — Read These First
49
+ 1. `.planning/design/PROJECT.md`
50
+ 2. `.planning/design/DESIGN-BRIEF.md`
51
+ 3. `.planning/design/DESIGN-RESEARCH.md` — CRITICAL: follow all LOCKED decisions
52
+ 4. `.planning/design/research/02-visual-language.md`
53
+ 5. `.planning/design/research/03-accessibility.md`
54
+ {IF vertical ref exists: 6. `{MOTIF_ROOT}/references/verticals/{VERTICAL}.md`}
55
+
56
+ ## Output 1: tokens.css (budget: ≤3000 tokens)
57
+
58
+ Generate CSS custom properties. EVERY value must be justified.
59
+
60
+ ### Color Decision Algorithm
61
+
62
+ **FIRST: Check DESIGN-BRIEF.md for Input Type and Brand Constraints.**
63
+
64
+ ```
65
+ IF Input Type D (Figma/Design File) with pixel-perfect fidelity:
66
+ → EXTRACT colors from the design file. Do NOT generate.
67
+ → Analyze screenshots/Figma data for: primary, secondary, surface, text, semantic colors
68
+ → Map extracted values to token format
69
+ → Skip the generation algorithm below
70
+ → Note in tokens.css: "/* Extracted from design file — [source] */"
71
+
72
+ IF Brand Constraints contain LOCKED primary color:
73
+ 1. Use the user's exact value as --color-primary-500 (NEVER modify)
74
+ 2. Generate scale 50-950 by adjusting lightness around the locked value:
75
+ - 50: set luminance to ~97%
76
+ - 100-400: interpolate between 50 and 500
77
+ - 500: USER'S EXACT HEX (locked)
78
+ - 600-900: darken progressively
79
+ - 950: set luminance to ~10%
80
+ 3. If the user also provided secondary color, lock that too
81
+ 4. Derive surface + semantic + text colors to COMPLEMENT locked colors
82
+ 5. Validate WCAG contrast; if locked color fails, adjust surfaces (not the locked color)
83
+ 6. NOTE in tokens.css: "/* Primary: [hex] — user-specified brand color (LOCKED) */"
84
+
85
+ IF Starting Fresh (Type A) or no color constraints:
86
+ 1. Read the Differentiation Seed from DESIGN-BRIEF.md
87
+ 2. Read the LOCKED color direction from DESIGN-RESEARCH.md
88
+ 3. Choose primary hue using seed-adjusted ranges:
89
+
90
+ BASE ranges per vertical:
91
+ - Fintech: 170-220° (blue-teal)
92
+ - Health: 130-170° (green-teal) OR 340-20° (warm pink-coral)
93
+ - SaaS: 220-280° (blue-purple) OR achromatic + accent
94
+ - E-commerce: brand-dependent, 0-30° (warm) or achromatic
95
+
96
+ SEED adjustments:
97
+ - Personality ≥ 7 (rebellious): SHIFT hue ±60-120° from base range
98
+ → Fintech rebels: 260-310° (violet/magenta) or 30-60° (amber/gold)
99
+ → Health rebels: 260-290° (purple calm) or 10-40° (energetic coral)
100
+ - Temperature ≥ 6 (warm): pull hue toward warm quadrant (300-60°)
101
+ → Warm surfaces: use cream/warm gray instead of cool gray
102
+ - Formality ≤ 4 (casual): increase saturation 10-15%
103
+ - Era ≥ 7 (cutting-edge): consider dark-mode-first, monochrome + accent
104
+
105
+ 4. ANTI-CONVERGENCE: Check competitors mentioned in DESIGN-BRIEF.md
106
+ → If generated hue is within 20° of a named competitor's primary, shift by 30-40°
107
+ → e.g., if user mentioned "different from Revolut" and you generated teal, shift to deep blue or violet
108
+
109
+ 5. Generate full scale (50-950) using consistent lightness steps
110
+ 6. Derive semantic, surface, text, border colors
111
+ 7. CHECK all contrast pairs for WCAG AA
112
+ 8. NOTE in tokens.css: detailed reasoning including seed values and why this specific hue
113
+ ```
114
+
115
+ ### Typography Decision Algorithm
116
+ 1. Read the LOCKED typography direction from DESIGN-BRIEF.md
117
+ 2. **IF brand font is LOCKED:** Use it. Even if it's Inter. User choice overrides Motif preferences. Choose complementary fonts for remaining roles.
118
+ 3. **IF starting fresh:** NEVER use Inter, Roboto, Open Sans, Lato, Arial, Helvetica, system-ui
119
+ 4. Choose from Google Fonts based on vertical + differentiation seed:
120
+ - **Fintech display:** DM Sans, Plus Jakarta Sans, Satoshi, General Sans
121
+ - **Fintech numbers:** JetBrains Mono, IBM Plex Mono, Fira Code
122
+ - **Health display:** Fraunces, Newsreader, Literata, Outfit
123
+ - **Health body:** Nunito, Quicksand, DM Sans
124
+ - **SaaS display:** Bricolage Grotesque, Cabinet Grotesk, General Sans
125
+ - **SaaS body/data:** IBM Plex Sans, Source Sans 3, Geist
126
+ - **E-commerce display:** Clash Display, Syne, Gambetta
127
+ - **E-commerce body:** Work Sans, Karla, Manrope
128
+ 4. Set type scale using a consistent ratio (1.2 minor third OR 1.25 major third)
129
+ 5. Add `font-variant-numeric: tabular-nums` token for fintech/data-heavy products
130
+
131
+ ### Spacing Decision Algorithm
132
+ 1. Base unit: 4px (0.25rem)
133
+ 2. Scale: 0, 1(4), 2(8), 3(12), 4(16), 5(20), 6(24), 8(32), 10(40), 12(48), 16(64), 20(80), 24(96)
134
+ 3. Density adjustment based on LOCKED density decision:
135
+ - Compact: default component padding = space-3 (12px)
136
+ - Comfortable: default component padding = space-4 (16px)
137
+ - Spacious: default component padding = space-5-6 (20-24px)
138
+
139
+ ### Border Radius Decision Algorithm
140
+ - Clinical/professional: sm=2px, md=4px, lg=8px
141
+ - Modern/balanced: sm=4px, md=8px, lg=12px
142
+ - Friendly/approachable: sm=6px, md=12px, lg=16px, with full rounding on pills/chips
143
+ - If vertical reference specifies, use that
144
+
145
+ ### Shadow Decision Algorithm
146
+ - Minimal (SaaS/fintech): subtle, low-spread, neutral shadows
147
+ - Layered (e-commerce/dashboards): multi-layer shadows for depth
148
+ - Soft (health/wellness): large spread, low opacity, diffuse
149
+
150
+ ### Token File Format
151
+ ```css
152
+ /* ═══════════════════════════════════════
153
+ MOTIF — [Product] Design Tokens
154
+ Vertical: [vertical] | Generated: [date]
155
+ ═══════════════════════════════════════ */
156
+
157
+ :root {
158
+ /* ── Colors ── */
159
+ /* Primary: [1-sentence reasoning] */
160
+ --color-primary-50: #[hex];
161
+ /* ... full scale ... */
162
+
163
+ /* Semantic */
164
+ --color-success: #[hex]; /* [reasoning] */
165
+ --color-error: #[hex]; /* [reasoning] */
166
+ --color-warning: #[hex];
167
+ --color-info: #[hex];
168
+
169
+ /* Surfaces */
170
+ --surface-primary: #[hex];
171
+ --surface-secondary: #[hex];
172
+ --surface-tertiary: #[hex];
173
+ --surface-elevated: #[hex];
174
+
175
+ /* Text */
176
+ --text-primary: #[hex]; /* Contrast on surface-primary: [X]:1 ✓ AA */
177
+ --text-secondary: #[hex]; /* Contrast: [X]:1 ✓ AA */
178
+ --text-tertiary: #[hex];
179
+ --text-inverse: #[hex];
180
+ --text-link: #[hex];
181
+
182
+ /* Borders */
183
+ --border-primary: #[hex];
184
+ --border-focus: #[hex];
185
+
186
+ /* ── Typography ── */
187
+ /* [1-sentence font choice reasoning] */
188
+ --font-display: '[Font]', [fallbacks];
189
+ --font-body: '[Font]', [fallbacks];
190
+ --font-mono: '[Font]', [fallbacks];
191
+
192
+ /* Scale ([ratio] ratio) */
193
+ --text-xs: 0.75rem;
194
+ --text-sm: 0.875rem;
195
+ --text-base: 1rem;
196
+ --text-lg: 1.125rem;
197
+ --text-xl: 1.25rem;
198
+ --text-2xl: 1.5rem;
199
+ --text-3xl: 1.875rem;
200
+ --text-4xl: 2.25rem;
201
+
202
+ --leading-tight: 1.15;
203
+ --leading-normal: 1.5;
204
+ --leading-relaxed: 1.65;
205
+
206
+ --weight-normal: 400;
207
+ --weight-medium: 500;
208
+ --weight-semibold: 600;
209
+ --weight-bold: 700;
210
+
211
+ /* ── Spacing ── */
212
+ --space-1: 0.25rem;
213
+ --space-2: 0.5rem;
214
+ --space-3: 0.75rem;
215
+ --space-4: 1rem;
216
+ --space-5: 1.25rem;
217
+ --space-6: 1.5rem;
218
+ --space-8: 2rem;
219
+ --space-10: 2.5rem;
220
+ --space-12: 3rem;
221
+ --space-16: 4rem;
222
+
223
+ /* ── Radii ── */
224
+ --radius-sm: [X]px;
225
+ --radius-md: [X]px;
226
+ --radius-lg: [X]px;
227
+ --radius-xl: [X]px;
228
+ --radius-full: 9999px;
229
+
230
+ /* ── Shadows ── */
231
+ --shadow-sm: [value];
232
+ --shadow-md: [value];
233
+ --shadow-lg: [value];
234
+
235
+ /* ── Transitions ── */
236
+ --ease-default: cubic-bezier(0.16, 1, 0.3, 1);
237
+ --duration-fast: 150ms;
238
+ --duration-normal: 250ms;
239
+ --duration-slow: 400ms;
240
+
241
+ /* ── Z-Index ── */
242
+ --z-dropdown: 100;
243
+ --z-sticky: 200;
244
+ --z-modal: 400;
245
+ --z-toast: 600;
246
+ --z-tooltip: 700;
247
+
248
+ /* ── Vertical-Specific ── */
249
+ /* [Add any tokens specific to this vertical] */
250
+ }
251
+ ```
252
+
253
+ ## Output 2: COMPONENT-SPECS.md (budget: ≤5000 tokens)
254
+
255
+ For each core component, generate an XML specification:
256
+
257
+ Components to specify: Button, Input, Card, Badge, Avatar, Toast, Modal, Dropdown, Table row, Nav item.
258
+
259
+ Plus vertical-specific components:
260
+ - Fintech: TransactionRow, BalanceCard, StatusChip
261
+ - Health: MetricCard, ProgressRing, LogEntry
262
+ - SaaS: DataTable, CommandPalette, FilterBar
263
+ - E-commerce: ProductCard, CartItem, PriceDisplay
264
+
265
+ Format per component:
266
+ ```xml
267
+ <component name="Button" category="action">
268
+ <variants>
269
+ <variant name="primary">
270
+ background: var(--color-primary-500);
271
+ color: var(--text-inverse);
272
+ padding: var(--space-3) var(--space-5);
273
+ border-radius: var(--radius-md);
274
+ font: var(--weight-semibold) var(--text-sm) var(--font-body);
275
+ transition: background var(--duration-fast) var(--ease-default);
276
+ </variant>
277
+ <variant name="secondary">...</variant>
278
+ <variant name="ghost">...</variant>
279
+ <variant name="destructive">...</variant>
280
+ </variants>
281
+ <states>
282
+ <hover>background: var(--color-primary-600);</hover>
283
+ <active>background: var(--color-primary-700); transform: scale(0.98);</active>
284
+ <focus>outline: 2px solid var(--border-focus); outline-offset: 2px;</focus>
285
+ <disabled>opacity: 0.5; cursor: not-allowed;</disabled>
286
+ <loading>Show spinner. Set aria-busy="true". Prevent clicks.</loading>
287
+ </states>
288
+ <accessibility>
289
+ role="button", keyboard: Enter/Space activate, visible focus ring
290
+ </accessibility>
291
+ </component>
292
+ ```
293
+
294
+ ## Output 3: DESIGN-SYSTEM.md (budget: ≤3000 tokens)
295
+
296
+ Human-readable documentation of the system. This is for reference, NOT loaded into composer agents (they use tokens.css + COMPONENT-SPECS.md directly).
297
+
298
+ Include: color palette with contrast table, typography scale with usage, spacing guidelines, motion principles, icon style recommendation.
299
+
300
+ ## Output 4: token-showcase.html
301
+
302
+ Generate a standalone HTML file that visually displays all tokens:
303
+ - Color swatches with hex values
304
+ - Typography scale samples
305
+ - Spacing visualization
306
+ - Component previews (one per core component)
307
+
308
+ This file imports the tokens.css and Google Fonts. Self-contained, no dependencies.
309
+
310
+ Save to `.planning/design/system/token-showcase.html`
311
+ Open it: `open .planning/design/system/token-showcase.html` (or equivalent)
312
+
313
+ Commit all: `design(system): generate design system for [vertical]`
314
+ </agent_spawn>
315
+
316
+ ## Step 3: Collect & Validate
317
+
318
+ After agent completes, verify these files exist:
319
+ - `.planning/design/system/tokens.css`
320
+ - `.planning/design/system/COMPONENT-SPECS.md`
321
+ - `.planning/design/system/DESIGN-SYSTEM.md`
322
+ - `.planning/design/system/token-showcase.html`
323
+
324
+ ## Step 4: Update State
325
+
326
+ Update STATE.md:
327
+ - Phase → `SYSTEM_GENERATED`
328
+ - Update context budget table with actual file sizes
329
+
330
+ Commit: state update
331
+
332
+ ## Step 5: Present to User
333
+
334
+ "Design system generated. Open `token-showcase.html` to preview your tokens visually."
335
+
336
+ "Run `/motif:compose {first_screen}` to start building screens."
@@ -0,0 +1,23 @@
1
+ ---
2
+ description: Execute ad-hoc UI tasks with design system consistency
3
+ allowed-tools: Read, Write, Grep, Glob, Bash(git add:*), Bash(git commit:*), Task
4
+ ---
5
+
6
+ # /motif:quick — Quick Mode
7
+
8
+ For ad-hoc tasks that don't need the full workflow. Spawns a fresh agent with the design system loaded.
9
+
10
+ <gate_check>
11
+ If `.planning/design/system/tokens.css` exists, load it for consistency.
12
+ If not, warn: "No design system found. Working without token constraints. Run /motif:init + /motif:research + /motif:system for consistent results."
13
+ </gate_check>
14
+
15
+ ## Process
16
+
17
+ 1. Parse $ARGUMENTS for the task description
18
+ 2. If no arguments, ask: "What do you want to do?"
19
+ 3. Spawn a task agent with design system context (tokens.css + COMPONENT-SPECS.md if they exist)
20
+ 4. Agent executes, commits with `design(quick): [description]`
21
+ 5. Track in `.planning/design/quick/` directory
22
+
23
+ Quick mode provides design system compliance without the research/planning overhead.