Agent Skills 与 MCP

安装 /stitch 智能体技能手册,并通过 Stitch MCP 服务器连接 AI 编码智能体。

@google/stitch CLI 生来就与编码智能体协同工作——无论你用的是 Claude Code、Cursor、Gemini CLI、Antigravity 还是 VS Code。

不必自己记住每一个 CLI flag,安装内置的 /stitch 技能,你的编码智能体就知道如何管理项目、编写并同步 DESIGN.md、捕获实时浏览器路由,以及运行本地 UI 审查。

安装 /stitch 技能

在项目内运行 stitch agent-skills add,把 /stitch 技能手册写入 .agents/skills/stitch/:

stitch agent-skills add

如果你希望本机所有仓库都能使用 /stitch,可以把它全局安装到 ~/.agents/skills/stitch/:

stitch agent-skills add --user

也可以指定某个智能体目录,例如 .claude/skills/stitch:

stitch agent-skills add --dir .claude/skills/stitch

/stitch 技能能为你的智能体做什么

安装完成后,你可以直接在编码智能体的对话中调用 /stitch。该技能开箱即包含三本核心手册:

  • 画布与屏幕设计(.agents/skills/stitch/SKILL.md)— 创建项目、生成屏幕、上传参考素材,以及用 stitch edit screen 迭代。
  • 设计系统同步(.agents/skills/stitch/flows/design.md)— 从代码库或创意简报撰写 DESIGN.md,并绑定到 Stitch 项目。
  • 本地 UI 审查(.agents/skills/stitch/flows/review.md)— 从本地开发服务器捕获实时路由,并依据 DESIGN.md 审查其 DOM 和截图。

试着对你的智能体说:

PROMPT
/stitch Create a DESIGN.md for this repository, sync it to my Stitch project, and review our /dashboard route against it.

启用工作区功能(stitch enable loop)时,CLI 会自动升级已安装的 .agents/skills/stitch 目录,一并加入代码库原型手册(flows/prototype.md)。

你可以随时查看技能的安装位置,或将其更新到与当前 CLI 版本一致:

stitch agent-skills list
stitch agent-skills update

注册 Stitch MCP 服务器

如果你还想通过模型上下文协议(MCP)暴露 Stitch 工具,请运行 stitch mcp install:

stitch mcp install

默认情况下,stitch mcp install 会检测你机器上所有受支持的编辑器,并自动注册 stitch MCP 服务器。

指定单个编辑器

传入 --target 可配置特定编辑器(也可以加上 --dry-run 先预览 JSON 改动):

stitch mcp install --target claude-code
stitch mcp install --target cursor
stitch mcp install --target gemini-cli
stitch mcp install --target antigravity
stitch mcp install --target vscode
stitch mcp install --target claude-desktop

如果你的 MCP 客户端使用自定义配置文件,请让它通过 stdio 指向 stitch mcp start:

{
  "mcpServers": {
    "stitch": {
      "command": "stitch",
      "args": ["mcp", "start"]
    }
  }
}

MCP 服务器暴露七个与 CLI 语法一一对应的统一工具:stitch_find、stitch_get、stitch_create、stitch_edit、stitch_generate、stitch_delete 和 stitch_url。每个工具的完整 schema 请参阅 MCP 工具参考。

原文: https://stitch.withgoogle.com/docs/cli/mcp-and-skills/

本页翻译自 Google Stitch 官方文档,原文版权归 Google LLC 所有。本站为独立第三方翻译,与 Google 无关联。