OPEN SOURCE DEEP DIVE
Stitch Skills: A Design-to-Code Agent Pipeline for Google Stitch
Google Stitch agent skills for extracting UI and design tokens, generating screens, and validating code handoffs.
Stitch Skills from Google Labs Code is not another one-shot interface generator. It is a collection of agent workflows for carrying an existing user interface or a project-specific design system through Google Stitch, then constraining the generated screens as they become React, React Native, dashboard, or prototype code. The repository organizes its work into three plugins and turns several steps that are often left to model judgment into explicit gates: source extraction, design-token management, MCP retrieval, visual inspection, component structure, and validation.
This review is based on a static reading of the public repository google-labs-code/stitch-skills, including its README, skill instructions, validators, examples, and scripts. The project is licensed under Apache-2.0 and follows the Agent Skills format, with instructions for Codex, Antigravity, Gemini CLI, Claude Code, Cursor, and OpenCode. The evidence has a clear boundary: no Stitch MCP endpoint was configured, no Google Stitch screen was generated, no project asset was uploaded, and no React validator was executed for this article. The claims below concern the repository's documented workflow and implementation constraints, not measured generation quality or a verified installation.
1. The hard problem is the handoff, not the first screen
A screenshot can communicate composition, but it carries very little reliable information about component states, responsive behavior, semantic structure, color roles, typography, navigation, and data boundaries. Stitch Skills treats those missing artifacts as first-class inputs and outputs. A rendered page becomes self-contained HTML. Source code becomes a structured DESIGN.md. Stitch project identifiers and screen dimensions are persisted in .stitch/metadata.json. Generated HTML and screenshots come back to the local workspace, where they can be reviewed and converted into a codebase.
The workflow does not remove model uncertainty. Instead, it distributes that uncertainty across stages with observable evidence. The agent is told what to retrieve, what to preserve, what not to invent, and when to stop for confirmation. That is the useful engineering idea: a design-to-code system is only as trustworthy as the context it can carry between design intent, generated output, and implementation.
flowchart LR A[Existing source or rendered UI] --> B[Static HTML and DESIGN.md] B --> C[Upload through Stitch MCP] C --> D[Generate or edit Stitch screens] D --> E[Download HTML and screenshots] E --> F[Visual review and token extraction] F --> G[React or React Native implementation] G --> H[Structural validation and engineering review] I[SITE.md and next-prompt.md] --> D D --> I
2. Three plugins define three kinds of responsibility
The repository avoids a monolithic “do everything” skill. Design work, build work, and cross-cutting utilities have separate owners. That separation matters because source extraction has different risks from component generation, and a multi-page build needs state that a single-screen conversion does not.
| Plugin | Skills | Responsibility |
|---|---|---|
stitch-design |
code-to-design, generate-design, manage-design-system, extract-design-md, extract-static-html, upload-to-stitch | Turn source and rendered interfaces into Stitch-ready context, then generate, edit, and maintain screens and design systems |
stitch-build |
react-components, react-native, react-vite-dashboard, remotion, shadcn-ui | Convert Stitch output into a specific implementation stack with structural and styling constraints |
stitch-utilities |
design-md, enhance-prompt, site-md, stitch-loop, taste-design | Supply design documentation, prompt refinement, site-level planning, and iterative build control |
Some names look similar until their boundaries are compared. extract-design-md reads frontend source and writes a design document without running the application. design-md analyzes an existing Stitch project. extract-static-html captures a live interface, while generate-design creates or edits screens through MCP. The repeated vocabulary reflects different stages of the same pipeline rather than redundant tooling.
3. Source extraction preserves context that screenshots lose
extract-static-html is more involved than saving outerHTML. Its recommended path uses Puppeteer to capture the rendered DOM and CSSOM after the application starts. It inlines stylesheets, images, srcset, source elements, and same-origin icon fonts. It can serialize canvases to images, remove scripts, strip development overlays, and resolve relative CSS URLs before embedding resources. The result is intended to be a portable representation of what the browser actually rendered, including rules produced by Vite, Tailwind development tooling, or CSS-in-JS.
The human checkpoints are part of the design. Before extraction, the agent must present the Puppeteer and browser-subagent strategies and ask the user to choose. After starting the local app, it must report the URL and port and wait for confirmation that the correct page is visible. These pauses prevent a login screen, error state, or development overlay from becoming the canonical visual input. Once that bad state is inlined into HTML and uploaded, every downstream model call can inherit it.
| Extraction path | Strength | Tradeoff |
|---|---|---|
| Puppeteer snapshot | Resolves computed styles for React, Vue, Angular, Next.js, and other running apps; writes directly to a file | Requires a local server and browser tooling, plus explicit user confirmation before capture |
| Browser subagent | Can click, fill forms, and navigate into a specific interactive state before extraction | Large output may exceed the agent context; styles and assets often need extra processing |
| Source-based design extraction | extract-design-md does not need the application to run and can organize declared design rules |
Declared code does not always match the browser's final computed appearance |
This is why the repository keeps source-derived design documentation and rendered snapshots as complementary artifacts. The source view can explain intended tokens and structure. The live snapshot can reveal inheritance, generated utility classes, runtime themes, and responsive decisions. A downstream agent is better prepared when it can compare the two than when it receives only one.
4. Design systems live at project scope
generate-design makes a strong separation between visual policy and page intent. Before generating a new screen, the agent must locate the project and check for an existing design system. If one exists, colors, fonts, and roundness are already applied at project level. The generation prompt must not repeat hex codes, font names, palettes, roundness values, or other design tokens. If no design system exists, the agent is directed to manage-design-system instead of inventing a new style in the prompt.
This is a useful architectural decision. New-screen prompts focus on purpose, platform, hierarchy, sections, content, and interaction. The design system handles the shared visual language. Exact color values become acceptable when a user requests a targeted edit to an existing screen, because the task is then to change a known visual property rather than define the entire theme. The distinction reduces token conflicts and prevents each generation call from reinterpreting the brand.
The skill also requires prompt enhancement before generation. Vague requests are rewritten with concrete component names, layout behavior, and professional UI terminology. After generation, the agent must surface Stitch's textual output and suggestions, then download the HTML and screenshot into .stitch/designs. The generated screen therefore leaves behind local artifacts that later stages can inspect, rather than existing only as remote state.
5. MCP is both the capability layer and the trust boundary
Stitch Skills assumes that the Stitch MCP server is installed and configured in the agent environment. Project discovery, screen generation, editing, variants, design systems, and metadata all flow through MCP tools. The README explicitly points users to the Stitch MCP setup flow and credential configuration. OpenCode users must also copy skill directories into a discoverable path and add a remote MCP entry to their configuration.
Cloning the repository is therefore not the same as having a working pipeline. Without a valid endpoint and credentials, the agent cannot create projects, generate screens, or upload assets. Once the connection exists, the data boundary becomes equally important. Static extraction inlines page copy and images into one file. Those resources may contain internal product plans, customer data, private screenshots, or confidential branding. Teams need to inspect and authorize the material before sending it to an external design service; the skill scripts cannot decide whether that transfer is appropriate.
upload-to-stitch includes a sensible implementation detail: large files are Base64-encoded inside a Python process and sent through the upload interface rather than being printed into the model context and copied back out. This avoids model output limits, but it does not change where the data goes. Efficiency and privacy have to be assessed together.
6. Code generation is where the repository becomes opinionated
react-components contains the strongest engineering gates in the project. The workflow has four phases, and each phase states the condition required before the agent may continue. First, every screen must be retrieved through MCP. The agent downloads HTML and a screenshot at the screen's actual width, then visually audits the image. It may not skip retrieval and work directly from stale local files. If matching local designs already exist, it must ask whether to refresh or reuse them.
The second phase extracts Tailwind configuration and design tokens from the current project's HTML, then overwrites style-guide.json. This prevents a subtle but costly failure mode: carrying the previous project's colors and typography into a structurally correct implementation. The third phase imposes component architecture. Reusable patterns become separate components, interaction logic moves into hooks, static content and image URLs move into mock data, and every component must declare a readonly [ComponentName]Props interface.
| Gate | Required evidence | Failure prevented |
|---|---|---|
| Screen retrieval | Every screen fetched through MCP, with HTML and screenshot downloaded and visually reviewed | Implementation based on stale, partial, or assumed design state |
| Token synchronization | Style guide rebuilt from the current project's HTML | Correct layout rendered with another project's brand tokens |
| Component architecture | Modular components, hooks, external mock data, and typed Props interfaces | Monolithic pages, hardcoded content, and unmaintainable event logic |
| Navigation and styling | Real routes instead of placeholder links; theme classes instead of arbitrary hex values | Dead navigation, missing dark-mode states, and uncontrolled visual tokens |
| Execution | User permission before validators, dependency installation, dev servers, or browser tests | Unexpected commands, local service exposure, or environment changes |
The repository includes AST-based validators that check for Props interfaces and hexadecimal colors inside className. The React Native path adds requirements for exported Props and rejects HTML intrinsic elements. These checks do not replace a code review, but they convert common model shortcuts into explicit failures. That is usually more dependable than repeating the same instruction in prose and hoping the model follows it.
7. Multi-page work uses a durable baton
stitch-loop addresses long-running site construction. It stores the site vision, Stitch project ID, page map, and roadmap in .stitch/SITE.md; visual rules live in DESIGN.md; project and screen metadata live in metadata.json; and .stitch/next-prompt.md carries the next task. Each iteration reads the baton, checks the sitemap to avoid recreating a page, generates and integrates the next screen, updates project documentation, and writes a new baton before stopping.
The autonomy is bounded. The loop can be driven manually, by a person in the middle, through CI/CD, or by an agent chain. Visual verification depends on optional Chrome DevTools MCP availability. Permission requirements still apply to running servers and validation. The real contribution is state continuity: a later agent session can recover the site plan and next task from files instead of reconstructing them from conversation history.
The approach also has an obvious dependency: the baton and project files must stay accurate. If the sitemap omits completed pages, agents will duplicate work. If metadata is not refreshed after generation, later retrieval can target the wrong screens. A durable handoff improves coordination, but it cannot make an incorrect roadmap correct.
8. Where it fits, and what must be true before deployment
The strongest fit is a team that already has a visual source and wants to preserve its design system across multiple Stitch screens before implementing them in a bounded React or React Native stack. The repository is less suitable for teams looking for a fully unattended product builder, for prototypes that can be published without review, or for private interfaces that cannot be sent to an external design service.
Before adopting it, four conditions should be verified. The agent client must discover the skill format and resolve any tool-name differences; OpenCode, for example, may require manual installation and naming adjustments. Stitch MCP must be configured with valid credentials and access to the intended project. Users must accept the strategy selection, rendered-page confirmation, local-file reuse, and testing-permission checkpoints. Finally, the team still needs independent code review, dependency review, accessibility testing, and visual acceptance; the repository's validators cover only a narrow set of structural rules.
The most interesting contribution is therefore not a particular prompt template. It is the decision to encode design-to-code work as an auditable agent protocol with evidence at each handoff: source HTML, semantic design documentation, project metadata, retrieved screenshots, synchronized tokens, typed component boundaries, and executable checks. The repository publishes no independent benchmark showing better visual fidelity or faster delivery, so those outcomes remain project-specific. What can be stated with confidence is that the workflow makes the assumptions, artifacts, and approval points visible enough for a team to test and govern.