OpenAI Codex
OpenAI Codex 會在 CLI 與雲端任務中自動讀取 AGENTS.md。將 AGENTS.md 指向 DESIGN.md,即可讓 UI 編輯與工程指令、建置命令維持分離。
DESIGN.md 的放置位置
my-app/
├── DESIGN.md
├── AGENTS.md
└── src/將 DESIGN.md 接入 AGENTS.md
讓 AGENTS.md 專注於架構、測試與任務路由,並將視覺決策委派給 DESIGN.md:
## UI & Styling
Before modifying files under `src/app/` or `src/components/`, read `DESIGN.md`
in the repository root. Follow its YAML tokens and prose rules (`Colors`,
`Typography`, `Layout`, `Components`, `Do's and Don'ts`). Do not introduce
arbitrary hex values or shadow styles outside the specification.請參閱 CLAUDE.md vs AGENTS.md vs DESIGN.md,了解為何將視覺規則抽離 AGENTS.md 能同時提升 Lint 檢查與提示詞效率。
連線 DesignMD Pro MCP 伺服器
在 Codex CLI 中,於 ~/.codex/config.toml 設定 Streamable HTTP MCP 伺服器:
# Public read-only access (30 requests/minute per IP)
[mcp_servers.designmdpro]
url = "https://designmdpro.app/mcp"若使用 Pro API 金鑰(dmdp_…,來自 帳戶 → API 金鑰),請在 Shell 環境中匯出 DESIGNMDPRO_API_KEY 並透過 bearer_token_env_var 傳入,使機密資訊不會以明文形式存在於設定檔中:
[mcp_servers.designmdpro]
url = "https://designmdpro.app/mcp"
bearer_token_env_var = "DESIGNMDPRO_API_KEY"在 Shell 任務透過原始 Markdown 擷取規範
當在具備對外 HTTP 存取權限但未設定 MCP 的環境中執行 Codex 時,可直接擷取原始 .md 端點:
curl -fsSL https://designmdpro.app/websites/linear.md -o DESIGN.md
npx --yes @google/design.md lint DESIGN.md提示詞範本
Read DESIGN.md first. Implement the API key management card in src/components/
using the defined surface, border, typography, and button-primary tokens. Run
type-check after editing.Use the designmdpro MCP server to call search_websites and get_design_md
(sections: ["Colors", "Typography", "Do's and Don'ts"]) for a developer-tools
reference, then align our DESIGN.md contrast pairs and validate with the CLI.常見陷阱
- 將設計 Token 直接混入
AGENTS.md:AGENTS.md內的內嵌散文無法使用@google/design.md lint進行驗證,也無法由程式碼產生器匯出。 - 未限制範圍的指令拖慢非 UI 任務:請在
AGENTS.md指標中明確限定僅針對 UI 路徑載入DESIGN.md,避免在後端資料庫遷移或腳本任務中載入。
下一步
- MCP 伺服器參考 — 全部四個工具與速率限制層級
- REST API 與 Markdown — 直接擷取
/websites/<slug>.md - 為 AI Agent 撰寫規範 — 撰寫在多檔案編輯中依然有效的規則
Last updated on