Agent Skills 與 MCP

安裝 /stitch 代理程式技能手冊,並透過 Stitch MCP 伺服器連接 AI 程式碼代理程式。

@google/stitch CLI 的設計就是與你的程式碼代理程式並肩運作——無論你使用的是 Claude Code、Cursor、Gemini CLI、Antigravity 或 VS Code。

你不必自己背下每個 CLI 旗標,只要安裝內附的 /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 伺服器

如果你也想透過 Model Context Protocol(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。各工具的完整結構描述請參閱 MCP 工具參考。

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

本頁翻譯自 Google Stitch 官方文件,原文版權歸 Google LLC 所有。本站為獨立第三方翻譯,與 Google 無關聯。