stitch-loop — stitch-loop setup .stitch directory stitch-loop, stitch-skills, official, stitch-loop setup .stitch directory, ide skills, autonomous website build loop pattern, AI agent iterative development workflow, Claude Code, Cursor, Windsurf

Verified
v1.0.0
GitHub

About this Skill

Ideal for autonomous frontend builder agents seeking to master iterative website development using Stitch with a baton-passing loop pattern stitch-loop is an AI agent skill that implements an autonomous iterative build pattern for website creation. It uses a baton file (`.stitch/next-prompt.md`) to pass tasks between iterations, generating pages with Stitch MCP tools and integrating them into the site structure.

Features

Reads build tasks from the `.stitch/next-prompt.md` baton file
Generates pages using Stitch MCP tools
Integrates newly created pages into the existing site structure
Prepares instructions for the next iteration in the autonomous loop
Implements baton-passing pattern for continuous development cycles
Operates as part of an autonomous frontend builder workflow

# Core Topics

google-labs-code google-labs-code
[2.2k]
[256]
Updated: 3/6/2026

Agent Capability Analysis

The stitch-loop skill by google-labs-code is an open-source official AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance. Optimized for stitch-loop setup .stitch directory, autonomous website build loop pattern, AI agent iterative development workflow.

Ideal Agent Persona

Ideal for autonomous frontend builder agents seeking to master iterative website development using Stitch with a baton-passing loop pattern

Core Value

Empowers agents to generate pages using Stitch MCP tools, integrate them into sites, and prepare instructions for the next iteration, leveraging the autonomous baton-passing loop pattern and reading from `.stitch/next-prompt.md` files

Capabilities Granted for stitch-loop

Generating pages using Stitch MCP tools
Integrating pages into existing websites
Preparing instructions for subsequent build loop iterations

! Prerequisites & Limits

  • Requires Stitch MCP tools
  • Dependent on `.stitch/next-prompt.md` file format
  • Autonomous loop pattern may require additional configuration
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

stitch-loop

Install stitch-loop, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

Stitch Build Loop

You are an autonomous frontend builder participating in an iterative site-building loop. Your goal is to generate a page using Stitch, integrate it into the site, and prepare instructions for the next iteration.

Overview

The Build Loop pattern enables continuous, autonomous website development through a "baton" system. Each iteration:

  1. Reads the current task from a baton file (.stitch/next-prompt.md)
  2. Generates a page using Stitch MCP tools
  3. Integrates the page into the site structure
  4. Writes the next task to the baton file for the next iteration

Prerequisites

Required:

  • Access to the Stitch MCP Server
  • A Stitch project (existing or will be created)
  • A .stitch/DESIGN.md file (generate one using the design-md skill if needed)
  • A .stitch/SITE.md file documenting the site vision and roadmap

Optional:

  • Chrome DevTools MCP Server — enables visual verification of generated pages

The Baton System

The .stitch/next-prompt.md file acts as a relay baton between iterations:

markdown
1--- 2page: about 3--- 4A page describing how jules.top tracking works. 5 6**DESIGN SYSTEM (REQUIRED):** 7[Copy from .stitch/DESIGN.md Section 6] 8 9**Page Structure:** 101. Header with navigation 112. Explanation of tracking methodology 123. Footer with links

Critical rules:

  • The page field in YAML frontmatter determines the output filename
  • The prompt content must include the design system block from .stitch/DESIGN.md
  • You MUST update this file before completing your work to continue the loop

Execution Protocol

Step 1: Read the Baton

Parse .stitch/next-prompt.md to extract:

  • Page name from the page frontmatter field
  • Prompt content from the markdown body

Step 2: Consult Context Files

Before generating, read these files:

FilePurpose
.stitch/SITE.mdSite vision, Stitch Project ID, existing pages (sitemap), roadmap
.stitch/DESIGN.mdRequired visual style for Stitch prompts

Important checks:

  • Section 4 (Sitemap) — Do NOT recreate pages that already exist
  • Section 5 (Roadmap) — Pick tasks from here if backlog exists
  • Section 6 (Creative Freedom) — Ideas for new pages if roadmap is empty

Step 3: Generate with Stitch

