@torka/claude-workflows 0.10.0 → 0.12.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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- Convert SuperDesign HTML/CSS output to React components. Used when `design.tool_used` = `superdesign`.
5
+ Convert HTML/CSS output to React components. Used when `design.tool_used` = `superdesign`, `stitch`, or `wireframe`.
6
6
 
7
7
  ---
8
8
 
@@ -26,6 +26,21 @@ Map standard elements to shadcn, use MagicPatterns for custom components.
26
26
 
27
27
  **Best for:** Mix of standard and custom elements
28
28
 
29
+ ### Strategy G: Google's react-components (Stitch only)
30
+
31
+ Use Google's react-components skill for full modular React architecture.
32
+
33
+ **Best for:** Production-quality components, enforced architecture patterns
34
+ **Available:** Only when `design.tool_used` = `stitch`
35
+
36
+ Features:
37
+ - Modular file structure (Atomic/Composite patterns)
38
+ - Logic extraction to `src/hooks/`
39
+ - Data decoupling to `src/data/mockData.ts`
40
+ - TypeScript interfaces with `Readonly<T>`
41
+ - AST-based validation (no hardcoded hex values)
42
+ - Dark mode support validation
43
+
29
44
  ---
30
45
 
31
46
  ## Execution Flow
@@ -35,7 +50,7 @@ Map standard elements to shadcn, use MagicPatterns for custom components.
35
50
  ```
36
51
  CONVERSION STRATEGY
37
52
 
38
- Your SuperDesign prototype is HTML/CSS. Let's convert to React components.
53
+ Your {tool_name} prototype is HTML/CSS. Let's convert to React components.
39
54
 
40
55
  Prototype location: {design.output_location}
41
56
 
@@ -46,6 +61,13 @@ Choose your approach:
46
61
  → You install via CLI, minimal custom code
47
62
  → Best for: Standard UI patterns
48
63
 
64
+ {if design.tool_used = stitch}
65
+ [G] Google's react-components
66
+ → Full modular React architecture
67
+ → AST validation, data decoupling, hooks extraction
68
+ → Best for: Production-quality Stitch conversions
69
+ {/if}
70
+
49
71
  [M] MagicPatterns Conversion {if available, else "(not configured)"}
50
72
  → Generate React code from the design
51
73
  → Direct component code output
@@ -56,7 +78,7 @@ Choose your approach:
56
78
  → Use MagicPatterns for custom components
57
79
  → Best for: Mix of standard and custom
58
80
 
59
- Which approach? [C/M/H]
81
+ Which approach? [C/{if stitch}G/{/if}M/H]
60
82
  ```
61
83
 
62
84
  ---
@@ -212,6 +234,81 @@ Starting analysis...
212
234
 
213
235
  ---
214
236
 
237
+ ### 2G. Google react-components Execution (Stitch only)
238
+
239
+ **Prerequisites:** This strategy is only available when `design.tool_used` = `stitch`.
240
+
241
+ Check if react-components skill is installed. If not:
242
+
243
+ ```
244
+ REACT-COMPONENTS SKILL NOT FOUND
245
+
246
+ The react-components skill is required for this conversion strategy.
247
+
248
+ This should have been auto-installed. Install manually with:
249
+ npx skills add google-labs-code/stitch-skills --skill react-components -g -a claude-code -y
250
+
251
+ Then restart Claude Code and try again.
252
+
253
+ [B] Back to strategy selection
254
+ ```
255
+
256
+ If installed, invoke the skill:
257
+
258
+ ```
259
+ REACT-COMPONENTS CONVERSION
260
+
261
+ Invoking Google's react-components skill...
262
+
263
+ This will:
264
+ 1. Fetch HTML from Stitch design
265
+ 2. Create modular React components
266
+ 3. Extract logic to hooks
267
+ 4. Decouple data to mockData.ts
268
+ 5. Validate with AST parser
269
+ ```
270
+
271
+ The skill handles:
272
+ - Downloads HTML from Stitch using built-in scripts
273
+ - Creates components from template patterns
274
+ - Validates against architecture checklist
275
+ - Ensures no hardcoded hex values (uses CSS variables)
276
+ - Checks dark mode support
277
+
278
+ After completion:
279
+
280
+ ```
281
+ REACT COMPONENTS CREATED
282
+
283
+ Files generated:
284
+ - src/components/{ComponentName}.tsx
285
+ - src/hooks/use{ComponentName}.ts (if logic extracted)
286
+ - src/data/mockData.ts
287
+
288
+ Validation: {PASSED | FAILED}
289
+
290
+ shadcn components identified for installation:
291
+ {list from our component mapping}
292
+
293
+ [R] Review generated files
294
+ [V] Validate again
295
+ [C] Continue to artifacts
296
+ ```
297
+
298
+ **If validation fails:**
299
+ ```
300
+ VALIDATION ISSUES
301
+
302
+ {list of issues}
303
+
304
+ Options:
305
+ [F] Fix issues - Adjust generated code
306
+ [I] Ignore - Proceed with warnings
307
+ [B] Back - Choose different strategy
308
+ ```
309
+
310
+ ---
311
+
215
312
  ### 3. Generate Installation Command
