跳到正文
Skillpedia
网站与界面(前端)39k · #7485

pro-upgrade

它能做什么

这项技能指导 Ant Design Pro 项目的升级。适合基于 Pro 模板搭建项目、希望升级到新版本而不丢失自己工作成果的团队。

适用场景

  • ✓当你想把 Ant Design Pro 项目升级到最新版本的时候。
  • ✓当你的 Pro 项目落后于官方模板、需要跟上进度的时候。
  • ✓当你希望在保留自定义代码的同时让项目保持最新的时候。

技能链接

https://github.com/ant-design/ant-design-pro/blob/master/.claude/skills/pro-upgrade/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/ant-design/ant-design-pro/blob/master/.claude/skills/pro-upgrade/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请把我们的 Ant Design Pro 项目升级到最新的模板版本,并保留我们所有自己的页面和设置。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会先检查你的更改是否已提交,然后下载最新的官方模板。它会把你的文件分为模板拥有的文件和你自己的业务文件,进行比较,并在保留你的工作成果的同时合并模板的更改。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Ant Design Pro Upgrade Skill

You are an Ant Design Pro upgrade assistant. Your task is to help users upgrade their Pro-based project to the latest version by comparing it against the official template and intelligently merging changes.

Preflight

Before starting, confirm:

  1. The user has committed or stashed all changes (git status should be clean or they confirm it's OK to proceed).
  2. If not clean, remind them to commit or stash their changes first (e.g., "Please commit or stash your changes — the upgrade process will modify multiple files.") and wait for them to confirm.

Upgrade Flow

Step 1 — Fetch the latest template

rm -rf /tmp/ant-design-pro-upgrade
git clone --depth=1 https://github.com/ant-design/ant-design-pro.git /tmp/ant-design-pro-upgrade

Read the template's package.json to confirm its version.

Step 2 — Classify files

Separate the user's project files into framework files (Pro-owned, rarely customized) and business files (user-written, must be preserved).

Framework files — diff these against the template:

Path Notes
package.json dependencies, scripts, devDependencies only
config/config.ts framework config
config/routes.ts structure only — preserve user-added routes
config/defaultSettings.ts layout/theme defaults
config/proxy.ts structure only — preserve user targets
src/app.tsx runtime config
src/access.ts permission definitions
src/global.tsx global side effects
src/loading.tsx loading component
src/requestErrorConfig.ts request interceptor
src/typings.d.ts global type declarations
tsconfig.json TypeScript config
biome.json or biome.jsonc linter config
.husky/ git hooks
commitlint.config.* commit lint config
src/services/ant-design-pro/ auto-generated — do NOT manually edit; regenerate with npm run openapi

Business files — preserve these, only adjust imports/APIs if needed:

  • src/pages/** — user pages
  • src/components/** — user components
  • src/models/** — user models
  • src/services/**/*.ts — custom service files (NOT the ant-design-pro/ subdirectory)
  • src/locales/** — user translations (framework keys may need updating)
  • src/utils/** — user utilities
  • mock/** — user mocks
  • Any other files not listed above

Step 3 — Diff framework files

For each framework file, read both the user's version and the template version. Identify:

  • New dependencies or version bumps in package.json
  • New/changed config options in config/ files
  • Import path changes (e.g., from 'umi' → from '@umijs/max')
  • API changes in src/app.tsx, src/access.ts, etc.
  • New files that exist in template but not in user's project

Step 4 — Merge intelligently

Apply changes with these rules:

Framework files — adopt template structure, preserve user customizations:

  • package.json: update dependency versions to match template. Keep any extra deps the user added. If a dependency exists in the user's project but not in the template, assume it is a user customization and preserve it.
  • config/routes.ts: adopt the template's route structure for framework pages, but keep all user-added routes intact.
  • config/proxy.ts: adopt structure, preserve user's proxy targets.
  • Other framework files: adopt the template version, preserving any user customizations that are clearly intentional (comments, extra exports, business logic mixed in).

Business files — minimal changes only:

  • Update import paths if framework modules moved (e.g., 'umi' → '@umijs/max').
  • Update deprecated API calls if the template shows a new pattern.
  • Never rewrite business logic, restructure components, or change styling approaches unless the old approach is broken.

Auto-generated files:

  • src/services/ant-design-pro/: do NOT edit. Tell the user to run npm run openapi after upgrade.

Step 5 — Antd-specific migration checks

Run these commands to catch antd API changes:

npx antd env --format json
npx antd lint ./src --format json --only deprecated

If the user is upgrading across major antd versions, also run:

npx antd migrate <current_major> <target_major> --format json

Detect the current major version from the user's package.json and the target from the template's.

Address any findings by updating the flagged code.

Step 6 — Install and verify

n
常见问题

我需要先保存更改吗?

需要。技能会要求你在升级开始之前提交或暂存你的更改。

我自己的页面会被覆盖吗?

不会。你编写的业务文件会被保留,你添加的路由也会被保留。

什么是模板?

它是官方的 Ant Design Pro 起始项目,你的应用就是基于它构建的。

详情

作者的原始描述

Use when the user wants to upgrade their Ant Design Pro project to the latest version. Triggers on: upgrade pro, pro upgrade, migrate pro, update pro, 升级, 迁移项目, "how to upgrade", "update to latest", "keep project up to date".

repo: ant-design/ant-design-pro

热度

GitHub 星标
39k
排名
#7485
许可证
MIT
更新时间
2026/10/28

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能