Use the Stitch MCP tools to generate the page:

  1. Discover namespace: Run list_tools to find the Stitch MCP prefix
  2. Get or create project:
    • If .stitch/metadata.json exists, use the projectId from it
    • Otherwise, call [prefix]:create_project, then call [prefix]:get_project to retrieve full project details, and save them to .stitch/metadata.json (see schema below)
    • After generating each screen, call [prefix]:get_project again and update the screens map in .stitch/metadata.json with each screen's full metadata (id, sourceScreen, dimensions, canvas position)
  3. Generate screen: Call [prefix]:generate_screen_from_text with:
    • projectId: The project ID
    • prompt: The full prompt from the baton (including design system block)
    • deviceType: DESKTOP (or as specified)
  4. Retrieve assets: Before downloading, check if .stitch/designs/{page}.html and .stitch/designs/{page}.png already exist:
    • If files exist: Ask the user whether to refresh the designs from the Stitch project or reuse the existing local files. Only re-download if the user confirms.
    • If files do not exist: Proceed with download:
      • htmlCode.downloadUrl — Download and save as .stitch/designs/{page}.html
      • screenshot.downloadUrl — Append =w{width} to the URL before downloading, where {width} is the width value from the screen metadata (Google CDN serves low-res thumbnails by default). Save as .stitch/designs/{page}.png

Step 4: Integrate into Site

  1. Move generated HTML from .stitch/designs/{page}.html to site/public/{page}.html
  2. Fix any asset paths to be relative to the public folder
  3. Update navigation:
    • Find existing placeholder links (e.g., href="#") and wire them to the new page
    • Add the new page to the global navigation if appropriate
  4. Ensure consistent headers/footers across all pages

Step 4.5: Visual Verification (Optional)

If the Chrome DevTools MCP Server is available, verify the generated page:

  1. Check availability: Run list_tools to see if chrome* tools are present
  2. Start dev server: Use Bash to start a local server (e.g., npx serve site/public)
  3. Navigate to page: Call [chrome_prefix]:navigate to open http://localhost:3000/{page}.html
  4. Capture screenshot: Call [chrome_prefix]:screenshot to capture the rendered page
  5. Visual comparison: Compare against the Stitch screenshot (.stitch/designs/{page}.png) for fidelity
  6. Stop server: Terminate the dev server process

Note: This step is optional. If Chrome DevTools MCP is not installed, skip to Step 5.

Step 5: Update Site Documentation

Modify .stitch/SITE.md:

  • Add the new page to Section 4 (Sitemap) with [x]
  • Remove any idea you consumed from Section 6 (Creative Freedom)
  • Update Section 5 (Roadmap) if you completed a backlog item

Step 6: Prepare the Next Baton (Critical)

You MUST update .stitch/next-prompt.md before completing. This keeps the loop alive.

  1. Decide the next page:
    • Check .stitch/SITE.md Section 5 (Roadmap) for pending items
    • If empty, pick from Section 6 (Creative Freedom)
    • Or invent something new that fits the site vision
  2. Write the baton with proper YAML frontmatter:
markdown
1--- 2page: achievements 3--- 4A competitive achievements page showing developer badges and milestones. 5 6**DESIGN SYSTEM (REQUIRED):** 7[Copy the entire design system block from .stitch/DESIGN.md] 8 9**Page Structure:** 101. Header with title and navigation 112. Badge grid showing unlocked/locked states 123. Progress bars for milestone tracking

File Structure Reference

project/
├── .stitch/
│   ├── metadata.json   # Stitch project & screen IDs (persist this!)
│   ├── DESIGN.md       # Visual design system (from design-md skill)
│   ├── SITE.md         # Site vision, sitemap, roadmap
│   ├── next-prompt.md  # The baton — current task
│   └── designs/        # Staging area for Stitch output
│       ├── {page}.html
│       └── {page}.png
└── site/public/        # Production pages
    ├── index.html
    └── {page}.html

.stitch/metadata.json Schema

This file persists all Stitch identifiers so future iterations can reference them for edits or variants. Populate it by calling [prefix]:get_project after creating a project or generating screens.

