@hustle-together/api-dev-tools 3.12.16 → 4.5.3

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 (180) hide show
  1. package/.claude/adr-requests/.gitkeep +10 -0
  2. package/.claude/agents/adr-researcher.md +109 -0
  3. package/.claude/agents/visual-analyzer.md +183 -0
  4. package/.claude/api-dev-state.json +10 -0
  5. package/.claude/documentation-audit.json +114 -0
  6. package/.claude/registry.json +289 -0
  7. package/.claude/settings.json +45 -1
  8. package/.claude/settings.local.json +1 -7
  9. package/.claude/workflow-logs/None.json +49 -0
  10. package/.claude/workflow-logs/session-20251230-143727.json +106 -0
  11. package/.skills/adr-deep-research/SKILL.md +351 -0
  12. package/.skills/api-create/SKILL.md +34 -20
  13. package/.skills/api-research/SKILL.md +130 -0
  14. package/.skills/docs-update/SKILL.md +205 -0
  15. package/.skills/hustle-brand/SKILL.md +368 -0
  16. package/.skills/hustle-build/SKILL.md +365 -38
  17. package/.skills/parallel-spawn/SKILL.md +212 -0
  18. package/.skills/ralph-continue/SKILL.md +151 -0
  19. package/.skills/ralph-loop/SKILL.md +341 -0
  20. package/.skills/ralph-status/SKILL.md +87 -0
  21. package/.skills/refactor/SKILL.md +59 -0
  22. package/.skills/shadcn/SKILL.md +522 -0
  23. package/.skills/test-all/SKILL.md +210 -0
  24. package/.skills/test-builds/SKILL.md +208 -0
  25. package/.skills/test-debug/SKILL.md +212 -0
  26. package/.skills/test-e2e/SKILL.md +168 -0
  27. package/.skills/test-review/SKILL.md +707 -0
  28. package/.skills/test-unit/SKILL.md +143 -0
  29. package/.skills/test-visual/SKILL.md +301 -0
  30. package/.skills/token-report/SKILL.md +132 -0
  31. package/CHANGELOG.md +488 -0
  32. package/README.md +346 -53
  33. package/bin/cli.js +359 -123
  34. package/hooks/__pycache__/api-workflow-check.cpython-314.pyc +0 -0
  35. package/hooks/__pycache__/auto-answer.cpython-314.pyc +0 -0
  36. package/hooks/__pycache__/cache-research.cpython-314.pyc +0 -0
  37. package/hooks/__pycache__/check-api-routes.cpython-314.pyc +0 -0
  38. package/hooks/__pycache__/check-playwright-setup.cpython-314.pyc +0 -0
  39. package/hooks/__pycache__/check-storybook-setup.cpython-314.pyc +0 -0
  40. package/hooks/__pycache__/check-update.cpython-314.pyc +0 -0
  41. package/hooks/__pycache__/completion-promise-detector.cpython-314.pyc +0 -0
  42. package/hooks/__pycache__/context-capacity-warning.cpython-314.pyc +0 -0
  43. package/hooks/__pycache__/detect-interruption.cpython-314.pyc +0 -0
  44. package/hooks/__pycache__/docs-update-check.cpython-314.pyc +0 -0
  45. package/hooks/__pycache__/enforce-a11y-audit.cpython-314.pyc +0 -0
  46. package/hooks/__pycache__/enforce-brand-guide.cpython-314.pyc +0 -0
  47. package/hooks/__pycache__/enforce-component-type-confirm.cpython-314.pyc +0 -0
  48. package/hooks/__pycache__/enforce-deep-research.cpython-314.pyc +0 -0
  49. package/hooks/__pycache__/enforce-disambiguation.cpython-314.pyc +0 -0
  50. package/hooks/__pycache__/enforce-documentation.cpython-314.pyc +0 -0
  51. package/hooks/__pycache__/enforce-dry-run.cpython-314.pyc +0 -0
  52. package/hooks/__pycache__/enforce-environment.cpython-314.pyc +0 -0
  53. package/hooks/__pycache__/enforce-external-research.cpython-314.pyc +0 -0
  54. package/hooks/__pycache__/enforce-freshness.cpython-314.pyc +0 -0
  55. package/hooks/__pycache__/enforce-interview.cpython-314.pyc +0 -0
  56. package/hooks/__pycache__/enforce-page-components.cpython-314.pyc +0 -0
  57. package/hooks/__pycache__/enforce-page-data-schema.cpython-314.pyc +0 -0
  58. package/hooks/__pycache__/enforce-questions-sourced.cpython-314.pyc +0 -0
  59. package/hooks/__pycache__/enforce-refactor.cpython-314.pyc +0 -0
  60. package/hooks/__pycache__/enforce-research.cpython-314.pyc +0 -0
  61. package/hooks/__pycache__/enforce-schema-from-interview.cpython-314.pyc +0 -0
  62. package/hooks/__pycache__/enforce-schema.cpython-314.pyc +0 -0
  63. package/hooks/__pycache__/enforce-scope.cpython-314.pyc +0 -0
  64. package/hooks/__pycache__/enforce-tdd-red.cpython-314.pyc +0 -0
  65. package/hooks/__pycache__/enforce-ui-disambiguation.cpython-314.pyc +0 -0
  66. package/hooks/__pycache__/enforce-ui-interview.cpython-314.pyc +0 -0
  67. package/hooks/__pycache__/enforce-verify.cpython-314.pyc +0 -0
  68. package/hooks/__pycache__/generate-adr-options.cpython-314.pyc +0 -0
  69. package/hooks/__pycache__/generate-manifest-entry.cpython-314.pyc +0 -0
  70. package/hooks/__pycache__/hook_utils.cpython-314.pyc +0 -0
  71. package/hooks/__pycache__/notify-input-needed.cpython-314.pyc +0 -0
  72. package/hooks/__pycache__/notify-phase-complete.cpython-314.pyc +0 -0
  73. package/hooks/__pycache__/ntfy-on-question.cpython-314.pyc +0 -0
  74. package/hooks/__pycache__/orchestrator-completion.cpython-314.pyc +0 -0
  75. package/hooks/__pycache__/orchestrator-handoff.cpython-314.pyc +0 -0
  76. package/hooks/__pycache__/orchestrator-session-startup.cpython-314.pyc +0 -0
  77. package/hooks/__pycache__/parallel-orchestrator.cpython-314.pyc +0 -0
  78. package/hooks/__pycache__/periodic-reground.cpython-314.pyc +0 -0
  79. package/hooks/__pycache__/project-document-prompt.cpython-314.pyc +0 -0
  80. package/hooks/__pycache__/remote-question-proxy.cpython-314.pyc +0 -0
  81. package/hooks/__pycache__/remote-question-server.cpython-314.pyc +0 -0
  82. package/hooks/__pycache__/run-code-review.cpython-314.pyc +0 -0
  83. package/hooks/__pycache__/run-visual-qa.cpython-314.pyc +0 -0
  84. package/hooks/__pycache__/session-logger.cpython-314.pyc +0 -0
  85. package/hooks/__pycache__/session-startup.cpython-314.pyc +0 -0
  86. package/hooks/__pycache__/track-scope-coverage.cpython-314.pyc +0 -0
  87. package/hooks/__pycache__/track-token-usage.cpython-314.pyc +0 -0
  88. package/hooks/__pycache__/track-tool-use.cpython-314.pyc +0 -0
  89. package/hooks/__pycache__/update-adr-decision.cpython-314.pyc +0 -0
  90. package/hooks/__pycache__/update-api-showcase.cpython-314.pyc +0 -0
  91. package/hooks/__pycache__/update-registry.cpython-314.pyc +0 -0
  92. package/hooks/__pycache__/update-ui-showcase.cpython-314.pyc +0 -0
  93. package/hooks/__pycache__/verify-after-green.cpython-314.pyc +0 -0
  94. package/hooks/__pycache__/verify-implementation.cpython-314.pyc +0 -0
  95. package/hooks/api-workflow-check.py +34 -0
  96. package/hooks/auto-answer.py +97 -20
  97. package/{.claude/hooks → hooks}/completion-promise-detector.py +0 -0
  98. package/{.claude/hooks → hooks}/context-capacity-warning.py +0 -0
  99. package/{.claude/hooks → hooks}/docs-update-check.py +0 -0
  100. package/{.claude/hooks → hooks}/enforce-dry-run.py +0 -0
  101. package/hooks/enforce-external-research.py +25 -0
  102. package/hooks/enforce-interview.py +20 -0
  103. package/{.claude/hooks → hooks}/generate-adr-options.py +0 -0
  104. package/{.claude/hooks → hooks}/hook_utils.py +0 -0
  105. package/hooks/ntfy-on-question.py +15 -2
  106. package/hooks/orchestrator-handoff.py +81 -3
  107. package/{.claude/hooks → hooks}/parallel-orchestrator.py +0 -0
  108. package/hooks/periodic-reground.py +40 -0
  109. package/{.claude/hooks → hooks}/remote-question-server.py +0 -0
  110. package/hooks/run-code-review.py +176 -29
  111. package/{.claude/hooks → hooks}/run-visual-qa.py +0 -0
  112. package/hooks/session-logger.py +27 -1
  113. package/hooks/session-startup.py +113 -0
  114. package/{.claude/hooks → hooks}/update-adr-decision.py +0 -0
  115. package/package.json +1 -1
  116. package/templates/.skills/hustle-interview/SKILL.md +174 -0
  117. package/templates/adr-viewer/_components/ADRViewer.tsx +326 -0
  118. package/templates/api-dev-state.json +33 -1
  119. package/templates/brand-page/page.tsx +645 -0
  120. package/templates/component/Component.visual.spec.ts +30 -24
  121. package/templates/eslint-plugin-zod-schema/index.js +446 -0
  122. package/templates/eslint-plugin-zod-schema/package.json +26 -0
  123. package/templates/github-workflows/security.yml +274 -0
  124. package/templates/hustle-build-defaults.json +53 -1
  125. package/templates/page/page.e2e.test.ts +30 -26
  126. package/templates/performance-budgets.json +63 -5
  127. package/templates/registry.json +279 -3
  128. package/templates/review-dashboard/page.tsx +510 -0
  129. package/templates/settings.json +74 -7
  130. package/templates/ui-showcase/_components/UIShowcase.tsx +47 -0
  131. package/templates/ui-showcase/_components/VisualTestingDashboard.tsx +579 -0
  132. package/.claude/commands/hustle-combine.md +0 -1089
  133. package/.claude/commands/hustle-ui-create-page.md +0 -1078
  134. package/.claude/commands/hustle-ui-create.md +0 -1058
  135. package/.claude/hooks/auto-answer.py +0 -305
  136. package/.claude/hooks/cache-research.py +0 -337
  137. package/.claude/hooks/check-api-routes.py +0 -168
  138. package/.claude/hooks/check-playwright-setup.py +0 -103
  139. package/.claude/hooks/check-storybook-setup.py +0 -81
  140. package/.claude/hooks/check-update.py +0 -132
  141. package/.claude/hooks/detect-interruption.py +0 -165
  142. package/.claude/hooks/enforce-a11y-audit.py +0 -202
  143. package/.claude/hooks/enforce-brand-guide.py +0 -241
  144. package/.claude/hooks/enforce-component-type-confirm.py +0 -97
  145. package/.claude/hooks/enforce-freshness.py +0 -184
  146. package/.claude/hooks/enforce-page-components.py +0 -186
  147. package/.claude/hooks/enforce-page-data-schema.py +0 -155
  148. package/.claude/hooks/enforce-questions-sourced.py +0 -146
  149. package/.claude/hooks/enforce-schema-from-interview.py +0 -248
  150. package/.claude/hooks/enforce-ui-disambiguation.py +0 -108
  151. package/.claude/hooks/enforce-ui-interview.py +0 -130
  152. package/.claude/hooks/generate-manifest-entry.py +0 -1161
  153. package/.claude/hooks/lib/__init__.py +0 -1
  154. package/.claude/hooks/lib/greptile.py +0 -355
  155. package/.claude/hooks/lib/ntfy.py +0 -209
  156. package/.claude/hooks/notify-input-needed.py +0 -73
  157. package/.claude/hooks/notify-phase-complete.py +0 -90
  158. package/.claude/hooks/ntfy-on-question.py +0 -240
  159. package/.claude/hooks/orchestrator-completion.py +0 -313
  160. package/.claude/hooks/orchestrator-handoff.py +0 -267
  161. package/.claude/hooks/orchestrator-session-startup.py +0 -146
  162. package/.claude/hooks/run-code-review.py +0 -393
  163. package/.claude/hooks/session-logger.py +0 -323
  164. package/.claude/hooks/test-orchestrator-reground.py +0 -248
  165. package/.claude/hooks/track-scope-coverage.py +0 -220
  166. package/.claude/hooks/track-token-usage.py +0 -121
  167. package/.claude/hooks/update-api-showcase.py +0 -161
  168. package/.claude/hooks/update-registry.py +0 -352
  169. package/.claude/hooks/update-ui-showcase.py +0 -224
  170. package/.claude/test-auto-answer-bot.py +0 -183
  171. package/.claude/test-completion-detector.py +0 -263
  172. package/.claude/test-orchestrator-state.json +0 -20
  173. package/.claude/test-orchestrator.sh +0 -271
  174. /package/{.claude/commands → commands}/hustle-build.md +0 -0
  175. /package/{.claude/hooks → hooks}/lib/__pycache__/__init__.cpython-314.pyc +0 -0
  176. /package/{.claude/hooks → hooks}/lib/__pycache__/greptile.cpython-314.pyc +0 -0
  177. /package/{.claude/hooks → hooks}/lib/__pycache__/ntfy.cpython-314.pyc +0 -0
  178. /package/{.claude/hooks → hooks}/project-document-prompt.py +0 -0
  179. /package/{.claude/hooks → hooks}/remote-question-proxy.py +0 -0
  180. /package/{.claude/hooks → hooks}/update-testing-checklist.py +0 -0
