Cursor
Cursor 透過 .cursor/rules/*.mdc 規則檔案啟用上下文,並讀取設定於 ~/.cursor/mcp.json 中的 MCP 伺服器。
DESIGN.md 的放置位置
將標準的 DESIGN.md 保留在儲存庫根目錄,讓 CLI Lint 檢查與其他 Agent 共用同一份檔案,並新增 .cursor/rules/design-system.mdc 來控制 Cursor 何時載入它:
my-app/
├── DESIGN.md
└── .cursor/
└── rules/
└── design-system.mdc在 DesignMD Pro 探索頁 的任何網站頁面中,於 Use this design 卡片選擇 Cursor,即可下載設定好 alwaysApply: true、可直接放入的 {slug}-design-system.mdc 檔案。
設定 .cursor/rules/design-system.mdc
選項 A:限定路徑的包裝規則(建議全端儲存庫使用)
將 DESIGN.md 保留為唯一編輯來源,並僅在編輯 UI 檔案時讓 Cursor 讀取它:
---
description: Project design system (DESIGN.md) — apply to all UI components and pages
globs:
- "src/components/**/*.tsx"
- "src/app/**/*.tsx"
- "src/app/**/*.css"
alwaysApply: false
---
Follow the design tokens, spacing scale, typography, and Do's and Don'ts defined in `DESIGN.md` at the repository root. Never invent hex colors or border radii outside the spec.選項 B:獨立且永遠啟用的 .mdc 規則
若您直接從 DesignMD Pro 匯出了 {slug}-design-system.mdc,請將其放置於 .cursor/rules/ 中:
---
description: Meridian Workspace design system (DESIGN.md) — apply to all UI work
globs:
alwaysApply: true
---
Follow the Meridian Workspace design system below for every UI change. Use its tokens instead of inventing new values, and follow its Do's and Don'ts.
```markdown
---
version: alpha
name: Meridian Workspace
...
---
```連線 DesignMD Pro MCP 伺服器
將 designmdpro 加入 ~/.cursor/mcp.json(或在團隊工作區內的 .cursor/mcp.json 中設定,但切勿提交個人機密資訊):
{
"mcpServers": {
"designmdpro": {
"url": "https://designmdpro.app/mcp"
}
}
}若使用 Pro API 金鑰(dmdp_…,來自 帳戶 → API 金鑰):
{
"mcpServers": {
"designmdpro": {
"url": "https://designmdpro.app/mcp",
"headers": {
"Authorization": "Bearer dmdp_your_api_key"
}
}
}
}編輯 mcp.json 後,請重新啟動 Cursor 或在 Cursor Settings → Tools & MCP 中重新整理 MCP 伺服器。
提示詞範本
@DESIGN.md Refactor the settings card layout to match the Surface, Shapes, and
Elevation & Depth rules. Keep all hex values mapped to defined color tokens.Using the designmdpro MCP server, search for developer-tool design systems,
inspect the Colors and Typography sections of the closest match, and list
which tokens differ from our current DESIGN.md.常見陷阱
- 使用已淘汰且無 glob 限制的
.cursorrules:舊版單一.cursorrules檔案會將設計 Token 注入資料庫遷移與後端測試中。請改用帶有globs的.cursor/rules/design-system.mdc。 - 在
.mdc與DESIGN.md中重複維護 Token:若您為了執行@google/design.md lint而保留獨立的DESIGN.md,請從.mdc引用該檔案,而非手動維護兩份複本。
下一步
- MCP 伺服器參考 — 工具、註解與驗證層級
- Tailwind CSS 與 shadcn/ui 整合 — 將 Token 對應至專案中的 CSS 變數
- 完整範例 — 完整的入門
DESIGN.md檔案
Last updated on