216
313
 
217
314
  After any conversion strategy:
@@ -0,0 +1,347 @@
1
+ # Stitch Tool Execution
2
+
3
+ ## Overview
4
+
5
+ Stitch is Google's AI design tool that generates web UI screens from text prompts.
6
+ This tool requires both Stitch MCP and Google's stitch-skills to be installed.
7
+
8
+ **Output Location:** `.stitch/screens/`
9
+ **Output Format:** HTML + CSS files + screenshots
10
+ **MCP Tools Used:** `generate_screen_from_text`, `get_screen`, `list_projects`, `create_project`
11
+ **Dependencies:** Google's stitch-skills (design-md skill at minimum)
12
+
13
+ ---
14
+
15
+ ## Prerequisites
16
+
17
+ Check availability before proceeding:
18
+
19
+ ```
20
+ Stitch MCP: [check if mcp__stitch* or stitch* tools available]
21
+ Stitch Skills: [check if design-md skill installed]
22
+ ```
23
+
24
+ ### If Stitch MCP not available:
25
+
26
+ ```
27
+ STITCH MCP NOT CONFIGURED
28
+
29
+ Stitch MCP is required for this design tool.
30
+
31
+ To use Stitch:
32
+ 1. Configure Stitch MCP server (see stitch.withgoogle.com/docs/mcp/guide/)
33
+ 2. Restart Claude Code
34
+
35
+ Alternative options:
36
+ [S] SuperDesign - HTML/CSS prototype
37
+ [M] MagicPatterns - AI-generated React components
38
+ [B] Back to tool selection
39
+ ```
40
+
41
+ ### If Stitch Skills not installed:
42
+
43
+ ```
44
+ STITCH SKILLS REQUIRED
45
+
46
+ Google's stitch-skills are required for Stitch integration.
47
+
48
+ Install with:
49
+ npx skills add google-labs-code/stitch-skills --skill design-md -g -a claude-code -y
50
+ npx skills add google-labs-code/stitch-skills --skill react-components -g -a claude-code -y
51
+
52
+ Then restart Claude Code and try again.
53
+
54
+ [B] Back to tool selection
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Execution Flow
60
+
61
+ ### 1. Check for DESIGN.md
62
+
63
+ ```
64
+ STITCH PROJECT SETUP
65
+
66
+ Checking for design system documentation...
67
+ ```
68
+
69
+ **If DESIGN.md exists in project root:**
70
+
71
+ ```
72
+ Found: DESIGN.md
73
+ Design system will be used for prompt consistency.
74
+
75
+ [C] Continue with existing design system
76
+ [U] Update design system first (uses design-md skill)
77
+ ```
78
+
79
+ **If DESIGN.md doesn't exist:**
80
+
81
+ ```
82
+ No DESIGN.md found.
83
+
84
+ DESIGN.md helps Stitch generate consistent designs by documenting
85
+ your color palette, typography, and component styles.
86
+
87
+ Options:
88
+ [G] Generate DESIGN.md (Recommended)
89
+ → Uses design-md skill to create semantic design documentation
90
+ → Best for: New projects, establishing design consistency
91
+
92
+ [S] Skip - proceed without design system
93
+ → Stitch will use default styling
94
+ → Fine for: Quick prototypes, one-off designs
95
+ ```
96
+
97
+ **If G (Generate):**
98
+ - Invoke the design-md skill: `/design-md`
99
+ - Wait for user to complete the skill workflow
100
+ - Continue to design generation after DESIGN.md is created
101
+
102
+ ---
103
+
104
+ ### 2. Prepare Design Prompt
105
+
106
+ Frame the design request from context:
107
+
108
+ ```
109
+ DESIGN REQUEST FOR STITCH
110
+
111
+ Feature: {user_intent}
112
+
113
+ Context:
114
+ - {scope_summary}
115
+ - {inspiration_references}
116
+
117
+ Requirements:
118
+ - Responsive design (desktop-first)
119
+ - Tailwind CSS classes
120
+ - {additional_context_from_scope}
121
+
122
+ {if DESIGN.md exists}
123
+ DESIGN SYSTEM:
124
+ [Include relevant sections from DESIGN.md - colors, typography, component styles]
125
+ {/if}
126
+
127
+ Style Direction:
128
+ - {visual_direction_notes}
129
+ - {inspiration_sources}
130
+ ```
131
+
132
+ ---
133
+
134
+ ### 3. Create or Select Project
135
+
136
+ **If `stitch.json` exists in project root with projectId:**
137
+
138
+ ```
139
+ EXISTING STITCH PROJECT FOUND
140
+
141
+ Project: {project_title}
142
+ Project ID: {projectId}
143
+
144
+ [C] Continue with this project
145
+ [N] Create new project
146
+ ```
147
+
148
+ **If no existing project or user selects [N]:**
149
+
150
+ ```
151
+ Creating new Stitch project...
152
+ ```
153
+
154
+ ```
155
+ Tool: create_project
156
+ Parameters:
157
+ title: "{feature_name} Design"
158
+ description: "{user_intent summary}"
159
+ ```
160
+
161
+ Save projectId to `stitch.json` for future sessions:
162
+
163
+ ```json
164
+ {
165
+ "projectId": "{created_project_id}",
166
+ "projectTitle": "{project_title}",
167
+ "createdAt": "{timestamp}"
168
+ }
169
+ ```
170
+
171
+ ---
172
+
173
+ ### 4. Generate Screen
174
+
175
+ ```
176
+ GENERATING DESIGN
177
+
178
+ Feature: {user_intent}
179
+ Project: {project_name}
180
+
181
+ Please wait while Stitch generates your design...
182
+ ```
183
+
184
+ ```
185
+ Tool: generate_screen_from_text
186
+ Parameters:
187
+ projectId: "{projectId}"
188
+ prompt: "{constructed_prompt}"
189
+ deviceType: "DESKTOP"
190
+ ```
191
+
192
+ ---
193
+
194
+ ### 5. Retrieve and Save Assets
195
+
196
+ After generation completes:
197
+
198
+ ```
199
+ Tool: get_screen
200
+ Parameters:
201
+ projectId: "{projectId}"
202
+ screenId: "{screenId}"
203
+ ```
204
+
205
+ Create output directory if needed:
206
+ ```
207
+ mkdir -p .stitch/screens/
208
+ ```
209
+
210
+ Download and save assets:
211
+ - **HTML:** `htmlCode.downloadUrl` → save to `.stitch/screens/{page}.html`
212
+ - **Screenshot:** `screenshot.downloadUrl` → save to `.stitch/screens/{page}.png`
213
+
214
+ ---
215
+
216
+ ### 6. Present Result
217
+
218
+ ```
219
+ DESIGN CREATED
220
+
221
+ Project: {project_name}
222
+ Screen: {screen_title}
223
+
224
+ Files saved:
225
+ - HTML: .stitch/screens/{page}.html
226
+ - Preview: .stitch/screens/{page}.png
227
+
228
+ Options:
229
+ [V] View - Display screenshot
230
+ [P] Playwright - Capture live rendering (desktop + mobile)
231
+ [U] Update - Request changes via Stitch
232
+ [C] Continue - Design approved, proceed to next step
233
+ ```
234
+
235
+ ### Handle User Selection
236
+
237
+ **If V (View):**
238
+ - Display the screenshot image from `.stitch/screens/{page}.png`
239
+ - Return to options
240
+
241
+ **If P (Playwright) and Playwright available:**
242
+ - Navigate to `file://{absolute_path}/.stitch/screens/{page}.html`
243
+ - Capture desktop screenshot (1280px width)
244
+ - Resize viewport (375px width) and capture mobile screenshot
245
+ - Present both screenshots for comparison
246
+ - Return to options
247
+
248
+ **If U (Update):**
249
+ ```
250
+ What changes would you like to make?
251
+
252
+ Describe the changes and I'll generate an updated design.
253
+ ```
254
+ - Append change request to prompt
255
+ - Generate new screen with updated prompt
256
+ - Return to step 5
257
+
258
+ **If C (Continue):**
259
+ - Store design state
260
+ - Return control to parent step (step-03-design.md)
261
+
262
+ ---
263
+
264
+ ## Output State
265
+
266
+ After completion, set:
267
+
268
+ ```yaml
269
+ design:
270
+ tool_used: stitch
271
+ output_location: ".stitch/screens/{page}.html"
272
+ output_format: html
273
+ needs_conversion: true # HTML needs React conversion in Step 4
274
+ screenshot: ".stitch/screens/{page}.png"
275
+ stitch_project_id: "{projectId}"
276
+ stitch_screen_id: "{screenId}"
277
+ design_md_used: true/false
278
+ ```
279
+
280
+ ---
281
+
282
+ ## Design Registry Pattern
283
+
284
+ When creating multiple screens (scope has multiple items), track progress:
285
+
286
+ ```yaml
287
+ designs:
288
+ - name: "{scope_item_name}"
289
+ screen_id: "{id_or_pending}"
290
+ status: [pending | created | approved]
291
+ html_path: ".stitch/screens/{name}.html"
292
+ screenshot_path: ".stitch/screens/{name}.png"
293
+ ```
294
+
295
+ ### Batch Generation Flow
296
+
297
+ If scope has multiple items:
298
+
299
+ ```
300
+ SCOPE ITEMS TO DESIGN
301
+
302
+ You have {count} items to design:
303
+ {foreach scope_item}
304
+ [ ] {item_name}
305
+ {/foreach}
306
+
307
+ Options:
308
+ [A] All at once - Generate all designs in sequence
309
+ [O] One by one - Generate and approve each individually
310
+
311
+ Which approach? [A/O]
312
+ ```
313
+
314
+ **If A (All at once):**
315
+ - Generate each design in sequence
316
+ - Track status in design registry
317
+ - Present all for review at end
318
+
319
+ **If O (One by one):**
320
+ - Generate first design
321
+ - Present for approval
322
+ - On approval, move to next
323
+ - Repeat until all complete
324
+
325
+ ---
326
+
327
+ ## Conversion Notes
328
+
329
+ Stitch outputs HTML/CSS with Tailwind classes. The conversion step (Step 4) offers two paths:
330
+
331
+ 1. **Quick shadcn mapping** - Our standard `conversion.md` flow
332
+ 2. **Google's react-components** - Full modular React architecture with AST validation
333
+
334
+ Both are presented in Step 4 when `design.tool_used` = `stitch`.
335
+
336
+ ---
337
+
338
+ ## Reference: Stitch MCP Tools
339
+
340
+ | Tool | Purpose |
341
+ |------|---------|
342
+ | `list_projects` | Get all Stitch projects |
343
+ | `get_project` | Get project details |
344
+ | `create_project` | Create new project |
345
+ | `list_screens` | Get all screens in project |
346
+ | `get_screen` | Get screen details + download URLs |
347
+ | `generate_screen_from_text` | Generate new screen from prompt |