stitch-kit 1.5.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 (98) hide show
  1. package/AGENTS.md +139 -0
  2. package/CHANGELOG.md +86 -0
  3. package/README.md +167 -0
  4. package/agents/stitch-kit.md +93 -0
  5. package/bin/stitch-kit.mjs +430 -0
  6. package/docs/architecture.md +118 -0
  7. package/docs/color-prompt-guide.md +119 -0
  8. package/docs/mcp-naming-convention.md +64 -0
  9. package/docs/mcp-schemas/README.md +130 -0
  10. package/docs/mcp-schemas/apply_design_system.json +36 -0
  11. package/docs/mcp-schemas/create_design_system.json +78 -0
  12. package/docs/mcp-schemas/create_project.json +290 -0
  13. package/docs/mcp-schemas/delete_project.json +20 -0
  14. package/docs/mcp-schemas/edit_screens.json +46 -0
  15. package/docs/mcp-schemas/generate_screen_from_text.json +242 -0
  16. package/docs/mcp-schemas/generate_variants.json +77 -0
  17. package/docs/mcp-schemas/get_project.json +137 -0
  18. package/docs/mcp-schemas/get_screen.json +92 -0
  19. package/docs/mcp-schemas/list_design_systems.json +32 -0
  20. package/docs/mcp-schemas/list_projects.json +136 -0
  21. package/docs/mcp-schemas/list_screens.json +56 -0
  22. package/docs/mcp-schemas/update_design_system.json +32 -0
  23. package/docs/mcp-schemas/upload_screens_from_images.json +52 -0
  24. package/docs/prd-to-stitch-workflow.md +137 -0
  25. package/docs/skills-index.md +108 -0
  26. package/docs/tailwind-reference.md +207 -0
  27. package/package.json +41 -0
  28. package/skills/stitch-a11y/SKILL.md +428 -0
  29. package/skills/stitch-a11y/resources/audit-checklist.md +102 -0
  30. package/skills/stitch-animate/SKILL.md +371 -0
  31. package/skills/stitch-animate/resources/animation-patterns.md +248 -0
  32. package/skills/stitch-design-md/SKILL.md +215 -0
  33. package/skills/stitch-design-md/examples/DESIGN.md +54 -0
  34. package/skills/stitch-design-md/examples/usage.md +67 -0
  35. package/skills/stitch-design-md/scripts/fetch-stitch.sh +35 -0
  36. package/skills/stitch-design-system/SKILL.md +314 -0
  37. package/skills/stitch-design-system/resources/tokens-template.css +237 -0
  38. package/skills/stitch-html-components/SKILL.md +344 -0
  39. package/skills/stitch-html-components/resources/architecture-checklist.md +74 -0
  40. package/skills/stitch-html-components/scripts/fetch-stitch.sh +45 -0
  41. package/skills/stitch-loop/SKILL.md +183 -0
  42. package/skills/stitch-loop/examples/SITE.md +39 -0
  43. package/skills/stitch-loop/examples/next-prompt.md +24 -0
  44. package/skills/stitch-loop/examples/usage.md +77 -0
  45. package/skills/stitch-mcp-apply-design-system/SKILL.md +82 -0
  46. package/skills/stitch-mcp-create-design-system/SKILL.md +117 -0
  47. package/skills/stitch-mcp-create-project/SKILL.md +77 -0
  48. package/skills/stitch-mcp-delete-project/SKILL.md +62 -0
  49. package/skills/stitch-mcp-edit-screens/SKILL.md +121 -0
  50. package/skills/stitch-mcp-generate-screen-from-text/SKILL.md +102 -0
  51. package/skills/stitch-mcp-generate-screen-from-text/examples/desktop.md +53 -0
  52. package/skills/stitch-mcp-generate-screen-from-text/examples/mobile.md +71 -0
  53. package/skills/stitch-mcp-generate-variants/SKILL.md +124 -0
  54. package/skills/stitch-mcp-get-project/SKILL.md +67 -0
  55. package/skills/stitch-mcp-get-screen/SKILL.md +117 -0
  56. package/skills/stitch-mcp-get-screen/scripts/fetch-stitch.sh +35 -0
  57. package/skills/stitch-mcp-list-design-systems/SKILL.md +84 -0
  58. package/skills/stitch-mcp-list-projects/SKILL.md +77 -0
  59. package/skills/stitch-mcp-list-screens/SKILL.md +69 -0
  60. package/skills/stitch-mcp-update-design-system/SKILL.md +82 -0
  61. package/skills/stitch-mcp-upload-screens-from-images/SKILL.md +95 -0
  62. package/skills/stitch-mcp-upload-screens-from-images/scripts/encode-image.sh +43 -0
  63. package/skills/stitch-nextjs-components/SKILL.md +181 -0
  64. package/skills/stitch-nextjs-components/resources/architecture-checklist.md +65 -0
  65. package/skills/stitch-nextjs-components/resources/component-template.tsx +101 -0
  66. package/skills/stitch-nextjs-components/scripts/fetch-stitch.sh +45 -0
  67. package/skills/stitch-orchestrator/SKILL.md +337 -0
  68. package/skills/stitch-orchestrator/examples/workflow.md +173 -0
  69. package/skills/stitch-react-components/SKILL.md +236 -0
  70. package/skills/stitch-react-components/references/tailwind-to-react.md +117 -0
  71. package/skills/stitch-react-components/resources/architecture-checklist.md +34 -0
  72. package/skills/stitch-react-components/resources/component-template.tsx +35 -0
  73. package/skills/stitch-react-components/scripts/fetch-stitch.sh +35 -0
  74. package/skills/stitch-react-native-components/SKILL.md +333 -0
  75. package/skills/stitch-react-native-components/resources/architecture-checklist.md +74 -0
  76. package/skills/stitch-react-native-components/resources/component-template.tsx +104 -0
  77. package/skills/stitch-react-native-components/scripts/fetch-stitch.sh +45 -0
  78. package/skills/stitch-remotion/SKILL.md +280 -0
  79. package/skills/stitch-setup/SKILL.md +183 -0
  80. package/skills/stitch-shadcn-ui/SKILL.md +255 -0
  81. package/skills/stitch-skill-creator/SKILL.md +257 -0
  82. package/skills/stitch-skill-creator/references/output-patterns.md +71 -0
  83. package/skills/stitch-skill-creator/scripts/init_stitch_skill.py +229 -0
  84. package/skills/stitch-svelte-components/SKILL.md +282 -0
  85. package/skills/stitch-svelte-components/resources/architecture-checklist.md +62 -0
  86. package/skills/stitch-svelte-components/resources/component-template.svelte +193 -0
  87. package/skills/stitch-svelte-components/scripts/fetch-stitch.sh +36 -0
  88. package/skills/stitch-swiftui-components/SKILL.md +424 -0
  89. package/skills/stitch-swiftui-components/resources/architecture-checklist.md +83 -0
  90. package/skills/stitch-swiftui-components/resources/component-template.swift +131 -0
  91. package/skills/stitch-swiftui-components/resources/layout-mapping.md +155 -0
  92. package/skills/stitch-swiftui-components/scripts/fetch-stitch.sh +45 -0
  93. package/skills/stitch-ued-guide/SKILL.md +124 -0
  94. package/skills/stitch-ui-design-spec-generator/SKILL.md +115 -0
  95. package/skills/stitch-ui-design-spec-generator/examples/usage.md +79 -0
  96. package/skills/stitch-ui-design-variants/SKILL.md +127 -0
  97. package/skills/stitch-ui-prompt-architect/SKILL.md +196 -0
  98. package/skills/stitch-ui-prompt-architect/references/KEYWORDS.md +170 -0
