@jamie-tam/forge 6.0.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 (213) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +389 -0
  3. package/agents/architect.md +92 -0
  4. package/agents/builder.md +122 -0
  5. package/agents/code-reviewer.md +107 -0
  6. package/agents/concept-designer.md +207 -0
  7. package/agents/craft-reviewer.md +132 -0
  8. package/agents/critic.md +130 -0
  9. package/agents/doc-writer.md +85 -0
  10. package/agents/dreamer.md +129 -0
  11. package/agents/e2e-runner.md +89 -0
  12. package/agents/gotcha-hunter.md +127 -0
  13. package/agents/prototype-builder.md +193 -0
  14. package/agents/prototype-codifier.md +204 -0
  15. package/agents/prototype-reviewer.md +163 -0
  16. package/agents/security-reviewer.md +108 -0
  17. package/agents/spec-reviewer.md +94 -0
  18. package/agents/tracer.md +98 -0
  19. package/agents/wireframer.md +109 -0
  20. package/commands/abort.md +25 -0
  21. package/commands/bugfix.md +151 -0
  22. package/commands/evolve.md +118 -0
  23. package/commands/feature.md +236 -0
  24. package/commands/forge.md +100 -0
  25. package/commands/greenfield.md +185 -0
  26. package/commands/hotfix.md +98 -0
  27. package/commands/refactor.md +147 -0
  28. package/commands/resume.md +25 -0
  29. package/commands/setup.md +201 -0
  30. package/commands/status.md +27 -0
  31. package/commands/task-force.md +110 -0
  32. package/commands/validate.md +12 -0
  33. package/dist/__tests__/active-manifest.test.js +272 -0
  34. package/dist/__tests__/copy.test.js +96 -0
  35. package/dist/__tests__/gate-check.test.js +384 -0
  36. package/dist/__tests__/wiki.test.js +472 -0
  37. package/dist/__tests__/work-manifest.test.js +304 -0
  38. package/dist/active-manifest.js +229 -0
  39. package/dist/cli.js +158 -0
  40. package/dist/copy.js +124 -0
  41. package/dist/gate-check.js +326 -0
  42. package/dist/hooks.js +60 -0
  43. package/dist/init.js +140 -0
  44. package/dist/manifest.js +90 -0
  45. package/dist/merge.js +77 -0
  46. package/dist/paths.js +36 -0
  47. package/dist/uninstall.js +216 -0
  48. package/dist/update.js +158 -0
  49. package/dist/verify-manifest.js +65 -0
  50. package/dist/verify.js +98 -0
  51. package/dist/wiki-ui.js +310 -0
  52. package/dist/wiki.js +364 -0
  53. package/dist/work-manifest.js +798 -0
  54. package/hooks/config/gate-requirements.json +79 -0
  55. package/hooks/hooks.json +143 -0
  56. package/hooks/scripts/analyze-telemetry.sh +114 -0
  57. package/hooks/scripts/gate-enforcer.sh +164 -0
  58. package/hooks/scripts/pre-compact.sh +90 -0
  59. package/hooks/scripts/session-start.sh +81 -0
  60. package/hooks/scripts/telemetry.sh +41 -0
  61. package/hooks/scripts/wiki-lint.sh +87 -0
  62. package/hooks/templates/AGENTS.md.template +48 -0
  63. package/hooks/templates/CLAUDE.md.template +45 -0
  64. package/package.json +55 -0
  65. package/protocols/README.md +40 -0
  66. package/protocols/codex.md +151 -0
  67. package/protocols/graphify.md +156 -0
  68. package/references/common/agent-coordination.md +65 -0
  69. package/references/common/coding-standards.md +54 -0
  70. package/references/common/feature-tracking.md +21 -0
  71. package/references/common/io-protocol.md +36 -0
  72. package/references/common/phases.md +57 -0
  73. package/references/common/quality-gates.md +130 -0
  74. package/references/common/skill-authoring.md +154 -0
  75. package/references/common/skill-compliance.md +30 -0
  76. package/references/python/standards.md +44 -0
  77. package/references/react/standards.md +61 -0
  78. package/references/typescript/standards.md +42 -0
  79. package/rules/common/forge-system.md +59 -0
  80. package/rules/common/git-workflow.md +40 -0
  81. package/rules/common/guardrails.md +37 -0
  82. package/rules/common/quality-gates.md +18 -0
  83. package/rules/common/security.md +50 -0
  84. package/rules/common/skill-selection.md +78 -0
  85. package/rules/common/testing.md +58 -0
  86. package/rules/common/verification.md +39 -0
  87. package/skills/build-pr-workflow/SKILL.md +301 -0
  88. package/skills/build-pr-workflow/references/pr-template.md +62 -0
  89. package/skills/build-pr-workflow/references/subagent-merge.md +47 -0
  90. package/skills/build-pr-workflow/references/worktree-setup.md +125 -0
  91. package/skills/build-prototype/SKILL.md +264 -0
  92. package/skills/build-scaffold/SKILL.md +340 -0
  93. package/skills/build-tdd/SKILL.md +89 -0
  94. package/skills/build-wireframe/SKILL.md +110 -0
  95. package/skills/build-wireframe/assets/baseline-template.html +486 -0
  96. package/skills/build-wireframe/references/demo-walkthroughs.md +170 -0
  97. package/skills/build-wireframe/references/gotchas.md +188 -0
  98. package/skills/build-wireframe/references/legend-lines.md +141 -0
  99. package/skills/concept-slides/SKILL.md +192 -0
  100. package/skills/deliver-db-migration/SKILL.md +466 -0
  101. package/skills/deliver-deploy/SKILL.md +407 -0
  102. package/skills/deliver-onboarding/SKILL.md +198 -0
  103. package/skills/deliver-onboarding/references/document-templates.md +393 -0
  104. package/skills/deliver-onboarding/templates/getting-started.md +122 -0
  105. package/skills/discover-codebase-analysis/SKILL.md +448 -0
  106. package/skills/discover-requirements/SKILL.md +418 -0
  107. package/skills/discover-requirements/templates/prd.md +99 -0
  108. package/skills/discover-requirements/templates/technical-spec.md +123 -0
  109. package/skills/discover-requirements/templates/user-stories.md +76 -0
  110. package/skills/harden/SKILL.md +214 -0
  111. package/skills/iterate-prototype/SKILL.md +241 -0
  112. package/skills/plan-architecture/SKILL.md +457 -0
  113. package/skills/plan-architecture/templates/adr-template.md +52 -0
  114. package/skills/plan-architecture/templates/api-contract.md +99 -0
  115. package/skills/plan-architecture/templates/db-schema.md +81 -0
  116. package/skills/plan-architecture/templates/system-design.md +111 -0
  117. package/skills/plan-brainstorm/SKILL.md +433 -0
  118. package/skills/plan-design-system/SKILL.md +279 -0
  119. package/skills/plan-task-decompose/SKILL.md +454 -0
  120. package/skills/quality-code-review/SKILL.md +286 -0
  121. package/skills/quality-security-audit/SKILL.md +292 -0
  122. package/skills/quality-security-audit/references/audit-report-template.md +89 -0
  123. package/skills/quality-security-audit/references/owasp-checks.md +178 -0
  124. package/skills/quality-test-execution/SKILL.md +435 -0
  125. package/skills/quality-test-plan/SKILL.md +297 -0
  126. package/skills/quality-test-plan/references/test-type-guide.md +263 -0
  127. package/skills/quality-test-plan/templates/e2e-test-plan.md +72 -0
  128. package/skills/quality-test-plan/templates/integration-test-plan.md +74 -0
  129. package/skills/quality-test-plan/templates/load-test-plan.md +111 -0
  130. package/skills/quality-test-plan/templates/smoke-test-plan.md +68 -0
  131. package/skills/quality-test-plan/templates/unit-test-plan.md +56 -0
  132. package/skills/quality-uiux/SKILL.md +481 -0
  133. package/skills/support-debug/SKILL.md +464 -0
  134. package/skills/support-dream/SKILL.md +213 -0
  135. package/skills/support-gotcha/SKILL.md +249 -0
  136. package/skills/support-runtime-reachability/SKILL.md +190 -0
  137. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/app.ts +7 -0
  138. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/handlers/cases.ts +7 -0
  139. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/app.ts +8 -0
  140. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/handlers/cases.ts +7 -0
  141. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/App.tsx +5 -0
  142. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/components/RingingBanner.tsx +7 -0
  143. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/hooks/useTwilio.ts +6 -0
  144. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/App.tsx +5 -0
  145. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/components/MyComp.tsx +3 -0
  146. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/App.tsx +3 -0
  147. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/components/Orphan.tsx +3 -0
  148. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/lib/Service.ts +6 -0
  149. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/main.ts +4 -0
  150. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/lib/Lonely.ts +5 -0
  151. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/main.ts +2 -0
  152. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/handler.ts +3 -0
  153. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/main.ts +3 -0
  154. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/handler.ts +3 -0
  155. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/main.ts +2 -0
  156. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/lib.ts +5 -0
  157. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/main.ts +3 -0
  158. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/index.ts +1 -0
  159. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/internal.ts +3 -0
  160. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/main.ts +3 -0
  161. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.test.ts +5 -0
  162. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.ts +3 -0
  163. package/skills/support-runtime-reachability/scripts/__fixtures__/case-13-gated-pending-annotation/src/future.ts +4 -0
  164. package/skills/support-runtime-reachability/scripts/__fixtures__/case-14-untraceable-annotation/src/decorated.ts +4 -0
  165. package/skills/support-runtime-reachability/scripts/__fixtures__/case-15-untraceable-empty/src/lazy.ts +4 -0
  166. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/lib.py +15 -0
  167. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/main.py +5 -0
  168. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/parent.ts +5 -0
  169. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/routes/cases.ts +5 -0
  170. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/lib/foo.ts +3 -0
  171. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/other.ts +8 -0
  172. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/cases.ts +4 -0
  173. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/users.ts +4 -0
  174. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/main.ts +5 -0
  175. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/handlers/cases.ts +3 -0
  176. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/main.ts +4 -0
  177. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/lib.ts +5 -0
  178. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/main.ts +5 -0
  179. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/lib.ts +3 -0
  180. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/main.ts +8 -0
  181. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/lib.ts +3 -0
  182. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/main.ts +7 -0
  183. package/skills/support-runtime-reachability/scripts/check.mjs +638 -0
  184. package/skills/support-runtime-reachability/scripts/check.test.mjs +244 -0
  185. package/skills/support-skill-validator/SKILL.md +194 -0
  186. package/skills/support-skill-validator/references/false-positives.md +59 -0
  187. package/skills/support-skill-validator/references/validation-checks.md +280 -0
  188. package/skills/support-system-guide/SKILL.md +311 -0
  189. package/skills/support-task-force/SKILL.md +265 -0
  190. package/skills/support-task-force/references/dispatch-pattern.md +178 -0
  191. package/skills/support-task-force/references/synthesis-template.md +126 -0
  192. package/skills/support-wiki-bootstrap/SKILL.md +37 -0
  193. package/skills/support-wiki-lint/SKILL.md +196 -0
  194. package/skills/support-wiki-lint/scripts/lint.mjs +488 -0
  195. package/skills/support-wiki-lint/scripts/lint.test.mjs +196 -0
  196. package/templates/README.md +23 -0
  197. package/templates/aiwiki/CLAUDE.md.template +78 -0
  198. package/templates/aiwiki/schemas/architecture.md +118 -0
  199. package/templates/aiwiki/schemas/convention.md +112 -0
  200. package/templates/aiwiki/schemas/decision.md +144 -0
  201. package/templates/aiwiki/schemas/gotcha.md +118 -0
  202. package/templates/aiwiki/schemas/oracle.md +105 -0
  203. package/templates/aiwiki/schemas/session.md +125 -0
  204. package/templates/manifests/bugfix.yaml +41 -0
  205. package/templates/manifests/feature.yaml +69 -0
  206. package/templates/manifests/greenfield.yaml +61 -0
  207. package/templates/manifests/hotfix.yaml +45 -0
  208. package/templates/manifests/refactor.yaml +44 -0
  209. package/templates/manifests/v5/SCHEMA.md +327 -0
  210. package/templates/manifests/v5/feature.yaml +77 -0
  211. package/templates/manifests/v6/SCHEMA.md +199 -0
  212. package/templates/wiki-html/dream-detail.html +378 -0
  213. package/templates/wiki-html/dreams-list.html +155 -0
