name: ant-design description: Work effectively in the ant-design/ant-design codebase and in Ant Design based React apps. Use when tasks involve implementing or fixing Ant Design components, adding demos, updating component docs (index.en-US.md / index.zh-CN.md), adjusting theme tokens via ConfigProvider, handling Next.js or Vite integration, or preparing contribution-quality tests/lint/build checks for Ant Design changes.
Ant Design
Overview
Execute Ant Design tasks with repository-accurate workflow and guardrails. Prefer small, reviewable changes that keep component code, demos, docs, and tests in sync.
Workflow
- Identify task mode:
- Use repo contribution mode for changes inside
ant-design/ant-design. - Use app integration mode for consumer apps using
antd.
- Load only the needed reference:
- Open
references/repo-map.mdfor directory map and command matrix. - Open
references/implementation-playbook.mdfor change and validation checklist.
- Locate the component scope quickly:
- Run
scripts/find_component.sh <repo_root> <component_or_keyword>.
- Implement paired changes:
- Update source, demo, docs, and tests together when behavior or API changes.
- Validate progressively:
- Start from targeted checks, then run broader checks only if needed.
- Summarize impact:
- Report modified files, commands run, and remaining risk.
Repo Contribution Mode
- Locate the target component:
- Example:
scripts/find_component.sh /path/to/ant-design button.
- Follow component structure convention:
components/<name>/index.tsx: public export entry.components/<name>/*.tsx: implementation.components/<name>/style/*: token/style logic.components/<name>/demo/*: docs demos.components/<name>/index.en-US.mdandindex.zh-CN.md: API/docs.components/<name>/__tests__/*: behavior snapshots and tests.
- Keep docs and demos aligned with behavior:
- Add or update demos if UX/API changed.
- Update both Chinese and English docs when API changes.
- Validate with minimal-first ladder:
- Targeted test first, then
npm run test,npm run lint, optionalnpm run compile. - Run image tests only for visual-impacting changes.
App Integration Mode
- Bootstrap quickly:
- Install
antdand import components directly (import { Button } from 'antd').
- Configure theme through
ConfigProvider theme={{ token: ... }}. - Handle SSR/style extraction by framework:
- Next.js App Router: use
@ant-design/nextjs-registry. - Next.js Pages Router: use
@ant-design/cssinjscache +extractStyle.
- Respect known constraints:
- Next.js App Router does not support sub-components via dot syntax like
<Select.Option />. - Static methods (
message.xxx,Modal.xxx,notification.xxx) do not consume surroundingConfigProvidercontext; use hooks orAppwrapper when context is needed.
High-Value References
- Ant Design LLM endpoints:
https://ant.design/llms.txthttps://ant.design/llms-full.txt
- Use these for quick component/API grounding when local docs are unavailable.
Resources
scripts/find_component.sh- Locate matching components and print key implementation/docs/test files.
references/repo-map.md- Read for repository structure and common commands.
references/implementation-playbook.md- Read for execution checklist before submitting or finalizing changes.