@@ -0,0 +1,337 @@
1
+ ---
2
+ name: stitch-orchestrator
3
+ description: Master entry point for all Stitch design workflows. Routes from user request → design spec → prompt assembly → screen generation → iteration (edit, variants, design systems) → design system extraction → framework conversion (Next.js, Svelte, HTML, React Native, or SwiftUI) → optional quality pass.
4
+ allowed-tools:
5
+ - "stitch*:*"
6
+ - "Read"
7
+ - "Write"
8
+ - "Bash"
9
+ ---
10
+
11
+ # Stitch Orchestrator
12
+
13
+ You are an autonomous UI design orchestrator. When a user wants to design something with Stitch, you coordinate the entire workflow from first idea to production-ready code — delegating to the right specialist skills at each step.
14
+
15
+ ## Critical prerequisite
16
+
17
+ **Only activate when the user explicitly mentions "Stitch"** in their request. Do not trigger this workflow silently during regular conversation.
18
+
19
+ Trigger phrases:
20
+ - "Use Stitch to design..."
21
+ - "Design X using Stitch"
22
+ - "Create a Stitch project for..."
23
+ - "Generate a Stitch screen for..."
24
+ - "Edit my Stitch screen..."
25
+ - "Upload this screenshot to Stitch..."
26
+
27
+ ## Preflight — Step 0
28
+
29
+ Before doing anything else, check whether the Stitch MCP tools are available:
30
+
31
+ ```
32
+ Run: list_tools
33
+ ```
34
+
35
+ - **Tools found** (you see `create_project`, `generate_screen_from_text`, etc.): proceed with the **Full Execution Workflow**
36
+ - **Tools not found**: proceed with the **Prompt-Only Workflow**
37
+
38
+ Note the tool namespace prefix (e.g., `stitch:` or `mcp__stitch__`). Use this prefix for all subsequent tool calls.
39
+
40
+ ---
41
+
42
+ ## Full Execution Workflow
43
+
44
+ Execute all steps autonomously. **Do not ask for confirmation between steps.** Report progress as you go.
45
+
46
+ ### Step 1: Classify intent
47
+
48
+ Determine what the user wants:
49
+
50
+ | Intent | Approach |
51
+ |--------|---------|
52
+ | **New screen** — design from scratch | Full workflow: Steps 2 → 9 |
53
+ | **Edit existing** — iterate on a screen | Skip Steps 2–3. Call `stitch-mcp-edit-screens` with edit instruction. Then offer Step 5b menu. |
54
+ | **Upload screenshot** — import existing UI | Call `stitch-mcp-upload-screens-from-images`, then offer edit or convert (Step 5b). |
55
+ | **Refine existing** — iterate on a screen | Skip Step 2 (reuse project ID). Preserve layout structure in new prompt. |
56
+ | **Export existing** — just get the code | Skip Steps 2-5. Go to Step 6 (get screen) → Step 8 (convert). |
57
+ | **Variants** — explore design directions | Call `stitch-mcp-generate-variants` natively (1 API call). Present results, then Step 5b. |
58
+ | **Delete project** — clean up | Call `stitch-mcp-delete-project` with confirmation gate. Stop after deletion. |
59
+
60
+ ### Step 2: Generate Design Spec
61
+
62
+ Call `stitch-ui-design-spec-generator` internally to produce a structured JSON spec.
63
+
64
+ Input: the user's original request
65
+ Output: JSON with `theme`, `primaryColor`, `font`, `roundness`, `density`, `designMode`, `styleKeywords`, `deviceType`
66
+
67
+ ### Step 3: Assemble Stitch prompt
68
+
69
+ Call `stitch-ui-prompt-architect` in **Path B mode** (Design Spec + user request → structured prompt).
70
+
71
+ Input: Design Spec JSON from Step 2 + original user request
72
+ Output: Structured prompt with `[Context] [Layout] [Components]` format
73
+
74
+ Check: Does the project have a `DESIGN.md` file? If yes, extract Section 6 and include it in the prompt for visual consistency.
75
+
76
+ **Before proceeding to Step 4**, verify the prompt passes the **Prompt Quality Standard** checklist in `stitch-ui-prompt-architect`. Specifically confirm:
77
+ - Hex colors present (not just "blue" — needs `#3B82F6`)
78
+ - Font sizes specified in px with weight
79
+ - Component names are concrete (not "a form" — needs "email input with inline validation")
80
+ - Layout sections have specific dimensions where relevant
81
+
82
+ If any of these are missing — re-invoke the prompt architect. Don't send vague prompts to generation.
83
+
84
+ ### Step 4: Create or reuse project
85
+
86
+ 1. Call `stitch-mcp-list-projects` to check for existing projects
87
+ 2. **If no projects exist:** create one immediately via `stitch-mcp-create-project` — no need to ask
88
+ 3. **If projects exist:** show the user the list and ask: "Use an existing project or create new?"
89
+ 4. Only create a new project when the user explicitly confirms
90
+
91
+ If creating new: Call `stitch-mcp-create-project` → get `projectId` (both numeric and full-path forms)
92
+
93
+ #### Step 4b: Check for existing design systems
94
+
95
+ After selecting a project:
96
+
97
+ 1. Call `stitch-mcp-list-design-systems` with the projectId
98
+ 2. If design systems exist: "This project has design system: **[name]**. Apply to new screens?"
99
+ 3. If the user accepts: store the `assetId` for use in Step 5b
100
+ 4. Optionally offer cleanup: "Want to delete any old projects?" → `stitch-mcp-delete-project`
101
+
102
+ ### Step 5: Generate the screen
103
+
104
+ Call `stitch-mcp-generate-screen-from-text` with:
105
+ - `projectId`: numeric ID (no `projects/` prefix)
106
+ - `prompt`: assembled prompt from Step 3
107
+ - `deviceType`: from Design Spec
108
+ - `modelId`: `GEMINI_3_PRO` (default) or `GEMINI_3_FLASH` (if user wants fast iteration)
109
+
110
+ > ⏱ **Generation timing:** Stitch typically takes 60–180 seconds to generate a screen. This is normal — do NOT retry or assume failure during this window.
111
+ >
112
+ > If it fails after the timeout:
113
+ > 1. Check the error message
114
+ > 2. If rate-limited: wait 60 seconds, retry once
115
+ > 3. If prompt error: simplify the prompt and retry
116
+ > 4. If server error: inform the user and offer to retry later
117
+ >
118
+ > **Never** spam `generate_screen_from_text` with retries — each call creates a new generation.
119
+
120
+ #### Step 5b: Post-generation iteration loop
121
+
122
+ After generation completes, present the iteration menu:
123
+
124
+ > "Screen generated! Before converting to code:
125
+ > **A)** Edit this screen (change colors, layout, content) → text-based refinement
126
+ > **B)** Generate variants (explore alternatives) → see different takes
127
+ > **C)** Apply a design system → match an existing theme
128
+ > **D)** Proceed to code conversion → Step 6"
129
+
130
+ If the user stored an assetId from Step 4b, add:
131
+ > **C)** Apply design system **[name]** → already selected
132
+
133
+ Route based on selection:
134
+ - **A** → `stitch-mcp-edit-screens` → after edit, return to this menu
135
+ - **B** → `stitch-mcp-generate-variants` → after selecting winner, return to this menu
136
+ - **C** → `stitch-mcp-apply-design-system` with stored assetId → after applying, return to this menu
137
+ - **D** → proceed to Step 6
138
+
139
+ This loop allows multiple rounds. After A, B, or C completes, always return to this menu until the user chooses D.
140
+
141
+ ### Step 6: Retrieve the screen
142
+
143
+ 1. Call `stitch-mcp-list-screens` with `projects/[projectId]` → find the new screen
144
+ 2. Call `stitch-mcp-get-screen` with numeric projectId and screenId → get `htmlCode.downloadUrl` and `screenshot.downloadUrl`
145
+ 3. Download HTML: `bash scripts/fetch-stitch.sh "[htmlCode.downloadUrl]" "temp/source.html"`
146
+
147
+ Show the user the screenshot URL.
148
+
149
+ Check the `deviceType` from the screen response, then ask the relevant question:
150
+
151
+ **If `deviceType: DESKTOP` or `AGNOSTIC`:**
152
+ > "Screen generated! Would you like me to:
153
+ > A) Convert to Next.js (App Router) — React web app
154
+ > B) Convert to Svelte 5 (SvelteKit) — lightweight web app
155
+ > C) Convert to HTML + CSS — platform-agnostic, works in WebViews
156
+ > D) Extract design tokens only
157
+ > E) Edit this screen (iterate with text prompts)
158
+ > F) Generate variants (explore alternatives)
159
+ > G) Create a Stitch Design System from this screen
160
+ > H) Just the Stitch design for now"
161
+
162
+ **If `deviceType: MOBILE`:**
163
+ > "Screen generated! Would you like me to:
164
+ > A) Convert to React Native / Expo — native iOS + Android
165
+ > B) Convert to SwiftUI — native iOS only
166
+ > C) Convert to HTML + CSS — mobile web, Capacitor, or Ionic
167
+ > D) Convert to Next.js (App Router) — mobile-first web app
168
+ > E) Extract design tokens only
169
+ > F) Edit this screen (iterate with text prompts)
170
+ > G) Generate variants (explore alternatives)
171
+ > H) Create a Stitch Design System from this screen
172
+ > I) Just the Stitch design for now"
173
+
174
+ Route edit/variant/design-system options back to the appropriate skills:
175
+ - Edit → `stitch-mcp-edit-screens` → re-retrieve → show this menu again
176
+ - Variants → `stitch-mcp-generate-variants` → pick winner → re-retrieve → show this menu again
177
+ - Design System → proceed to Step 7b
178
+
179
+ ### Step 7: Design system extraction (recommended before conversion)
180
+
181
+ If proceeding to code:
182
+
183
+ Call `stitch-design-system` → generates:
184
+ - `design-tokens.css` (CSS variables, light + dark mode)
185
+ - `tailwind-theme.css` (Tailwind v4 config)
186
+ - `DESIGN.md` (extended design document)
187
+
188
+ #### Step 7b: Stitch Design System bridge
189
+
190
+ After extracting CSS tokens, offer:
191
+
192
+ > "Want to also create a Stitch Design System from these tokens?
193
+ > This lets you apply the same theme to future screens without re-extracting."
194
+
195
+ If the user accepts:
196
+ 1. Map CSS variables to DesignTheme fields:
197
+ - `--color-primary` → `customColor`
198
+ - `--color-bg` / `--bg-light` → `backgroundLight`
199
+ - `--bg-dark` → `backgroundDark`
200
+ - `--font-family` → `font` (map to closest enum: e.g., "DM Sans" → `DM_SANS`)
201
+ - `--border-radius` → `roundness` (4px→`ROUND_FOUR`, 8px→`ROUND_EIGHT`, 12px→`ROUND_TWELVE`, 16px+→`ROUND_FULL`)
202
+ 2. Call `stitch-mcp-create-design-system` with the mapped values
203
+ 3. Store the returned asset name for future use
204
+
205
+ ### Step 8: Framework conversion
206
+
207
+ Route to the appropriate skill based on the user's selection:
208
+
209
+ | Selection | Skill | Notes |
210
+ |---|---|---|
211
+ | Next.js | `stitch-nextjs-components` | App Router, Server/Client split, `next-themes` |
212
+ | Svelte | `stitch-svelte-components` | Svelte 5 runes, scoped CSS, SvelteKit |
213
+ | HTML + CSS | `stitch-html-components` | Platform-agnostic, mobile-first, WebView-safe |
214
+ | React Native | `stitch-react-native-components` | Expo SDK 50+, iOS + Android — **MOBILE designs only** |
215
+ | SwiftUI | `stitch-swiftui-components` | Xcode 15+, iOS 16+ — **MOBILE designs only** |
216
+
217
+ All web skills (Next.js, Svelte, HTML) will:
218
+ - Read the downloaded HTML from `temp/source.html`
219
+ - Import `design-tokens.css` for theming
220
+ - Generate components with dark mode, responsive layout, ARIA baseline
221
+
222
+ Mobile skills (React Native, SwiftUI) will:
223
+ - Read the downloaded HTML from `temp/source.html`
224
+ - Extract color tokens and generate `ThemeTokens` / `tokens.ts`
225
+ - Generate native components — no `design-tokens.css` (native theming instead)
226
+
227
+ > **Note:** If the user selected a mobile skill but the design is `deviceType: DESKTOP`, warn them and recommend regenerating the Stitch screen with `deviceType: MOBILE` first.
228
+
229
+ ### Step 9: Quality pass (offer, don't force)
230
+
231
+ After conversion, offer:
232
+ > "Components generated. Would you like me to also:
233
+ > - **Add animations** (stitch-animate) — CSS, Framer Motion, or Svelte transitions
234
+ > - **Run accessibility audit** (stitch-a11y) — WCAG 2.1 AA review and fixes"
235
+
236
+ Execute whichever the user selects.
237
+
238
+ ---
239
+
240
+ ## Prompt-Only Workflow (no Stitch MCP tools)
241
+
242
+ When tools are unavailable, produce a ready-to-use prompt instead.
243
+
244
+ 1. Run Steps 2-3 (spec generation + prompt assembly) exactly as above
245
+ 2. Output the assembled prompt in copy-paste format:
246
+
247
+ ```
248
+ ## Your Stitch Generation Prompt
249
+
250
+ [Copy this into Stitch at stitch.withgoogle.com]
251
+
252
+ ---
253
+ [The full structured prompt]
254
+ ---
255
+
256
+ **Settings:**
257
+ - Device: [deviceType]
258
+ - Model: Gemini 3 Pro (recommended)
259
+ ```
260
+
261
+ **Stop here.** Do not fake results. Do not pretend to generate a screen.
262
+
263
+ ---
264
+
265
+ ## Output format after full execution
266
+
267
+ ```
268
+ ## Design Complete: [Screen Title]
269
+
270
+ **Project ID:** [numeric ID]
271
+ **Screen ID:** [screenId]
272
+ **Screenshot:** [downloadUrl]
273
+
274
+ ### What was generated
275
+ [Brief description of the screen]
276
+
277
+ ### Files created
278
+ - `design-tokens.css` — CSS custom properties (light + dark mode)
279
+ - `tailwind-theme.css` — Tailwind v4 @theme block
280
+ - `DESIGN.md` — Extended design system documentation
281
+ - `src/[...].tsx` or `.svelte` — Generated components
282
+
283
+ ### Next steps
284
+ - Run `npm run dev` to preview
285
+ - Use `stitch-animate` to add motion
286
+ - Use `stitch-a11y` for an accessibility pass
287
+ ```
288
+
289
+ ---
290
+
291
+ ## Consolidated ID format table
292
+
293
+ This is the #1 source of bugs. Every MCP tool has specific ID format requirements:
294
+
295
+ | Tool | projectId | screenId | Other IDs | Notes |
296
+ |------|-----------|----------|-----------|-------|
297
+ | `create_project` | — | — | Returns `projects/ID` | Extract numeric for later |
298
+ | `get_project` | `projects/ID` | — | — | Full path |
299
+ | `delete_project` | `projects/ID` | — | — | Full path |
300
+ | `list_projects` | — | — | — | Returns full paths |
301
+ | `list_screens` | `projects/ID` | — | — | Returns full paths |
302
+ | `get_screen` | Numeric | Numeric | — | No prefixes |
303
+ | `generate_screen_from_text` | Numeric | — | — | No prefix |
304
+ | `upload_screens_from_images` | Numeric | — | — | No prefix |
305
+ | `edit_screens` | Numeric | Numeric array | — | No prefixes |
306
+ | `generate_variants` | Numeric | Numeric array | — | No prefixes |
307
+ | `create_design_system` | Numeric (optional) | — | — | Returns Asset `name` |
308
+ | `update_design_system` | — | — | Asset `name` required | — |
309
+ | `list_design_systems` | Numeric (optional) | — | — | Returns Asset names |
310
+ | `apply_design_system` | Numeric | Numeric array | `assetId` required | — |
311
+
312
+ **Rules of thumb:**
313
+ - **Read operations** (`get_project`, `list_screens`, `delete_project`) → `projects/ID` full path
314
+ - **Generation operations** (`generate_screen_from_text`, `edit_screens`, `generate_variants`, `upload_screens_from_images`, `apply_design_system`) → numeric only
315
+ - **Design system operations** → numeric `projectId` (optional), asset `name` for identity
316
+
317
+ ---
318
+
319
+ ## Anti-patterns — never do these
320
+
321
+ - **Never report fake success.** If a tool call fails, say so and stop.
322
+ - **Never generate code directly** from the Stitch prompt — route to the conversion skills.
323
+ - **Never confuse a Stitch project with a code repository.** Stitch project = design workspace.
324
+ - **Never omit the `[Context] [Layout] [Components]` structure** from generation prompts.
325
+ - **Never use `projects/ID`** for `generate_screen_from_text`, `get_screen`, `edit_screens`, `generate_variants`, or `apply_design_system` — they need numeric IDs.
326
+ - **Never create a new project when projects already exist without asking.** Check existing projects first with `stitch-mcp-list-projects`.
327
+ - **Never retry `generate_screen_from_text` immediately on failure.** Wait 60 seconds, retry once max. Each call creates a new generation — retries mean duplicate screens.
328
+ - **Never call `delete_project` without explicit user confirmation.** Always show the project name and screen count first.
329
+ - **Never call `edit_screens` with a vague prompt.** Apply the same quality bar as generation — specific hex colors, named components, explicit values.
330
+ - **Never call `generate_variants` without an existing screen to vary.** Variants require a source design.
331
+ - **Never use `projects/ID` format for `edit_screens`, `generate_variants`, or `apply_design_system`.** These all take numeric IDs only.
332
+
333
+ ---
334
+
335
+ ## References
336
+
337
+ - `examples/workflow.md` — Complete end-to-end example (SaaS app design → Next.js code)
@@ -0,0 +1,173 @@
1
+ # End-to-End Workflow Example
2
+
3
+ ## Scenario: Designing a SaaS analytics app
4
+
5
+ **User:** "Use Stitch to design a dashboard for my SaaS analytics tool. I want a clean, modern look with indigo as the primary color."
6
+
7
+ ---
8
+
9
+ ### Step 0: Preflight
10
+ *Orchestrator runs `list_tools`*
11
+
12
+ Found: `stitch:create_project`, `stitch:generate_screen_from_text`, `stitch:list_screens`, `stitch:get_screen`
13
+ Namespace: `stitch:`
14
+
15
+ → Proceed with Full Execution Workflow.
16
+
17
+ ---
18
+
19
+ ### Step 1: Classify intent
20
+ New screen from scratch → full workflow.
21
+
22
+ ---
23
+
24
+ ### Step 2: Design Spec generation
25
+ *Orchestrator calls `stitch-ui-design-spec-generator`*
26
+
27
+ Input: "SaaS analytics tool, clean modern, indigo primary"
28
+
29
+ Output:
30
+ ```json
31
+ {
32
+ "theme": "LIGHT",
33
+ "primaryColor": "#6366F1",
34
+ "font": "DM Sans",
35
+ "roundness": "Medium",
36
+ "density": "COMPACT",
37
+ "designMode": "HIGH_FIDELITY",
38
+ "styleKeywords": ["Clean", "Modern", "SaaS", "Structured"],
39
+ "deviceType": "DESKTOP"
40
+ }
41
+ ```
42
+
43
+ ---
44
+
45
+ ### Step 3: Prompt assembly
46
+ *Orchestrator calls `stitch-ui-prompt-architect` in Path B mode*
47
+
48
+ Output:
49
+ ```
50
+ Desktop High-Fidelity analytics dashboard for a SaaS platform. Clean modern aesthetic. Light mode. Background: White (#ffffff). Primary: Indigo (#6366F1). Font: DM Sans.
51
+
52
+ Left sidebar navigation (200px): Logo top-left, nav items (Overview, Revenue, Users, Reports, Settings) with icons, user avatar + name at bottom. Top bar: Page title 'Overview', date range picker, notification bell, 'Export CSV' button.
53
+
54
+ KPI row: 4 cards — MRR ($48,200, +8.3% MoM, green arrow), Active Users (3,847, +12%), Churn Rate (1.9%, -0.4%), Avg Revenue Per User ($12.54). Line chart: 'Revenue Growth' spanning last 12 months, indigo primary line with subtle fill. Two-column bottom: 'Top Plans' horizontal bar chart left, 'Recent Signups' table right (avatar, name, plan, date).
55
+ ```
56
+
57
+ ---
58
+
59
+ ### Step 4: Create project
60
+ *Orchestrator calls `stitch-mcp-create-project`*
61
+
62
+ ```json
63
+ { "name": "create_project", "arguments": { "title": "SaaS Analytics Dashboard" } }
64
+ ```
65
+
66
+ Result: `{ "name": "projects/3780309359108792857" }`
67
+
68
+ - Full name: `projects/3780309359108792857`
69
+ - Numeric ID: `3780309359108792857`
70
+
71
+ ---
72
+
73
+ ### Step 5: Generate screen
74
+ *Orchestrator calls `stitch-mcp-generate-screen-from-text`*
75
+
76
+ ```json
77
+ {
78
+ "name": "generate_screen_from_text",
79
+ "arguments": {
80
+ "projectId": "3780309359108792857",
81
+ "prompt": "[assembled prompt from Step 3]",
82
+ "deviceType": "DESKTOP",
83
+ "modelId": "GEMINI_3_PRO"
84
+ }
85
+ }
86
+ ```
87
+
88
+ ---
89
+
90
+ ### Step 6: Retrieve screen
91
+ *Orchestrator calls `stitch-mcp-list-screens`, then `stitch-mcp-get-screen`*
92
+
93
+ list_screens: `{ "projectId": "projects/3780309359108792857" }`
94
+ → Found screen: `88805abc123def456`
95
+
96
+ get_screen: `{ "projectId": "3780309359108792857", "screenId": "88805abc123def456" }`
97
+ → Returns `htmlCode.downloadUrl` and `screenshot.downloadUrl`
98
+
99
+ Download HTML:
100
+ ```bash
101
+ bash scripts/fetch-stitch.sh "$htmlCode_downloadUrl" "temp/source.html"
102
+ ```
103
+
104
+ Orchestrator shows screenshot URL to user and asks framework preference.
105
+ User selects: **A) Convert to Next.js**
106
+
107
+ ---
108
+
109
+ ### Step 7: Design system extraction
110
+ *Orchestrator calls `stitch-design-system`*
111
+
112
+ Reads `temp/source.html` → extracts colors, fonts, spacing.
113
+
114
+ Generates:
115
+ - `design-tokens.css` with light/dark mode CSS variables
116
+ - `tailwind-theme.css` with `@theme` block
117
+ - `DESIGN.md` with Section 6 Stitch copy-paste block
118
+
119
+ ---
120
+
121
+ ### Step 8: Framework conversion
122
+ *Orchestrator calls `stitch-nextjs-components`*
123
+
124
+ Reads `temp/source.html` + `design-tokens.css`
125
+
126
+ Generates:
127
+ - `src/data/mockData.ts` — extracted KPI values, chart data
128
+ - `src/components/Sidebar.tsx` — Server Component
129
+ - `src/components/TopBar.tsx` — Client Component (date picker interaction)
130
+ - `src/components/KPICard.tsx` — Server Component
131
+ - `src/components/RevenueChart.tsx` — Client Component (chart interaction)
132
+ - `src/components/SignupsTable.tsx` — Server Component
133
+ - `app/dashboard/page.tsx` — Route entry composing all components
134
+
135
+ ---
136
+
137
+ ### Step 9: Quality pass
138
+ Orchestrator offers animations + a11y. User selects animations.
139
+
140
+ *Orchestrator calls `stitch-animate`*
141
+
142
+ Adds to components:
143
+ - `RevealOnScroll` wrapper around KPI cards (staggered fade-up, 60ms delay each)
144
+ - Chart fade-in transition on mount
145
+ - Card hover lift effect (CSS micro-interaction)
146
+ - `prefers-reduced-motion` override in `globals.css`
147
+
148
+ ---
149
+
150
+ ### Final output
151
+
152
+ ```
153
+ ## Design Complete: SaaS Analytics Dashboard
154
+
155
+ **Project ID:** 3780309359108792857
156
+ **Screen ID:** 88805abc123def456
157
+
158
+ ### Files created
159
+ - design-tokens.css
160
+ - tailwind-theme.css
161
+ - DESIGN.md
162
+ - src/data/mockData.ts
163
+ - src/components/Sidebar.tsx
164
+ - src/components/TopBar.tsx
165
+ - src/components/KPICard.tsx
166
+ - src/components/RevenueChart.tsx
167
+ - src/components/SignupsTable.tsx
168
+ - app/dashboard/page.tsx
169
+
170
+ ### Next steps
171
+ - Run `npm run dev` to preview
172
+ - Use `stitch-a11y` for an accessibility pass before launching
173
+ ```