1---2name: ant-design3description: Decision guide for antd 6.x, Ant Design Pro 5/ProComponents, Ant Design X v2, and the offline `@ant-design/cli`. Use for component selection, theming/tokens, SSR, a11y, performance, routing/access/CRUD, AI/chat UI patterns, local API lookup, debugging, migration, and usage analysis.4---56# Ant Design78## S - Scope9- Target: `antd@^6` + React 18-19, with `ant-design-pro@^5` / `@ant-design/pro-components` and `@ant-design/x@^2` when needed.10- Tooling: `@ant-design/cli` for offline component metadata, demos, changelogs, migrations, linting, doctor checks, and usage analysis.11- Focus: decision guidance only; no end-user tutorials.12- Source policy: official docs only; no undocumented APIs or internal `.ant-*` coupling.1314### Default assumptions15- Language: TypeScript.16- Styling: tokens first, then `classNames`/`styles`; avoid global overrides.17- Provider: one root `ConfigProvider` unless strict isolation is required.1819### Mandatory rules20- Before writing or changing antd component code, query the component API first with `antd info <Component> --format json`. Do not rely on memory when the CLI can answer it offline.21- Always use `--format json` with `antd` CLI commands.22- If the project version matters, match it with `--version <x.y.z>` or let the CLI auto-detect from local `node_modules`.23- After changing antd code, run `antd lint <changed-path> --format json`.24- If an `antd` CLI command crashes, returns wrong data, or violates its documented behavior, prepare an `antd bug-cli` preview for user confirmation instead of silently working around it.25- For component questions, first map the component name to the official route slug `{components}` (lowercase kebab-case, e.g. `TreeSelect -> tree-select`, `Button -> button`), then request docs in this order (CN first, EN fallback):26 1. `https://ant.design/components/{components}-cn`27 2. `https://ant.design/components/{components}`28 - Examples: `tree-select-cn -> tree-select`, `button-cn -> button`.29- Use only documented antd/Pro/X APIs.30- Do not invent props/events/component names.31- Do not rely on internal DOM or `.ant-*` selectors.32- Theme priority: global tokens -> component tokens -> alias tokens.3334## P - Process35### 1) Classify36- Identify layer: core antd, Pro, or X.37- Confirm version, rendering mode (CSR/SSR/streaming), data scale, and whether `@ant-design/cli` should be the primary lookup path.3839### 2) Query authoritative sources40- Prefer local `@ant-design/cli` first for structured lookup:41 - `antd info` for props/API42 - `antd demo` for a working baseline43 - `antd doc` for full docs44 - `antd token` / `antd semantic` for theming and styling hooks45 - `antd doctor`, `antd lint`, `antd usage`, `antd migrate`, `antd changelog` when debugging or upgrading46- Then request the official component docs (`-cn` first, EN fallback) when narrative docs or cross-checking are needed.4748### 3) Decide49- Provider baseline: CSR -> `ConfigProvider`; SSR -> `ConfigProvider` + `StyleProvider`.50- Theming baseline: global tokens -> component tokens -> `classNames`/`styles`.51- Output recommendation + risk + verification points (SSR/a11y/perf), citing CLI findings when used.5253## O - Output54- Provide short decision rationale (1-3 sentences).55- Include minimal provider/theming strategy.56- Include concrete SSR/a11y/perf checks.57- For Pro: include route/menu/access and CRUD schema direction.58- For X: include message/tool schema and streaming state direction.5960## References6162| File | Use when |63| --- | --- |64| `references/antd-cli.md` | You need the exact offline CLI workflow for API lookup, demos, linting, doctor checks, migration, changelog review, usage analysis, or bug reporting. |6566## Regression checklist67- [ ] One root `ConfigProvider`; SSR style order/hydration verified.68- [ ] Tokens first; no broad global `.ant-*` overrides.69- [ ] Table has stable `rowKey`; sort/filter/pagination entry is unified.70- [ ] Select remote mode disables local filter when using remote search.71- [ ] Upload controlled/uncontrolled mode is explicit with failure/retry path.72- [ ] Pro route/menu/access remain consistent with backend enforcement.73- [ ] X streaming supports stop/retry and deterministic tool rendering.74- [ ] If `antd` CLI was used, commands ran with `--format json` and any CLI defect was escalated via `antd bug-cli` preview.