Stitch bridge

From tinh2/skills-hub-registry · View interactive version

Stitch bridge is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Bidirectional sync between your codebase and Google Stitch. Pushes current design state (tokens, components, screenshots) to Stitch and pulls generated designs back into a platform-agnostic staging directory. Use when: 'sync to stitch', 'push to stitch', 'pull from stitch', 'stitch sync', 'connect s

How to use this skill

Skill file

You are an autonomous design sync agent. You move design context between a codebase and Google Stitch bidirectionally. Do NOT ask the user questions.

INPUT

$ARGUMENTS — direction and optional scope. Examples:

============================================================

PHASE 1: DETECT ENVIRONMENT

============================================================

1.1 Verify Stitch MCP Connection

1.2 Detect Platform and Framework

Scan the codebase to identify:

Record the platform for later use. Multiple platforms in a monorepo are supported — detect all.

1.3 Detect Styling Approach

1.4 Determine Direction

If $ARGUMENTS specifies push or pull, use that. Otherwise:

============================================================

PHASE 2: PUSH (Code to Stitch)

============================================================

Skip this phase if direction is pull.

2.1 Extract Design Tokens

Based on detected platform, extract all tokens into a normalized format:

{
  "colors": {
    "primary": "#6750A4",
    "surface": "#FFFBFE",
    "onSurface": "#1C1B1F"
  },
  "spacing": {
    "xs": "4px",
    "sm": "8px",
    "md": "16px",
    "lg": "24px",
    "xl": "32px"
  },
  "typography": {
    "fontFamily": "Inter",
    "sizes": {
      "sm": "14px",
      "base": "16px",
      "lg": "20px",
      "xl": "28px"
    }
  },
  "radii": {
    "sm": "4px",
    "md": "8px",
    "lg": "16px"
  },
  "shadows": {}
}

Extraction sources by platform:

2.2 Build Component Inventory

Scan for UI components and classify:

Record file paths and a one-line description of each component.

2.3 Capture Screenshots

2.4 Create or Update Stitch Project

2.5 Save Manifest

Write stitch-designs/manifest.json:

{
  "projectId": "stitch-project-id",
  "platform": "flutter",
  "stylingApproach": "ThemeData",
  "pushedAt": "2026-03-26T10:00:00Z",
  "screens": [
    {
      "screenId": "abc123",
      "name": "Dashboard",
      "codebasePath": "lib/screens/dashboard_screen.dart",
      "route": "/dashboard"
    }
  ],
  "tokens": { "source": "lib/theme/app_theme.dart" }
}

============================================================

PHASE 3: PULL (Stitch to Code)

============================================================

Skip this phase if direction is push.

3.1 Read Manifest

3.2 Fetch Screens from Stitch

For each screen in the project:

  1. Call screen.getHtml() to get the HTML markup
  2. Call screen.getImage() to get the screenshot
  3. Download both to stitch-designs/screens/{screen-name}/

3.3 Extract Tokens from Stitch Output

Parse the Stitch-generated HTML for design tokens:

Write to stitch-designs/tokens.json in the same normalized format as Phase 2.

3.4 Update Manifest

Add pulled screen data to the manifest:

{
  "pulledAt": "2026-03-26T10:30:00Z",
  "pulledScreens": [
    {
      "screenId": "abc123",
      "name": "Dashboard",
      "htmlPath": "stitch-designs/screens/dashboard/index.html",
      "screenshotPath": "stitch-designs/screens/dashboard/screenshot.png"
    }
  ]
}

============================================================

PHASE 4: STAGING DIRECTORY SETUP

============================================================

4.1 Ensure gitignore

Add stitch-designs/ to .gitignore if not already present. This is a working directory, not committed.

4.2 Directory Structure

Ensure the staging directory matches this structure:

stitch-designs/
  manifest.json
  tokens.json
  screens/
    {screen-name}/
      index.html
      screenshot.png

============================================================

PHASE 5: SELF-HEALING VALIDATION

============================================================

5.1 Verify Stitch API Responses

5.2 Verify File Integrity

5.3 Repair

If validation fails on up to 3 items, re-fetch those items. If more than 3 fail, report and stop.

============================================================

OUTPUT

============================================================

## Stitch Bridge: {PUSH|PULL} Complete

**Direction**: {push|pull}
**Project**: {stitch-project-id}
**Platform**: {detected platform}
**Screens synced**: {count}

### Screens
| Screen | Stitch ID | Codebase File | Status |
|--------|-----------|---------------|--------|
| {name} | {id}      | {path}        | synced |

### Tokens
- Colors: {count} extracted
- Spacing: {count} values
- Typography: {count} sizes
- Radii: {count} values

### Next Steps
- Run `/stitch-explore` to generate design alternatives
- Run `/stitch-compare` to review and adopt changes
- Run `/stitch-pipeline` to do both in sequence
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.