diff --git a/CLAUDE.md b/CLAUDE.md index ff768f35..1e05118e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -40,10 +40,23 @@ Other: `npm run openapi` (regenerate `src/services/`), `npm run simple` (**irrev **Cloudflare Worker**: `cloudflare-worker/` — separate Hono app, own `package.json`, not an npm workspace. -## Upgrading +## AI Skills + +This project ships with two built-in Claude Code Skills (`.claude/skills/`). If you already have these skills in your project, no installation is needed — just run them directly. To update to the latest skill definitions, run `npx skills add ant-design/ant-design-pro`. + +### `/pro-upgrade` — Project Upgrade Run `/pro-upgrade` in Claude Code to auto-upgrade the project to the latest Ant Design Pro version. It diffs the latest template against this project and merges framework changes while preserving business code. Works for any version gap (v5→v6, v6.x→latest, etc.). +### `/antd` — Ant Design CLI + +Run `/antd` in Claude Code for any antd-related work. It provides access to `@ant-design/cli` with offline metadata for antd v3/v4/v5/v6. Key commands: + +- `npx antd info ` — look up props/API before writing code (mandatory) +- `npx antd lint ./src` — check for deprecated or problematic usage (must pass before commit) +- `npx antd demo ` — get working code examples +- `npx antd migrate ` — migration checklist between major versions + ## Page Co-location Each page dir: `index.tsx`, optional `service.ts`, `_mock.ts`, `data.d.ts`, style files. Keep page-specific code with the page. \ No newline at end of file diff --git a/README.md b/README.md index 9c3e17b4..40060e17 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,27 @@ This will: npm run build ``` +## AI Skills (Claude Code) + +This project ships with two built-in [Claude Code Skills](https://docs.anthropic.com/en/docs/claude-code/skills) in `.claude/skills/`: + +| Skill | Trigger | Description | +|---|---|---| +| `/pro-upgrade` | "upgrade pro", "update to latest" | Auto-upgrade to the latest Ant Design Pro version. Diffs the latest template, merges framework changes while preserving your business code. | +| `/antd` | antd-related code or questions | Query antd component APIs, props, tokens, demos; lint for deprecated usage; migrate between versions — all via `@ant-design/cli`. | + +**Usage in Claude Code:** + +```bash +# Upgrade the project to latest Pro version +/pro-upgrade + +# Query antd component info, debug issues, run lint, etc. +/antd +``` + +> 💡 If your project was cloned from this repo, these skills are already included — no installation needed. To get the latest skill definitions, pull the updates from the template or run `npx skills add ant-design/ant-design-pro` to refresh them. + ## Browsers support Modern browsers. diff --git a/README.zh-CN.md b/README.zh-CN.md index 6117cea6..3f3dd897 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -123,6 +123,27 @@ npm run build 更多信息请参考 [使用文档](./docs/cheatsheet.zh-CN.md)。 +## AI Skills(Claude Code) + +本项目内置了两个 [Claude Code Skills](https://docs.anthropic.com/en/docs/claude-code/skills),位于 `.claude/skills/` 目录下: + +| Skill | 触发词 | 说明 | +|---|---|---| +| `/pro-upgrade` | "升级"、"upgrade pro"、"update to latest" | 自动升级到最新 Ant Design Pro 版本。对比最新模板差异,合并框架变更并保留业务代码。 | +| `/antd` | antd 相关代码或问题 | 查询 antd 组件 API、props、token、demo;检查废弃用法;跨版本迁移 — 基于 `@ant-design/cli`。 | + +**在 Claude Code 中使用:** + +```bash +# 升级项目到最新 Pro 版本 +/pro-upgrade + +# 查询 antd 组件信息、调试问题、运行 lint 等 +/antd +``` + +> 💡 如果你的项目是从本仓库克隆的,这些 skill 已经内置,无需额外安装。如需获取最新 skill 定义,可以从模板拉取更新或运行 `npx skills add ant-design/ant-design-pro` 刷新。 + ## 支持环境 现代浏览器。 diff --git a/docs/cheatsheet.en-US.md b/docs/cheatsheet.en-US.md index 639fa394..31629250 100644 --- a/docs/cheatsheet.en-US.md +++ b/docs/cheatsheet.en-US.md @@ -563,6 +563,54 @@ npm run simple # Irreversible npm install # Update dependencies ``` +## AI Skills (Claude Code) + +This project includes two built-in [Claude Code Skills](https://docs.anthropic.com/en/docs/claude-code/skills) (`.claude/skills/`): + +### `/pro-upgrade` — Project Upgrade Assistant + +Auto-upgrade to the latest Ant Design Pro version. Diffs the latest template against your project and merges framework changes while preserving business code. + +```bash +# In Claude Code, just run: +/pro-upgrade +``` + +What it does: +1. Clones the latest Pro template +2. Classifies framework vs. business files +3. Merges dependency updates, config changes, and code pattern migrations +4. Runs `npx antd lint` to catch antd-specific issues +5. Verifies with `npm run lint && npm run build` + +### `/antd` — Ant Design CLI Helper + +Query antd component APIs, debug issues, lint for deprecated usage, and assist migrations — all via `@ant-design/cli` with offline bundled metadata. + +```bash +# In Claude Code, just run: +/antd +``` + +Key commands available: +- `npx antd info ` — props, types, version info +- `npx antd demo ` — working code examples +- `npx antd lint ./src` — check for deprecated/problematic usage +- `npx antd migrate ` — migration checklist between versions +- `npx antd doc ` — full component documentation + +### Installation & Updates + +> 💡 If your project was cloned from this repo, these skills are already included — no installation needed. + +To get the latest skill definitions (or add them to an existing project): + +```bash +npx skills add ant-design/ant-design-pro +``` + +For other AI assistants (Cursor, etc.), paste the content of `.claude/skills/pro-upgrade/SKILL.md` or `.claude/skills/antd/SKILL.md` into the assistant's context. + ## Constraints & Gotchas - **`src/services/ant-design-pro/`** is auto-generated code. Do NOT edit manually. Modify `config/oneapi.json` and run `npm run openapi` to regenerate. diff --git a/docs/cheatsheet.zh-CN.md b/docs/cheatsheet.zh-CN.md index 753d6620..9c1f0e05 100644 --- a/docs/cheatsheet.zh-CN.md +++ b/docs/cheatsheet.zh-CN.md @@ -563,6 +563,54 @@ npm run simple # 不可逆操作 npm install # 更新依赖 ``` +## AI Skills(Claude Code) + +本项目内置两个 [Claude Code Skills](https://docs.anthropic.com/en/docs/claude-code/skills)(位于 `.claude/skills/`): + +### `/pro-upgrade` — 项目升级助手 + +自动升级到最新 Ant Design Pro 版本。对比最新模板差异,合并框架变更并保留业务代码。 + +```bash +# 在 Claude Code 中直接运行: +/pro-upgrade +``` + +执行流程: +1. 克隆最新 Pro 模板 +2. 将文件分类为框架文件和业务文件 +3. 合并依赖更新、配置变更和代码模式迁移 +4. 运行 `npx antd lint` 检查 antd 相关问题 +5. 通过 `npm run lint && npm run build` 验证 + +### `/antd` — Ant Design CLI 助手 + +查询 antd 组件 API、调试问题、检查废弃用法、辅助版本迁移 — 基于 `@ant-design/cli`,离线元数据,无需网络。 + +```bash +# 在 Claude Code 中直接运行: +/antd +``` + +常用命令: +- `npx antd info ` — props、类型、版本信息 +- `npx antd demo ` — 可运行的代码示例 +- `npx antd lint ./src` — 检查废弃或有问题的用法 +- `npx antd migrate ` — 版本迁移清单 +- `npx antd doc ` — 完整组件文档 + +### 安装与更新 + +> 💡 如果你的项目是从本仓库克隆的,这些 skill 已经内置,无需额外安装。 + +获取最新 skill 定义(或将其添加到已有项目): + +```bash +npx skills add ant-design/ant-design-pro +``` + +如使用其他 AI 助手(Cursor 等),可将 `.claude/skills/pro-upgrade/SKILL.md` 或 `.claude/skills/antd/SKILL.md` 的内容提供给它。 + ## 注意事项 - **`src/services/ant-design-pro/`** 为自动生成代码,禁止手动编辑。修改 `config/oneapi.json` 后执行 `npm run openapi` 重新生成