Skip to content
cccskills
FreePublished on GitHub

stitch-loop

Iteratively build multi-page websites using Stitch. Reads next-prompt.md (the baton), generates the next page with Stitch MCP, integrates it into the site, then updates next-prompt.md to continue the loop. Works with stitch-design-md and stitch-ui-prompt-architect for consistent multi-page output.

The English summary is being prepared. Showing the original description.

See how to install

Files included (4)

  • SKILL.md6.2 KB
  • examples/next-prompt.md1.1 KB
  • examples/SITE.md1.4 KB
  • examples/usage.md2.8 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Stitch Build Loop

Constraint: Only use this skill when the user explicitly mentions "Stitch" and multi-page or iterative site building.

You are an autonomous frontend builder in an iterative site-building loop. Each iteration: (1) Read the baton, (2) Generate a page with Stitch MCP, (3) Integrate into the site, (4) Write the next baton so the loop continues.

Prerequisites

  • Stitch MCP Server (see stitch-setup skill or https://stitch.withgoogle.com/docs/mcp/guide/)
  • DESIGN.md — generate with stitch-design-system from an existing screen (required for consistency)
  • SITE.md — site vision, Stitch project ID, sitemap, roadmap (create if missing)

The baton system

next-prompt.md is the relay baton between iterations. It tells the loop what page to build next.

Baton format

---
page: about
---

**DESIGN SYSTEM (REQUIRED):**
[Paste DESIGN.md Section 6 here verbatim]

**Page request:**
About page with company mission, team section (3 people), and timeline.

Rules:

  • page frontmatter → output filename (about.html)
  • The body must include the design system block from DESIGN.md Section 6
  • You must update next-prompt.md at the end of every iteration — the loop stops if this is missing

Execution protocol

Step 1 — Read the baton

Parse next-prompt.md:

  • Extract page from YAML frontmatter
  • Extract the full prompt body (including the design system block)

Step 2 — Consult context files

FileWhat to look for
SITE.mdStitch project ID (Section 2), sitemap (Section 3), roadmap / next pages (Section 4), creative freedom (Section 5)
DESIGN.mdSection 6 — copy this into every prompt, not just the current one

Check: Do not rebuild pages already in SITE.md sitemap. Do not deviate from the visual language in DESIGN.md.

Step 3 — Generate with Stitch

  1. Run list_tools → find Stitch MCP prefix
  2. If stitch.json exists, use stored projectId — do not create a new project
  3. If no stitch.json, call create_project → save numeric ID to stitch.json
  4. Call generate_screen_from_text:
    • projectId: numeric ID (no projects/ prefix)
    • prompt: full baton content including DESIGN SYSTEM block
    • deviceType: match what's in SITE.md or DESIGN.md
  5. Call get_screen with numeric projectId + screenId
  6. Download HTML: bash scripts/fetch-stitch.sh "[htmlCode.downloadUrl]" "queue/[page].html"
  7. Download screenshot: save to queue/[page].png

Step 4 — Integrate into site

  1. Move queue/[page].html → site/public/[page].html
  2. Fix asset paths (make relative to site/public/)
  3. Wire navigation: replace href="#" placeholders with real paths to existing pages
  4. Ensure the header/footer matches other pages in the site

Step 4.5 — Visual verification (if Chrome DevTools MCP available)

If chrome* tools are in list_tools:

  1. Start local server: npx serve site/public -p 3000
  2. Navigate to http://localhost:3000/[page].html
  3. Take screenshot, compare against queue/[page].png
  4. Stop server

Step 5 — Update SITE.md

  • Add [x] [page].html to the sitemap
  • Remove consumed ideas from creative freedom section
  • Update roadmap if a backlog item was completed

Step 6 — Write the next baton (CRITICAL)

You must update next-prompt.md before completing — the loop stalls if you skip this.

  1. Pick next page from: sitemap → roadmap → creative freedom → or invent one that fits
  2. Write next-prompt.md with:
    • Valid YAML frontmatter (page: <next-page-name>)
    • **DESIGN SYSTEM (REQUIRED):** block copied verbatim from DESIGN.md Section 6
    • Clear page description

File structure

project/
├── next-prompt.md       ← Baton (current task; updated each iteration)
├── stitch.json          ← Stitch project ID (persist between loops!)
├── DESIGN.md            ← From stitch-design-system
├── SITE.md              ← Vision, sitemap, roadmap
├── queue/               ← Staging: [page].html, [page].png
└── site/
    └── public/          ← Production: index.html, about.html, etc.

SITE.md template

# Site Vision

[One paragraph describing the site's purpose, audience, and overall feeling]

## Stitch Project

- **Project ID (numeric):** [ID from stitch-mcp-create-project]

## Sitemap

- [ ] index.html — Home
- [ ] about.html — About
- [ ] contact.html — Contact

## Roadmap

1. index.html — main landing page
2. about.html — company/team info
3. contact.html — contact form

## Creative freedom

Additional pages or sections not yet planned...

Common pitfalls

  • ❌ Forgetting to update next-prompt.md (loop stops)
  • ❌ Rebuilding a page already in SITE.md sitemap
  • ❌ Omitting DESIGN.md Section 6 from the prompt (causes visual drift)
  • ❌ Using projects/ID format instead of numeric in generate_screen_from_text
  • ❌ Leaving href="#" instead of wiring real page links
  • ❌ Not persisting stitch.json (creates new project every iteration)

Troubleshooting

IssueFix
Inconsistent visual styles across pagesKeep DESIGN.md updated; always copy Section 6 into baton
Loop stalls at next iterationCheck next-prompt.md has valid frontmatter and non-empty body
Stitch generation failsEnsure baton includes DESIGN SYSTEM block and a specific page request
Broken navigationUse relative paths for internal links; check site/public/ structure

References

  • scripts/fetch-stitch.sh — Reliable GCS HTML downloader
  • stitch-design-system — Generate DESIGN.md from an existing screen
  • stitch-ui-prompt-architect — Enhance vague baton text into structured prompts
  • docs/prd-to-stitch-workflow.md — PRD-driven multi-screen workflow

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Audits Stitch-generated components for WCAG 2.1 AA accessibility issues and applies fixes — semantic HTML, ARIA attributes, keyboard navigation, focus management, and screen reader support.

The English summary is being prepared. Showing the original description.

gabelul/stitch-kit45Updated Jul 21, 2026

Adds a purposeful animation layer to Stitch-generated components — CSS transitions, Framer Motion (React/Next.js), or Svelte transitions. Always respects prefers-reduced-motion.

The English summary is being prepared. Showing the original description.

gabelul/stitch-kit45Updated Jul 21, 2026

Analyzes a Stitch project's screens and synthesizes a natural-language DESIGN.md — visual atmosphere, color palette with hex values, typography rules, and Stitch-ready prompt snippets. Use this before stitch-loop or any multi-page build to establish design consistency.

The English summary is being prepared. Showing the original description.

gabelul/stitch-kit45Updated Jul 21, 2026

Extracts a Stitch design and generates production code artifacts — CSS custom properties with dark mode tokens, a Tailwind v4 @theme block, and a semantic design system document. Run this before framework conversion skills.

The English summary is being prepared. Showing the original description.

gabelul/stitch-kit45Updated Jul 21, 2026

Converts a Stitch screen, a local HTML file, or a URL into clean, platform-agnostic HTML5 + CSS — semantic markup, CSS custom properties for theming, dark mode via prefers-color-scheme, mobile-first responsive, zero framework dependencies. Works in browsers, WebViews, Capacitor, and Ionic. Only the Stitch route needs an API key.

The English summary is being prepared. Showing the original description.

gabelul/stitch-kit45Updated Jul 21, 2026

Conversational design ideation agent that researches trends, explores visual directions, and refines ideas through adaptive questioning — then produces a rich PRD document and auto-generates Stitch screens. Your design buddy that thinks deeply before designing.

The English summary is being prepared. Showing the original description.

gabelul/stitch-kit45Updated Jul 21, 2026

See all skills by gabelul

Report a problem with this skill