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
feat: react-components skill
David East581d7d044353
diff --git a/.github/workflows/validate-skills.yml b/.github/workflows/validate-skills.ymlnew file mode 100644index 0000000..178b41e--- /dev/null+++ b/.github/workflows/validate-skills.yml@@ -0,0 +1,30 @@+name: Validate Skills++on:+ push:+ branches: [ main ]+ pull_request:+ branches: [ main ]++jobs:+ validate-stitch-to-react:+ runs-on: ubuntu-latest+ defaults:+ run:+ working-directory: skills/react-components++ steps:+ - uses: actions/checkout@v4++ - name: Use Node.js+ uses: actions/setup-node@v4+ with:+ node-version: '18.x'+ cache: 'npm'+ cache-dependency-path: skills/react-components/package-lock.json++ - name: Install dependencies+ run: npm ci++ - name: Verify Gold Standard Example+ run: node scripts/validate.js examples/gold-standard-card.tsxdiff --git a/README.md b/README.mdindex 02bc059..caacf11 100644--- a/README.md+++ b/README.md@@ -1,56 +1,35 @@-# Stitch to React Agent Skills+# Stitch Agent Skills-A library of specialized agent skills designed to convert Stitch MCP designs into modular, production-ready Vite + React + TypeScript components.+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.-## Quick Start+## Installation & Discovery-The fastest way to use these skills is via the `add-skill` CLI. This will automatically detect your coding agent (Claude Code, Cursor, Antigravity, etc.) and install the skill into the correct directory.+Install any skill from this repository using the `add-skill` CLI. This command will automatically detect your active coding agents and place the skill in the appropriate directory.```bash-# Install the core component skill globally-npx add-skill davideast/stitch-to-react-skills --skill stitch-to-react-components --global+# List all available skills in this repository+npx add-skill google-labs-code/stitch-skills --list+# Install a specific skill (e.g., Stitch to React Components)+npx add-skill google-labs-code/stitch-skills --skill react:components --global```-## Available Skills--| Skill Name | Description | Path |-| --- | --- | --- |-| `stitch-to-react-components` | Converts designs into modular components with AST validation and custom networking. | `skills/stitch-to-react-components` |-## Repository Structure-This repository follows the **Agent Skills** open standard. Each skill is self-contained with its own logic, validation scripts, and design tokens.+Every directory within `skills/` follows a standardized structure to ensure the AI agent has everything it needs to perform "few-shot" learning and automated quality checks.```text-skills/stitch-to-react-components/-├── SKILL.md — Core instructions & workflow-├── package.json — Validator dependencies-├── scripts/ — Networking & AST validation-├── resources/ — Style guides & API references-└── examples/ — Gold-standard code samples+skills/[category]/+├── SKILL.md — The "Mission Control" for the agent+├── scripts/ — Executable enforcers (Validation & Networking)+├── resources/ — The knowledge base (Checklists & Style Guides)+└── examples/ — The "Gold Standard" syntactically valid references```-## How it Works--When activated, the agent follows a high-fidelity engineering pipeline:--1. **Retrieval**: Uses a system-level `curl` script to bypass TLS/SNI issues on Google Cloud Storage.-2. **Mapping**: Cross-references Stitch metadata with the local `style-guide.json` to ensure token consistency.-3. **Generation**: Scaffolds components using a strict Atomic Design pattern.-4. **Validation**: Runs an automated AST check using `@swc/core` to prevent hardcoded hex values or missing interfaces.-5. **Audit**: Performs a final self-correction check against a 20-point architecture checklist.--## Requirements--* **Node.js**: v18 or higher (for the validation scripts).-* **Stitch MCP Server**: Must be configured in your IDE/CLI.-* **Environment**: A React + Vite + Tailwind project.--## Development--To add a new skill to this repository:+## Adding New Skills+All new skills need to follow the file structure above to implement the Agent Skills open standard.-1. Create a new directory under `skills/`.-2. Ensure it contains a `SKILL.md` with a valid `name` and `description` in the YAML frontmatter.-3. Push to GitHub; `add-skill` will automatically discover the new entry.+### Great candidates for new skills+* **Validation**: Skills that convert Stitch HTML to other UI frameworks and validate the syntax.+* **Decoupling Data**: Skills that convert static design content into external mock data files.+* **Generate Designs**: Skills that generate new design screens in Stitch from a given set of data.diff --git a/skills/react-components/README.md b/skills/react-components/README.mdnew file mode 100644index 0000000..a6c3dda--- /dev/null+++ b/skills/react-components/README.md@@ -0,0 +1,30 @@+# Stitch to React Components Skill++## Example Prompt++```text+Convert my Landing Page screen in my Podcast Stitch Project to a React component system.+```++## Skill Structure++This repository follows the **Agent Skills** open standard. Each skill is self-contained with its own logic, validation scripts, and design tokens.++```text+skills/react-components/+├── SKILL.md — Core instructions & workflow+├── package.json — Validator dependencies+├── scripts/ — Networking & AST validation+├── resources/ — Style guides & API references+└── examples/ — Gold-standard code samples+```++## How it Works++When activated, the agent follows a high-fidelity engineering pipeline:++1. **Retrieval**: Uses a system-level `curl` script to bypass TLS/SNI issues on Google Cloud Storage.+2. **Mapping**: Cross-references Stitch metadata with the local `style-guide.json` to ensure token consistency.+3. **Generation**: Scaffolds components using a strict Atomic Design pattern.+4. **Validation**: Runs an automated AST check using `@swc/core` to prevent hardcoded hex values or missing interfaces.+5. **Audit**: Performs a final self-correction check against a 20-point architecture checklist.diff --git a/skills/stitch-to-react-components/SKILL.md b/skills/react-components/SKILL.mdsimilarity index 96%rename from skills/stitch-to-react-components/SKILL.mdrename to skills/react-components/SKILL.mdindex 322a9cd..c0d4200 100644--- a/skills/stitch-to-react-components/SKILL.md+++ b/skills/react-components/SKILL.md@@ -1,5 +1,5 @@----name: stitch-to-react-components+name: react:componentsdescription: Converts Stitch designs into modular Vite and React components using system-level networking and AST-based validation.allowed-tools:- "stitch*:*"@@ -9,7 +9,7 @@ allowed-tools:- "web_fetch"----# Stitch to react components+# Stitch to React ComponentsYou are a frontend engineer focused on transforming designs into clean React code. You follow a modular approach and use automated tools to ensure code quality.diff --git a/skills/stitch-to-react-components/examples/gold-standard-card.tsx b/skills/react-components/examples/gold-standard-card.tsxsimilarity index 100%rename from skills/stitch-to-react-components/examples/gold-standard-card.tsxrename to skills/react-components/examples/gold-standard-card.tsxdiff --git a/skills/stitch-to-react-components/package-lock.json b/skills/react-components/package-lock.jsonsimilarity index 100%rename from skills/stitch-to-react-components/package-lock.jsonrename to skills/react-components/package-lock.jsondiff --git a/skills/stitch-to-react-components/package.json b/skills/react-components/package.jsonsimilarity index 90%rename from skills/stitch-to-react-components/package.jsonrename to skills/react-components/package.jsonindex abdb20e..4b3e67b 100644--- a/skills/stitch-to-react-components/package.json+++ b/skills/react-components/package.json@@ -1,5 +1,5 @@{- "name": "stitch-to-react-pro",+ "name": "react-components","version": "1.0.0","description": "Professional design-to-code orchestration for Stitch MCP","type": "module",@@ -13,4 +13,4 @@"engines": {"node": ">=18.0.0"}-}+}\ No newline at end of filediff --git a/skills/stitch-to-react-components/resources/architecture-checklist.md b/skills/react-components/resources/architecture-checklist.mdsimilarity index 100%rename from skills/stitch-to-react-components/resources/architecture-checklist.mdrename to skills/react-components/resources/architecture-checklist.mddiff --git a/skills/stitch-to-react-components/resources/component-template.tsx b/skills/react-components/resources/component-template.tsxsimilarity index 100%rename from skills/stitch-to-react-components/resources/component-template.tsxrename to skills/react-components/resources/component-template.tsxdiff --git a/skills/stitch-to-react-components/resources/stitch-api-reference.md b/skills/react-components/resources/stitch-api-reference.mdsimilarity index 100%rename from skills/stitch-to-react-components/resources/stitch-api-reference.mdrename to skills/react-components/resources/stitch-api-reference.mddiff --git a/skills/stitch-to-react-components/resources/style-guide.json b/skills/react-components/resources/style-guide.jsonsimilarity index 100%rename from skills/stitch-to-react-components/resources/style-guide.jsonrename to skills/react-components/resources/style-guide.jsondiff --git a/skills/stitch-to-react-components/scripts/fetch-stitch.sh b/skills/react-components/scripts/fetch-stitch.shsimilarity index 100%rename from skills/stitch-to-react-components/scripts/fetch-stitch.shrename to skills/react-components/scripts/fetch-stitch.shdiff --git a/skills/stitch-to-react-components/scripts/validate.js b/skills/react-components/scripts/validate.jssimilarity index 51%rename from skills/stitch-to-react-components/scripts/validate.jsrename to skills/react-components/scripts/validate.jsindex 3519eff..163c093 100644--- a/skills/stitch-to-react-components/scripts/validate.js+++ b/skills/react-components/scripts/validate.js@@ -9,6 +9,9 @@ async function validateComponent(filePath) {const ast = await swc.parse(code, { syntax: "typescript", tsx: true });let hasInterface = false;let tailwindIssues = [];++ console.log("🔍 Scanning AST...");+const walk = (node) => {if (!node) return;if (node.type === 'TsInterfaceDeclaration' && node.id.value.endsWith('Props')) hasInterface = true;@@ -18,11 +21,32 @@ async function validateComponent(filePath) {for (const key in node) { if (node[key] && typeof node[key] === 'object') walk(node[key]); }};walk(ast);- console.log(`--- Validation: ${filename} ---`);- if (!hasInterface) console.error("❌ MISSING: Props interface.");- if (tailwindIssues.length > 0) console.error("❌ STYLE: Hex codes found.");- process.exit((hasInterface && tailwindIssues.length === 0) ? 0 : 1);- } catch (err) { console.error("❌ PARSE ERROR"); process.exit(1); }++ console.log(`--- Validation for: ${filename} ---`);+ if (hasInterface) {+ console.log("✅ Props declaration found.");+ } else {+ console.error("❌ MISSING: Props interface (must end in 'Props').");+ }++ if (tailwindIssues.length === 0) {+ console.log("✅ No hardcoded hex values found.");+ } else {+ console.error(`❌ STYLE: Found ${tailwindIssues.length} hardcoded hex codes.`);+ tailwindIssues.forEach(hex => console.error(` - ${hex}`));+ }++ if (hasInterface && tailwindIssues.length === 0) {+ console.log("\n✨ COMPONENT VALID.");+ process.exit(0);+ } else {+ console.error("\n🚫 VALIDATION FAILED.");+ process.exit(1);+ }+ } catch (err) {+ console.error("❌ PARSE ERROR:", err.message);+ process.exit(1);+ }}validateComponent(process.argv[2]);