> For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt.

# 迁移到 Rstack CLI \{#migrate-to-rstack-cli}

迁移现有项目时，推荐使用 `migrate-to-rstack-cli` Skill。该 Skill 会分析仓库，并将其中受支持的工具（包括 Rstack 工具链、Prettier 和 Husky 等）迁移到 Rstack CLI。

## 使用迁移 Skill \{#use-the-migration-skill}

### 一次性迁移 \{#migrate-in-one-pass}

如需一次性迁移所有受支持的工具，请向 Coding Agent 发送以下 Prompt：

```text wrapCode
运行 `npx --yes skills@latest use rstackjs/rstack-cli@migrate-to-rstack-cli`，然后按照生成的 Skill 指令将当前项目迁移到 Rstack CLI。
```

### 分批迁移 \{#migrate-in-stages}

如果希望每次改动更小、更便于审查，可以按工具分批迁移。首先，将 Skill 安装到当前仓库：

```bash
npx skills add rstackjs/rstack-cli --skill migrate-to-rstack-cli
```

然后让 Coding Agent 每次只迁移一种工具。例如，可以先迁移 Rslint：

```text wrapCode
使用 migrate-to-rstack-cli Skill 将 Rslint 迁移到 Rstack CLI，并保持其他工具不变。
```

审查并验证本次改动后，再迁移 Rstest：

```text wrapCode
使用 migrate-to-rstack-cli Skill 将 Rstest 迁移到 Rstack CLI，并保持其他工具不变。
```

其余工具也可以按此方式依次迁移。

## 支持的工具 \{#supported-tools}

该 Skill 可以直接迁移以下独立工具：

- **Rstack 工具链：**[Rsbuild](https://rsbuild.rs/zh/)、[Rslib](https://rslib.rs/zh/)、[Rstest](https://rstest.rs/zh/)、[Rslint](https://rslint.rs/) 和 [Rspress](https://rspress.rs/zh/)
- **代码格式化：**[Prettier](https://github.com/prettier/prettier)
- **暂存文件处理：**[lint-staged](https://github.com/lint-staged/lint-staged) 和 [nano-staged](https://github.com/usmanyunusov/nano-staged)
- **Git hooks：**[Husky](https://github.com/typicode/husky) 和 [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks)

## 不支持的工具 \{#unsupported-tools}

该 Skill 不会直接迁移上面列表之外的工具。如果项目使用以下工具，请先将其迁移到对应的 Rstack 工具，再运行 `migrate-to-rstack-cli` Skill：

- **应用构建：**&#x53C2;考 Rsbuild 的 [webpack 迁移指南](https://rsbuild.rs/zh/guide/migration/webpack)、[Vite 迁移指南](https://rsbuild.rs/zh/guide/migration/vite)、[Create React App 迁移指南](https://rsbuild.rs/zh/guide/migration/cra) 或 [Vue CLI 迁移指南](https://rsbuild.rs/zh/guide/migration/vue-cli)，将项目迁移到 Rsbuild。
- **库构建：**&#x53C2;考 Rslib 的 [tsup 迁移指南](https://rslib.rs/zh/guide/migration/tsup) 或 [tsc 迁移指南](https://rslib.rs/zh/guide/migration/tsc)，将库迁移到 Rslib。
- **测试：**&#x53C2;考 Rstest 的 [Jest 迁移指南](https://rstest.rs/zh/guide/migration/jest) 或 [Vitest 迁移指南](https://rstest.rs/zh/guide/migration/vitest)，将项目迁移到 Rstest。
- **代码检查：**&#x53C2;考 [Rslint 入门指南](https://rslint.rs/guide/)，将 ESLint 或其他代码检查工具迁移到 Rslint。
