Official agent skill

Stitch SDK Usage

by google-labs-code in google-labs-code/stitch-sdk

Use the Stitch SDK to generate, edit, and iterate on UI screens from text prompts, manage projects, and retrieve screen HTML/images.

OfficialApache-2.0Auto-check passedFrontend & Design

Install Stitch SDK Usage

skills CLI
$ npx skills add google-labs-code/stitch-sdk --skill stitch-sdk-usage -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install google-labs-code/stitch-sdk stitch-sdk-usage --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/google-labs-code/stitch-sdk.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/stitch-sdk-usage .claude/skills/stitch-sdk-usage && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
stitch-sdk-usage
GitHub stars
1.8k
Token cost
~2.8k tokens
SKILL.md length
493 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
Apache-2.0

At a glance

Use the Stitch SDK to generate, edit, and iterate on UI screens from text prompts, manage projects, and retrieve screen HTML/images.

  • The user wants to consume the SDK in their application
  • SKILL.md covers Installation, Environment Variables, Quick Start and Working with Projects, plus 7 more sections
  • Calls npm; reaches stitch.googleapis.com; needs STITCH_API_KEY and STITCH_ACCESS_TOKEN

What it does

Stitch SDK Usage is an agent skill from google-labs-code/stitch-sdk, published by the product's own GitHub organization. Use the Stitch SDK to generate, edit, and iterate on UI screens from text prompts, manage projects, and retrieve screen HTML/images. Use when the user wants to consume the SDK in their application.

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Frontend & Design. It works with Google Stitch. The repository describes itself as: Generate UI screens from text prompts and extract their HTML and screenshots programmatically. The licence is Apache-2.0.

When your agent uses it

  • The user wants to consume the SDK in their application

Example prompts

  • “/stitch-sdk-usage”

Requirements

  • Node.js
  • A credential in STITCH_API_KEY
  • A credential in STITCH_ACCESS_TOKEN

What it can do on your machine

Read from SKILL.md and the folder at commit e3f8ece. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • stitch.googleapis.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • STITCH_API_KEY
    • STITCH_ACCESS_TOKEN

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Stitch SDK Usage loads about 2.8k tokens when it runs. Until then it costs about 54 tokens; SKILL.md has 493 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~54
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from google-labs-code/stitch-sdk at commit e3f8ece, republished under its Apache-2.0 licence (© google-labs-code). 493 words, ~2,847 tokens.

