create-pr
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate React Router PR
创建 React Router PR
Create the pull request handoff for completed React Router work. Default to a draft PR targeting unless the user explicitly asks for a ready PR or a different base branch.
main为已完成的 React Router 工作创建拉取请求交接。默认创建指向 分支的草稿 PR,除非用户明确要求创建就绪状态的 PR 或指定不同的基础分支。
mainPreconditions
前置条件
- Inspect and
git status --short --branch.git branch --show-current - Do not include unrelated dirty files. If unrelated changes are present, leave them unstaged and mention them.
- If the worktree is detached, create a branch from the current before committing. Use the branch name requested by the user, an existing repository convention, or
HEADwhen no stronger convention is available.<author>/<semantic-name> - If already on a suitable named branch, use it.
- Confirm appropriate automated coverage exists or was added. Do not list routine CI-covered checks in the PR body.
- If user-facing functionality is being updated, check that the appropriate package has a change file under . This is not necessary for docs-only, GitHub Actions/workflow-only, or dependency-maintenance PRs unless the dependency change itself has user-facing impact.
packages/<package>/.changes/
- 检查 和
git status --short --branch的输出。git branch --show-current - 不要包含无关的未提交文件。如果存在无关更改,请不要暂存它们并予以说明。
- 如果工作区处于分离头指针状态,请在提交前从当前 创建一个分支。使用用户要求的分支名、仓库现有的命名规范,如果没有更明确的规范,则使用
HEAD格式。<author>/<semantic-name> - 如果已经在合适命名的分支上,直接使用该分支。
- 确认存在或已添加适当的自动化测试覆盖。不要在 PR 正文中列出常规的 CI 覆盖检查项。
- 如果更新了面向用户的功能,请检查对应的包在 目录下是否有变更文件。对于仅文档修改、仅 GitHub Actions/工作流修改或依赖维护类的 PR 则不需要,除非依赖变更本身会影响用户。
packages/<package>/.changes/
Context
上下文
- Capture what changed, why it changed, and who it affects.
- Find related issues, discussions, or PRs and include links when relevant.
- Prefer plus focused
git diff --statover broad repo archaeology when the change is small.git diff - If the user supplies a report, issue, discussion, or related PR, treat that as the primary context source.
- For new feature work, include a concise usage snippet. If the feature replaces or improves an older approach, include before/after examples when they help reviewers.
- 记录变更内容、变更原因以及影响范围。
- 查找相关的 issue、讨论或 PR,并在相关时附上链接。
- 当变更较小时,优先使用 加上针对性的
git diff --stat,而不是大范围翻查仓库历史。git diff - 如果用户提供了报告、issue、讨论或相关 PR,将其作为主要的上下文来源。
- 对于新功能开发,附上简洁的使用代码片段。如果该功能替代或改进了旧有实现方式,在有助于评审者理解的情况下,附上改造前后的示例。
Commit and Push
提交与推送
- Review the diff with and focused
git diff --statas needed.git diff - Stage only the intended files.
- Commit with a concise imperative subject.
- Push the branch before creating the PR.
- 使用 查看变更统计,并根据需要使用针对性的
git diff --stat检查详细变更。git diff - 仅暂存目标文件。
- 使用简洁的祈使句作为提交信息标题。
- 在创建 PR 之前推送分支。
PR Creation
PR 创建
Save the PR body to a temporary file, then use with:
gh pr createsh
gh pr create --draft --base main --head <branch> --title "<title>" --body-file <file>- Omit only when the user explicitly asks for a ready PR.
--draft - Change only when the user explicitly requests a different base branch.
--base - Keep shell quoting simple. Prefer a body file if the body contains backticks, quotes, or multiple paragraphs.
- Include issue/discussion links when known. Use for bug fixes the PR should close; use
Closes #NNNNor a plain link for RFCs/discussions when closing semantics are not appropriate.Implements #NNNN - Include testing notes only for manual checks, unusual verification, skipped non-CI checks, or failures that reviewers should know about.
- If fails, leave the branch pushed when possible and give the user a ready-to-open compare URL plus the prepared title and body.
gh pr create
Recommended PR body shape:
markdown
This change ...
- Optional extra detail when useful.
```tsx
// Optional feature usage example
```tsx
// Optional before/after exampleTesting
- Optional manual or non-CI verification notes only.
- 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.将 PR 正文保存到临时文件,然后使用以下 命令:
gh pr createsh
gh pr create --draft --base main --head <branch> --title "<title>" --body-file <file>- 仅当用户明确要求创建就绪 PR 时,才省略 参数。
--draft - 仅当用户明确要求使用不同的基础分支时,才修改 参数。
--base - 保持 shell 引号简洁。如果 PR 正文包含反引号、引号或多个段落,优先使用正文文件。
- 如果已知相关 issue/讨论,附上链接。对于该 PR 应关闭的 bug 修复,使用 ;对于 RFC/讨论,如果关闭语义不合适,则使用
Closes #NNNN或普通链接。Implements #NNNN - 仅针对手动检查、非常规验证、跳过的非 CI 检查,或评审者需要了解的失败情况,才添加测试说明。
- 如果 执行失败,尽可能保留已推送的分支,并向用户提供可直接打开的比较 URL,以及准备好的标题和正文。
gh pr create
推荐的 PR 正文结构:
markdown
This change ...
- Optional extra detail when useful.
```tsx
// Optional feature usage example
```tsx
// Optional before/after example测试
- 仅包含手动或非 CI 验证说明。
- 不要使用 `## Summary` 标题。用一到两个短句开头,说明变更的作用。
- 仅在需要更多细节时,才在开头后添加项目符号列表。
- 对于新功能附上使用示例,对于替代或改进类变更附上前后对比示例,帮助评审者理解变更。
- 仅当存在手动检查、非常规验证步骤、跳过的非 CI 检查,或评审者需要了解的失败情况时,才在描述下方添加 `**Testing**` 及项目符号列表。常规自动化覆盖的内容无需添加。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.
- 不要在 PR 正文中列出代码检查、类型检查、单元测试或集成测试命令,即使你在本地运行过。CI 会自动执行这些检查。
- 不要说明 CI 会运行常规的代码检查、类型检查、单元测试或集成测试。这是每个 PR 的默认操作。
- 默认情况下不要添加手动测试说明。
- 仅在必要时添加手动测试说明,例如需要人工评审的视觉/UI 行为、CI 未覆盖的特定环境行为、发布/发布预演步骤、外部服务集成,或无法在自动化测试中可靠复现的问题。
- 当需要手动测试时,保持说明简洁,并直接对应未覆盖的风险点。
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>"If fails because the specified label is invalid or missing, run:
gh pr edit --add-labelsh
gh label list --limit 200Then choose the correct label from the live list and update this skill in place so the stable label guidance stays current. Use real labels only. If the right label does not exist, do not invent one; mention the missing label.
PR 创建完成后再应用标签。对于常规 PR,使用本技能中列出的稳定标签。
使用以下命令应用标签:
sh
gh pr edit <number-or-url> --add-label "<label>"如果 因指定的标签无效或不存在而失败,请运行:
gh pr edit --add-labelsh
gh label list --limit 200然后从实时列表中选择正确的标签,并就地更新本技能,以保持稳定标签指南的时效性。仅使用真实存在的标签。如果没有合适的标签,不要编造;请说明缺失的标签。
Package Labels
包标签
Add every applicable label based on touched package paths:
pkg:*| Touched path | Label |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
If a package path is unclear, inspect its and use when that label exists. If a change touches generated artifacts or integration tests only, infer the package label from the runtime/tooling area being tested. For example, Vite plugin or prerender integration coverage usually maps to .
package.jsonnamepkg:<name>pkg:@react-router/dev根据修改的包路径,添加所有适用的 标签:
pkg:*| 修改路径 | 标签 |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
如果包路径不明确,请检查其 中的 字段,并在对应标签存在时使用 。如果变更仅涉及生成的产物或集成测试,请从被测试的运行时/工具领域推断包标签。例如,Vite 插件或预渲染集成测试通常对应 。
package.jsonnamepkg:<name>pkg:@react-router/devFeature Labels
功能标签
Add applicable labels for the behavior area being changed. Common labels include:
feat:*| Behavior area | Label |
|---|---|
| Core navigation, loaders/actions, fetchers, redirects, matching, and router state | |
Route config APIs and | |
| Vite plugin and build pipeline behavior | |
| SPA mode | |
| Prerendering | |
| Lazy route discovery | |
| Hydration and hydration fallback behavior | |
| View transition APIs | |
| Middleware behavior | |
| Split route module behavior | |
| Streaming behavior | |
| CSS handling | |
| Windows-specific fixes | |
| RSC Data or RSC Framework behavior | |
| Path matching semantics | |
| Single fetch behavior | |
| Types, typegen, and TypeScript behavior | |
Multiple feature labels are fine when the diff truly spans multiple areas. Prefer the most specific label that exists.
为变更的行为领域添加适用的 标签。常见标签包括:
feat:*| 行为领域 | 标签 |
|---|---|
| 核心导航、loaders/actions、fetchers、重定向、路由匹配和 router 状态 | |
路由配置 API 和 | |
| Vite 插件和构建流水线行为 | |
| SPA 模式 | |
| 预渲染 | |
| 懒路由发现 | |
| Hydration 和 hydration 回退行为 | |
| 视图过渡 API | |
| 中间件行为 | |
| 拆分路由模块行为 | |
| 流式处理行为 | |
| CSS 处理 | |
| Windows 特定修复 | |
| RSC Data 或 RSC 框架行为 | |
| 路径匹配语义 | |
| 单次获取行为 | |
| 类型、类型生成和 TypeScript 行为 | |
当变更确实涉及多个领域时,可以添加多个功能标签。优先选择最具体的现有标签。
Non-Package Labels
非包标签
Some PRs do not need package or feature labels:
- Add for documentation-only changes.
docs - Add for
github-actionsor Actions infrastructure changes..github/workflows/ - Add for dependency or lockfile-only maintenance.
dependencies - Add version labels such as ,
v6, orv7only when the PR is intentionally scoped to that release line or the user asks for it.v8
有些 PR 不需要包标签或功能标签:
- 仅文档类变更添加 标签。
docs - 或 Actions 基础设施变更添加
.github/workflows/标签。github-actions - 仅依赖或锁文件维护类变更添加 标签。
dependencies - 仅当 PR 明确针对某个发布线,或用户要求时,才添加版本标签如 、
v6或v7。v8
Final Report
最终报告
Report:
- Branch name.
- Commit hash.
- PR URL and whether it is draft or ready.
- Base branch.
- Labels applied.
- Verification performed or skipped.
报告内容包括:
- 分支名称。
- 提交哈希。
- PR URL 以及是草稿还是就绪状态。
- 基础分支。
- 已应用的标签。
- 已执行或跳过的验证。