json
1{ 2 "name": "projects/6139132077804554844", 3 "projectId": "6139132077804554844", 4 "title": "My App", 5 "visibility": "PRIVATE", 6 "createTime": "2026-03-04T23:11:25.514932Z", 7 "updateTime": "2026-03-04T23:34:40.400007Z", 8 "projectType": "PROJECT_DESIGN", 9 "origin": "STITCH", 10 "deviceType": "MOBILE", 11 "designTheme": { 12 "colorMode": "DARK", 13 "font": "INTER", 14 "roundness": "ROUND_EIGHT", 15 "customColor": "#40baf7", 16 "saturation": 3 17 }, 18 "screens": { 19 "index": { 20 "id": "d7237c7d78f44befa4f60afb17c818c1", 21 "sourceScreen": "projects/6139132077804554844/screens/d7237c7d78f44befa4f60afb17c818c1", 22 "x": 0, 23 "y": 0, 24 "width": 390, 25 "height": 1249 26 }, 27 "about": { 28 "id": "bf6a3fe5c75348e58cf21fc7a9ddeafb", 29 "sourceScreen": "projects/6139132077804554844/screens/bf6a3fe5c75348e58cf21fc7a9ddeafb", 30 "x": 549, 31 "y": 0, 32 "width": 390, 33 "height": 1159 34 } 35 }, 36 "metadata": { 37 "userRole": "OWNER" 38 } 39}
FieldDescription
nameFull resource name (projects/{id})
projectIdStitch project ID (from create_project or get_project)
titleHuman-readable project title
designThemeDesign system tokens: color mode, font, roundness, custom color, saturation
deviceTypeTarget device: MOBILE, DESKTOP, TABLET
screensMap of page name → screen object. Each screen includes id, sourceScreen (resource path for MCP calls), canvas position (x, y), and dimensions (width, height)
metadata.userRoleUser's role on the project (OWNER, EDITOR, VIEWER)

Orchestration Options

The loop can be driven by different orchestration layers:

MethodHow it works
CI/CDGitHub Actions triggers on .stitch/next-prompt.md changes
Human-in-loopDeveloper reviews each iteration before continuing
Agent chainsOne agent dispatches to another (e.g., Jules API)
ManualDeveloper runs the agent repeatedly with the same repo

The skill is orchestration-agnostic — focus on the pattern, not the trigger mechanism.

Design System Integration

This skill works best with the design-md skill:

  1. First time setup: Generate .stitch/DESIGN.md using the design-md skill from an existing Stitch screen
  2. Every iteration: Copy Section 6 ("Design System Notes for Stitch Generation") into your baton prompt
  3. Consistency: All generated pages will share the same visual language

Common Pitfalls

  • ❌ Forgetting to update .stitch/next-prompt.md (breaks the loop)
  • ❌ Recreating a page that already exists in the sitemap
  • ❌ Not including the design system block from .stitch/DESIGN.md in the prompt
  • ❌ Leaving placeholder links (href="#") instead of wiring real navigation
  • ❌ Forgetting to persist .stitch/metadata.json after creating a new project

Troubleshooting

IssueSolution
Stitch generation failsCheck that the prompt includes the design system block
Inconsistent stylesEnsure .stitch/DESIGN.md is up-to-date and copied correctly
Loop stallsVerify .stitch/next-prompt.md was updated with valid frontmatter
Navigation brokenCheck all internal links use correct relative paths

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is stitch-loop?

Ideal for autonomous frontend builder agents seeking to master iterative website development using Stitch with a baton-passing loop pattern stitch-loop is an AI agent skill that implements an autonomous iterative build pattern for website creation. It uses a baton file (`.stitch/next-prompt.md`) to pass tasks between iterations, generating pages with Stitch MCP tools and integrating them into the site structure.

How do I install stitch-loop?

Run the command: npx killer-skills add google-labs-code/stitch-skills/stitch-loop. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for stitch-loop?

Key use cases include: Generating pages using Stitch MCP tools, Integrating pages into existing websites, Preparing instructions for subsequent build loop iterations.

Which IDEs are compatible with stitch-loop?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for stitch-loop?

Requires Stitch MCP tools. Dependent on `.stitch/next-prompt.md` file format. Autonomous loop pattern may require additional configuration.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add google-labs-code/stitch-skills/stitch-loop. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use stitch-loop immediately in the current project.

Related Skills

Looking for an alternative to stitch-loop or another official skill for your workflow? Explore these related open-source skills.

View All

flags

Logo of facebook
facebook

Use when you need to check feature flag states, compare channels, or debug why a feature behaves differently across release channels.

243.6k
0
Developer

extract-errors

Logo of facebook
facebook

Use when adding new error messages to React, or seeing unknown error code warnings.

243.6k
0
Developer

fix

Logo of facebook
facebook

Use when you have lint errors, formatting issues, or before committing code to ensure it passes CI.

243.6k
0
Developer

flow

Logo of facebook
facebook

Use when you need to run Flow type checking, or when seeing Flow type errors in React code.

243.6k
0
Developer