create-pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Create PR

创建 PR

Quick start

快速开始

  1. Find the template:
    .github/pull_request_template.md
    or
    .github/PULL_REQUEST_TEMPLATE.md
    (case varies by repo). If none exists, fall back to a minimal Summary/Changes/Testing body — don't invent sections.
  2. Gather branch state:
    git status
    ,
    git diff main...HEAD
    (or the repo's default branch),
    git log main..HEAD
    , and whether the branch is pushed/tracks a remote.
  3. Fill in the template's sections from the actual diff and commit history — don't leave checklist items unchecked by default; check the ones genuinely true (e.g. "I verified no sensitive data is included" once you've looked).
  4. Title: Conventional Commits format (
    feat:
    ,
    fix:
    ,
    chore:
    ,
    docs:
    ,
    refactor:
    ,
    test:
    ).
  5. Resolve the assignee: use
    $PR_ASSIGNEE
    if set in the environment, otherwise the currently authenticated GitHub user (
    gh api user --jq .login
    ). Never hardcode a specific username — this skill is shared across the team, and the assignee should default to whoever is running it.
  6. Create with:
    assignee="${PR_ASSIGNEE:-$(gh api user --jq .login)}"
    gh pr create --title "<type>: <summary>" --body "$(cat <<'EOF'
    <filled template>
    EOF
    )" --assignee "$assignee"
  7. If updating an existing PR instead, use
    gh pr edit <number> --body "..." --add-assignee "$assignee"
    (only add the assignee if not already set).
  1. 查找模板:
    .github/pull_request_template.md
    或
    .github/PULL_REQUEST_TEMPLATE.md
    (大小写因仓库而异)。如果不存在,则退回到一个最小的 Summary/Changes/Testing 正文——不要凭空编造章节。
  2. 收集分支状态:
    git status
    、
    git diff main...HEAD
    (或仓库的默认分支)、
    git log main..HEAD
    ,以及分支是否已推送/跟踪远程分支。
  3. 根据实际的 diff 和提交历史填充模板的各个章节——不要默认保留未勾选的清单项;勾选那些确实为真的项(例如,一旦你检查过,就勾选“I verified no sensitive data is included”)。
  4. 标题:Conventional Commits 格式(
    feat:
    、
    fix:
    、
    chore:
    、
    docs:
    、
    refactor:
    、
    test:
    )。
  5. 解析 assignee:如果环境中设置了
    $PR_ASSIGNEE
    ,则使用该值,否则使用当前已认证的 GitHub 用户(
    gh api user --jq .login
    )。切勿硬编码特定用户名——此 skill 由团队共享,assignee 应默认为运行该 skill 的人。
  6. 使用以下命令创建:
    assignee="${PR_ASSIGNEE:-$(gh api user --jq .login)}"
    gh pr create --title "<type>: <summary>" --body "$(cat <<'EOF'
    <filled template>
    EOF
    )" --assignee "$assignee"
  7. 如果是更新现有 PR,改用
    gh pr edit <number> --body "..." --add-assignee "$assignee"
    (仅在未设置 assignee 时才添加)。

Template quirks by repo

各仓库的模板特殊之处

  • If a repo's
    AGENTS.md
    or
    CLAUDE.md
    documents PR conventions (e.g. a Version Bump section, a required trailer, a non-standard checklist), follow those over guessing.
  • If a repo has no template, use a plain Summary + Changes + Test plan body — do not apply another repo's template.
  • 如果仓库的
    AGENTS.md
    或
    CLAUDE.md
    记录了 PR 约定(例如 Version Bump 章节、必需的 trailer、非标准清单),则遵循这些约定,而不是自行猜测。
  • 如果仓库没有模板,使用简单的 Summary + Changes + Test plan 正文——不要套用其他仓库的模板。

Related Work section

Related Work 章节

If the branch name or commits reference a work item (ADO
AB#NNNNN
or GitHub issue
#NNN
), populate the "Related Work" / "Issue" line with it. Don't fabricate a link if none is evident.
如果分支名或提交引用了工作项(ADO
AB#NNNNN
或 GitHub issue
#NNN
),请在“Related Work”/“Issue”行中填充该工作项。如果没有明显的工作项,不要凭空捏造链接。

Notes

注意事项

  • Always re-read the template fresh per repo/PR rather than assuming it matches a previous run — templates can drift between repos.
  • 每次针对仓库/PR 都应重新阅读模板,而不是假设它与之前的运行匹配——模板在不同仓库之间可能会有差异。