Communitygithub.com

0xAlchemist-cs/personal-ui-system

當使用者的任務涉及 Ant Design (antd) 時使用 — 編寫 antd 元件、除錯 antd 問題、查詢 antd API/屬性/Tokens/示範、在不同 antd 版本之間遷移,或分析專案中的 antd 使用情況。觸發條件為 antd 相關程式碼、來自 'antd' 的導入,或明確的 antd 問題。

personal-ui-system 是什麼?

此技能提供一個本地端的命令列工具 `@ant-design/cli`,其中包含 antd v4/v5/v6 的捆綁元數據,以及 v3→v4、v4→v5、v5→v6 的遷移指南。它讓 AI 代理能夠離線查詢元件知識、分析專案並引導遷移,無需網路連線。主要功能包括:在編寫元件程式碼前查閱 API 屬性與示範;使用詳細環境快照與語法檢查進行除錯;使用完整的檢查清單與變更日誌輔助版本遷移;以及透過 MCP 伺服器模式與支援 MCP 的 IDE(如 Claude Desktop 或 Cursor)整合。此技能透過強制要求先查詢再編寫、比對使用者正確的 antd 版本、使用 `--format json` 取得結構化輸出,以及在修改程式碼後執行 lint 檢查,確保 AI 代理的行為準確且可靠。

相容平台✓Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/0xAlchemist-cs/personal-ui-system/tree/HEAD/.agents/skills/antd

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Ant Design CLI

您有權使用 @ant-design/cli — 這是一個本機端命令列工具,內含 antd v4/v5/v6 的捆綁元數據(以及 v3 → v4、v4 → v5、v5 → v6 的遷移指南)。用它來查詢元件知識、分析專案以及引導遷移。所有資料均為離線,無需網路。

設定

首次使用前,請檢查 CLI 是否已安裝。若未安裝,請自動安裝:

which antd || npm install -g @ant-design/cli

執行任何命令後,如果輸出中包含「Update available」通知,請先執行 antd upgrade 更新後再繼續。

一律使用 --format json 以取得可供程式解析的結構化輸出。

情境

1. 編寫 antd 元件程式碼

在編寫任何 antd 元件程式碼之前,請先查閱其 API — 不要依賴記憶。

# 檢查有哪些屬性可用
antd info Button --format json

# 取得可作為起點的工作示範
antd demo Button basic --format json

# 檢查自訂樣式的語義 classNames/styles
antd semantic Button --format json

# 檢查主題的元件層級設計 Token
antd token Button --format json

# 取得整體設計語言(design.md):顏色、字體排印、間距、圓角 + 原則
antd design.md --format json

工作流程: antd info → 了解屬性 → antd demo → 取得工作範例 → 編寫程式碼。

2. 查閱完整文件

當您需要完整的元件文件(不僅是屬性)時:

antd doc Table --format json        # Table 的完整 Markdown 文件
antd doc Table --lang zh            # 中文文件

3. 除錯 antd 問題

當程式碼運作不如預期或使用者回報 antd 錯誤時:

# 收集完整的環境快照(系統、依賴套件、瀏覽器、建置工具)
antd env --format json

# 檢查該屬性在使用者的 antd 版本中是否存在
a ntd info Select --version 5.12.0 --format json

# 檢查該屬性是否已棄用
a ntd lint ./src/components/MyForm.tsx --format json

# 診斷專案層級的設定問題
a ntd doctor --format json

工作流程: antd env → 捕捉完整環境 → antd doctor → 檢查設定 → antd info --version X → 根據使用者確切版本驗證 API → antd lint → 找出已棄用或不正確的使用方式。

4. 在不同版本之間遷移

當使用者想要升級 antd(例如 v3 → v4 或 v4 → v5)時:

# 取得完整的遷移檢查清單
a ntd migrate 3 4 --format json    # v3 → v4
a ntd migrate 4 5 --format json    # v4 → v5

# 檢查特定元件的遷移
a ntd migrate 4 5 --component Select --format json

# 產生適合代理程式的自動遷移提示(不會修改檔案)
a ntd migrate 4 5 --apply ./src --format json

# 查看兩個版本之間的變更
a ntd changelog 4.24.0 5.0.0 --format json

# 查看特定元件的變更
a ntd changelog 4.24.0 5.0.0 Select --format json