Download SKILL.mdSave it as .claude/skills/stitch-sdk-usage/SKILL.md (or your agent's skills folder).
name
stitch-sdk-usage
description
Use the Stitch SDK to generate, edit, and iterate on UI screens from text prompts, manage projects, and retrieve screen HTML/images. Use when the user wants to consume the SDK in their application.

Using the Stitch SDK

The Stitch SDK provides a TypeScript interface for Google Stitch, an AI-powered UI generation service.

Installation

bash
npm install @google/stitch-sdk

Environment Variables

bash
export STITCH_API_KEY="your-api-key"

Quick Start

typescript
import { stitch } from "@google/stitch-sdk";

const project = await stitch.createProject({ title: "My App" });
const generation = await project.generate("A settings page with dark theme");
const screen = generation.first; // all screens: generation.screens
const html = await screen.getHtml(); // the HTML content
const png = await screen.getImage(); // screenshot bytes (Uint8Array)

The stitch singleton reads STITCH_API_KEY from the environment and connects on first use — no setup code required.

Working with Projects

typescript
import { stitch } from "@google/stitch-sdk";

// List all projects
const projects = await stitch.projects();

// Reference a project by ID (no network call)
const project = stitch.project("4044680601076201931");

// Create a new project
const newProject = await stitch.createProject({ title: "My App" });

Design Systems

typescript
// Create a design system for a project
const ds = await project.createDesignSystem({ displayName: "My Theme" });

// List design systems
const systems = await project.listDesignSystems();

// Reference by ID (no network call)
const dsRef = project.designSystem("existing-asset-id");

// Update a design system
const updated = await ds.update({ displayName: "Updated Theme" });

// Apply to screens (requires SelectedScreenInstance objects from project.data.screenInstances)
// Returns a Generation — all updated screens are in .screens
const applied = await ds.apply([
  { id: "instance-id", sourceScreen: "projects/123/screens/456" },
]);
applied.screens;

Uploading Images

Upload an existing image file (PNG, JPG, JPEG, WEBP) to create a screen directly from a mockup or asset.

typescript
import { stitch } from "@google/stitch-sdk";

const project = stitch.project("your-project-id");

// Upload a local image file
const [screen] = await project.upload("./mockup.png", {
  title: "Home Screen",
});

console.log(screen.id);
const html = await screen.getHtml(); // HTML content
const png = await screen.getImage(); // screenshot bytes (Uint8Array)

The method reads the file from disk and posts it directly to the Stitch REST API — no output token constraints apply (unlike agent-driven MCP calls).

Supported formats: .png, .jpg, .jpeg, .webp

Options:

OptionTypeDefaultDescription
titlestring—Display title for the created screen
createScreenInstancesbooleantrueWhether to add the screen to the canvas

Throws StitchError with codes: NOT_FOUND (file not found), UNKNOWN_ERROR (unsupported format or upload failure), AUTH_FAILED (invalid API key).

Generating and Iterating on Screens

typescript
// Generate screens from a prompt. Stitch can return MANY screens per
// generation — a Generation carries all of them plus the raw response.
const generation = await project.generate(
  "Login page with email and password fields",
);
generation.screens; // every generated Screen
generation.first; // convenience: the first screen
generation.raw; // full typed tool response

// Optional settings go in a trailing options object
const mobile = await project.generate("A settings page", {
  deviceType: "MOBILE",
});

// Edit an existing screen (also returns a Generation)
const edited = await generation.first.edit(
  "Make the background dark and add a subtitle",
);

// Generate variants of a screen
const variants = await generation.first.variants(
  "Try different color schemes",
  {
    variantCount: 2,
    creativeRange: "EXPLORE",
    aspects: ["COLOR_SCHEME", "LAYOUT"],
  },
);
variants.screens; // all variant Screens

Retrieving Screen Assets

typescript
// CONTENT (fetched for you)
const html = await screen.getHtml(); // HTML string
const png = await screen.getImage(); // Uint8Array

// Or just the signed download URLs
const htmlUrl = await screen.getHtmlUrl();
const imageUrl = await screen.getImageUrl();

URL accessors use cached data from the generation response when available and write fetched responses back to the cache. A missing artifact throws StitchError with code NOT_FOUND (never a silent empty string).

Dynamic Tool Client (for agents)

For agents and orchestration scripts that forward JSON payloads to MCP tools:

typescript
import { stitch } from "@google/stitch-sdk";

// Find available tools
const { tools } = await stitch.listTools();
for (const tool of tools) {
  console.log(`${tool.name}: ${tool.description}`);
}
// Call a tool with a JSON payload
const result = await stitch.callTool("generate_screen_from_text", {
  projectId: "123",
  prompt: "A login page",
});
await stitch.close();

Error Handling

All SDK methods throw StitchError on failure. Use try/catch:

typescript
import { stitch, StitchError } from "@google/stitch-sdk";

try {
  const project = stitch.project("bad-id");
  await project.screens();
} catch (e) {
  if (e instanceof StitchError) {
    console.log(e.code); // "AUTH_FAILED", "NOT_FOUND", etc.
    console.log(e.message); // Human-readable description
    console.log(e.recoverable); // Whether retrying might succeed
  }
}

Error codes: AUTH_FAILED, NOT_FOUND, PERMISSION_DENIED, RATE_LIMITED, NETWORK_ERROR, VALIDATION_ERROR, CLARIFICATION_REQUIRED, UNKNOWN_ERROR

CLARIFICATION_REQUIRED is recoverable: generate()/edit()/variants() got a question instead of screens. Read e.clarification.question / e.clarification.suggestions and call the same method again with an answering prompt.

API Reference

Stitch Class
MethodReturnsDescription
createProject(options?)Promise<Project>Create a new project (options.title)
projects()Promise<Project[]>List all projects
project(id)ProjectReference a project by ID (no network call)
Show full SKILL.md (223 more words)Show less
Project Class
MethodReturnsDescription
generate(prompt, options?)Promise<Generation<Screen>>Generate screens — .screens, .first, .raw (options.deviceType, options.modelId)
screens()Promise<Screen[]>List all screens in the project
getScreen(screenId)Promise<Screen>Retrieve a specific screen by ID
upload(filePath, opts?)Promise<Screen[]>Upload an image/HTML file and create screen(s) from it
createDesignSystem(designSystem)Promise<DesignSystem>Create a design system for this project
listDesignSystems()Promise<DesignSystem[]>List all design systems
designSystem(id)DesignSystemReference by ID (no API call)

deviceType: "MOBILE" | "DESKTOP" | "TABLET" | "AGNOSTIC"

upload supported formats: .png .jpg .jpeg .webp .html

DesignSystem Class
MethodReturnsDescription
update(designSystem)Promise<DesignSystem>Update the design system's theme
apply(selectedScreenInstances)Promise<Generation<Screen>>Apply this design system to screens (.screens)
Screen Class
MethodReturnsDescription
getHtml()Promise<string>Fetch the screen's HTML content
getImage()Promise<Uint8Array>Fetch the screenshot bytes
getHtmlUrl() / getImageUrl()Promise<string>Signed download URLs (cache-aware)
edit(prompt, options?)Promise<Generation<Screen>>Edit the screen using a text prompt
variants(prompt, variantOptions, options?)Promise<Generation<Screen>>Generate variants of the screen

modelId: "GEMINI_3_8_FLASH" | "GEMINI_3_5_FLASH_LITE" (optional, defaults to backend default)

StitchToolClient (for agents)
MethodReturnsDescription
callTool(name, args)Promise<T>Call any MCP tool by name
listTools()Promise<Tools>Discover available tools
connect()Promise<void>Establish MCP connection (auto-called by callTool)
close()Promise<void>Close the connection
Explicit Configuration
typescript
import { Stitch, StitchToolClient } from "@google/stitch-sdk";

const client = new StitchToolClient({
  apiKey: "your-api-key",
  baseUrl: "https://stitch.googleapis.com/mcp",
  timeout: 300_000,
});

const sdk = new Stitch(client);
const projects = await sdk.projects();
OptionEnv VariableDescription
apiKeySTITCH_API_KEYAPI key for authentication
accessTokenSTITCH_ACCESS_TOKENOAuth access token
projectIdGOOGLE_CLOUD_PROJECTGCP project ID (required with OAuth)
baseUrl—MCP server URL (default: https://stitch.googleapis.com/mcp)
timeout—Request timeout in ms (default: 300000)

© google-labs-code, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/stitch-sdk-usage of google-labs-code/stitch-sdk.

Open the folder on GitHubat commit e3f8ece

Compare with similar skills

Stitch SDK Usage next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Stitch SDK Usage compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Stitch SDK Usage this skillgoogle-labs-code/stitch-sdk1.8k—~2.8kAutomated safety check: PassApache-2.0
Stitch Taste Design Systemgoogle-labs-code/stitch-skills8.4k15 repos~3.1kAutomated safety check: PassApache-2.0
Stitch Build Loopgoogle-labs-code/stitch-skills8.4k5 repos~2.6kAutomated safety check: NotesApache-2.0
Stitch to React and Vite Dashboardgoogle-labs-code/stitch-skills8.4k—~914Automated safety check: NotesApache-2.0
Stitch Designdiodeme/Gold-Band1431 repos~925Automated safety check: PassAGPL-3.0
Site Mdgoogle-labs-code/stitch-skills8.4k—~783Automated safety check: PassApache-2.0

Similar skills

  • Stitch Taste Design System

    google-labs-code/stitch-skills

    Official

    Generates a DESIGN.md design-language file for Google Stitch that encodes color, typography, layout, component behavior and motion rules to avoid generic AI-looking UI.

    8.4k GitHub starsUsed in 15 repos~3.1k tokens
    Frontend & DesignAuto-check passed
  • Stitch Build Loop

    google-labs-code/stitch-skills

    Official

    Builds a website page by page with Stitch in an autonomous loop, passing a baton file from one iteration to the next that names the next page and prompt.

    8.4k GitHub starsUsed in 5 repos~2.6k tokens
    Frontend & DesignAuto-check: notes
  • Stitch to React and Vite Dashboard

    google-labs-code/stitch-skills

    Official

    Turns Stitch screens into a React, Vite and TypeScript dashboard with TanStack Query data fetching, DESIGN.md tokens as CSS variables and optional read-only Web3 data.

    8.4k GitHub stars~914 tokensUpdated 1 mo ago
    Frontend & DesignAuto-check: notes
  • Stitch Design

    diodeme/Gold-Band

    Unified entry point for Stitch design work. An agent skill from diodeme/Gold-Band.

    143 GitHub starsUsed in 1 repo~925 tokens
    Frontend & DesignAuto-check passed
  • Site Md

    google-labs-code/stitch-skills

    Official

    Analyze a project description or site requirements and synthesize a project constitution into SITE.md for the Stitch Build Loop

    8.4k GitHub stars~783 tokensUpdated 1 mo ago
    Frontend & DesignAuto-check passed
  • Vibe Prototype

    idiotLeoLYJ/Daliu-Awesome-Skills

    Vibe Coding 流水线第五步:依据 design.md(视觉准则)与 interaction.md,为每个页面在 Stitch 画布生成原型, 经 stitch-mcp 拉取 HTML 与截图存入 prototypes/,并与交互文档做双向对齐校验。

    140 GitHub stars~3.1k tokensUpdated 29 days ago
    Frontend & DesignAuto-check passed

More from google-labs-code/stitch-sdk

All 9 skills in this repo
  • Stitch SDK Development

    google-labs-code/stitch-sdk

    Official

    Develop the Stitch SDK. An agent skill from google-labs-code/stitch-sdk.

    1.8k GitHub stars~3.4k tokensUpdated 7 days ago
    Auto-check passed
  • Stitch SDK Domain Design

    google-labs-code/stitch-sdk

    Official

    Design the domain model for the Stitch SDK. An agent skill from google-labs-code/stitch-sdk.

    1.8k GitHub stars~2.4k tokensUpdated 7 days ago
    Auto-check passed
  • Stitch SDK Pipeline

    google-labs-code/stitch-sdk

    Official

    Run the full Stitch SDK generation pipeline. An agent skill from google-labs-code/stitch-sdk.

    1.8k GitHub stars~2k tokensUpdated 7 days ago
    Auto-check passed
  • Stitch SDK Readme

    google-labs-code/stitch-sdk

    Official

    Generate or update the README for the Stitch SDK. An agent skill from google-labs-code/stitch-sdk.

    1.8k GitHub stars~1.8k tokensUpdated 7 days ago
    Auto-check passed
  • TDD Red Green Refactor

    google-labs-code/stitch-sdk

    Official

    Enforces a disciplined Red-Green-Refactor (TDD) workflow in TypeScript/Node.js.

    1.8k GitHub stars~755 tokensUpdated 7 days ago
    Auto-check passed
  • Typed Service Contracts

    google-labs-code/stitch-sdk

    Official

    Architecture standard for building robust, type-safe TypeScript services using the "Spec and Handler" pattern.

    1.8k GitHub stars~1.4k tokensUpdated 7 days ago
    Auto-check passed

Works with

Questions about Stitch SDK Usage

What does Stitch SDK Usage do?

Use the Stitch SDK to generate, edit, and iterate on UI screens from text prompts, manage projects, and retrieve screen HTML/images. Stitch SDK Usage is an agent skill from google-labs-code/stitch-sdk, published by the product's own GitHub organization. Use the Stitch SDK to generate, edit, and iterate on UI screens from text prompts, manage projects, and retrieve screen HTML/images.

When should I use Stitch SDK Usage?

Stitch SDK Usage fits situations like: the user wants to consume the SDK in their application.

How do I install Stitch SDK Usage in Claude Code?

Run `npx skills add google-labs-code/stitch-sdk --skill stitch-sdk-usage -a claude-code`. Or copy the skill folder (.agents/skills/stitch-sdk-usage in google-labs-code/stitch-sdk) into .claude/skills/stitch-sdk-usage in your project. Claude Code loads it when a task matches its description.

How do I install Stitch SDK Usage in Codex?

Run `npx skills add google-labs-code/stitch-sdk --skill stitch-sdk-usage -a codex`. Or copy the skill folder (.agents/skills/stitch-sdk-usage in google-labs-code/stitch-sdk) into .agents/skills/stitch-sdk-usage in your project. Codex loads it when a task matches its description.

Can I use Stitch SDK Usage in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add google-labs-code/stitch-sdk --skill stitch-sdk-usage -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/stitch-sdk-usage, .gemini/skills/stitch-sdk-usage, .github/skills/stitch-sdk-usage and .opencode/skills/stitch-sdk-usage in your project.

What does Stitch SDK Usage need to run?

Going by SKILL.md and its folder, Stitch SDK Usage needs the command-line tools its instructions call (npm) and credentials named STITCH_API_KEY and STITCH_ACCESS_TOKEN. Our summary lists: Node.js; A credential in STITCH_API_KEY; A credential in STITCH_ACCESS_TOKEN.

Does Stitch SDK Usage access the network?

SKILL.md names 1 domain. In commands or code: stitch.googleapis.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Stitch SDK Usage safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Stitch SDK Usage use?

Stitch SDK Usage is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Stitch SDK Usage use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Stitch SDK Usage?

Skills that share tags, products or a category with Stitch SDK Usage: Stitch Taste Design System (google-labs-code/stitch-skills, 8.4k stars), Stitch Build Loop (google-labs-code/stitch-skills, 8.4k stars), Stitch to React and Vite Dashboard (google-labs-code/stitch-skills, 8.4k stars) and Stitch Design (diodeme/Gold-Band, 143 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Stitch SDK Usage?

google-labs-code (a GitHub organization, an official publisher) maintains it in google-labs-code/stitch-sdk, which has 1,826 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 1, 2026.

Source: google-labs-code/stitch-sdk on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.