stitch-loop
Original:🇺🇸 English
Not Translated
Teaches agents to iteratively build websites using Stitch with an autonomous baton-passing loop pattern
1installs
Added on
NPX Install
npx skill4agent add hasinananwu/stitch-skills stitch-loopSKILL.md Content
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:
- Reads the current task from a baton file ()
next-prompt.md - Generates a page using Stitch MCP tools
- Integrates the page into the site structure
- 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 file (generate one using the
DESIGN.mdskill if needed)design-md - A file documenting the site vision and roadmap
SITE.md
Optional:
- Chrome DevTools MCP Server — enables visual verification of generated pages
The Baton System
The file acts as a relay baton between iterations:
next-prompt.mdmarkdown
---
page: about
---
A page describing how jules.top tracking works.
**DESIGN SYSTEM (REQUIRED):**
[Copy from DESIGN.md Section 6]
**Page Structure:**
1. Header with navigation
2. Explanation of tracking methodology
3. Footer with linksCritical rules:
- The field in YAML frontmatter determines the output filename
page - The prompt content must include the design system block from
DESIGN.md - You MUST update this file before completing your work to continue the loop
Execution Protocol
Step 1: Read the Baton
Parse to extract:
next-prompt.md- Page name from the frontmatter field
page - Prompt content from the markdown body
Step 2: Consult Context Files
Before generating, read these files:
| File | Purpose |
|---|---|
| Site vision, Stitch Project ID, existing pages (sitemap), roadmap |
| Required 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:
- Discover namespace: Run to find the Stitch MCP prefix
list_tools - Get or create project:
- If exists, use the
stitch.jsonfrom itprojectId - Otherwise, call and save the ID to
[prefix]:create_projectstitch.json
- If
- Generate screen: Call with:
[prefix]:generate_screen_from_text- : The project ID
projectId - : The full prompt from the baton (including design system block)
prompt - :
deviceType(or as specified)DESKTOP
- Retrieve assets: Call to get:
[prefix]:get_screen- — Download and save as
htmlCode.downloadUrlqueue/{page}.html - — Download and save as
screenshot.downloadUrlqueue/{page}.png
Step 4: Integrate into Site
- Move generated HTML from to
queue/{page}.htmlsite/public/{page}.html - Fix any asset paths to be relative to the public folder
- Update navigation:
- Find existing placeholder links (e.g., ) and wire them to the new page
href="#" - Add the new page to the global navigation if appropriate
- Find existing placeholder links (e.g.,
- 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:
- Check availability: Run to see if
list_toolstools are presentchrome* - Start dev server: Use Bash to start a local server (e.g., )
npx serve site/public - Navigate to page: Call to open
[chrome_prefix]:navigatehttp://localhost:3000/{page}.html - Capture screenshot: Call to capture the rendered page
[chrome_prefix]:screenshot - Visual comparison: Compare against the Stitch screenshot () for fidelity
queue/{page}.png - 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 :
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 before completing. This keeps the loop alive.
next-prompt.md- Decide the next page:
- Check Section 5 (Roadmap) for pending items
SITE.md - If empty, pick from Section 6 (Creative Freedom)
- Or invent something new that fits the site vision
- Check
- Write the baton with proper YAML frontmatter:
markdown
---
page: achievements
---
A competitive achievements page showing developer badges and milestones.
**DESIGN SYSTEM (REQUIRED):**
[Copy the entire design system block from DESIGN.md]
**Page Structure:**
1. Header with title and navigation
2. Badge grid showing unlocked/locked states
3. Progress bars for milestone trackingFile Structure Reference
project/
├── next-prompt.md # The baton — current task
├── stitch.json # Stitch project ID (persist this!)
├── DESIGN.md # Visual design system (from design-md skill)
├── SITE.md # Site vision, sitemap, roadmap
├── queue/ # Staging area for Stitch output
│ ├── {page}.html
│ └── {page}.png
└── site/public/ # Production pages
├── index.html
└── {page}.htmlOrchestration Options
The loop can be driven by different orchestration layers:
| Method | How it works |
|---|---|
| CI/CD | GitHub Actions triggers on |
| Human-in-loop | Developer reviews each iteration before continuing |
| Agent chains | One agent dispatches to another (e.g., Jules API) |
| Manual | Developer 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 skill:
design-md- First time setup: Generate using the
DESIGN.mdskill from an existing Stitch screendesign-md - Every iteration: Copy Section 6 ("Design System Notes for Stitch Generation") into your baton prompt
- Consistency: All generated pages will share the same visual language
Common Pitfalls
- ❌ Forgetting to update (breaks the loop)
next-prompt.md - ❌ Recreating a page that already exists in the sitemap
- ❌ Not including the design system block in the prompt
- ❌ Leaving placeholder links () instead of wiring real navigation
href="#" - ❌ Forgetting to persist after creating a new project
stitch.json
Troubleshooting
| Issue | Solution |
|---|---|
| Stitch generation fails | Check that the prompt includes the design system block |
| Inconsistent styles | Ensure DESIGN.md is up-to-date and copied correctly |
| Loop stalls | Verify |
| Navigation broken | Check all internal links use correct relative paths |