
stitch-sdk-domain-design
Design the domain model for the Stitch SDK. Use when mapping MCP tools to domain classes and bindings in domain-map.json. This is Stage 2 of the generation pipeline.
- Installs
- 185
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/google-labs-code/stitch-sdk --skill stitch-sdk-domain-design- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads stitch-sdk-domain-design automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Stitch SDK Domain Design
This skill teaches you how to perform Stage 2 of the generation pipeline: reading tool schemas and producing domain-map.json — the intermediate representation that drives codegen.
Your Inputs
tools-manifest.json— raw MCP tool schemas captured from the server (includesoutputSchema)ir-schema.ts— Zod schema defining valid domain-map structure (the canonical contract)- Existing
domain-map.json— the current IR (if extending, not starting fresh) - The
stitch-sdk-developmentskill — for understanding the pipeline context
Your Output
A valid domain-map.json with two sections: classes and bindings, validated by ir-schema.ts.
[!IMPORTANT] Your output is validated twice by the codegen: structurally (Zod IR schema) and semantically (projection steps verified against
outputSchemafrom the tools-manifest).
Designing Classes
Each class represents a domain entity. Ask: "What noun does the user interact with?"
{
"Stitch": {
"description": "Main entry point. Manages projects.",
"constructorParams": [],
"isRoot": true,
"factories": [
{
"method": "project",
"returns": "Project",
"description": "Create a Project handle from an ID."
}
]
}
}
Key decisions:
| Field | Purpose | Example |
|---|---|---|
constructorParams | Fields stored on the instance | ["projectId", "screenId"] |
reference | Identity-map keys (.id aliases the LAST key) | { "keys": ["projectId", "screenId"] } |
parentField | Which param is injected from a parent class | "projectId" |
factories | Local factory methods (no API call) | [{ "method": "project", "returns": "Project" }] |
sideEffects | Handwritten extension methods (declared, never generated) | [{ "method": "upload", "reason": "private_rest", "specPath": "src/spec/upload.ts" }] |
extensionPath | Module re-exporting the class with handwritten methods | "../../src/project-ext.js" |
[!IMPORTANT] The IR schema is STRICT. Unknown keys are hard validation errors, not silently ignored. Per-field source-mapping helpers described in older docs were never implemented and do not exist — identity fields are populated by the EntityManager from
reference.keys, resourcenameparsing, andidfallback. If validation rejects a key you expected to exist, the feature does not exist — do not work around it.
Designing Bindings
Each binding maps one MCP tool to one class method. Ask: "Who owns this action?"
Arg routing
| Type | Meaning | Code generated |
|---|---|---|
self | From this.field | projectId: this.projectId |
param | From method parameter | prompt: prompt |
computed | template interpolation ("template": "projects/{projectId}") | name: \projects/${this.projectId}/screens/${screenId}`` |
selfArray | Wrap self field as array | selectedScreenIds: [this.screenId] |
Optional params use "optional": true. Renamed params use "rename": "newName".
A "default": "VALUE" (requires optional: true) is sent when the caller
omits the value: deviceType: options?.deviceType ?? "DESKTOP".
[!IMPORTANT] Method signature shape (D12): required params are positional, in IR order; ALL optional params are emitted into a single trailing
options?: { ... }object.generate(prompt, options?), nevergenerate(prompt, deviceType?).
Response Projections
The returns.projection array tells codegen how to navigate the API response. Each step is a ProjectionStep:
{ prop: string; index?: number; each?: boolean; find?: string; acknowledgeSingle?: boolean }
| Projection | Generated code | Use when |
|---|---|---|
[] (empty) | raw | Direct return (whole response) |
[{ "prop": "projects" }] | raw.projects | Array inside object |
[{ "prop": "outputComponents", "index": 0 }, { "prop": "design" }, { "prop": "screens", "index": 0 }] | raw.outputComponents[0].design.screens[0] | Deeply nested single item |
[{ "prop": "outputComponents", "each": true }, { "prop": "design" }, { "prop": "screens", "each": true }] | flatMap chain | Collect all items across arrays |
[{ "prop": "screenshot" }, { "prop": "downloadUrl" }] | raw.screenshot.downloadUrl | Navigate nested properties |
Decision: Use "index": 0 when extracting a single item. Use "each": true when collecting all items (array result). You cannot use both on the same step. "find": "a.b" scans an array for the first element whose nested path is non-null.
[!TIP] Every
propin a projection is validated against the tool'soutputSchemaat codegen time. If you typo a property name, codegen will fail with a diagnostic listing the available properties. Stepping THROUGH an array withoutindex/each/findis also a codegen error — the emitted chain would beundefinedat runtime.
[!WARNING] Truncation lint: using
indexorfindon an UNBOUNDED array emits a warning — every other element is silently dropped (this exact pattern causedproject.generate()to return one screen of many). Prefer"each": true+"array": true. Only if the result is semantically singular, acknowledge it with"acknowledgeSingle": trueon the step.
Return class wrapping
When returns.class is set, the extracted data is wrapped in a domain class constructor:
{
"returns": {
"class": "Screen",
"projection": [{ "prop": "screens" }],
"array": true
}
}
The codegen automatically spreads parentField into the data if the child class declares one.
Cache-aware methods
Add a cache field with a structured projection to check this.data before calling the API:
{
"cache": {
"projection": [{ "prop": "htmlCode" }, { "prop": "downloadUrl" }],
"description": "Use cached HTML download URL from generation response if available"
}
}
When the cached property is a nested object (like File with a downloadUrl), use multiple projection steps to drill into it.
Generated code:
if (this.data?.htmlCode?.downloadUrl) return this.data?.htmlCode?.downloadUrl;
// ... else call API
Decision Framework
When mapping a new tool, answer these questions:
-
Which class? Look at which fields the tool requires. If it needs
projectIdfromself, it belongs onProjectorScreen. If it needs nothing from self, it belongs onStitch. -
Which method name? Use the verb from the tool name, simplified.
generate_screen_from_text→generate.edit_screens→edit. -
Arguments from self or param? If the caller already has the data (because they're calling a method on themselves), use
self. If they need to provide it, useparam. -
How deep is the return? Check the tool's
outputSchemaintools-manifest.json. Build theprojectionarray step-by-step to navigate to the useful data. -
Should it cache? If the data is available from a previous response (like generation), add a cache field with the projection path.
Validation
After editing domain-map.json:
bun scripts/generate-sdk.ts # Validates IR + projections, then generates
npx tsc --noEmit # Type check
npx vitest run # Unit tests
bun scripts/e2e-test.ts # E2E tests
bun scripts/validate-generated.ts # Lock integrity
If a projection is invalid, you'll see:
❌ Binding "Project.generate" projection step 2:
property "screenz" not found in outputSchema.
Available properties: screens, components, metadata
FAQ
What does the stitch-sdk-domain-design skill do?
Design the domain model for the Stitch SDK. Use when mapping MCP tools to domain classes and bindings in domain-map.json. This is Stage 2 of the generation pipeline.
How do I install stitch-sdk-domain-design?
Run npx skills add https://github.com/google-labs-code/stitch-sdk --skill stitch-sdk-domain-design in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/stitch-sdk-domain-design/ (personal) or .claude/skills/stitch-sdk-domain-design/ (project).
Which AI agents can use stitch-sdk-domain-design?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is stitch-sdk-domain-design safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains stitch-sdk-domain-design?
It is published by google-labs-code in google-labs-code/stitch-sdk, and it is an official skill from the maker of the technology it covers. It has 185 recorded installs.
More from google-labs-code/stitch-sdk
stitch-sdk-usage
google-labs-code/stitch-sdk
Use the Stitch SDK to generate, edit, and iterate on UI screens from text prompts, manage projects, and retrieve screen HTML/images. Use when the user wants to consume the SDK in their application.
stitch-sdk-readme
google-labs-code/stitch-sdk
Open the skill to read its SKILL.md instructions.
stitch-sdk-development
google-labs-code/stitch-sdk
Open the skill to read its SKILL.md instructions.
tdd-red-green-refactor
google-labs-code/stitch-sdk
Open the skill to read its SKILL.md instructions.
stitch-sdk-pipeline
google-labs-code/stitch-sdk
Open the skill to read its SKILL.md instructions.
stitch-sdk-bug-bash
google-labs-code/stitch-sdk
Open the skill to read its SKILL.md instructions.
Popular ai & agents skills
google-agents-cli-publish
google/agents-cli
This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).
google-agents-cli-eval
google/agents-cli
This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).
skill-creator
anthropics/skills
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
codex-pet
prime-skills/runcomfy-agent-skills
Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.
full-output-enforcement
leonxlnx/taste-skill
Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.
executing-plans
obra/superpowers
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available