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,430 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * stitch-kit CLI installer
5
+ *
6
+ * Installs stitch-kit skills and agent definition for Claude Code and/or Codex CLI.
7
+ * Detects which platforms are available and installs to the right locations.
8
+ *
9
+ * Usage:
10
+ * npx stitch-kit — install (default)
11
+ * npx stitch-kit install — install or update
12
+ * npx stitch-kit update — same as install (npx always fetches latest)
13
+ * npx stitch-kit uninstall — remove stitch-kit from all platforms
14
+ * npx stitch-kit status — show what's installed where
15
+ *
16
+ * Platforms:
17
+ * Claude Code — agent → ~/.claude/agents/, MCP config, plugin recommendation
18
+ * Codex CLI — agent → ~/.codex/agents/, skills → ~/.codex/skills/
19
+ */
20
+
21
+ import { existsSync, mkdirSync, cpSync, rmSync, readFileSync, readdirSync, lstatSync, symlinkSync, unlinkSync } from 'node:fs';
22
+ import { join, dirname, resolve } from 'node:path';
23
+ import { homedir } from 'node:os';
24
+ import { fileURLToPath } from 'node:url';
25
+
26
+ // ── Constants ──────────────────────────────────────────────────────────────────
27
+
28
+ const __filename = fileURLToPath(import.meta.url);
29
+ const __dirname = dirname(__filename);
30
+ const PACKAGE_ROOT = resolve(__dirname, '..');
31
+
32
+ const HOME = homedir();
33
+ const CLAUDE_DIR = join(HOME, '.claude');
34
+ const CLAUDE_AGENTS_DIR = join(CLAUDE_DIR, 'agents');
35
+ const CLAUDE_PLUGINS_FILE = join(CLAUDE_DIR, 'plugins', 'installed_plugins.json');
36
+
37
+ const CODEX_DIR = join(HOME, '.codex');
38
+ const CODEX_AGENTS_DIR = join(CODEX_DIR, 'agents');
39
+ const CODEX_SKILLS_DIR = join(CODEX_DIR, 'skills');
40
+
41
+ const SKILLS_SRC = join(PACKAGE_ROOT, 'skills');
42
+ const AGENTS_SRC = join(PACKAGE_ROOT, 'agents');
43
+
44
+ const VERSION = JSON.parse(readFileSync(join(PACKAGE_ROOT, 'package.json'), 'utf8')).version;
45
+
46
+ // ── Helpers ────────────────────────────────────────────────────────────────────
47
+
48
+ /** Prints styled output — keeps it readable without dependencies */
49
+ function log(msg) { console.log(msg); }
50
+ function logOk(msg) { console.log(` ✓ ${msg}`); }
51
+ function logSkip(msg) { console.log(` → ${msg}`); }
52
+ function logWarn(msg) { console.log(` ⚠ ${msg}`); }
53
+ function logErr(msg) { console.error(` ✗ ${msg}`); }
54
+
55
+ /** Check if Claude Code is installed (has ~/.claude/) */
56
+ function hasClaudeCode() {
57
+ return existsSync(CLAUDE_DIR);
58
+ }
59
+
60
+ /** Check if Codex CLI is installed (has ~/.codex/) */
61
+ function hasCodex() {
62
+ return existsSync(CODEX_DIR);
63
+ }
64
+
65
+ /** Check if stitch-kit is already installed as a Claude Code plugin */
66
+ function isPluginInstalled() {
67
+ if (!existsSync(CLAUDE_PLUGINS_FILE)) return false;
68
+ try {
69
+ const plugins = JSON.parse(readFileSync(CLAUDE_PLUGINS_FILE, 'utf8'));
70
+ // installed_plugins.json is an array of plugin objects
71
+ if (Array.isArray(plugins)) {
72
+ return plugins.some(p =>
73
+ (p.name && p.name.includes('stitch-kit')) ||
74
+ (p.source && p.source.includes('stitch-kit'))
75
+ );
76
+ }
77
+ // Or it could be an object with plugin entries
78
+ return JSON.stringify(plugins).includes('stitch-kit');
79
+ } catch {
80
+ return false;
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Copy a file, creating parent directories as needed.
86
+ * Returns true if the file was written, false if skipped.
87
+ */
88
+ function copyFile(src, dest, overwrite = true) {
89
+ if (!existsSync(src)) {
90
+ logErr(`Source not found: ${src}`);
91
+ return false;
92
+ }
93
+ if (existsSync(dest) && !overwrite) {
94
+ logSkip(`Already exists: ${dest}`);
95
+ return false;
96
+ }
97
+ mkdirSync(dirname(dest), { recursive: true });
98
+ cpSync(src, dest, { force: true });
99
+ return true;
100
+ }
101
+
102
+ /**
103
+ * Copy an entire directory recursively.
104
+ * @param {string} src - Source directory
105
+ * @param {string} dest - Destination directory
106
+ */
107
+ function copyDir(src, dest) {
108
+ mkdirSync(dest, { recursive: true });
109
+ cpSync(src, dest, { recursive: true, force: true });
110
+ }
111
+
112
+ /**
113
+ * List skill directory names from the source.
114
+ * @returns {string[]} Array of skill directory names
115
+ */
116
+ function listSkills() {
117
+ if (!existsSync(SKILLS_SRC)) return [];
118
+ return readdirSync(SKILLS_SRC).filter(name => {
119
+ const full = join(SKILLS_SRC, name);
120
+ return lstatSync(full).isDirectory();
121
+ });
122
+ }
123
+
124
+ // ── Install ────────────────────────────────────────────────────────────────────
125
+
126
+ function installClaudeCode() {
127
+ log('');
128
+ log('Claude Code');
129
+ log('───────────');
130
+
131
+ const pluginInstalled = isPluginInstalled();
132
+
133
+ // Always install/update the agent definition
134
+ const agentSrc = join(AGENTS_SRC, 'stitch-kit.md');
135
+ const agentDest = join(CLAUDE_AGENTS_DIR, 'stitch-kit.md');
136
+
137
+ if (copyFile(agentSrc, agentDest)) {
138
+ logOk(`Agent installed → ${agentDest}`);
139
+ }
140
+
141
+ // Check if Stitch MCP is configured by reading the settings file directly
142
+ let mcpConfigured = false;
143
+ const claudeSettingsFile = join(CLAUDE_DIR, 'settings.json');
144
+ if (existsSync(claudeSettingsFile)) {
145
+ try {
146
+ const settings = JSON.parse(readFileSync(claudeSettingsFile, 'utf8'));
147
+ mcpConfigured = settings.mcpServers && 'stitch' in settings.mcpServers;
148
+ } catch { /* ignore parse errors */ }
149
+ }
150
+ // Also check project-level .mcp.json in common locations
151
+ if (!mcpConfigured) {
152
+ const mcpJson = join(process.cwd(), '.mcp.json');
153
+ if (existsSync(mcpJson)) {
154
+ try {
155
+ const mcp = JSON.parse(readFileSync(mcpJson, 'utf8'));
156
+ mcpConfigured = mcp.mcpServers && 'stitch' in mcp.mcpServers;
157
+ } catch { /* ignore */ }
158
+ }
159
+ }
160
+
161
+ if (!mcpConfigured) {
162
+ log('');
163
+ log(' Stitch MCP not detected. To add it, run in your terminal:');
164
+ log('');
165
+ log(' claude mcp add stitch -- npx -y @google/stitch-mcp');
166
+ log('');
167
+ } else {
168
+ logOk('Stitch MCP already configured');
169
+ }
170
+
171
+ // Skills: plugin system is the right path for Claude Code
172
+ if (pluginInstalled) {
173
+ logOk('Plugin already installed — skills delivered via plugin system');
174
+ log('');
175
+ log(' To update the plugin to the latest version:');
176
+ log(' /plugin install stitch-kit@stitch-kit');
177
+ } else {
178
+ log('');
179
+ log(' For full skill support in Claude Code, install the plugin:');
180
+ log('');
181
+ log(' /plugin marketplace add https://github.com/gabelul/stitch-kit.git');
182
+ log(' /plugin install stitch-kit@stitch-kit');
183
+ log('');
184
+ log(' The agent works standalone with MCP tools, but skills add');
185
+ log(' prompt engineering, design tokens, and framework conversion.');
186
+ }
187
+ }
188
+
189
+ function installCodex() {
190
+ log('');
191
+ log('Codex CLI');
192
+ log('─────────');
193
+
194
+ // Install agent
195
+ const agentSrc = join(AGENTS_SRC, 'stitch-kit.md');
196
+ const agentDest = join(CODEX_AGENTS_DIR, 'stitch-kit.md');
197
+ mkdirSync(CODEX_AGENTS_DIR, { recursive: true });
198
+
199
+ if (copyFile(agentSrc, agentDest)) {
200
+ logOk(`Agent installed → ${agentDest}`);
201
+ }
202
+
203
+ // Install skills — copy each skill directory
204
+ mkdirSync(CODEX_SKILLS_DIR, { recursive: true });
205
+ const skills = listSkills();
206
+ let installed = 0;
207
+ let updated = 0;
208
+
209
+ for (const skillName of skills) {
210
+ const src = join(SKILLS_SRC, skillName);
211
+ const dest = join(CODEX_SKILLS_DIR, skillName);
212
+
213
+ const existed = existsSync(dest);
214
+
215
+ // Remove old symlinks or dirs before copying fresh
216
+ if (existed) {
217
+ if (lstatSync(dest).isSymbolicLink()) {
218
+ unlinkSync(dest);
219
+ } else {
220
+ rmSync(dest, { recursive: true, force: true });
221
+ }
222
+ updated++;
223
+ } else {
224
+ installed++;
225
+ }
226
+
227
+ copyDir(src, dest);
228
+ }
229
+
230
+ logOk(`${installed} skills installed, ${updated} updated (${skills.length} total)`);
231
+
232
+ // Check Stitch MCP in codex config
233
+ const codexConfig = join(CODEX_DIR, 'config.toml');
234
+ let mcpConfigured = false;
235
+ if (existsSync(codexConfig)) {
236
+ try {
237
+ const content = readFileSync(codexConfig, 'utf8');
238
+ mcpConfigured = content.includes('stitch');
239
+ } catch { /* ignore */ }
240
+ }
241
+
242
+ if (!mcpConfigured) {
243
+ log('');
244
+ log(' Add Stitch MCP to ~/.codex/config.toml:');
245
+ log('');
246
+ log(' [mcp_servers.stitch]');
247
+ log(' command = "npx"');
248
+ log(' args = ["-y", "@google/stitch-mcp"]');
249
+ } else {
250
+ logOk('Stitch MCP already in config.toml');
251
+ }
252
+
253
+ log('');
254
+ log(' Use $stitch-kit to invoke the agent');
255
+ log(' Use $stitch-orchestrator for the full pipeline');
256
+ }
257
+
258
+ function install() {
259
+ log(`stitch-kit v${VERSION} — installer`);
260
+ log('════════════════════════════════');
261
+
262
+ const claude = hasClaudeCode();
263
+ const codex = hasCodex();
264
+
265
+ if (!claude && !codex) {
266
+ log('');
267
+ logErr('Neither Claude Code (~/.claude/) nor Codex CLI (~/.codex/) found.');
268
+ log('');
269
+ log(' Install Claude Code: https://claude.ai/code');
270
+ log(' Install Codex CLI: https://github.com/openai/codex');
271
+ log('');
272
+ process.exit(1);
273
+ }
274
+
275
+ if (claude) installClaudeCode();
276
+ if (codex) installCodex();
277
+
278
+ log('');
279
+ log('════════════════════════════════');
280
+ log('Done.');
281
+ if (claude && codex) {
282
+ log('Installed for both Claude Code and Codex CLI.');
283
+ } else if (claude) {
284
+ log('Installed for Claude Code.');
285
+ } else {
286
+ log('Installed for Codex CLI.');
287
+ }
288
+ log('');
289
+ }
290
+
291
+ // ── Uninstall ──────────────────────────────────────────────────────────────────
292
+
293
+ function uninstall() {
294
+ log(`stitch-kit v${VERSION} — uninstaller`);
295
+ log('══════════════════════════════════');
296
+
297
+ // Claude Code — remove agent only (plugin managed separately)
298
+ const claudeAgent = join(CLAUDE_AGENTS_DIR, 'stitch-kit.md');
299
+ if (existsSync(claudeAgent)) {
300
+ rmSync(claudeAgent);
301
+ logOk('Removed Claude Code agent');
302
+ }
303
+
304
+ if (isPluginInstalled()) {
305
+ logWarn('stitch-kit plugin is still installed in Claude Code.');
306
+ log(' To remove it, run inside Claude Code: /plugin uninstall stitch-kit');
307
+ }
308
+
309
+ // Codex — remove agent + all stitch skills
310
+ const codexAgent = join(CODEX_AGENTS_DIR, 'stitch-kit.md');
311
+ if (existsSync(codexAgent)) {
312
+ rmSync(codexAgent);
313
+ logOk('Removed Codex agent');
314
+ }
315
+
316
+ const skills = listSkills();
317
+ let removed = 0;
318
+ for (const skillName of skills) {
319
+ const dest = join(CODEX_SKILLS_DIR, skillName);
320
+ if (existsSync(dest)) {
321
+ if (lstatSync(dest).isSymbolicLink()) {
322
+ unlinkSync(dest);
323
+ } else {
324
+ rmSync(dest, { recursive: true, force: true });
325
+ }
326
+ removed++;
327
+ }
328
+ }
329
+
330
+ if (removed > 0) {
331
+ logOk(`Removed ${removed} Codex skills`);
332
+ }
333
+
334
+ log('');
335
+ log('Done. Stitch MCP server config was left in place — remove manually if needed.');
336
+ log('');
337
+ }
338
+
339
+ // ── Status ─────────────────────────────────────────────────────────────────────
340
+
341
+ function status() {
342
+ log(`stitch-kit v${VERSION} — status`);
343
+ log('══════════════════════════════');
344
+
345
+ log('');
346
+ log('Claude Code');
347
+ log('───────────');
348
+ if (!hasClaudeCode()) {
349
+ logWarn('Not installed (~/.claude/ not found)');
350
+ } else {
351
+ const agentExists = existsSync(join(CLAUDE_AGENTS_DIR, 'stitch-kit.md'));
352
+ const pluginExists = isPluginInstalled();
353
+
354
+ if (agentExists) logOk('Agent: installed');
355
+ else logWarn('Agent: not installed');
356
+
357
+ if (pluginExists) logOk('Plugin: installed (skills delivered via plugin)');
358
+ else logWarn('Plugin: not installed (skills not available — run /plugin install)');
359
+ }
360
+
361
+ log('');
362
+ log('Codex CLI');
363
+ log('─────────');
364
+ if (!hasCodex()) {
365
+ logWarn('Not installed (~/.codex/ not found)');
366
+ } else {
367
+ const agentExists = existsSync(join(CODEX_AGENTS_DIR, 'stitch-kit.md'));
368
+ if (agentExists) logOk('Agent: installed');
369
+ else logWarn('Agent: not installed');
370
+
371
+ // Count installed skills
372
+ const skills = listSkills();
373
+ let installedCount = 0;
374
+ for (const s of skills) {
375
+ if (existsSync(join(CODEX_SKILLS_DIR, s))) installedCount++;
376
+ }
377
+ if (installedCount === skills.length) {
378
+ logOk(`Skills: ${installedCount}/${skills.length} installed`);
379
+ } else if (installedCount > 0) {
380
+ logWarn(`Skills: ${installedCount}/${skills.length} installed (outdated — run npx stitch-kit update)`);
381
+ } else {
382
+ logWarn('Skills: none installed');
383
+ }
384
+ }
385
+
386
+ log('');
387
+ }
388
+
389
+ // ── CLI entry point ────────────────────────────────────────────────────────────
390
+
391
+ const command = process.argv[2] || 'install';
392
+
393
+ switch (command) {
394
+ case 'install':
395
+ case 'update':
396
+ install();
397
+ break;
398
+ case 'uninstall':
399
+ case 'remove':
400
+ uninstall();
401
+ break;
402
+ case 'status':
403
+ status();
404
+ break;
405
+ case '--version':
406
+ case '-v':
407
+ log(VERSION);
408
+ break;
409
+ case '--help':
410
+ case '-h':
411
+ log(`stitch-kit v${VERSION}`);
412
+ log('');
413
+ log('Usage: npx stitch-kit [command]');
414
+ log('');
415
+ log('Commands:');
416
+ log(' install Install or update stitch-kit (default)');
417
+ log(' update Same as install — npx always fetches latest');
418
+ log(' uninstall Remove stitch-kit from all platforms');
419
+ log(' status Show what is installed where');
420
+ log('');
421
+ log('Platforms detected automatically:');
422
+ log(' Claude Code ~/.claude/agents/ + plugin system');
423
+ log(' Codex CLI ~/.codex/agents/ + ~/.codex/skills/');
424
+ log('');
425
+ break;
426
+ default:
427
+ logErr(`Unknown command: ${command}`);
428
+ log('Run: npx stitch-kit --help');
429
+ process.exit(1);
430
+ }
@@ -0,0 +1,118 @@
1
+ # stitch-kit Architecture
2
+
3
+ How the skills are organized and why. The short version: there are 4 layers, each with a specific job, and the MCP wrappers exist because the Stitch API has inconsistent ID format requirements that break agent runs.
4
+
5
+ ---
6
+
7
+ ## The four layers
8
+
9
+ ```
10
+ stitch-kit
11
+ ├── Brain (stitch-ui-*) — design logic, no API calls
12
+ ├── Hands (stitch-mcp-*) — MCP execution, one skill per tool
13
+ ├── Quality (stitch-design-*, stitch-animate, stitch-a11y)
14
+ └── Loop (stitch-loop, stitch-design-md)
15
+ ```
16
+
17
+ ---
18
+
19
+ ### Brain (`stitch-ui-*`)
20
+
21
+ Pure design intelligence. These skills handle spec generation and prompt engineering without making any Stitch API calls — so they're free to run and fast to iterate on.
22
+
23
+ | Skill | What it does |
24
+ |-------|-------------|
25
+ | `stitch-ui-design-spec-generator` | Turns a vague request or PRD into a structured Design Spec JSON (theme, color, font, device, density). This spec is the contract that feeds the prompt architect. |
26
+ | `stitch-ui-prompt-architect` | **Two modes:** (A) vague idea → enhanced Stitch prompt; (B) Design Spec + request → structured `[Context][Layout][Components]` prompt. Mode B is what you want for reliable results — it gives Stitch much more to work with. |
27
+ | `stitch-ui-design-variants` | Generates 3 alternative prompt variants for A/B exploration. Useful when you want to explore before committing to one direction. |
28
+ | `stitch-ued-guide` | Visual vocabulary reference — layout patterns, aesthetic styles, device constraints, color structure. Loaded by other skills on demand to save context. |
29
+
30
+ ---
31
+
32
+ ### Hands (`stitch-mcp-*`)
33
+
34
+ One skill per Stitch MCP tool. The wrappers exist because the raw Stitch API is inconsistent about ID formats and agents get this wrong constantly.
35
+
36
+ **The ID format problem:**
37
+
38
+ | Tool | projectId format | screenId format |
39
+ |------|-----------------|----------------|
40
+ | `create_project` | Returns `projects/NUMERIC_ID` | — |
41
+ | `list_projects` | — | — |
42
+ | `get_project` | `projects/NUMERIC_ID` | — |
43
+ | `generate_screen_from_text` | **Numeric only** | — |
44
+ | `list_screens` | `projects/NUMERIC_ID` | — |
45
+ | `get_screen` | **Numeric only** | **Numeric only** |
46
+
47
+ `generate_screen_from_text` and `get_screen` need bare numbers. `get_project` and `list_screens` need the `projects/` prefix. There's no obvious reason for the inconsistency — you just have to know. The wrappers bake this in so the orchestrator doesn't have to handle it inline.
48
+
49
+ Naming convention: MCP tool name with underscores replaced by hyphens, prefixed with `stitch-mcp-`. So `get_screen` → `stitch-mcp-get-screen`. Full mapping in [mcp-naming-convention.md](mcp-naming-convention.md).
50
+
51
+ ---
52
+
53
+ ### Quality
54
+
55
+ Skills that run after generation, before you ship anything.
56
+
57
+ | Skill | What it does |
58
+ |-------|-------------|
59
+ | `stitch-design-system` | Extracts design tokens from Stitch output → `design-tokens.css` with CSS custom properties for light + dark mode. Also outputs `tailwind-theme.css`. |
60
+ | `stitch-design-md` | Analyzes a Stitch project → `DESIGN.md` with color palette, typography, atmosphere, and Section 6 (Stitch prompt snippets so the next screen matches the first). |
61
+ | `stitch-animate` | Adds purposeful animation — CSS keyframes, Framer Motion, or Svelte transitions. Handles `prefers-reduced-motion` automatically. |
62
+ | `stitch-a11y` | WCAG 2.1 AA audit and auto-fixes: semantic HTML, ARIA labels, keyboard navigation, focus indicators, color contrast, image alt text. |
63
+
64
+ ---
65
+
66
+ ### Loop
67
+
68
+ For multi-page sites where visual consistency matters. The core problem: each Stitch generation is independent, so screen 5 can look nothing like screen 1 unless you explicitly carry design state forward.
69
+
70
+ The pattern:
71
+ 1. Generate a screen
72
+ 2. `stitch-design-md` analyzes it → produces `DESIGN.md`
73
+ 3. `DESIGN.md` feeds back into the next Stitch prompt via the prompt architect
74
+ 4. Repeat — every subsequent screen inherits the visual system
75
+
76
+ `stitch-loop` automates this with `next-prompt.md` (carries context from the previous screen) and `SITE.md` (tracks the overall site map).
77
+
78
+ ---
79
+
80
+ ## The orchestrator
81
+
82
+ `stitch-orchestrator` is the single entry point. Describe what you want to build — it coordinates the full pipeline:
83
+
84
+ ```
85
+ request → spec (Brain) → prompt (Brain) → generate (Hands) → retrieve (Hands) → tokens (Quality) → convert → [animate / a11y]
86
+ ```
87
+
88
+ `agents/stitch-kit.md` wraps this into a persistent agent definition for Claude Code and Codex — a Stitch specialist that routes to the right skill, knows the ID format rules, and handles Stitch URL parsing.
89
+
90
+ ---
91
+
92
+ ## Skill directory structure
93
+
94
+ Each skill has the same layout:
95
+
96
+ ```text
97
+ skills/[skill-name]/
98
+ ├── SKILL.md — name, description, when to use it, instructions
99
+ ├── examples/ — real examples the agent copies instead of guessing
100
+ ├── references/ — design contracts, checklists, style guides (on-demand)
101
+ └── scripts/ — fetch helpers, validators, code generators
102
+ ```
103
+
104
+ **Why this matters:**
105
+
106
+ `SKILL.md` is what the agent reads. The YAML frontmatter declares the skill's name, description (used for discovery), and optionally `allowed-tools` to restrict which tools it can invoke while active.
107
+
108
+ `examples/` is the quality multiplier. Agents copy concrete patterns instead of generating boilerplate from scratch — this is why the framework conversion output is consistent instead of creative. `fetch-stitch.sh` in `scripts/` downloads Stitch HTML before the GCS URL expires (TTL is short, and the agent can't know in advance when it'll expire).
109
+
110
+ `references/` is loaded on demand. Design contracts, official docs, checklists that are only needed at specific pipeline stages don't eat context window by default.
111
+
112
+ ---
113
+
114
+ ## Why stitch-kit instead of just the official skills
115
+
116
+ The [official Google Stitch Skills repo](https://github.com/google-labs-code/stitch-skills) has 6 skills. They're solid but they don't coordinate, don't handle ID formats, and don't cover the full pipeline from spec to production component. stitch-kit wraps every official skill (and improves each one), adds the orchestration layer, adds the MCP wrappers that actually make the API reliable to call, and adds the quality layer that gets you from raw Stitch output to shippable code.
117
+
118
+ See [README.md](../README.md#vs-the-official-google-stitch-skills) for the full comparison table.
@@ -0,0 +1,119 @@
1
+ # Color Prompt Guide for Stitch
2
+
3
+ 8 ready-to-use color palettes. Copy any block directly into the **Context & Style** section of your Stitch prompt.
4
+
5
+ These are structured as: app type + background / primary / accent colors (hex) + design system / style + mood.
6
+
7
+ ---
8
+
9
+ ## How to use
10
+
11
+ Paste one of these blocks into your Stitch prompt's **[Context]** section, or combine with `[Layout]` and `[Components]` for a full prompt:
12
+
13
+ ```
14
+ [Context]
15
+ <paste color block here>
16
+
17
+ [Layout]
18
+ ...
19
+
20
+ [Components]
21
+ ...
22
+ ```
23
+
24
+ For more prompt structure guidance see `stitch-ui-prompt-architect` and `stitch-ued-guide`.
25
+
26
+ ---
27
+
28
+ ## 1. Dark productivity (developer / SaaS tools)
29
+
30
+ Deep blue, high contrast, fluorescent blue accent. Works for dev tools, dashboards, and productivity apps.
31
+
32
+ ```
33
+ Modern productivity app dark theme, charcoal grey background #1a1a1a, primary blue #4A90E2, secondary teal #26D0CE, neutral greys #2d2d2d to #f5f5f5, accent orange #FF6B35 for CTAs, Material Design 3 inspired, high contrast for readability, professional and focused atmosphere
34
+ ```
35
+
36
+ ---
37
+
38
+ ## 2. Enterprise blue-gray (collaboration / workspace)
39
+
40
+ Slate, indigo, and emerald — professional and balanced. Suits B2B, collaboration, and admin UIs.
41
+
42
+ ```
43
+ Enterprise collaboration suite colors, slate grey base #1E293B, primary indigo #6366F1, secondary emerald #10B981, neutral palette #475569 to #F8FAFC, amber accent #F59E0B, Fluent Design System inspired, balanced professional appearance, suitable for team productivity
44
+ ```
45
+
46
+ ---
47
+
48
+ ## 3. Clean light (project management / task tracking)
49
+
50
+ Soft blue, purple, and green — calm and organized. Works for project tools, calendars, and kanban apps.
51
+
52
+ ```
53
+ Project management app bright theme, clean white background #FFFFFF, primary royal blue #2563EB, secondary purple #7C3AED, soft grey cards #F9FAFB, green success #22C55E, red alerts #DC2626, yellow warnings #F59E0B, minimal design with subtle shadows, organized and efficient visual hierarchy
54
+ ```
55
+
56
+ ---
57
+
58
+ ## 4. Airy sky (cloud services / storage)
59
+
60
+ Light blue gradient background, azure primary, teal accents. Open and trustworthy. Works for cloud apps, file storage, and SaaS.
61
+
62
+ ```
63
+ Cloud storage desktop client colors, sky blue gradient #E0F2FE to #DBEAFE, primary azure #0EA5E9, secondary slate #64748B, white panels #FFFFFF with soft shadows, teal accents #14B8A6, folder yellow #FCD34D, modern airy interface, trustworthy and spacious feeling
64
+ ```
65
+
66
+ ---
67
+
68
+ ## 5. Classic business (email / communication)
69
+
70
+ Neutral grays and navy — familiar and safe. Works for email clients, messaging apps, and corporate tools.
71
+
72
+ ```
73
+ Email client professional palette, light grey background #F7F8FA, primary navy #1E40AF, secondary grey blue #64748B, white message cards #FFFFFF, unread indicator blue #3B82F6, important flag red #EF4444, archive green #10B981, classic business communication aesthetic
74
+ ```
75
+
76
+ ---
77
+
78
+ ## 6. Creative gradient (design / creative tools)
79
+
80
+ Deep purple to electric blue, neon pink accents, dark background. Glassmorphism-ready. Works for design tools, creative apps, and portfolios.
81
+
82
+ ```
83
+ Creative software gradient color palette, deep purple #6B46C1 to electric blue #2563EB, dark background #0F0F0F, neon pink accent #FF0080, lime green highlights #84CC16, glassmorphism elements with transparency, futuristic and inspiring mood, suitable for digital artists and designers
84
+ ```
85
+
86
+ ---
87
+
88
+ ## 7. Cinema / broadcast (video editing / media)
89
+
90
+ True black background, amber and red accents, blue timeline tracks. Professional broadcast aesthetic. Works for video tools, media apps, and production software.
91
+
92
+ ```
93
+ Video editing suite cinema theme, true black background #000000, primary amber #F59E0B, secondary red #DC2626, timeline tracks in gradient blues #1E40AF to #3B82F6, playback controls silver #E5E7EB, render progress green #10B981, professional broadcast studio inspired design
94
+ ```
95
+
96
+ ---
97
+
98
+ ## 8. Industrial precision (3D / engineering tools)
99
+
100
+ Dark gray viewport, orange primary, steel blue secondary. Technical and focused. Works for 3D modeling, engineering, and high-frequency professional tools.
101
+
102
+ ```
103
+ 3D modeling app industrial colors, dark grey viewport #1F1F1F, primary orange #F97316, secondary steel blue #475569, grid lines subtle grey #374151, selection yellow #FDE047, tool panels charcoal #262626, metallic accents #94A3B8, technical precision focused interface
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Mobile-specific notes
109
+
110
+ When using these palettes for `deviceType: MOBILE` designs:
111
+ - Increase contrast — small screens in bright sunlight need higher ratios
112
+ - Avoid small accent colors for primary actions; use them for status only
113
+ - Test dark mode specifically — pure `#000000` backgrounds can feel harsh on OLED; prefer `#0F0F0F` or `#18181B`
114
+
115
+ ## Dark mode token mapping
116
+
117
+ After generation, use `stitch-design-system` to extract the exact hex values from the Stitch HTML and generate:
118
+ - `design-tokens.css` — CSS custom properties with light + dark variants
119
+ - `tailwind-theme.css` — Tailwind v4 `@theme` block