antd
它能做什么
这项技能为智能体提供 Ant Design 组件库的准确参考数据。适合构建或调试使用 antd 的 React 界面的开发者。
适用场景
- ✓当你在代码中编写或修改 Ant Design 组件的时候。
- ✓当你需要找到正确的属性、可运行的示例或某个组件的设计令牌的时候。
- ✓当你在 Ant Design 版本之间升级,或调试 antd 问题的时候。
技能链接
https://github.com/ant-design/ant-design-pro/blob/master/.claude/skills/antd/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在这个表单中添加一个 Ant Design 日期选择器。先检查可用的属性,并使用可运行的示例。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会使用一个本地命令行工具,它内置了多个版本的 Ant Design 数据。它会查找每个组件的属性、示例和主题令牌,然后基于这些信息而不是记忆来编写代码。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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.
# Check what props are available
npx antd info Button --format json
# Get a working demo as starting point
npx antd demo Button basic --format json
# Check semantic classNames/styles for custom styling
npx antd semantic Button --format json
# Check component-level design tokens for theming
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 # full markdown docs for Table
npx antd doc Table --lang zh # Chinese docs
3. Debugging antd issues
When code isn't working as expected or the user reports an antd bug:
# Collect full environment snapshot (system, deps, browsers, build tools)
npx antd env --format json
# Check if the prop exists for the user's antd version
npx antd info Select --version 5.12.0 --format json
# Check if the prop is deprecated
npx antd lint ./src/components/MyForm.tsx --format json
# Diagnose project-level configuration issues
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):
# Get full migration checklist
npx antd migrate 3 4 --format json # v3 → v4
npx antd migrate 4 5 --format json # v4 → v5
# Check migration for a specific component
npx antd migrate 4 5 --component Select --format json
# See what changed between two versions
npx antd changelog 4.24.0 5.0.0 --format json
# See changes for a specific component
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:
# Scan component usage statistics
npx antd usage ./src --format json
# Filter to a specific component
npx antd usage ./src --filter Form --format json
# Lint for best practice violations
npx antd lint ./src --format json
# Check only specific rule categories
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:
# Specific version changelog
npx antd changelog 5.22.0 --format json
# Version range (both ends inclusive)
npx antd changelog 5.21.0..5.24.0 --format json
7. Exploring available components
When the user is choosing which component to use:
# List all components with categories
npx antd list --format json
# List components for a specific antd version
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:
# Full environment snapshot (text — paste into GitHub Issues)
npx antd env
# Structured JSON for programmatic use
npx antd env --format json
# Scan a specific project directory
npx antd env ./my-project --format json
9. Reporting antd bugs
When the user asks you to report an antd bug:
# Step 0: Collect environment info for reference (optional)
npx antd env --format json
# Step 1: Preview for user review
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
常见问题
它需要联网吗?
不需要。Ant Design 数据内置在本地命令行工具中,因此查询可以离线进行。
它涵盖哪些版本?
Ant Design 3、4、5 和 6 版本。
它能帮助迁移吗?
可以。它可以指导 Ant Design 版本之间的迁移,并分析项目中 antd 的使用情况。
详情
作者的原始描述
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.
热度
- GitHub 星标
- 39k
- 排名
- #7484
- 许可证
- MIT
- 更新时间
- 2026/10/28
评论
- …