Skip to content

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

support uploading DESIGN.md through script

jilinxiaa2d69f79ee07
diff --git a/plugins/stitch-design/skills/code-to-design/SKILL.md b/plugins/stitch-design/skills/code-to-design/SKILL.md
index 0e182d7..80cefb9 100644
--- a/plugins/stitch-design/skills/code-to-design/SKILL.md
+++ b/plugins/stitch-design/skills/code-to-design/SKILL.md
@@ -56,27 +56,20 @@ full analysis workflow.
Write `.stitch/DESIGN.md` following the `extract-design-md` skill's output
structure.
-#### 4. Create Design System in Stitch (MCP)
+#### 4. Upload DESIGN.md and Create Design System in Stitch
-> [!WARNING]
-> **Checkpoint — User Confirmation Required.**
-> Before calling `upload_design_md` and proceeding to upload, you **MUST** pause and ask the user to review both the extracted static HTML file(s) and the generated `DESIGN.md`. Present a summary of the extracted design system (key colors, fonts, roundness, overall theme) and the path to the HTML file, and wait for explicit approval. Do **NOT** proceed until the user confirms.
+Delegate to the `manage-design-system` skill to upload the `DESIGN.md` and
+create the design system in Stitch. Read
+[skills/manage-design-system/SKILL.md](../manage-design-system/SKILL.md) for
+the full workflow (upload script usage, `create_design_system_from_design_md`
+call, and required schemas).
-> [!IMPORTANT]
-> You **MUST** create the design system in the Stitch platform using the MCP tools. Do not just create the local file.
->
-> Follow the two-step pattern:
-> 1. Call `upload_design_md` with the base64 encoded content of the `DESIGN.md` file and the `projectId`. This uploads the markdown and returns the source screen ID.
-> 2. Immediately call `create_design_system_from_design_md` with the `projectId` and `selectedScreenInstance` (constructed using the returned source screen ID and fetching the screen instance ID from `get_project`).
->
-> Refer to the `manage-design-system` skill for detailed schemas and required fields.
+#### 5. Upload HTML to Stitch
-#### 5. Upload to Stitch
-
-Delegate to the `upload-to-stitch` skill to upload the extracted HTML file.
+Use the same `upload-to-stitch` skill's script to upload the extracted HTML file.
Read [skills/upload-to-stitch/SKILL.md](../upload-to-stitch/SKILL.md) for detailed instructions and script usage.
You will need:
- The path to the standalone HTML file generated in Step 1.
-- Your Stitch API Key (see `upload-to-stitch` instructions for location).
+- Your Stitch API Key (same key used in Step 4).
- The target `projectId`.
\ No newline at end of file
diff --git a/plugins/stitch-design/skills/manage-design-system/SKILL.md b/plugins/stitch-design/skills/manage-design-system/SKILL.md
index 8ffcc58..b1a6bfa 100644
--- a/plugins/stitch-design/skills/manage-design-system/SKILL.md
+++ b/plugins/stitch-design/skills/manage-design-system/SKILL.md
@@ -18,7 +18,7 @@ consistency across all future screens.
> [!NOTE]
> Refer to your system prompt for instruction on handling MCP tool prefixes for
-> all tools mentioned in this skill (e.g., `get_screen`, `upload_design_md`,
+> all tools mentioned in this skill (e.g., `get_screen`,
> `create_design_system_from_design_md`, `apply_design_system`).
## 📥 Retrieval
@@ -51,24 +51,30 @@ The `DESIGN.md` file should follow the structure defined in the `design-md` skil
## 🚀 Create or Update Design System in Stitch
After generating `.stitch/DESIGN.md`, make sure to also create or update the
-design system in Stitch using MCP tools.
+design system in Stitch.
**Two-step design system creation:**
> [!WARNING]
> **Checkpoint — User Confirmation Required.**
-> Before calling `upload_design_md`, you **MUST** pause and ask the user for
+> Before uploading, you **MUST** pause and ask the user for
> confirmation. Present a summary of the design system you are about to create
> (display name, key colors, fonts, and roundness) and wait for explicit approval
-> before proceeding. Do **NOT** call `upload_design_md` until the user
-> confirms.
-
-Read the tool schema for the exact call formats before making these calls.
-
-1. Call `upload_design_md` with the base64 encoded content of the `DESIGN.md` file and the `projectId`. This uploads the markdown and returns the source screen ID.
-2. Immediately call `create_design_system_from_design_md` with the `projectId` and `selectedScreenInstance` (constructed using the returned source screen ID and fetching the screen instance ID from `get_project`).
-
-Once both `upload_design_md` and `create_design_system_from_design_md` have been called,
+> before proceeding. Do **NOT** upload until the user confirms.
+
+1. **Upload `DESIGN.md`**:
+ - **Option A (Recommended - Uploader Script)**: Use the modified `upload-to-stitch` Python script which natively handles `.md` files. It base64-encodes the markdown file in-process and sends it to the `/v1/projects/{projectId}/screens:batchCreate` endpoint, bypassing output token limits.
+ ```bash
+ python3 stitch-skills/plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py \
+ --project-id <PROJECT_ID> \
+ --file-path /path/to/DESIGN.md \
+ --api-key <API_KEY>
+ ```
+ This returns the `sourceScreen` ID and the `screenInstance` ID.
+ - **Option B (Direct MCP Tool)**: If the `DESIGN.md` is small (under ~5KB), you can call the `upload_design_md` MCP tool directly, passing the base64-encoded design markdown content as `designMdBase64`.
+2. **Create Design System**: Call the `create_design_system_from_design_md` tool immediately after the upload, passing the `projectId` and the `selectedScreenInstance` (containing the `id` and `sourceScreen` returned from the upload step).
+
+Once the upload script and `create_design_system_from_design_md` have both completed,
Stitch holds the design tokens at the project level — you do NOT need to repeat
them in generation prompts.
diff --git a/plugins/stitch-design/skills/manage-design-system/reference/tool-schema.md b/plugins/stitch-design/skills/manage-design-system/reference/tool-schema.md
index 276e9b3..883e0c4 100644
--- a/plugins/stitch-design/skills/manage-design-system/reference/tool-schema.md
+++ b/plugins/stitch-design/skills/manage-design-system/reference/tool-schema.md
@@ -4,15 +4,21 @@ Use these examples to format your Stitch MCP design system tool calls correctly.
---
-## `upload_design_md`
+## Upload `DESIGN.md` (via `upload_to_stitch.py` script)
-Uploads a `DESIGN.md` file content to a project. This is the first step in creating a design system from a markdown file.
+Uploads a `DESIGN.md` file to a project via the `BatchCreateScreens` endpoint.
+This is the first step in creating a design system from a markdown file.
-```json
-{
- "projectId": "4044680601076201931",
- "designMdBase64": "LS0tCm5hbWU6IEF1cmEgUXVpZXQgTGl2aW5n..." // Base64 encoded content of DESIGN.md
-}
+> [!NOTE]
+> Use the `upload-to-stitch` skill's script instead of the `upload_design_md`
+> MCP tool. The script handles base64 encoding in-process, avoiding the model's
+> output token limit.
+
+```bash
+python3 <SKILL_DIR>/scripts/upload_to_stitch.py \
+ --project-id <PROJECT_ID> \
+ --file-path /path/to/DESIGN.md \
+ --api-key <API_KEY>
```
---
@@ -33,14 +39,16 @@ Creates a design system for a project using the uploaded `DESIGN.md` file.
```
> [!NOTE]
-> You must call `upload_design_md` first to get the source screen ID, and then fetch the project details with `get_project` to find the corresponding screen instance ID to pass as `id` in `selectedScreenInstance`.
+> You must upload `DESIGN.md` via the script first to get the source screen ID, and then fetch the project details with `get_project` to find the corresponding screen instance ID to pass as `id` in `selectedScreenInstance`.
---
## `update_design_system`
-Updates an existing design system for a project. This is needed to set the
-theme and display the design system in the UI.
+Updates an existing design system for a project. This is **required** immediately after calling `create_design_system` to set the theme and display the design system in the UI.
+
+> [!NOTE]
+> While `update_design_system` is mandatory after the basic `create_design_system` call, you do **not** need to call it after `create_design_system_from_design_md`. The latter automatically populates and updates all theme tokens directly from the parsed YAML frontmatter of the uploaded `DESIGN.md`.
```json
{
diff --git a/plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py b/plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py
index 0da901e..b0e75cd 100644
--- a/plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py
+++ b/plugins/stitch-design/skills/upload-to-stitch/scripts/upload_to_stitch.py
@@ -44,6 +44,7 @@ _MIME_TYPES = {
".webp": "image/webp",
".html": "text/html",
".htm": "text/html",
+ ".md": "text/markdown",
}
@@ -136,7 +137,7 @@ def build_screen_request(
"mimeType": mime_type,
}
- if mime_type == "text/html":
+ if mime_type in ("text/html", "text/markdown"):
screen = {
"htmlCode": file_obj,
"screenType": "DOCUMENT",