工作流程: antd migrate → 取得完整檢查清單 → antd changelog <v1> <v2> → 了解重大變更 → 套用修正 → antd lint → 驗證無殘留已棄用用法。

5. 分析專案 antd 使用情況

當使用者想了解 antd 在其專案中的使用情況時:

# 掃描元件使用統計
antd usage ./src --format json

# 過濾至特定元件
antd usage ./src --filter Form --format json

# 檢查最佳實務違規
antd lint ./src --format json

# 僅檢查特定規則類別
antd lint ./src --only deprecated --format json
antd lint ./src --only a11y --format json
antd lint ./src --only performance --format json

6. 檢查變更日誌與版本歷史

當使用者詢問某個版本中的變更時:

# 特定版本的變更日誌
antd changelog 5.22.0 --format json

# 版本範圍(兩端包含)
antd changelog 5.21.0..5.24.0 --format json

7. 探索可用元件

當使用者正在選擇要使用哪個元件時:

# 列出所有元件及其類別
antd list --format json

# 列出特定 antd 版本的元件
antd list --version 5.0.0 --format json

8. 收集環境資訊

當您需要了解專案的 antd 設定,或為錯誤報告準備資訊時:

# 完整環境快照(純文字 — 貼入 GitHub Issues)
antd env

# 結構化 JSON 供程式使用
antd env --format json

# 掃描特定專案目錄
antd env ./my-project --format json

