stitch-loop

An iterative website-building workflow for Stitch, a tool that generates interface screens from descriptions. It uses a file called next-prompt.md as a handoff note between iterations, building and integrating one page at a time.

In plain words
What is it for?
Use it to generate a site page by page, integrate each result, and continue the build across repeated Stitch iterations.
Why use it?
It keeps multi-page generation organized and helps later pages follow the same design system. The handoff file records what should be built next.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/gabelul/stitch-kit/stitch-loop
Any agent
npx skills add gabelul/stitch-kit --skill stitch-loop
Clone the repo
git clone --depth 1 https://github.com/gabelul/stitch-kit

Made for: Claude Code, Codex.

Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,567 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00065 $0.01567
Opus 5 $0.00032 $0.00783
Sonnet 5 $0.00013 $0.00313
Haiku 4.5 $0.00006 $0.00157

Measured yesterday against content hash 64b9b510f578, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

stitch-loop scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/stitch-loop/SKILL.md · 184 lines

How it starts

The opening of the file, as written. The whole thing — 184 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

File What to look for
SITE.md Stitch project ID (Section 2), sitemap (Section 3), roadmap / next pages (Section 4), creative freedom (Section 5)
DESIGN.md Section 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

Read the full file on GitHub · 184 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 184 lines · 65 tokens per session scan A 64b9b510f578

Subscribe to this mod's changes

stitch-loop is a skill published in the GitHub repository gabelul/stitch-kit (43 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 65 tokens to every session and 1,567 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories