Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 4 min read

Dissecting Google's 15.8K-Star stitch-skills: 9 of 16 Are Markdown, 3 Scripts Do the Real Work

Google Labs' google-labs-code/stitch-skills repository just crossed 15,802 stars (1,834 forks, Apache-2.0). The README pitches a full design-to-code skill suite for Claude Code, Cursor, Codex, Antigravity, and VS Code Co

Google Labs' google-labs-code/stitch-skills repository just crossed 15,802 stars (1,834 forks, Apache-2.0). The README pitches a full design-to-code skill suite for Claude Code, Cursor, Codex, Antigravity, and VS Code Copilotβ€”from design-token extraction and React/shadcn scaffolding to autonomous multi-page builds via stitch-loop.

Before wiring a 16-skill repo into my own agent context, I cloned all 109 files (601.5 KB) locally and counted what actually runs code versus what is pure Markdown guidance.

The Real Split: 7 Script-Backed Skills vs. 9 Markdown Playbooks

Across the three plugin folders inside plugins/:

Plugin Total Skills Script-Backed Pure Markdown (0 scripts)
stitch-build 5 4 1 (react-vite-dashboard)
stitch-design 6 3 3 (code-to-design, generate-design, manage-design-system)
stitch-utilities 5 0 5 (including stitch-loop, design-md, site-md, enhance-prompt, taste-design)
Total 16 7 9

More than half the catalogβ€”including the viral stitch-loop baton-passing site builderβ€”ships zero executable scripts. It relies entirely on prompt conventions around .stitch/next-prompt.md, .stitch/DESIGN.md, and .stitch/SITE.md.

That said, the 7 script-backed skills contain 38 real JS/TS/TSX/Python/Shell source and test files, and three of those scripts are genuinely worth lifting into any frontend agent workflowβ€”even if you never sign up for Google Stitch.

1. upload_to_stitch.py (409 lines): Documenting the Real MCP File-Upload Failure Mode

Inside plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py, lines 4–14 explain a practical failure mode anyone building MCP file tools eventually hits:

AI models cannot upload binary or large files directly through MCP tool calls because tool arguments consume the model's output token budget. A 53 KB PNG expands to ~71K characters of base64, smashing into typical ~16K output ceilings and truncating mid-payload.

Google's workaround strips the model out of the byte path entirely: the agent invokes upload_to_stitch.py, which reads the local .png/.html/.md file, base64-encodes it in-process, and sends it over Python urllib.request directly to BatchCreateScreens.

A couple of production touches stand out:

  • Corporate CA precedence: os.environ.get("SSL_CERT_FILE") or certifi.where() ensures enterprise proxy CAs win over bundled certifi.
  • Resource-prefix normalization & host pinning: strips duplicate projects/ prefixes returned by list_projects, and validates target API URLs against a strict regex (*.stitch.googleapis.com) backed by upload-to-stitch-security.test.mjs.

2. snapshot.ts (1,495 lines / 57.6 KB) & extract-live-url.mjs (372 lines): Standalone Local DOM & Token Extractors

The heaviest engineering in the repo lives inside plugins/stitch-design/skills/extract-static-html/ (10 TypeScript and test files). snapshot.ts, paired with extract_inline_html.ts (37.5 KB) and post_process.ts (15.5 KB), drives Puppeteer against any running React, Vue, Svelte, or Angular server and serializes a single self-contained HTML snapshot:

  • Inlines stylesheets and converts images, canvas buffers, and fonts to base64 data URIs.
  • Strips <script> tags and optionally drops fixed/sticky cookie banners (--remove-fixed).
  • Enforces URL validation and cross-origin iframe filtering via snapshot_security.ts and frame_policy.ts, with four dedicated unit test suites.

Right next to it, extract-design-md/scripts/extract-live-url.mjs renders any live URL with local headless Chrome, translates modern CSS color formats (oklab, display-p3, linear RGB) straight into hex values, and emits computed styles as JSON alongside a screenshot.

Neither script requires a Stitch API key. Both run locally and are cleanly reusable under Apache-2.0.

3. validate.js (98 lines): Enforcing Tailwind & TypeScript Guardrails via @swc/core AST

Telling an LLM in Markdown not to hardcode hex colors inside Tailwind className strings works until turn four of a refactor.

In plugins/stitch-build/skills/react-components/scripts/validate.js (and its react-native counterpart), Google enforces two rules deterministically with @swc/core:

  1. Parses the generated .tsx AST and confirms a TsInterfaceDeclaration or TsTypeAliasDeclaration ending in Props exists.
  2. Walks every object nodeβ€”explicitly handling SWC call arguments and array wrappers without a type fieldβ€”and rejects any className literal or template chunk matching /#[0-9A-Fa-f]{3,8}\b/.

On failure it exits non-zero, forcing the agent to repair the component before moving on. Prompting sets taste; an AST gate holds the floor.

3 Honest Caveats Before Installing the Whole Repo

  1. Core generation and upload are locked to Google Stitch MCP
    Running stitch-loop, generate-design, or upload-to-stitch requires Google's hosted endpoint (https://stitch.googleapis.com/mcp) and an X-Goog-Api-Key from stitch.withgoogle.com. If your team stays inside Figma or local codebases, installing all 16 skills just burns prompt tokens.

  2. The 9 Markdown-only skills have no deterministic safety net
    stitch-utilities is 100% Markdown playbooks. stitch-loop expects the model to update .stitch/next-prompt.md and .stitch/metadata.json faithfully on every pass; weaker or context-saturated models can drift or overwrite existing routes.

  3. Real local runtime weight
    The git clone is only 601.5 KB, yet snapshot.ts requires Puppeteer, Chromium, and npx tsx, while stitch-loop recommends Chrome DevTools MCP for visual verificationβ€”heavier than pure CLI agent skills.

Bottom Line

If you already prototype in Google Stitch, stitch-build and stitch-design are well-engineered companions. If you do not use Stitch at all, skip the plugin install and cherry-pick snapshot.ts, extract-live-url.mjs, and validate.js as standalone Apache-2.0 guardrails for your own coding agent.

How are you keeping AI-generated React/Tailwind components clean right nowβ€”AST/lint scripts or purely prompt rules?

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.