关于 create-pr
用于为已完成的 React Router 工作准备并提交 PR 的技能,涵盖仓库检查、选择性暂存、提交与推送;默认创建草稿 PR,并按变更添加标签。
主要功能
- 01检查工作区与分支
- 02审阅差异和变更内容
- 03仅暂存目标文件
- 04提交并推送变更
- 05默认创建草稿 PR
- 06按包和功能添加标签
适用场景
- 01交接已完成的 React Router 变更
- 02创建以 main 为目标的草稿 PR
- 03避免将无关本地修改纳入 PR
- 04根据变更包为 PR 添加标签
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ remix-run/ react-router --skill create-pr安装后在 Claude Code 中输入/create-pr确认已加载。
详细介绍
创建 React Router PR
为已完成的 React Router 工作创建拉取请求交接。默认创建针对 main 的草稿 PR,除非用户明确要求可合并的 PR 或不同的基础分支。
前置条件
- 检查
git status --short --branch和git branch --show-current。 - 不要包含无关的已修改文件。如果存在无关更改,请保持它们未暂存并予以说明。
- 如果工作区处于分离头指针状态,请在提交前从当前
HEAD创建分支。使用用户请求的分支名、现有仓库约定,或在没有更强约定时使用<author>/<semantic-name>。 - 如果已在合适的命名分支上,则直接使用该分支。
- 确认存在或已添加适当的自动化覆盖。不要在 PR 正文中列出常规的 CI 覆盖检查。
- 如果正在更新面向用户的功能,请检查相应包在
packages/<package>/.changes/下是否有变更文件。对于仅文档、仅 GitHub Actions/工作流或依赖维护类 PR,除非依赖更改本身具有面向用户的影响,否则无需此项。
上下文
- 记录更改了什么、为什么更改以及影响哪些人。
- 查找相关 issue、讨论或 PR,并在相关时附上链接。
- 当更改较小时,优先使用
git diff --stat加有针对性的git diff,而不是大范围翻查仓库。 - 如果用户提供了报告、issue、讨论或相关 PR,请将其作为主要上下文来源。
- 对于新功能工作,请包含简洁的用法片段。如果该功能取代或改进了旧方法,请在有助于审阅者时包含前后对比示例。
提交与推送
- 根据需要,使用
git diff --stat和有针对性的git diff审阅差异。 - 仅暂存目标文件。
- 使用简洁的祈使句主题进行提交。
- 在创建 PR 之前推送分支。
创建 PR
将 PR 正文保存到临时文件,然后使用 gh pr create,并带上:
gh pr create --draft --base main --head <branch> --title "<title>" --body-file <file>
- 仅在用户明确要求可合并的 PR 时才省略
--draft。 - 仅在用户明确请求不同基础分支时才更改
--base。 - 保持 shell 引号简单。如果正文包含反引号、引号或多个段落,优先使用正文文件。
- 在已知时包含 issue/讨论链接。对于 PR 应关闭的缺陷修复,使用
Closes #NNNN;对于 RFC/讨论,当关闭语义不适用时,使用Implements #NNNN或普通链接。 - 仅针对手动检查、非常规验证、跳过的非 CI 检查或审阅者应了解的错误,包含测试说明。
- 如果
gh pr create失败,请尽可能保持分支已推送,并向用户提供可直接打开的对比 URL 以及准备好的标题和正文。
推荐的 PR 正文格式:
This change ...
- Optional extra detail when useful.
```tsx
// Optional feature usage example
```
// Optional before/after example
测试
- 仅可选的、关于手动或非 CI 验证的说明。
- Do not use a `## Summary` heading. Start with one or two short sentences explaining what the change accomplishes.
- Add bullets after the opening only when more detail is useful.
- Include usage examples for new features, and before/after examples for replacements or improvements, when they help reviewers understand the change.
- Add `**Testing**` with bullets below the description only when there are manual checks, unusual verification steps, skipped non-CI checks, or failures reviewers should know about. Omit it for routine automated coverage.
## Testing Notes
- Do not list linting, typechecking, unit test, or integration test commands in the PR body, even if they were run locally. CI runs these automatically.
- Do not say that CI will run routine linting, typechecking, unit tests, or integration tests. That is assumed for every PR.
- Do not add manual testing instructions by default.
- Add manual testing instructions only when necessary, such as visual/UI behavior that needs human review, environment-specific behavior not covered by CI, release/publish dry-run steps, external service integration, or a reproduction that cannot be expressed reliably in automated tests.
- When manual testing is necessary, keep the instructions minimal and directly tied to the uncovered risk.
## Labels
Apply labels after the PR exists. Rely on the stable labels listed in this skill for normal PRs.
Apply labels with:
```sh
gh pr edit <number-or-url> --add-label "<label>"
如果 gh pr edit --add-label 因指定的标签无效或缺失而失败,请运行:
gh label list --limit 200
然后从实时列表中选择正确的标签,并就地更新此技能,使稳定的标签指南保持最新。仅使用真实标签。如果正确的标签不存在,请不要杜撰;说明缺失的标签。
包标签
根据涉及的包路径添加所有适用的 pkg:* 标签:
| 涉及的路径 | 标签 |
|---|---|
packages/react-router/ | pkg:react-router |
packages/react-router-dev/ | pkg:@react-router/dev |
packages/create-react-router/ | pkg:create-react-router |
packages/react-router-architect/ | pkg:@react-router/architect |
packages/react-router-cloudflare/ | pkg:@react-router/cloudflare |
packages/react-router-node/ | pkg:@react-router/node |
packages/react-router-serve/ | pkg:@react-router/serve |
packages/react-router-express/ | pkg:@react-router/express |
packages/react-router-fs-routes/ | pkg:@react-router/fs-routes |
packages/react-router-remix-routes-option-adapter/ | pkg:@react-router/remix-routes-option-adapter |
如果某个包路径不明确,请检查其 package.json 中的 name,并在该标签存在时使用 pkg:<name>。如果某个变更仅涉及生成的产物或集成测试,请根据所测试的运行时/工具链领域推断包标签。例如,Vite 插件或预渲染集成覆盖通常对应 pkg:@react-router/dev。
功能标签
为正在更改的行为区域添加适用的 feat:* 标签。常见标签包括:
| 行为区域 | 标签 |
|---|---|
| 核心导航、加载器/操作、获取器、重定向、匹配和路由器状态 | feat:router |
路由配置 API 和 routes.ts | feat:routes.ts |
| Vite 插件和构建流水线行为 | feat:vite |
| SPA 模式 | feat:spa-mode |
| 预渲染 | feat:prerender |
| 懒加载路由发现 | feat:lazy-route-discovery |
| 水合和水合回退行为 | feat:hydration |
| 视图过渡 API | feat:view-transitions |
| 中间件行为 | feat:middleware |
| 拆分路由模块行为 | feat:split-route-modules |
| 流式传输行为 | feat:streaming |
| CSS 处理 | feat:css |
| Windows 特定修复 | feat:windows |
| RSC 数据或 RSC 框架行为 | feat:rsc |
| 路径匹配语义 | feat:path-matching |
| 单次获取行为 | feat:single-fetch |
| 类型、类型生成和 TypeScript 行为 | feat:typescript |
当 diff 确实跨越多个区域时,可以添加多个功能标签。优先选择已有的最具体的标签。
非包标签
某些 PR 不需要包标签或功能标签:
- 对于仅文档更改,添加
docs。 - 对于
.github/workflows/或 Actions 基础设施更改,添加github-actions。 - 对于仅依赖或锁文件维护,添加
dependencies。 - 仅在 PR 有意限定于该发布线或用户要求时,添加诸如
v6、v7或v8的版本标签。
最终报告
报告:
- 分支名称。
- 提交哈希。
- PR URL 以及它是草稿还是就绪状态。
- 基础分支。
- 已应用的标签。
- 已执行或跳过的验证。
评论
支持 Markdown