@@ -1,1078 +0,0 @@
1
- ---
2
- description: Create Next.js pages with 14-phase interview-driven workflow
3
- argument-hint: [page-name]
4
- ---
5
-
6
- # Hustle UI Create - Page Mode
7
-
8
- **Version:** 4.0.0
9
- **14-phase workflow for creating Next.js App Router pages**
10
-
11
- **Usage:** `/hustle-ui-create-page [page-name] [--auto] [--resume [workflow-id]]`
12
-
13
- You are creating a page using the Hustle Together interview-driven workflow.
14
-
15
- ## Arguments
16
-
17
- - `[page-name]` - Name of the page to create
18
- - `--auto` - Fully autonomous mode, auto-answers all questions with comprehensive defaults
19
- - `--resume [workflow-id]` - Resume an interrupted workflow from its last phase
20
-
21
- ---
22
-
23
- ## Auto Mode (`--auto`)
24
-
25
- When `--auto` flag is used:
26
-
27
- 1. **No Interactive Questions:**
28
- - All questions auto-answered with comprehensive defaults
29
- - Uses `.claude/hustle-build-defaults.json` for configured answers
30
- - Falls back to "most comprehensive" option when no default exists
31
-
32
- 2. **Comprehensive Selection Logic:**
33
- - Uses responsive-grid layout
34
- - Enables full SEO (Open Graph, Twitter cards, JSON-LD)
35
- - Creates loading states and error boundaries
36
- - Enables prefetching and Suspense
37
- - Uses all available components from registry
38
-
39
- 3. **Error Handling:**
40
- - E2E test failures: Retry 3x, then log and continue
41
- - Missing API routes: Log warning, create stubs
42
- - Performance budget exceeded: Log warning, continue
43
-
44
- 4. **Logging:**
45
- - All decisions logged to `.claude/workflow-logs/ui-create-page/[workflow-id].json`
46
- - Review with `/hustle-ui-create-page-review [workflow-id]`
47
-
48
- ---
49
-
50
- ## Resume Mode (`--resume`)
51
-
52
- When `--resume [workflow-id]` is used:
53
-
54
- 1. Load state from `.claude/api-dev-state.json`
55
- 2. Find the last incomplete phase
56
- 3. Continue from that point
57
- 4. Preserve all previous decisions
58
-
59
- ---
60
-
61
- ## Orchestrated Mode
62
-
63
- When running as part of `/hustle-build`:
64
-
65
- 1. `orchestrated: true` flag is set in state
66
- 2. `shared_decisions` are pre-filled from orchestrator interview
67
- 3. Questions covered by shared_decisions are SKIPPED (e.g., auth, brand guide, testing level)
68
- 4. Components to use are pre-selected based on orchestrator decomposition
69
- 5. Only page-specific questions are asked (layout, SEO details)
70
-
71
- ---
72
-
73
- ## Pre-Flight Check
74
-
75
- Before starting, verify state file exists:
76
-
77
- ```bash
78
- cat .claude/api-dev-state.json 2>/dev/null || echo "Creating new state file"
79
- ```
80
-
81
- Initialize state for page creation:
82
-
83
- ```json
84
- {
85
- "workflow": "ui-create-page",
86
- "element_name": "[page-name]",
87
- "element_type": "page"
88
- }
89
- ```
90
-
91
- ---
92
-
93
- # Phase 1: DISAMBIGUATION
94
-
95
- **Goal:** Clarify page type and purpose
96
-
97
- Ask the user:
98
-
99
- ```
100
- Phase 1: DISAMBIGUATION
101
-
102
- What type of page is this?
103
-
104
- A) Landing Page - Marketing/showcase page with hero, features, CTA
105
- B) Dashboard - Data display with metrics, charts, tables
106
- C) Form Page - User input form (create, edit, settings)
107
- D) List/Grid - Display collection of items (search, filter, paginate)
108
- E) Detail Page - Single item view (profile, product, article)
109
- F) Auth Page - Login, register, password reset
110
- G) Other - [describe]
111
-
112
- Please select A-G:
113
- ```
114
-
115
- **Wait for user response.**
116
-
117
- Update state:
118
-
119
- ```json
120
- {
121
- "phases": {
122
- "disambiguation": {
123
- "status": "complete",
124
- "page_type": "[landing|dashboard|form|list|detail|auth|other]"
125
- }
126
- }
127
- }
128
- ```
129
-
130
- ---
131
-
132
- # Phase 2: SCOPE
133
-
134
- **Goal:** Confirm understanding of page purpose and route structure
135
-
136
- Based on the page name and type, present your understanding:
137
-
138
- ```
139
- Phase 2: SCOPE CONFIRMATION
140
-
141
- Based on your input, here's my understanding:
142
-
143
- Page: [Name]
144
- Type: [Landing/Dashboard/Form/List/Detail/Auth]
145
- Route: /[name] (or /[name]/[id] for detail pages)
146
-
147
- Purpose: [Your understanding of what this page does]
148
-
149
- Expected Sections:
150
- - [Section 1]
151
- - [Section 2]
152
- - [Section 3]
153
-
154
- Data Requirements:
155
- - [Data source 1]
156
- - [Data source 2]
157
-
158
- Does this match your expectations?
159
- A) Yes, proceed
160
- B) No, let me clarify
161
-
162
- Please select A or B:
163
- ```
164
-
165
- **Wait for user response. Loop back if B selected.**
166
-
167
- Update state with `phases.scope.status = "complete"`
168
-
169
- ---
170
-
171
- # Phase 3: DESIGN RESEARCH
172
-
173
- **Goal:** Research Next.js App Router patterns and check brand guide
174
-
175
- ### Step 3a: Brand Guide Check
176
-
177
- ```
178
- Phase 3: DESIGN RESEARCH
179
-
180
- I found your brand guide at .claude/BRAND_GUIDE.md
181
-
182
- If you need to update your brand guide, NOW is the time!
183
- 1. Open .claude/BRAND_GUIDE.md
184
- 2. Make your changes
185
- 3. Save the file
186
- 4. Then select option A below
187
-
188
- Should I use the project brand guide?
189
- A) Yes, use brand guide (default)
190
- B) No, use different reference [provide URL or description]
191
-
192
- Please select A or B:
193
- ```
194
-
195
- **Wait for user response.**
196
-
197
- ### Step 3b: Next.js Pattern Research
198
-
199
- Perform 2-3 targeted searches based on page type:
200
-
201
- **For Landing Pages:**
202
-
203
- 1. `Next.js 15 landing page best practices`
204
- 2. `shadcn landing page components hero section`
205
- 3. `responsive landing page layout App Router`
206
-
207
- **For Dashboards:**
208
-
209
- 1. `Next.js 15 dashboard layout App Router`
210
- 2. `shadcn dashboard components data table`
211
- 3. `Recharts React charts dashboard`
212
-
213
- **For Form Pages:**
214
-
215
- 1. `Next.js 15 server actions form handling`
216
- 2. `react-hook-form zod validation`
217
- 3. `shadcn form components`
218
-
219
- **For List Pages:**
220
-
221
- 1. `Next.js 15 pagination App Router`
222
- 2. `shadcn data table filtering sorting`
223
- 3. `server-side pagination searchParams`
224
-
225
- **For Detail Pages:**
226
-
227
- 1. `Next.js 15 dynamic routes [id] App Router`
228
- 2. `generateStaticParams ISR`
229
- 3. `optimistic updates detail page`
230
-
231
- Use Context7 for Next.js and ShadCN documentation.
232
-
233
- Document findings in state:
234
-
235
- ```json
236
- {
237
- "phases": {
238
- "design_research": {
239
- "status": "complete",
240
- "brand_guide_applied": true,
241
- "sources": ["source1", "source2"],
242
- "patterns_found": ["pattern1", "pattern2"]
243
- }
244
- }
245
- }
246
- ```
247
-
248
- ---
249
-
250
- # Phase 4: INTERVIEW
251
-
252
- **Goal:** Deep dive into page requirements
253
-
254
- Ask 5-10 questions based on research findings. Questions should be GENERATED from research, not templates.
255
-
256
- **Example questions for Dashboard page:**
257
-
258
- ```
259
- Phase 4: INTERVIEW
260
-
261
- Based on my research, I have some questions about your [Page]:
262
-
263
- Q1: Data Fetching Strategy
264
- How should data be fetched?
265
- A) Server Components - Fetch on server (recommended for static data)
266
- B) Client Components - Fetch with SWR/TanStack Query (real-time updates)
267
- C) Hybrid - Server for initial, client for updates
268
-
269
- Q2: Layout Structure
270
- What layout should this page use?
271
- A) Full width - No sidebar, content spans full width
272
- B) Sidebar layout - Fixed sidebar with scrollable content
273
- C) Nested layout - Inherit from parent layout
274
-
275
- Q3: Authentication
276
- What authentication is required?
277
- A) Public - No auth required
278
- B) Protected - Must be logged in
279
- C) Role-based - Specific roles only
280
-
281
- Q4: SEO Requirements
282
- What SEO metadata is needed?
283
- A) Basic - Title and description
284
- B) Full - Open Graph, Twitter cards, JSON-LD
285
- C) None - Dashboard/internal page
286
-
287
- Q5: [Research-derived question about specific feature]
288
-
289
- Q6: [Research-derived question about specific feature]
290
- ```
291
-
292
- **Wait for all answers before proceeding.**
293
-
294
- Store all decisions in state:
295
-
296
- ```json
297
- {
298
- "phases": {
299
- "interview": {
300
- "status": "complete",
301
- "decisions": {
302
- "data_fetching": "server",
303
- "layout": "sidebar",
304
- "auth": "protected",
305
- "seo": "basic"
306
- }
307
- }
308
- }
309
- }
310
- ```
311
-
312
- ---
313
-
314
- # Phase 5: PAGE ANALYSIS
315
-
316
- **Goal:** Check registry for reusable components
317
-
318
- Check existing components in registry:
319
-
320
- ```bash
321
- cat .claude/registry.json | jq '.components'
322
- ```
323
-
324
- Also check for existing pages with similar patterns:
325
-
326
- ```bash
327
- cat .claude/registry.json | jq '.pages'
328
- ```
329
-
330
- Present findings:
331
-
332
- ```
333
- Phase 5: PAGE ANALYSIS
334
-
335
- Existing Components Available:
336
-
337
- From Registry:
338
- - Button (primary, secondary, destructive)
339
- - Card (header, content, footer)
340
- - DataTable (sorting, filtering, pagination)
341
- - Modal (confirm, form, custom)
342
-
343
- Your [Page] could use:
344
- - [Component 1] - for [purpose]
345
- - [Component 2] - for [purpose]
346
- - [Component 3] - for [purpose]
347
-
348
- Would you like to use these existing components?
349
- A) Yes, use all recommended
350
- B) Some - let me specify which
351
- C) None - create new components
352
-
353
- Please select:
354
- ```
355
-
356
- **Wait for user response.**
357
-
358
- Update state with selected components list.
359
-
360
- ---
361
-
362
- # Phase 6: DATA SCHEMA
363
-
364
- **Goal:** Define TypeScript interfaces for page data
365
-
366
- Based on interview decisions, create data schemas:
367
-
368
- ```typescript
369
- // src/app/[name]/_types/index.ts
370
-
371
- // API Response Types
372
- export interface [Name]PageData {
373
- /** Page title */
374
- title: string;
375
-
376
- /** Main content items */
377
- items: [Name]Item[];
378
-
379
- /** Pagination info */
380
- pagination: {
381
- page: number;
382
- totalPages: number;
383
- totalItems: number;
384
- };
385
- }
386
-
387
- export interface [Name]Item {
388
- id: string;
389
- // ... other fields based on interview
390
- }
391
-
392
- // Form Data Types (if applicable)
393
- export interface [Name]FormData {
394
- // ... form fields based on interview
395
- }
396
-
397
- // Search/Filter Types (if applicable)
398
- export interface [Name]Filters {
399
- search?: string;
400
- sortBy?: string;
401
- sortOrder?: 'asc' | 'desc';
402
- // ... other filters
403
- }
404
- ```
405
-
406
- Present to user:
407
-
408
- ```
409
- Phase 6: DATA SCHEMA
410
-
411
- Here are the TypeScript interfaces I've created:
412
-
413
- [Show interfaces]
414
-
415
- Do these schemas look correct?
416
- A) Yes, proceed
417
- B) No, needs changes [specify]
418
-
419
- Please select:
420
- ```
421
-
422
- **Wait for approval before proceeding.**
423
-
424
- ---
425
-
426
- # Phase 7: ENVIRONMENT
427
-
428
- **Goal:** Verify API routes and required packages
429
-
430
- ### Check API Routes
431
-
432
- ```bash
433
- ls -la src/app/api/v2/ 2>/dev/null | head -20
434
- ```
435
-
436
- If page requires API routes that don't exist:
437
-
438
- ```
439
- Phase 7: ENVIRONMENT CHECK
440
-
441
- API Routes Required:
442
- GET /api/v2/[name] - [Exists/Missing]
443
- POST /api/v2/[name] - [Exists/Missing]
444
- PUT /api/v2/[name]/:id - [Exists/Missing]
445
-
446
- Missing routes found! Options:
447
- A) Create them now using /api-create
448
- B) Skip - I'll create them later
449
- C) Use different API - [specify]
450
-
451
- Please select:
452
- ```
453
-
454
- ### Check Auth Configuration
455
-
456
- ```bash
457
- grep -r "middleware" src/ 2>/dev/null | head -5
458
- cat middleware.ts 2>/dev/null | head -20
459
- ```
460
-
461
- ### Check Required Packages
462
-
463
- ```bash
464
- cat package.json | jq '.dependencies, .devDependencies' | grep -E "next-auth|@tanstack|swr|recharts|@playwright"
465
- ```
466
-
467
- Report status:
468
-
469
- ```
470
- Environment Check:
471
- API Routes: [X/Y available]
472
- Auth Config: [Configured/Not configured]
473
- Playwright: [Installed/Not installed]
474
-
475
- Ready to proceed with TDD?
476
- ```
477
-
478
- ---
479
-
480
- # Phase 8: TDD RED
481
-
482
- **Goal:** Write failing Playwright E2E tests
483
-
484
- ### Create Test File
485
-
486
- ```typescript
487
- // src/app/[name]/__tests__/[name].e2e.test.ts
488
-
489
- import { test, expect } from "@playwright/test";
490
-
491
- test.describe("[Name] Page", () => {
492
- test.beforeEach(async ({ page }) => {
493
- await page.goto("/[name]");
494
- });
495
-
496
- // Basic Rendering Tests
497
- test("page loads successfully", async ({ page }) => {
498
- await expect(page).toHaveTitle(/[Name]/);
499
- await expect(page.locator("h1")).toContainText("[Expected Title]");
500
- });
501
-
502
- test("displays main content section", async ({ page }) => {
503
- await expect(page.getByRole("main")).toBeVisible();
504
- });
505
-
506
- // Data Display Tests (for List/Dashboard)
507
- test("displays data items", async ({ page }) => {
508
- await expect(
509
- page.locator('[data-testid="item-card"]'),
510
- ).toHaveCount.greaterThan(0);
511
- });
512
-
513
- // Form Tests (for Form pages)
514
- test("form validation works", async ({ page }) => {
515
- await page.click('button[type="submit"]');
516
- await expect(page.getByText("Required field")).toBeVisible();
517
- });
518
-
519
- test("form submission works", async ({ page }) => {
520
- await page.fill('input[name="email"]', "test@example.com");
521
- await page.click('button[type="submit"]');
522
- await expect(page.getByText("Success")).toBeVisible();
523
- });
524
-
525
- // Navigation Tests
526
- test("navigation works correctly", async ({ page }) => {
527
- await page.click('a[href="/[name]/details"]');
528
- await expect(page).toHaveURL(/\/[name]\/details/);
529
- });
530
-
531
- // Responsive Tests
532
- test("mobile layout works", async ({ page }) => {
533
- await page.setViewportSize({ width: 375, height: 667 });
534
- await expect(page.getByRole("navigation")).toBeVisible();
535
- });
536
-
537
- // Auth Tests (if protected)
538
- test("redirects to login when unauthenticated", async ({ page }) => {
539
- // Clear auth state
540
- await page.context().clearCookies();
541
- await page.goto("/[name]");
542
- await expect(page).toHaveURL(/\/login/);
543
- });
544
-
545
- // Performance Tests
546
- test("page loads within performance budget", async ({ page }) => {
547
- const startTime = Date.now();
548
- await page.goto("/[name]");
549
- await page.waitForLoadState("networkidle");
550
- const loadTime = Date.now() - startTime;
551
- expect(loadTime).toBeLessThan(3000); // 3 second budget
552
- });
553
- });
554
- ```
555
-
556
- ### Run Tests (Expect Failure)
557
-
558
- ```bash
559
- pnpm playwright test src/app/[name]
560
- ```
561
-
562
- **Tests MUST fail at this point (page doesn't exist yet).**
563
-
564
- Update state: `phases.tdd_red.status = "complete"`
565
-
566
- ---
567
-
568
- # Phase 9: TDD GREEN
569
-
570
- **Goal:** Implement page to pass tests
571
-
572
- ### Create Page Structure
573
-
574
- ```
575
- src/app/[name]/
576
- ├── page.tsx # Main page component
577
- ├── layout.tsx # Optional layout
578
- ├── loading.tsx # Loading state
579
- ├── error.tsx # Error boundary
580
- ├── _components/ # Page-specific components
581
- │ ├── [Name]Header.tsx
582
- │ ├── [Name]Content.tsx
583
- │ └── [Name]Sidebar.tsx
584
- ├── _types/
585
- │ └── index.ts # TypeScript interfaces
586
- ├── _lib/
587
- │ └── actions.ts # Server actions (if needed)
588
- └── __tests__/
589
- └── [name].e2e.test.ts
590
- ```
591
-
592
- ### Create Main Page
593
-
594
- ```typescript
595
- // src/app/[name]/page.tsx
596
-
597
- import { Metadata } from 'next';
598
- import { [Name]Header } from './_components/[Name]Header';
599
- import { [Name]Content } from './_components/[Name]Content';
600
-
601
- export const metadata: Metadata = {
602
- title: '[Name] | Your App',
603
- description: '[Page description from interview]',
604
- };
605
-
606
- // Server Component - data fetching
607
- async function get[Name]Data() {
608
- const res = await fetch(`${process.env.API_URL}/api/v2/[name]`, {
609
- cache: 'no-store', // or 'force-cache' based on interview
610
- });
611
- return res.json();
612
- }
613
-
614
- export default async function [Name]Page() {
615
- const data = await get[Name]Data();
616
-
617
- return (
618
- <main className="container mx-auto py-8">
619
- <[Name]Header />
620
- <[Name]Content data={data} />
621
- </main>
622
- );
623
- }
624
- ```
625
-
626
- ### Create Loading State
627
-
628
- ```typescript
629
- // src/app/[name]/loading.tsx
630
-
631
- import { Skeleton } from '@/components/ui/skeleton';
632
-
633
- export default function [Name]Loading() {
634
- return (
635
- <main className="container mx-auto py-8">
636
- <Skeleton className="h-12 w-64 mb-8" />
637
- <div className="grid gap-4">
638
- <Skeleton className="h-32 w-full" />
639
- <Skeleton className="h-32 w-full" />
640
- <Skeleton className="h-32 w-full" />
641
- </div>
642
- </main>
643
- );
644
- }
645
- ```
646
-
647
- ### Create Error Boundary
648
-
649
- ```typescript
650
- // src/app/[name]/error.tsx
651
-
652
- 'use client';
653
-
654
- import { useEffect } from 'react';
655
- import { Button } from '@/components/ui/button';
656
-
657
- export default function [Name]Error({
658
- error,
659
- reset,
660
- }: {
661
- error: Error & { digest?: string };
662
- reset: () => void;
663
- }) {
664
- useEffect(() => {
665
- console.error(error);
666
- }, [error]);
667
-
668
- return (
669
- <main className="container mx-auto py-8 text-center">
670
- <h2 className="text-2xl font-bold mb-4">Something went wrong!</h2>
671
- <p className="text-muted-foreground mb-4">{error.message}</p>
672
- <Button onClick={() => reset()}>Try again</Button>
673
- </main>
674
- );
675
- }
676
- ```
677
-
678
- ### Run Tests (Expect Pass)
679
-
680
- ```bash
681
- pnpm playwright test src/app/[name]
682
- ```
683
-
684
- **All tests MUST pass before proceeding.**
685
-
686
- Update state: `phases.tdd_green.status = "complete"`
687
-
688
- ---
689
-
690
- # Phase 10: VERIFY (4-STEP MANDATORY)
691
-
692
- **Goal:** Comprehensive verification across 4 dimensions
693
-
694
- ### Step 1: Responsive Check
695
-
696
- Run Playwright at different viewports:
697
-
698
- ```bash
699
- pnpm playwright test src/app/[name] --project=mobile --project=tablet --project=desktop
700
- ```
701
-
702
- ```
703
- Step 1: Responsive Check
704
-
705
- Desktop (1920px): [Checking...]
706
- Tablet (768px): [Checking...]
707
- Mobile (375px): [Checking...]
708
- ```
709
-
710
- ### Step 2: Data Flow Check
711
-
712
- Verify data flows correctly from API to UI:
713
-
714
- ```
715
- Step 2: Data Flow Check
716
-
717
- API Response: [Valid JSON]
718
- Server Component: [Data received]
719
- Client Render: [Data displayed]
720
- Error Handling: [Error boundary works]
721
- Loading State: [Skeleton shows]
722
- ```
723
-
724
- ### Step 3: All Tests Passed
725
-
726
- ```
727
- Step 3: Test Results
728
-
729
- E2E tests: [X/X passed]
730
- Navigation tests: [X/X passed]
731
- Form tests: [X/X passed] (if applicable)
732
- Auth tests: [X/X passed] (if applicable)
733
- ```
734
-
735
- ### Step 4: Performance Metrics
736
-
737
- Check page performance:
738
-
739
- ```bash
740
- pnpm lighthouse http://localhost:3000/[name] --output json
741
- ```
742
-
743
- ```
744
- Step 4: Performance Metrics
745
-
746
- First Contentful Paint: [< 1.8s]
747
- Largest Contentful Paint: [< 2.5s]
748
- Time to Interactive: [< 3.8s]
749
- Total Blocking Time: [< 200ms]
750
- Cumulative Layout Shift: [< 0.1]
751
- ```
752
-
753
- **Present 4-step results:**
754
-
755
- ```
756
- Phase 10: VERIFICATION (4-Step)
757
-
758
- Step 1: Responsive Check
759
- Desktop (1920px) - Renders correctly
760
- Tablet (768px) - Renders correctly
761
- Mobile (375px) - Renders correctly
762
-
763
- Step 2: Data Flow Check
764
- API → Server → Client flow verified
765
- Error boundary tested
766
- Loading state works
767
-
768
- Step 3: All Tests Passed
769
- E2E tests: 15/15 passed
770
- Coverage: Core user flows covered
771
-
772
- Step 4: Performance Metrics
773
- LCP: 1.2s (Good)
774
- FCP: 0.8s (Good)
775
- CLS: 0.02 (Good)
776
-
777
- All 4 checks passed!
778
-
779
- Any issues to fix?
780
- A) No, all good - proceed
781
- B) Yes, need to fix [specify]
782
- ```
783
-
784
- **Wait for user response. Loop back if issues found.**
785
-
786
- ---
787
-
788
- # Phase 11: CODE REVIEW (Greptile)
789
-
790
- **Goal:** AI-powered code review before refactoring
791
-
792
- Run Greptile code review to catch issues early:
793
-
794
- - Bug detection with full codebase context
795
- - Security vulnerability scanning (OWASP top 10)
796
- - Performance issue identification
797
- - Accessibility concerns
798
-
799
- **Requires:** GREPTILE_API_KEY + GITHUB_TOKEN
800
-
801
- Present results:
802
-
803
- ```
804
- Phase 11: CODE REVIEW
805
-
806
- Greptile found [N] issue(s):
807
-
808
- 1. [file:line] - [severity] [issue description]
809
- 2. [file:line] - [severity] [issue description]
810
-
811
- How should I proceed?
812
- A) Fix all issues in refactor phase
813
- B) Fix critical only, defer others
814
- C) Skip - no issues to fix
815
- ```
816
-
817
- **Wait for user response.**
818
-
819
- ---
820
-
821
- # Phase 12: TDD REFACTOR
822
-
823
- **Goal:** Fix code review issues + clean up code while tests pass
824
-
825
- Refactoring checklist:
826
-
827
- - [ ] Address Greptile issues (bugs, security, performance)
828
- - [ ] Extract repeated components to `_components/`
829
- - [ ] Move data fetching to dedicated functions
830
- - [ ] Extract server actions to `_lib/actions.ts`
831
- - [ ] Optimize images with next/image
832
- - [ ] Add proper error boundaries
833
- - [ ] Implement proper loading states
834
- - [ ] Extract types to `_types/`
835
-
836
- Run tests after each refactor:
837
-
838
- ```bash
839
- pnpm playwright test src/app/[name]
840
- ```
841
-
842
- ---
843
-
844
- # Phase 13: DOCUMENTATION
845
-
846
- **Goal:** Complete all documentation
847
-
848
- ### Page Documentation
849
-
850
- Create or update:
851
-
852
- ````typescript
853
- // src/app/[name]/README.md (optional)
854
-
855
- # [Name] Page
856
-
857
- ## Route
858
- `/[name]`
859
-
860
- ## Purpose
861
- [From interview]
862
-
863
- ## Data Requirements
864
- - API: `/api/v2/[name]`
865
- - Auth: [Protected/Public]
866
-
867
- ## Components Used
868
- - [Component 1]
869
- - [Component 2]
870
-
871
- ## Testing
872
- ```bash
873
- pnpm playwright test src/app/[name]
874
- ````
875
-
876
- ````
877
-
878
- ### Registry Entry
879
-
880
- Update `.claude/registry.json`:
881
- ```json
882
- {
883
- "pages": {
884
- "[name]": {
885
- "name": "[Name]",
886
- "description": "[From interview]",
887
- "route": "/[name]",
888
- "file": "src/app/[name]/page.tsx",
889
- "type": "[landing|dashboard|form|list|detail|auth]",
890
- "tests": "src/app/[name]/__tests__/",
891
- "components_used": ["Button", "Card", "DataTable"],
892
- "data_sources": ["/api/v2/[name]"],
893
- "auth_required": true,
894
- "seo": {
895
- "title": "[Name] | App",
896
- "description": "[Description]"
897
- },
898
- "status": "complete",
899
- "created_at": "[date]"
900
- }
901
- }
902
- }
903
- ````
904
-
905
- Present checklist:
906
-
907
- ```
908
- Phase 12: DOCUMENTATION
909
-
910
- Page README: [Complete]
911
- Route documented: [Complete]
912
- Registry updated: [Complete]
913
- SEO metadata: [Complete]
914
-
915
- Documentation complete?
916
- A) Yes, proceed to completion
917
- B) No, need changes
918
- ```
919
-
920
- ---
921
-
922
- # Phase 14: COMPLETION
923
-
924
- **Goal:** Final output and showcase integration
925
-
926
- ### Update UI Showcase
927
-
928
- Page is auto-added to UI Showcase via registry update hook.
929
-
930
- ### Final Output
931
-
932
- ```
933
- [Name] page complete!
934
-
935
- Created Files:
936
- - src/app/[name]/page.tsx
937
- - src/app/[name]/layout.tsx (if needed)
938
- - src/app/[name]/loading.tsx
939
- - src/app/[name]/error.tsx
940
- - src/app/[name]/_components/[Name]Header.tsx
941
- - src/app/[name]/_components/[Name]Content.tsx
942
- - src/app/[name]/_types/index.ts
943
- - src/app/[name]/__tests__/[name].e2e.test.ts
944
-
945
- Route: /[name]
946
- Auth: [Protected/Public]
947
-
948
- Tests: All 15 E2E tests passed
949
- Performance: LCP 1.2s, FCP 0.8s (within budget)
950
-
951
- Registry: Added to .claude/registry.json
952
-
953
- Would you like to create another page or component?
954
- ```
955
-
956
- ### Showcase Redirect
957
-
958
- ```
959
- Your page has been added to the showcase!
960
-
961
- View it at: http://localhost:3000/ui-showcase
962
-
963
- The page preview card shows:
964
- - Screenshot
965
- - Route link
966
- - Data sources
967
- - Components used
968
-
969
- Run `pnpm dev` and navigate to /ui-showcase to see it.
970
- ```
971
-
972
- Update state: `phases.completion.status = "complete"`
973
-
974
- ### End-of-Workflow Summary
975
-
976
- After successful page creation, display:
977
-
978
- ```
979
- ═══════════════════════════════════════════════════════════════
980
- ✅ PAGE CREATED: [PageName]
981
-
982
- 📍 Quick Links:
983
- • View page: /[page-name]
984
- • UI Showcase: /ui-showcase
985
- • Run E2E: pnpm playwright test src/app/[page-name]
986
-
987
- 📊 Dashboard: /hustle-dev-dashboard
988
-
989
- Next Steps:
990
- • /hustle-ui-create - Create components for this page
991
- • /hustle-api-create - Create APIs this page needs
992
- • /commit - Commit your changes
993
- ═══════════════════════════════════════════════════════════════
994
- ```
995
-
996
- ---
997
-
998
- # State File Structure
999
-
1000
- ```json
1001
- {
1002
- "version": "3.10.0",
1003
- "workflow": "ui-create-page",
1004
- "active_element": "[name]",
1005
- "elements": {
1006
- "[name]": {
1007
- "type": "page",
1008
- "status": "in_progress",
1009
- "started_at": "2025-12-12T15:30:00Z",
1010
- "ui_config": {
1011
- "mode": "page",
1012
- "page_type": "dashboard",
1013
- "route": "/[name]",
1014
- "auth_required": true,
1015
- "data_fetching": "server",
1016
- "layout": "sidebar",
1017
- "seo_level": "full"
1018
- },
1019
- "phases": {
1020
- "disambiguation": { "status": "complete", "page_type": "dashboard" },
1021
- "scope": { "status": "complete" },
1022
- "design_research": {
1023
- "status": "complete",
1024
- "brand_guide_applied": true
1025
- },
1026
- "interview": { "status": "complete", "decisions": {} },
1027
- "page_analysis": { "status": "complete", "components_selected": [] },
1028
- "data_schema": { "status": "complete", "schema_file": "..." },
1029
- "environment_check": {
1030
- "status": "complete",
1031
- "api_routes_verified": true
1032
- },
1033
- "tdd_red": { "status": "complete", "tests_written": 15 },
1034
- "tdd_green": { "status": "complete", "tests_passed": 15 },
1035
- "verify": { "status": "complete", "four_step_passed": true },
1036
- "tdd_refactor": { "status": "complete" },
1037
- "documentation": { "status": "complete" },
1038
- "completion": { "status": "complete" }
1039
- }
1040
- }
1041
- }
1042
- }
1043
- ```
1044
-
1045
- ---
1046
-
1047
- # Hooks That Enforce This Workflow
1048
-
1049
- | Phase | Hook | Purpose |
1050
- | ----- | ------------------------------ | -------------------------------- |
1051
- | 1 | `enforce-ui-disambiguation.py` | Validates page type selection |
1052
- | 3 | `enforce-brand-guide.py` | Ensures brand guide is checked |
1053
- | 4 | `enforce-ui-interview.py` | Injects interview decisions |
1054
- | 5 | `enforce-page-components.py` | Checks registry for components |
1055
- | 6 | `enforce-page-data-schema.py` | Validates data types defined |
1056
- | 7 | `check-api-routes.py` | Verifies required API routes |
1057
- | 8 | `check-playwright-setup.py` | Ensures Playwright is configured |
1058
- | 10 | `verify-after-green.py` | Triggers 4-step verification |
1059
- | 12 | `update-registry.py` | Adds page to registry |
1060
- | 12 | `update-ui-showcase.py` | Updates showcase |
1061
- | 13 | `api-workflow-check.py` | Blocks if incomplete |
1062
-
1063
- ---
1064
-
1065
- # Key Principles
1066
-
1067
- 1. **ALWAYS ask user** - Never proceed without explicit response
1068
- 2. **Brand guide first** - Check and apply before implementation
1069
- 3. **Component reuse** - Check registry before creating new components
1070
- 4. **4-Step verification** - All 4 checks MUST pass
1071
- 5. **Playwright E2E** - Full page tests, not unit tests
1072
- 6. **Performance budget** - LCP < 2.5s, FCP < 1.8s
1073
- 7. **Showcase link guaranteed** - Always output at completion
1074
-
1075
- ---
1076
-
1077
- **Version:** 4.0.0
1078
- **Last Updated:** 2025-12-28