# /stitch-loop: Build a multi-page site with an autonomous Stitch loop

Source: https://trendhub.net/skills/google-labs-code-stitch-skills/stitch-loop
Skill folder: https://github.com/google-labs-code/stitch-skills/tree/main/plugins/stitch-utilities/skills/stitch-loop
Pack: Stitch Skills (https://trendhub.net/skills/google-labs-code-stitch-skills)
Works with: Codex, Claude Code, Cursor, Any Agent Skills host (selective), OpenCode

stitch-loop sets up a repeatable cycle in which each agent run builds one page. A baton file names the next page and carries its prompt; the agent generates it in Stitch, moves the HTML into the site, wires navigation, updates the sitemap and writes the next baton. It can run under CI, agent chains or manual review.

## When to use it

- You want a multi-page marketing or portfolio site generated in consistent style.
- You want an agent to keep extending a site from a roadmap across many runs.
- You want each page checked against its Stitch screenshot in a browser.

## How it works

1. **Read the baton**: The agent parses .stitch/next-prompt.md for the page name and prompt, which must include the design-system block from DESIGN.md.
2. **Consult context**: It reads SITE.md for the project ID, existing pages, roadmap and ideas, and refuses to recreate pages already built.
3. **Generate and download**: It generates the screen in Stitch, records IDs in metadata.json and downloads full-resolution HTML and screenshots, asking before overwriting local files.
4. **Integrate and verify**: It moves the page into site/public, fixes asset paths, wires placeholder links and, if Chrome DevTools MCP is present, compares a screenshot.
5. **Pass the baton**: It marks the page in the sitemap, updates the roadmap and writes the next page's prompt so the loop continues.

## What it steers the agent away from

- Rebuilding a page that is already in the sitemap
- Leaving href="#" placeholder links unwired
- Ending a run without writing the next baton

## What it can touch

Calls Stitch MCP tools, downloads files, writes .stitch/ files and site/public pages, and may start a local server and drive Chrome through the Chrome DevTools MCP server.

## Pairs well with

- `/generate-design`
- `/design-md`
- `/site-md`

## Questions

### What files must exist before the first run?

A .stitch/DESIGN.md, which the design-md skill can create, and a .stitch/SITE.md describing the vision and roadmap, which site-md can draft.

### What triggers the next iteration?

The skill does not care: a CI job watching the baton file, a person rerunning the agent, or one agent dispatching another all work.
