Global flags for CLI commands
Global flags supported by CLI commands: '--format json|text|markdown' (default 'text'), '--version <v>' to target a specific antd version like '5.20.0' (default auto-detect), '--lang en|zh' (default 'en'), '--detail' to include extended information (default false), and '-V, --cli-version' to print the CLI version.
@ant-design/cli highlights
The CLI is fully offline with all metadata shipped with the package. It is version-accurate with 55+ per-minor snapshots across v3/v4/v5/v6, agent-optimized with '--format json' on every command and structured errors with codes and suggestions. It is bilingual with every component name, description, and doc in both English and Chinese, supports smart matching with typo suggestions using Levenshtein distance, and includes 18 commands.
antd design.md command
The 'antd design.md' command outputs the design language description file for Ant Design, conformant with the google-labs-code/design.md specification. This file is intended for AI design tools such as Figma Make and Google Stitch to generate UI that follows Ant Design's visual language.
antd design.md output options
The 'antd design.md' command supports '--format json' for JSON format output and '--lang zh' for Chinese descriptions. The default format is text and default language is English.
antd migrate command
The 'antd migrate <from> <to>' command displays a migration checklist with auto-fixable and manual sections for upgrading between versions. The '--apply' flag enables an agent-ready migration prompt.
antd setup command
The 'antd setup' command sets up Ant Design MCP or Skill for Claude Code, Cursor, VS Code, or Codex. It supports '--client' parameter to specify the target tool and '--mode both' to write MCP configuration and install the bundled Ant Design skill. Additional flags include '--write-instructions', '--dry-run', and '--check'.
CLI usage with AI tools
The CLI includes built-in Skill files that guide Code Agents to call the correct commands at the right time. Install with: npx skills add ant-design/ant-design-cli. Supports Claude Code, Cursor, Codex, and Gemini CLI via the skills protocol.
@ant-design/cli key features
The CLI offers: complete offline operation with all metadata installed, version-precise coverage across 55+ minor versions for v3/v4/v5/v6, Agent-optimized output with --format json and structured error codes, bilingual output with --lang zh option, smart error correction using Levenshtein distance, and 18 total commands.
@ant-design/cli package overview
@ant-design/cli is the official command-line tool that brings Ant Design knowledge to your terminal. All metadata is installed with the package — every Prop, Token, Demo, and Changelog entry for antd v3/v4/v5/v6 — with millisecond-level queries and completely offline operation.
@ant-design/cli installation
Install globally with: npm install -g @ant-design/cli. Requires Node.js >=20.0.0. Can also use pnpm add -g @ant-design/cli or bun add -g @ant-design/cli for global installation.
CLI global parameters
Global parameters: --format json|text|markdown (default: text) sets output format; --version <v> sets target antd version (e.g., 5.20.0, default: auto-detected); --lang en|zh sets output language (default: en); --detail includes extended information (default: false); -V, --cli-version prints CLI version number.
CLI version detection order
Version auto-detection follows this order: --version parameter, node_modules/antd, package.json dependency declaration, then default fallback version.
CLI environment variables
Three environment variables control CLI behavior: ANTD_NO_AUTO_REPORT=1 disables Bug report suggestions for AI Agents; NO_UPDATE_CHECK=1 skips silent version update checks; CI=1 skips silent version update checks (equivalent to NO_UPDATE_CHECK=1).
Browser script tag import for antd
Ant Design can be imported via script tags in the browser, but using npm is recommended for easier maintenance.
For Agents page prompt for AI coding agents
Ant Design provides a prompt for AI coding agents that includes: read https://ant.design/docs/react/for-agents.md and https://raw.githubusercontent.com/ant-design/ant-design-cli/main/skills/antd/SKILL.md before writing code, pay attention to deprecation warnings, and follow instructions to use Ant Design. If the agent can install skills, run: npx skills add ant-design/ant-design-cli
Install @ant-design/cli globally
Install the Ant Design CLI globally using: npm install -g @ant-design/cli
@ant-design/cli ships all metadata locally
@ant-design/cli contains all metadata locally for antd v3, v4, v5, and v6 including every prop, token, demo, and changelog entry, queryable in milliseconds and fully offline.
LLMs.txt documentation files
LLMs.txt files provide structured documentation for AI: llms.txt (https://ant.design/llms.txt) is a navigation file with links to all documentation and components; design.md (https://ant.design/design.md) describes design language for AI design tools; llms-full.txt (https://ant.design/llms-full.txt) contains complete component documentation in English; llms-full-cn.txt (https://ant.design/llms-full-cn.txt) contains complete component documentation in Chinese. Individual component documentation can be accessed at https://ant.design/components/<name>.md
AI Agent prompt for Ant Design usage
Before writing any code, read https://ant.design/docs/react/for-agents-cn.md and https://raw.githubusercontent.com/ant-design/ant-design-cli/main/skills/antd/SKILL.md to understand deprecation notices and proper usage of Ant Design. The version may contain breaking changes with component APIs, conventions, and file structures differing from training data. If skills can be installed, run: npx skills add ant-design/ant-design-cli
@ant-design/cli installation
The @ant-design/cli package provides all metadata for antd v3, v4, v5, and v6 including every Prop, Token, Demo, and Changelog entry with millisecond-level queries, completely offline. Install globally with: npm install -g @ant-design/cli
MCP Server integration for IDE
The CLI supports running as an MCP server, providing 8 tools and 2 prompts for IDE integration with Claude Code, Cursor, VS Code, and others. Configure in mcpServers settings with command 'npx' and args ['-y', '@ant-design/cli', 'mcp'].
Jest configuration for Ant Design
Jest does not support ESM modules, and Ant Design uses them. To test an Ant Design application with Jest, add the following to your Jest config: "transform": { "^.+\\.(ts|tsx|js|jsx)?$": "ts-jest" }
Recommended build tools for Ant Design
For custom workflows, webpack or vite are recommended for building and debugging Ant Design applications. Various scaffolds from the React ecosystem are available for development, and many community-maintained scaffolds customized for antd exist at https://scaffold.ant.design/.
Tree shaking support in antd
The antd package supports tree shaking by default based on ES modules. Direct imports like `import { Button } from 'antd';` automatically benefit from tree shaking and only load the required components.
Ant Design Pro and scaffolding options
For projects requiring build, debug, proxy, and deployment workflows, Ant Design Pro (https://pro.ant.design/) is available. Additional scaffolds include create-next-app and the scaffold marketplace at https://scaffold.ant.design/.
MCP Server version pinning
Pin a specific Ant Design version in MCP configuration by adding --version argument: { "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp", "--version", "5.20.0"] } } }
MCP Server configuration for IDE
Add the MCP server to IDE configuration using the JSON block: { "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } } or if CLI is installed globally: { "mcpServers": { "antd": { "command": "antd", "args": ["mcp"] } } }
Official MCP Server availability
Starting from @ant-design/cli v6.3.5, you can start the official MCP server using the `antd mcp` command, which provides 8 tools and 2 prompts with support for IDE integration.
MCP Server tools provided
The official Ant Design MCP Server provides the following tools: antd_list (list available components), antd_info (get component property specifications), antd_doc (get complete documentation), antd_demo (get runnable code examples), antd_token (query Design Token values), antd_design_md (get design language documentation), antd_semantic (view DOM structure and style hooks), antd_changelog (analyze API changes across versions).
MCP Server prompts
The official Ant Design MCP Server provides two prompts: antd-expert (positions the Agent as an Ant Design expert) and antd-page-generator (assists with component-based page creation).
Configure MCP Server with npx
To configure the Ant Design MCP server using npx, add this to your IDE configuration: { "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
Configure MCP Server with global CLI installation
If @ant-design/cli is installed globally using `npm i -g @ant-design/cli`, you can configure the MCP server with: { "mcpServers": { "antd": { "command": "antd", "args": ["mcp"] } } }
Configure MCP Server with specific antd version
You can specify a particular Ant Design version when configuring the MCP server by adding the --version parameter: { "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp", "--version", "5.20.0"] } } }
MCP Server configuration for Cursor IDE
In Cursor, add the MCP server to `.cursor/mcp.json` or go to Settings → Features → MCP. Configuration: { "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
MCP Server configuration for Windsurf
In Windsurf, add the MCP server to `~/.codeium/windsurf/mcp_config.json`. Configuration: { "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
MCP Server configuration for Claude Code
In Claude Code, add the MCP server to Claude settings' `mcpServers`. Configuration: { "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
MCP Server configuration for VS Code
In VS Code, add the MCP server to `.vscode/mcp.json` or go to Settings → MCP. Configuration uses "servers" instead of "mcpServers": { "servers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
MCP Server configuration for Codex
In Codex, add the MCP server to `.codex/mcp.json`. Configuration: { "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
MCP Server configuration for Gemini CLI
In Gemini CLI, add the MCP server to the MCP configuration. Configuration: { "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
MCP Server configuration for Trae
In Trae, add the MCP server to MCP settings. Configuration: { "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
MCP Server configuration for Qoder
In Qoder, add the MCP server to the MCP configuration. Configuration: { "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
MCP Server configuration for Neovate Code
In Neovate Code, configure MCP in settings or use prompts to describe tasks. Configuration: { "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }
Community MCP Server for Ant Design
A community-maintained MCP server is available as @jzone-mcp/antd-components-mcp on npm. It provides: list-components (list all available Ant Design components), get-component-docs (get detailed documentation for a specific component), list-component-examples (get code examples for a component), get-component-changelog (get component update logs).
Configure community MCP Server
To configure the community MCP server @jzone-mcp/antd-components-mcp, add: { "mcpServers": { "antd-components": { "command": "npx", "args": ["-y", "@jzone-mcp/antd-components-mcp"] } } }
Use Ant Design CLI to assist v5 to v6 upgrade
The Ant Design CLI can check deprecated APIs, component usage, and version differences in your codebase to assist with upgrading from v5 to v6, reducing reliance on manual review.
Recommended command line tool
The recommended command line tool is Ant Design CLI.