@@ -0,0 +1,481 @@
1
+ ---
2
+ name: quality-uiux
3
+ description: "Use when working on frontend code to evaluate accessibility, component reuse, design-token compliance, and interaction patterns."
4
+ ---
5
+
6
+ # UI/UX Quality
7
+
8
+ ## Overview
9
+
10
+ Evaluate frontend code for accessibility, usability, component quality, visual consistency, and library choices. Produce actionable recommendations that improve the user experience.
11
+
12
+ **Core principle:** Good UI/UX is not decoration. It is usability, accessibility, and consistency -- measured and enforced, not subjective.
13
+
14
+ **Announce at start:** "I'm using the quality-uiux skill to evaluate the frontend code."
15
+
16
+ ## When to Use
17
+
18
+ - During or after frontend implementation
19
+ - When adding new UI components
20
+ - When choosing between UI libraries
21
+ - When the user requests a UI/UX review
22
+ - During `/feature` command when the feature has frontend components
23
+
24
+ **Not for:**
25
+ - Backend-only code
26
+ - CLI tools (unless they have interactive UI)
27
+ - API-only services
28
+
29
+ ## The Evaluation Process
30
+
31
+ ### Area 0: Codex Mode Check
32
+
33
+ Run the Codex consent flow from `protocols/codex.md` before proceeding.
34
+
35
+ - **Takeover selected:** Dispatch Codex to perform the full UI/UX evaluation across all 6 areas. Claude reviews the report.
36
+ - **Verify selected** or **Skip / Codex unavailable:** Proceed with Areas 1-6 below. If Verify was selected, the Codex Accessibility Review step will dispatch Codex to check Claude's evaluation.
37
+
38
+ ### Area 1: Accessibility (WCAG Compliance)
39
+
40
+ Check against Web Content Accessibility Guidelines (WCAG) 2.1 Level AA.
41
+
42
+ #### Keyboard Navigation
43
+
44
+ - [ ] All interactive elements are reachable via Tab key
45
+ - [ ] Tab order follows visual layout (logical reading order)
46
+ - [ ] Focus indicator is visible on all interactive elements
47
+ - [ ] No keyboard traps (user can always Tab away from any element)
48
+ - [ ] Custom components support expected keyboard interactions:
49
+ - Buttons: Enter/Space to activate
50
+ - Dropdowns: Arrow keys to navigate, Enter to select, Escape to close
51
+ - Modals: Escape to close, focus trapped inside while open
52
+ - Tabs: Arrow keys to switch, Tab to move into content
53
+
54
+ **Check method:**
55
+ ```
56
+ 1. Start at the top of the page
57
+ 2. Press Tab repeatedly to navigate through all interactive elements
58
+ 3. Verify each element is reachable and usable
59
+ 4. Verify focus indicator is visible at each step
60
+ 5. Test Escape, Enter, Space, Arrow keys where applicable
61
+ ```
62
+
63
+ #### Screen Reader Compatibility
64
+
65
+ - [ ] All images have descriptive `alt` text (or `alt=""` for decorative images)
66
+ - [ ] Form inputs have associated `<label>` elements (or `aria-label`/`aria-labelledby`)
67
+ - [ ] Headings follow hierarchical order (h1 > h2 > h3, no skipping levels)
68
+ - [ ] ARIA landmarks used appropriately (`main`, `nav`, `aside`, `footer`)
69
+ - [ ] Dynamic content changes announced with `aria-live` regions
70
+ - [ ] Custom components have appropriate ARIA roles
71
+ - [ ] Error messages associated with form fields via `aria-describedby`
72
+ - [ ] Page has a descriptive `<title>`
73
+
74
+ **Common ARIA issues:**
75
+ ```html
76
+ <!-- BAD: div acting as button without ARIA -->
77
+ <div onClick={handleClick}>Submit</div>
78
+
79
+ <!-- GOOD: proper button element -->
80
+ <button onClick={handleClick}>Submit</button>
81
+
82
+ <!-- GOOD: if div must be used, add ARIA -->
83
+ <div role="button" tabIndex={0} onClick={handleClick}
84
+ onKeyDown={(e) => e.key === 'Enter' && handleClick()}>
85
+ Submit
86
+ </div>
87
+ ```
88
+
89
+ #### Color and Contrast
90
+
91
+ - [ ] Text contrast ratio meets WCAG AA: 4.5:1 for normal text, 3:1 for large text
92
+ - [ ] Information not conveyed by color alone (also use icons, patterns, text)
93
+ - [ ] UI usable in high contrast mode
94
+ - [ ] Focus indicators have sufficient contrast against background
95
+
96
+ **Check method:**
97
+ ```
98
+ 1. Inspect text elements for color contrast ratios
99
+ 2. Check that error states use more than just red text (add icon or border)
100
+ 3. Check that success/warning/info states have non-color indicators
101
+ 4. Verify links are distinguishable from plain text without relying on color alone
102
+ ```
103
+
104
+ #### Motion and Animation
105
+
106
+ - [ ] Respects `prefers-reduced-motion` media query
107
+ - [ ] No auto-playing animations that cannot be paused
108
+ - [ ] No content that flashes more than 3 times per second
109
+ - [ ] Transitions serve a purpose (communicate state change, not decoration)
110
+
111
+ ```css
112
+ /* Respect user preference */
113
+ @media (prefers-reduced-motion: reduce) {
114
+ *, *::before, *::after {
115
+ animation-duration: 0.01ms !important;
116
+ transition-duration: 0.01ms !important;
117
+ }
118
+ }
119
+ ```
120
+
121
+ ### Area 2: Responsive Design
122
+
123
+ Verify the UI works across viewport sizes.
124
+
125
+ #### Breakpoint Verification
126
+
127
+ - [ ] Mobile (320px - 480px): Content readable, no horizontal scroll, touch targets 44x44px minimum
128
+ - [ ] Tablet (481px - 768px): Layout adapts, navigation accessible
129
+ - [ ] Desktop (769px - 1200px): Full layout, appropriate use of space
130
+ - [ ] Large desktop (1201px+): Content does not stretch beyond readable width (max-width applied)
131
+
132
+ #### Responsive Patterns
133
+
134
+ - [ ] Navigation collapses to hamburger/drawer on mobile
135
+ - [ ] Tables convert to cards or scroll horizontally on mobile
136
+ - [ ] Images scale appropriately (no overflow, no pixelation)
137
+ - [ ] Font sizes are readable at all viewports (minimum 16px body text on mobile)
138
+ - [ ] Form layouts stack vertically on mobile
139
+ - [ ] Modals/dialogs fill screen on mobile, center on desktop
140
+
141
+ #### Touch Targets
142
+
143
+ - [ ] All interactive elements are at least 44x44px on touch devices
144
+ - [ ] Adequate spacing between touch targets (no accidental taps)
145
+ - [ ] No hover-only interactions (provide tap alternatives)
146
+
147
+ **Check method:**
148
+ ```
149
+ 1. Test at 320px, 768px, 1024px, 1440px viewport widths
150
+ 2. Verify no horizontal scrollbar at any width
151
+ 3. Verify all content is accessible at each width
152
+ 4. Check touch target sizes on mobile viewport
153
+ ```
154
+
155
+ ### Area 3: Component Reusability
156
+
157
+ Evaluate component architecture for reuse and maintainability.
158
+
159
+ #### Duplicate Detection
160
+
161
+ Scan for components with similar purpose:
162
+
163
+ ```
164
+ DUPLICATE FOUND:
165
+ - src/components/UserCard.tsx (used in /users page)
166
+ - src/features/dashboard/MemberCard.tsx (used in /dashboard)
167
+ Both render: user avatar, name, email, role badge.
168
+ Difference: UserCard has "edit" button, MemberCard has "remove" button.
169
+ RECOMMENDATION: Extract shared UserCardBase, compose with action slots.
170
+ ```
171
+
172
+ - [ ] No two components render substantially the same UI
173
+ - [ ] Shared patterns extracted to reusable components
174
+ - [ ] Components accept composition via children/slots (not prop-based if/else)
175
+
176
+ #### Component API Quality
177
+
178
+ - [ ] Props have TypeScript types (no `any`)
179
+ - [ ] Required vs optional props are clearly defined
180
+ - [ ] Default values provided for optional props
181
+ - [ ] Components are controlled or uncontrolled (not mixed)
182
+ - [ ] Event handlers follow naming convention (onAction, handleAction)
183
+
184
+ ```typescript
185
+ // BAD: unclear API
186
+ interface Props {
187
+ data: any;
188
+ type: string;
189
+ show: boolean;
190
+ cb: Function;
191
+ }
192
+
193
+ // GOOD: clear, typed API
194
+ interface UserCardProps {
195
+ user: User;
196
+ variant?: 'compact' | 'detailed';
197
+ isHighlighted?: boolean;
198
+ onEdit?: (userId: string) => void;
199
+ children?: React.ReactNode; // composition slot for actions
200
+ }
201
+ ```
202
+
203
+ #### Component Composition
204
+
205
+ - [ ] Prefer composition over configuration (slots/children over boolean props)
206
+ - [ ] No components with more than 10 props (split into smaller components)
207
+ - [ ] No conditional rendering trees deeper than 3 levels
208
+ - [ ] Business logic in hooks/services, not in component body
209
+
210
+ ### Area 4: Library Recommendations
211
+
212
+ When the project needs a new UI library, evaluate candidates on these criteria.
213
+
214
+ #### Evaluation Matrix
215
+
216
+ | Criteria | Weight | How to Check |
217
+ |----------|--------|-------------|
218
+ | Bundle size | High | bundlephobia.com or `npm pack --dry-run` |
219
+ | Tree-shakeable | High | Check if library supports ESM imports |
220
+ | Maintenance | High | Last commit date, release frequency, open issues/PRs ratio |
221
+ | Community | Medium | npm weekly downloads, GitHub stars, Stack Overflow questions |
222
+ | TypeScript support | Medium | Built-in types vs @types package vs no types |
223
+ | License | Medium | MIT/Apache preferred. Check for copyleft (GPL) restrictions. |
224
+ | Accessibility | High | Built-in ARIA support, keyboard navigation |
225
+ | Documentation | Medium | Quality of docs, examples, migration guides |
226
+ | SSR compatibility | Varies | Server-side rendering support if needed |
227
+
228
+ **Recommendation format:**
229
+ ```markdown
230
+ ### Library Recommendation: Date Picker
231
+
232
+ | Candidate | Bundle Size | Downloads/wk | Last Release | TS | A11y | License |
233
+ |-----------|-------------|-------------|--------------|-----|------|---------|
234
+ | react-datepicker | 12KB | 2.1M | 2 weeks ago | Yes | Good | MIT |
235
+ | @mui/x-date-pickers | 45KB | 800K | 1 week ago | Yes | Excellent | MIT |
236
+ | react-day-picker | 8KB | 500K | 1 month ago | Yes | Good | MIT |
237
+
238
+ **Recommendation:** react-day-picker
239
+ **Reasoning:** Smallest bundle size, good accessibility, active maintenance.
240
+ MUI option is better for accessibility but 5x larger and pulls in MUI dependency.
241
+ react-datepicker is popular but larger than react-day-picker for similar features.
242
+ ```
243
+
244
+ **Rules:**
245
+ - Always compare at least 2 candidates
246
+ - Bundle size matters -- every KB affects load time
247
+ - Check if the library is actively maintained (last release within 6 months)
248
+ - Verify TypeScript support quality (not just @types with 50 open issues)
249
+ - Check license compatibility with project
250
+ - Verify via context7 or websearch when uncertain about library features
251
+
252
+ ### Area 5: Visual Consistency
253
+
254
+ **If `DESIGN.md` exists at the project root** (from `plan-design-system`), load it and validate the implementation against the approved design tokens. Every check below should reference the specific values from `DESIGN.md` rather than generic best practices. Flag any deviation where the implementation uses hardcoded values instead of the approved tokens. Also check for feature-scoped overrides in `.forge/work/{type}/{name}/design-overrides.md` — if present, those tokens take precedence over root `DESIGN.md` for this feature.
255
+
256
+ **If no `DESIGN.md` exists** (on-demand review, bugfix, or backend-only), evaluate against the project's existing patterns.
257
+
258
+ Check that the UI follows a consistent design language.
259
+
260
+ #### Spacing System
261
+
262
+ - [ ] Consistent spacing scale used (e.g., 4px, 8px, 12px, 16px, 24px, 32px, 48px)
263
+ - [ ] No arbitrary pixel values (everything from the scale)
264
+ - [ ] Consistent padding within similar components
265
+ - [ ] Consistent margins between sections
266
+
267
+ #### Typography
268
+
269
+ - [ ] Consistent font family throughout (or intentional variation for headings)
270
+ - [ ] Consistent type scale (e.g., 12px, 14px, 16px, 20px, 24px, 32px)
271
+ - [ ] Line height appropriate for readability (1.4-1.6 for body text)
272
+ - [ ] No more than 2-3 font weights used
273
+ - [ ] Maximum line width for readability (45-75 characters)
274
+
275
+ #### Color Usage
276
+
277
+ - [ ] Consistent color palette (defined as variables/tokens)
278
+ - [ ] Semantic color naming (--color-error, --color-success, not --color-red)
279
+ - [ ] Consistent use of primary, secondary, accent colors
280
+ - [ ] Dark mode support (if applicable) via CSS custom properties
281
+ - [ ] No hardcoded color values in components (use tokens)
282
+
283
+ ```css
284
+ /* BAD: hardcoded colors scattered throughout */
285
+ .button { background: #3b82f6; }
286
+ .link { color: #2563eb; }
287
+
288
+ /* GOOD: design tokens */
289
+ :root {
290
+ --color-primary: #3b82f6;
291
+ --color-primary-hover: #2563eb;
292
+ --color-error: #ef4444;
293
+ --color-success: #22c55e;
294
+ }
295
+ .button { background: var(--color-primary); }
296
+ .link { color: var(--color-primary); }
297
+ ```
298
+
299
+ #### Iconography
300
+
301
+ - [ ] Consistent icon set used throughout (not mixing multiple icon libraries)
302
+ - [ ] Icons have consistent size at each usage context
303
+ - [ ] Icons have accessible labels (aria-label or accompanying text)
304
+
305
+ ### Area 6: Interaction Patterns
306
+
307
+ Verify all UI states are handled properly.
308
+
309
+ #### Loading States
310
+
311
+ - [ ] Skeleton screens or spinners for async content
312
+ - [ ] Loading indicators for form submissions
313
+ - [ ] Button disabled state during async operations (prevent double submit)
314
+ - [ ] Progressive loading for large lists (pagination or infinite scroll)
315
+ - [ ] Timeout handling (show error after reasonable wait)
316
+
317
+ ```tsx
318
+ // BAD: no loading state
319
+ {data && <UserList users={data} />}
320
+
321
+ // GOOD: all states handled
322
+ {isLoading && <UserListSkeleton />}
323
+ {error && <ErrorMessage error={error} onRetry={refetch} />}
324
+ {data?.length === 0 && <EmptyState message="No users found" />}
325
+ {data && data.length > 0 && <UserList users={data} />}
326
+ ```
327
+
328
+ #### Error States
329
+
330
+ - [ ] Form validation errors shown inline (next to the field, not just at top)
331
+ - [ ] API error messages shown to user (not just console.error)
332
+ - [ ] Network error handling (offline state, retry option)
333
+ - [ ] Error boundary for unexpected crashes (show fallback UI)
334
+ - [ ] Error messages are actionable ("Check your email format" not "Error 422")
335
+
336
+ #### Empty States
337
+
338
+ - [ ] Empty lists show helpful message (not blank space)
339
+ - [ ] Empty states suggest action ("Add your first item")
340
+ - [ ] Search with no results shows helpful message and suggestions
341
+ - [ ] First-time user experience handles empty data gracefully
342
+
343
+ #### Success States
344
+
345
+ - [ ] Success feedback shown for form submissions (toast, redirect, inline message)
346
+ - [ ] Optimistic updates where appropriate (with rollback on failure)
347
+ - [ ] Confirmation for destructive actions (delete, cancel, discard)
348
+
349
+ ### Codex Accessibility Review
350
+ After completing all 6 evaluation areas, check the mode recorded at Area 0. If **Verify** was selected, dispatch Codex to review for missed accessibility issues, component consistency gaps, and responsive breakpoints. Merge findings into the evaluation report. If **Takeover** was selected, skip this step (Codex already ran). If **Skip**, do nothing. Do NOT re-run the consent flow. See **Codex Integration** section below for full details.
351
+
352
+ ## Evaluation Report Format
353
+
354
+ ```markdown
355
+ ## UI/UX Evaluation Report
356
+
357
+ **Scope:** [components/pages reviewed]
358
+ **Date:** {date}
359
+
360
+ ### Accessibility Score
361
+ | Category | Status | Issues |
362
+ |----------|--------|--------|
363
+ | Keyboard navigation | PASS / FAIL | {details} |
364
+ | Screen reader | PASS / FAIL | {details} |
365
+ | Color contrast | PASS / FAIL | {details} |
366
+ | Motion | PASS / FAIL | {details} |
367
+
368
+ ### Responsive Design Score
369
+ | Viewport | Status | Issues |
370
+ |----------|--------|--------|
371
+ | Mobile (320px) | PASS / FAIL | {details} |
372
+ | Tablet (768px) | PASS / FAIL | {details} |
373
+ | Desktop (1024px) | PASS / FAIL | {details} |
374
+ | Large (1440px) | PASS / FAIL | {details} |
375
+
376
+ ### Component Quality
377
+ - **Duplicates found:** {count}
378
+ - **Components needing refactor:** {list}
379
+ - **API quality issues:** {list}
380
+
381
+ ### Visual Consistency
382
+ - **Spacing issues:** {count}
383
+ - **Typography issues:** {count}
384
+ - **Color issues:** {count}
385
+
386
+ ### Interaction Patterns
387
+ | Pattern | Implemented | Missing |
388
+ |---------|------------|---------|
389
+ | Loading states | {components} | {components} |
390
+ | Error states | {components} | {components} |
391
+ | Empty states | {components} | {components} |
392
+ | Success feedback | {components} | {components} |
393
+
394
+ ### Library Recommendations
395
+ [If applicable, comparison tables and recommendations]
396
+
397
+ ### Prioritized Fixes
398
+ 1. [Critical accessibility issues first]
399
+ 2. [Responsive breakage second]
400
+ 3. [Component quality third]
401
+ 4. [Visual consistency fourth]
402
+ 5. [Interaction pattern gaps fifth]
403
+ ```
404
+
405
+ ## Common Mistakes
406
+
407
+ | Mistake | Fix |
408
+ |---------|-----|
409
+ | Accessibility as afterthought | Check accessibility first -- it affects architecture |
410
+ | Testing only desktop viewport | Test 320px, 768px, 1024px, 1440px at minimum |
411
+ | Ignoring empty/error states | Every data-driven component needs all four states |
412
+ | Choosing libraries by popularity | Evaluate by bundle size, maintenance, accessibility |
413
+ | Hardcoded colors throughout | Use design tokens (CSS custom properties) |
414
+ | Hover-only interactions | Always provide touch/keyboard alternatives |
415
+ | Skipping keyboard testing | Tab through every page. Every interactive element. |
416
+ | Giant components with many props | Prefer composition. Split at 10+ props. |
417
+
418
+ ## Red Flags
419
+
420
+ **Never:**
421
+ - Ship inaccessible UI (WCAG AA is the minimum)
422
+ - Choose a library without evaluating alternatives
423
+ - Ignore mobile viewports
424
+ - Leave unhandled loading/error/empty states
425
+ - Use hover-only interactions
426
+ - Skip keyboard navigation testing
427
+
428
+ **Always:**
429
+ - Test keyboard navigation through entire flows
430
+ - Check color contrast ratios for all text
431
+ - Handle all four states (loading, error, empty, success)
432
+ - Use design tokens for colors, spacing, typography
433
+ - Evaluate libraries on concrete criteria (not "popular")
434
+ - Verify via context7 or websearch when uncertain about library features
435
+ - Capture screenshots at each viewport for review
436
+
437
+ ## Codex Integration
438
+ **Modes:** Verify or Takeover | **Protocol:** `protocols/codex.md`
439
+
440
+ - **Verify:** Claude evaluates UI/UX, Codex reviews for missed issues.
441
+ - **Takeover:** Codex evaluates UI/UX, Claude reviews the report.
442
+
443
+ **When:** After Claude has produced the UI/UX evaluation report.
444
+
445
+ **Context to pass:**
446
+ - Path to `.forge/work/{type}/{name}/uiux-report.md`
447
+ - Path to frontend source directories
448
+ - Path to `DESIGN.md` (if available)
449
+
450
+ **What Codex reviews:**
451
+ - Accessibility issues Claude may have missed (ARIA attributes, focus management, screen reader compatibility)
452
+ - Component consistency gaps across pages/views
453
+ - Responsive breakpoint coverage
454
+ - Design token compliance against DESIGN.md
455
+
456
+ **Prompt focus:** "Review this UI/UX evaluation for missed accessibility issues, component inconsistencies, and responsive gaps. Focus on what the evaluation MISSED."
457
+
458
+ **Presentation:** Merge Codex findings into the evaluation report under a "Second Opinion" section.
459
+
460
+ ---
461
+
462
+ ## I/O Contract
463
+
464
+ | Field | Value |
465
+ |---|---|
466
+ | **Requires** | Frontend implementation code. `DESIGN.md` at project root (if available — from `plan-design-system`). Component library in use. |
467
+ | **Produces** | `.forge/work/{type}/{name}/uiux-report.md` (evaluation report with prioritized recommendations) |
468
+ | **Feeds into** | `quality-code-review` (apply improvements), `build-tdd` (write tests for accessibility/interaction fixes) |
469
+ | **Updates manifest** | `quality.uiux-review.status: complete, gate-passed: true/false` |
470
+
471
+ ## Integration
472
+
473
+ **Called by:**
474
+ - `/feature` command (when feature has frontend components)
475
+ - On-demand when user requests UI/UX review
476
+
477
+ **Pairs with:**
478
+ - `quality-code-review` (UI/UX findings feed into code review fixes)
479
+ - `build-tdd` (accessibility and interaction fixes follow TDD cycle)
480
+ - `quality-test-plan` (E2E tests should cover interaction patterns)
481
+ - `quality-test-execution` (Playwright tests verify accessibility)