收集內容:作業系統、Node、套件管理器(npm/pnpm/yarn/bun/utoo)、npm registry、瀏覽器、核心相依套件(antd/react/dayjs)、所有 @ant-design/* 和 rc-* 套件,以及建置工具(umi/vite/webpack/typescript 等)。

9. 回報 antd 錯誤

當使用者要求您回報 antd 錯誤時:

# 步驟 0:收集環境資訊以供參考(可選 — antd bug 已內嵌基本環境)
# 使用輸出交叉檢查版本或將額外詳細資訊附加到錯誤報告中
antd env --format json

# 步驟 1:預覽供使用者審查
antd bug --title "DatePicker crashes when selecting date" \
  --reproduction "https://codesandbox.io/s/xxx" \
  --steps "1. Open DatePicker 2. Click a date" \
  --expected "Date is selected" \
  --actual "Component crashes with error" \
  --format json

# 步驟 2:向使用者顯示,請求確認

# 步驟 3:使用者確認後提交
antd bug --title "DatePicker crashes when selecting date" \
  --reproduction "https://codesandbox.io/s/xxx" \
  --steps "1. Open DatePicker 2. Click a date" \
  --expected "Date is selected" \
  --actual "Component crashes with error" \
  --submit

10. 回報 CLI 問題

當使用者要求您回報 CLI 錯誤,或明確請求協助提交錯誤報告時:

# 為使用者預覽錯誤報告
antd bug-cli --title "antd info Button returns wrong props for v5.12.0" \
  --description "When querying Button props for version 5.12.0, the output includes props that don't exist in that version" \
  --steps "1. Run: antd info Button --version 5.12.0 --format json" \
  --expected "Props matching antd 5.12.0 Button API" \
  --actual "Props include 'classNames' which was added in 5.16.0" \
  --format json

在提交之前向使用者顯示報告並請求確認:

antd bug-cli --title "antd info Button returns wrong props for v5.12.0" \
  --description "..." \
  --steps "..." \
  --expected "..." \
  --actual "..." \
  --submit

選擇退出: 如果環境變數 ANTD_NO_AUTO_REPORT=1 已設定,則完全跳過所有錯誤報告建議 — 除非使用者直接要求,否則不要建議使用 antd bug 或 antd bug-cli。

11. 升級 CLI

當使用者想要將 @ant-design/cli 更新至最新版本,或出現「Update available」通知時:

# 升級至最新版本(自動偵測套件管理器)
antd upgrade

該命令會偵測安裝 CLI 的套件管理器(npm、yarn、pnpm、bun、cnpm、utoo)並執行適當的升級命令。如果偵測失敗,它會建議手動命令。

12. 作為 MCP 伺服器使用

如果工作在支援 MCP 的 IDE(Claude Desktop、Cursor 等)中進行,CLI 也可以作為 MCP 伺服器執行,直接公開所有知識查詢工具:

{
  "mcpServers": {
    "antd": {
      "command": "antd",
      "args": ["mcp", "--version", "5.20.0"]
    }
  }
}

這會透過 MCP 協定提供 8 個工具(antd_list、antd_info、antd_doc、antd_demo、antd_token、antd_design_md、antd_semantic、antd_changelog)和 2 個提示(antd-expert、antd-page-generator)。

全域旗標

旗標用途
--format <format>輸出格式:json、text 或 markdown(代理應偏好使用 json)
--version <v>指定目標 antd 版本(例如 5.20.0)
--lang zh中文輸出(預設:en)
--detail包含額外欄位(description、since、deprecated、FAQ)
-V, --cli-version列印 CLI 版本並結束

關鍵規則

  1. 先查詢再編寫 — 不要憑記憶猜測 antd API。請先執行 antd info。
  2. 符合使用者版本 — 知識查詢(list/info/doc/demo/token/semantic/changelog)支援 antd v4+。如果專案使用 antd 4.x/5.x/6.x,請傳入 --version 4.24.0 / 5.24.0 / 6.x。對於 antd v3 專案,請先使用 antd migrate 3 4。
  3. 使用 --format json — 每個命令都支援此選項。請解析 JSON 輸出,而不是使用正則表達式比對文字輸出。
  4. 建議遷移前先檢查 — 在提供版本升級建議之前,請執行 antd changelog <v1> <v2> 和 antd migrate。
  5. 變更後執行 Lint — 在編寫或修改 antd 程式碼後,請對已變更的檔案執行 antd lint 以捕捉已棄用或有問題的用法。
  6. 回報 antd 錯誤 — 當使用者要求回報 antd 錯誤時,請使用 antd bug。務必先預覽,取得使用者確認後再提交。
  7. 回報 CLI 問題 — 當使用者詢問 CLI 問題時,請使用 antd bug-cli 協助他們提交報告。務必先預覽,取得使用者確認後再提交。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

0xAlchemist-cs/personal-ui-system

Build responsive, accessible UI components and layouts using Chakra UI v3, install or configure Chakra UI in new and existing projects, and design scalable themes using tokens, semantic tokens, recipes, and slot recipes. Use this skill whenever a user asks to build, create, or generate any UI component, page, form, dashboard, navbar, card, landing section, pricing table, or layout using Chakra UI; wants to add Chakra UI to a project, set up ChakraProvider, run CLI snippets, configure color mode, or fix provider wrapping; or asks about theming — defining brand colors, design tokens, semantic tokens, dark mode values, component recipes, slot recipes, typegen, or ejecting the default theme. Trigger on any Chakra UI building, setup, or theming or charts request, however casually phrased — "add my brand colors", "make a reusable card style", "build a bar chart", "show me a line chart", "make me a login form", "build a sidebar", "add Chakra to my app".

0xAlchemist-cs/personal-ui-system

Migrate Chakra UI projects from v2 to v3, covering package changes, codemods, provider setup, color mode, prop renaming, compound components, theming, recipes, and Next.js updates. Use this skill whenever a user is upgrading Chakra UI versions, encountering breaking changes after an upgrade, converting old v2 patterns (ColorModeScript, useColorModeValue, styleConfig, extendTheme, isDisabled, colorScheme, @chakra-ui/icons, framer-motion dependency), fixing compound component patterns, or asking about differences between Chakra UI v2 and v3 — even if they don't say "migrate" or "upgrade" explicitly.

0xAlchemist-cs/personal-ui-system

Review, convert, and improve UI code using Chakra UI v3. Use this skill whenever a user wants to review Chakra UI code for issues, convert plain HTML/CSS, Tailwind, CSS Modules, or styled-components to Chakra UI, clean up messy Chakra components, fix layout structure or token usage, or asks anything like "is this correct", "what's wrong with this", "review my component", "refactor this", "clean up", "convert", or "chakra-ify this" — even without the words "review" or "refactor". Trigger on any request to check, improve, or convert Chakra UI code, however casually phrased.

0xAlchemist-cs/personal-ui-system

Integrates Material UI with Next.js App and Pages routers using @mui/material-nextjs, Emotion cache providers, next/font, CSS layers with Tailwind/CSS Modules, Link component prop patterns, CSS theme variables SSR notes, and App Router useSearchParams + Suspense. Use when setting up or debugging MUI in a Next.js app.

相關技能