| name | antd |
| description | Use when the user's task involves Ant Design (antd) โ writing antd components, debugging antd issues, querying antd APIs/props/tokens/demos, migrating between antd versions, or analyzing antd usage in a project. Triggers on antd-related code, imports from 'antd', or explicit antd questions.
|
| allowed-tools | ["Bash(antd *)","Bash(antd bug*)","Bash(antd bug-cli*)","Bash(npx antd *)","Bash(npx antd bug*)","Bash(npx antd bug-cli*)"] |
Ant Design CLI
You have access to @ant-design/cli โ a local CLI tool with bundled antd metadata for v3/v4/v5/v6. Use it to query component knowledge, analyze projects, and guide migrations. All data is offline, no network needed.
Setup
The CLI is installed as a dev dependency. Use npx antd to run it.
Always use --format json for structured output you can parse programmatically.
Scenarios
1. Writing antd component code
Before writing any antd component code, look up its API first โ don't rely on memory.
npx antd info Button --format json
npx antd demo Button basic --format json
npx antd semantic Button --format json
npx antd token Button --format json
Workflow: antd info โ understand props โ antd demo โ grab a working example โ write code.
2. Looking up full documentation
When you need comprehensive component docs (not just props):
npx antd doc Table --format json
npx antd doc Table --lang zh
3. Debugging antd issues
When code isn't working as expected or the user reports an antd bug:
npx antd env --format json
npx antd info Select --version 5.12.0 --format json
npx antd lint ./src/components/MyForm.tsx --format json
npx antd doctor --format json
Workflow: antd env โ capture full environment โ antd doctor โ check configuration โ antd info --version X โ verify API against the user's exact version โ antd lint โ find deprecated or incorrect usage.
4. Migrating between versions
When the user wants to upgrade antd (e.g., v3 โ v4 or v4 โ v5):
npx antd migrate 3 4 --format json
npx antd migrate 4 5 --format json
npx antd migrate 4 5 --component Select --format json
npx antd changelog 4.24.0 5.0.0 --format json
npx antd changelog 4.24.0 5.0.0 Select --format json
Workflow: antd migrate โ get full checklist โ antd changelog <v1> <v2> โ understand breaking changes โ apply fixes โ antd lint โ verify no deprecated usage remains.
5. Analyzing project antd usage
When the user wants to understand how antd is used in their project:
npx antd usage ./src --format json
npx antd usage ./src --filter Form --format json
npx antd lint ./src --format json
npx antd lint ./src --only deprecated --format json
npx antd lint ./src --only a11y --format json
npx antd lint ./src --only performance --format json
6. Checking changelogs and version history
When the user asks about what changed in a version:
npx antd changelog 5.22.0 --format json
npx antd changelog 5.21.0..5.24.0 --format json
7. Exploring available components
When the user is choosing which component to use:
npx antd list --format json
npx antd list --version 5.0.0 --format json
8. Collecting environment info
When you need to understand the project's antd setup, or prepare info for a bug report:
npx antd env
npx antd env --format json
npx antd env ./my-project --format json
9. Reporting antd bugs
When the user asks you to report an antd bug:
npx antd env --format json
npx 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
npx 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. Reporting CLI issues
When the user asks to report a CLI bug:
npx antd bug-cli --title "antd info Button returns wrong props" \
--description "When querying Button props for version 5.12.0, the output includes props that don't exist" \
--steps "1. Run: npx 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
Show the report to the user and confirm before submitting with --submit.
Opt-out: If the environment variable ANTD_NO_AUTO_REPORT=1 is set, skip all bug-reporting suggestions entirely.
11. Using as MCP server
If working in an IDE that supports MCP (Claude Desktop, Cursor, etc.), the CLI can also run as an MCP server:
{
"mcpServers": {
"antd": {
"command": "npx",
"args": ["antd", "mcp"]
}
}
}
This provides 7 tools (antd_list, antd_info, antd_doc, antd_demo, antd_token, antd_semantic, antd_changelog) and 2 prompts (antd-expert, antd-page-generator) via MCP protocol.
Global Flags
| Flag | Purpose |
|---|
--format json | Structured output โ always use this |
--version <v> | Target a specific antd version (e.g. 5.20.0) |
--lang zh | Chinese output (default: en) |
--detail | Include extra fields (description, since, deprecated, FAQ) |
Key Rules
- Always query before writing โ Don't guess antd APIs from memory. Run
antd info first.
- Match the user's version โ This project uses antd v6. The CLI auto-detects from
node_modules if no flag is given.
- Use
--format json โ Every command supports it. Parse the JSON output rather than regex-matching text output.
- Check before suggesting migration โ Run
antd changelog <v1> <v2> and antd migrate before advising on version upgrades.
- Lint after changes โ After writing or modifying antd code, run
antd lint on the changed files to catch deprecated or problematic usage.
- Report antd bugs โ When the user asks to report an antd bug, use
antd bug. Always preview first, get user confirmation, then submit.
- Report CLI issues โ When the user asks about a CLI problem, use
antd bug-cli to help them file a report. Always preview first, get user confirmation, then submit.