A library of Agent Skills designed to work with the Stitch MCP server. Each skill follows the Agent Skills open standard, for compatibility with coding agents such as Antigravity, Gemini CLI, Claude Code, Cursor.
TypeScript
Update two skills: 1. change all stitch related files into .stitch, 2. download png as well (#31)
J XIAaa363eed1fdc
diff --git a/skills/react-components/SKILL.md b/skills/react-components/SKILL.mdindex 6fb25b8..feac88c 100644--- a/skills/react-components/SKILL.md+++ b/skills/react-components/SKILL.md@@ -16,10 +16,14 @@ You are a frontend engineer focused on transforming designs into clean React cod## Retrieval and networking1. **Namespace discovery**: Run `list_tools` to find the Stitch MCP prefix. Use this prefix (e.g., `stitch:`) for all subsequent calls.2. **Metadata fetch**: Call `[prefix]:get_screen` to retrieve the design JSON.-3. **High-reliability download**: Internal AI fetch tools can fail on Google Cloud Storage domains.- - Use the `Bash` tool to run: `bash scripts/fetch-stitch.sh "[htmlCode.downloadUrl]" "temp/source.html"`.+3. **Check for existing designs**: 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 using the MCP, or reuse the existing local files. Only re-download if the user confirms.+ - **If files do not exist**: Proceed to step 4.+4. **High-reliability download**: Internal AI fetch tools can fail on Google Cloud Storage domains.+ - **HTML**: `bash scripts/fetch-stitch.sh "[htmlCode.downloadUrl]" ".stitch/designs/{page}.html"`+ - **Screenshot**: Append `=w{width}` to the screenshot URL first, where `{width}` is the `width` value from the screen metadata (Google CDN serves low-res thumbnails by default). Then run: `bash scripts/fetch-stitch.sh "[screenshot.downloadUrl]=w{width}" ".stitch/designs/{page}.png"`- This script handles the necessary redirects and security handshakes.-4. **Visual audit**: Check `screenshot.downloadUrl` to confirm the design intent and layout details.+5. **Visual audit**: Review the downloaded screenshot (`.stitch/designs/{page}.png`) to confirm design intent and layout details.## Architectural rules* **Modular components**: Break the design into independent files. Avoid large, single-file outputs.diff --git a/skills/stitch-loop/SKILL.md b/skills/stitch-loop/SKILL.mdindex 1f7b9c2..191e8be 100644--- a/skills/stitch-loop/SKILL.md+++ b/skills/stitch-loop/SKILL.md@@ -16,7 +16,7 @@ You are an **autonomous frontend builder** participating in an iterative site-bu## OverviewThe Build Loop pattern enables continuous, autonomous website development through a "baton" system. Each iteration:-1. Reads the current task from a baton file (`next-prompt.md`)+1. Reads the current task from a baton file (`.stitch/next-prompt.md`)2. Generates a page using Stitch MCP tools3. Integrates the page into the site structure4. Writes the next task to the baton file for the next iteration@@ -26,15 +26,15 @@ The Build Loop pattern enables continuous, autonomous website development throug**Required:**- Access to the Stitch MCP Server- A Stitch project (existing or will be created)-- A `DESIGN.md` file (generate one using the `design-md` skill if needed)-- A `SITE.md` file documenting the site vision and roadmap+- 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 `next-prompt.md` file acts as a relay baton between iterations:+The `.stitch/next-prompt.md` file acts as a relay baton between iterations:```markdown---@@ -43,7 +43,7 @@ page: aboutA page describing how jules.top tracking works.**DESIGN SYSTEM (REQUIRED):**-[Copy from DESIGN.md Section 6]+[Copy from .stitch/DESIGN.md Section 6]**Page Structure:**1. Header with navigation@@ -53,14 +53,14 @@ A page describing how jules.top tracking works.**Critical rules:**- The `page` field in YAML frontmatter determines the output filename-- The prompt content must include the design system block from `DESIGN.md`+- 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 `next-prompt.md` to extract:+Parse `.stitch/next-prompt.md` to extract:- **Page name** from the `page` frontmatter field- **Prompt content** from the markdown body@@ -70,8 +70,8 @@ Before generating, read these files:| File | Purpose ||------|---------|-| `SITE.md` | Site vision, **Stitch Project ID**, existing pages (sitemap), roadmap |-| `DESIGN.md` | Required visual style for Stitch prompts |+| `.stitch/SITE.md` | Site vision, **Stitch Project ID**, existing pages (sitemap), roadmap |+| `.stitch/DESIGN.md` | Required visual style for Stitch prompts |**Important checks:**- Section 4 (Sitemap) — Do NOT recreate pages that already exist@@ -84,19 +84,22 @@ Use the Stitch MCP tools to generate the page:1. **Discover namespace**: Run `list_tools` to find the Stitch MCP prefix2. **Get or create project**:- - If `stitch.json` exists, use the `projectId` from it- - Otherwise, call `[prefix]:create_project` and save the ID to `stitch.json`+ - If `.stitch/metadata.json` exists, use the `projectId` from it+ - Otherwise, call `[prefix]:create_project` and save the result to `.stitch/metadata.json`+ - After generating each screen, add its ID to the `screens` map in `.stitch/metadata.json`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**: Call `[prefix]:get_screen` to get:- - `htmlCode.downloadUrl` — Download and save as `queue/{page}.html`- - `screenshot.downloadUrl` — Download and save as `queue/{page}.png`+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 `queue/{page}.html` to `site/public/{page}.html`+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 folder3. Update navigation:- Find existing placeholder links (e.g., `href="#"`) and wire them to the new page@@ -111,24 +114,24 @@ If the **Chrome DevTools MCP Server** is available, verify the generated page: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 (`queue/{page}.png`) for fidelity+5. **Visual comparison**: Compare against the Stitch screenshot (`.stitch/designs/{page}.png`) for fidelity6. **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`:+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 `next-prompt.md` before completing.** This keeps the loop alive.+**You MUST update `.stitch/next-prompt.md` before completing.** This keeps the loop alive.1. **Decide the next page**:- - Check `SITE.md` Section 5 (Roadmap) for pending items+ - 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 vision2. **Write the baton** with proper YAML frontmatter:@@ -140,7 +143,7 @@ page: achievementsA competitive achievements page showing developer badges and milestones.**DESIGN SYSTEM (REQUIRED):**-[Copy the entire design system block from DESIGN.md]+[Copy the entire design system block from .stitch/DESIGN.md]**Page Structure:**1. Header with title and navigation@@ -152,25 +155,47 @@ A competitive achievements page showing developer badges and milestones.```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+├── .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.++```json+{+ "projectId": "6139132077804554844",+ "projectName": "My App",+ "screens": {+ "index": "d7237c7d78f44befa4f60afb17c818c1",+ "about": "bf6a3fe5c75348e58cf21fc7a9ddeafb"+ }+}+```++| Field | Description |+|-------|-------------|+| `projectId` | Stitch project ID (from `create_project` response `name` field) |+| `projectName` | Human-readable project title |+| `screens` | Map of page name → screen ID. Add an entry each time a screen is generated. Screen IDs are needed for `edit_screens` and `generate_variants`. |+## Orchestration OptionsThe loop can be driven by different orchestration layers:| Method | How it works ||--------|--------------|-| **CI/CD** | GitHub Actions triggers on `next-prompt.md` changes |+| **CI/CD** | GitHub Actions triggers on `.stitch/next-prompt.md` changes || **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 |@@ -181,23 +206,23 @@ The skill is orchestration-agnostic — focus on the pattern, not the trigger meThis skill works best with the `design-md` skill:-1. **First time setup**: Generate `DESIGN.md` using the `design-md` skill from an existing Stitch screen+1. **First time setup**: Generate `.stitch/DESIGN.md` using the `design-md` skill from an existing Stitch screen2. **Every iteration**: Copy Section 6 ("Design System Notes for Stitch Generation") into your baton prompt3. **Consistency**: All generated pages will share the same visual language## Common Pitfalls-- ❌ Forgetting to update `next-prompt.md` (breaks the loop)+- ❌ 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 in the prompt+- ❌ 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.json` after creating a new project+- ❌ Forgetting to persist `.stitch/metadata.json` after creating a new project## 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 `next-prompt.md` was updated with valid frontmatter |+| Inconsistent styles | Ensure `.stitch/DESIGN.md` is up-to-date and copied correctly |+| Loop stalls | Verify `.stitch/next-prompt.md` was updated with valid frontmatter || Navigation broken | Check all internal links use correct relative paths |