create-pr-jp

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Create PR (JP)

创建PR(日语版)

Purpose

目的

  • Open a new GitHub PR or update an existing one for the current branch.
  • Fill title and body in Japanese (unless AGENTS.md or the repo specifies otherwise).
  • Align the description with the repo’s PR template:
    .github/pull_request_template.md
    or
    docs/pull_request_template.md
    (see Procedure for lookup order).
  • Run
    pnpm lint && pnpm test
    before submitting the PR (or the repo’s standard checks per AGENTS.md).
  • 为当前分支打开新的GitHub PR或更新现有PR。
  • 填写日语标题和正文(除非AGENTS.md或仓库另有指定)。
  • 使描述与仓库的PR模板保持一致:
    .github/pull_request_template.md
    docs/pull_request_template.md
    (查看步骤了解查找顺序)。
  • 在提交PR前运行**
    pnpm lint && pnpm test
    **(或AGENTS.md中指定的仓库标准检查)。

Prerequisites

前提条件

  • gh
    CLI
    installed, authenticated (
    gh auth status
    ), and able to act on this repository.
  • Remote
    origin
    points at GitHub; the branch exists on
    origin
    (or you will push it in this flow—prefer the push skill for push-only work).
  • Default base branch is usually
    main
    ; use the repo’s default if different (
    master
    , etc.).
  • 已安装**
    gh
    CLI**并完成身份验证(
    gh auth status
    ),且能对该仓库执行操作。
  • 远程仓库**
    origin
    指向GitHub;分支已存在于
    origin
    (或您将在此流程中推送分支——仅推送操作请优先使用
    push**功能)。
  • 默认基准分支通常为
    main
    ;若仓库有不同默认分支则使用仓库默认分支(如
    master
    等)。

When to Use

使用场景

  • "PR 作成", "プルリク出して", "create a PR", "更新して" (PR), or similar—when the user wants a GitHub pull request created or updated.
  • 当用户提出“PR 作成”、“プルリク出して”、“create a PR”、“更新して”(针对PR)等需求时——即用户需要创建或更新GitHub Pull Request时。

Do Not Use When

禁用场景

  • The user only needs a local commit (use commit-jp).
  • The user wants commit + push in one flow without focusing on PR copy (use commit-and-push-jp; then optionally use create-pr-jp for the PR).
  • The user only needs to push or sync with the remote base branch (use push or pull—this skill does not replace them).
  • The goal is only merging or landing an existing PR on the default branch (follow repo / land workflows if defined).
  • 用户仅需要本地提交(请使用commit-jp功能)。
  • 用户希望在一个流程中完成提交+推送且不关注PR文案(请使用commit-and-push-jp功能;之后若仍需PR可再使用create-pr-jp功能)。
  • 用户仅需要推送或与远程基准分支同步(请使用pushpull功能——此功能无法替代它们)。
  • 目标仅为将现有PR合并或合并到默认分支(若仓库有定义,请遵循仓库/ land工作流)。

Related Skills

相关功能

  • commit-jp: Stage changes and write a Japanese Conventional Commit before opening a PR when work is not yet committed.
  • push: Publish the branch to
    origin
    after commits exist; create-pr-jp assumes the branch is reachable on GitHub.
  • pull: Merge
    origin/main
    (or the appropriate base) into the current branch when the branch is behind or push was rejected—before pushing and opening/updating the PR.
  • commit-and-push-jp: Commit and push in one go; use create-pr-jp afterward if the user still needs a PR.
  • commit-jp:当工作尚未提交时,在打开PR前暂存更改并撰写符合规范的日语提交信息。
  • push:提交完成后将分支发布到
    origin
    create-pr-jp功能假设分支已在GitHub上可访问。
  • pull:当分支落后于目标基准分支或推送被拒绝时,将
    origin/main
    (或相应基准分支)合并到当前分支——请在推送并打开/更新PR之前执行此操作。
  • commit-and-push-jp:一次性完成提交和推送;若用户仍需PR,之后可使用create-pr-jp功能。

Procedure

操作步骤

  1. Working tree: If there are uncommitted changes the user wants in the PR, use commit-jp (or commit-and-push-jp if they asked for commit+push). Do not open a PR that should include unstaged work without committing first.
  2. Sync with base: If the branch is behind the target base or
    git push
    would be non-fast-forward, use pull first, then push (or push after pull per repo rules).
  3. Push: Ensure the branch is on
    origin
    (
    git push
    /
    -u origin HEAD
    ). If the user only asked to push, defer to push; if push fails, fix with pull then push again.
  4. Checks: Run
    pnpm lint && pnpm test
    (or project-documented scripts). If checks fail, do not finalize the PR description as “ready” without fixing or noting the gap per repo policy.
  5. Review the change: Use
    git diff <base>...HEAD
    ,
    git log <base>..HEAD
    , and
    git diff <base>...HEAD --stat
    to summarize scope (adapt
    <base>
    to
    main
    or the default branch).
  6. Template: Locate a PR body template (use the first path that exists):
    • .github/pull_request_template.md
      (GitHub’s usual location), or
    • docs/pull_request_template.md
      . If both exist, prefer
      .github/pull_request_template.md
      unless the repo documents otherwise. Replace placeholders and
      <!-- ... -->
      comments with concrete content; keep required sections/checklists.
  7. Create or update:
    • If no open PR exists for this branch:
      gh pr create
      with a Japanese title and body (from template or file).
    • If an open PR already exists:
      gh pr edit
      to update title/body so they match the full branch diff.
    • If the branch is tied to a closed or merged PR, do not silently reuse it—ask for a new branch (or follow repo policy) before creating a new PR.
  8. Optional: On macOS, if
    open
    is available and the user benefits from it,
    open
    the PR URL from
    gh pr view --json url
    .
  9. Return the PR URL to the user.
  1. 工作区:若用户希望PR包含未提交的更改,请使用commit-jp(若用户要求提交+推送则使用commit-and-push-jp)。请勿在未提交的情况下打开包含未暂存工作的PR。
  2. 与基准分支同步:若分支落后于目标基准分支或
    git push
    无法快进合并,请先使用pull,再使用push(或遵循仓库规则在pull后推送)。
  3. 推送分支:确保分支已存在于
    origin
    (使用
    git push
    /
    -u origin HEAD
    )。若用户仅要求推送,请使用push功能;若推送失败,请先使用pull修复后再重新push
  4. 执行检查:运行**
    pnpm lint && pnpm test
    **(或项目文档中记录的脚本)。若检查失败,除非根据仓库政策修复或注明差异,否则请勿将PR描述标记为“就绪”。
  5. 审查变更:使用
    git diff <base>...HEAD
    git log <base>..HEAD
    git diff <base>...HEAD --stat
    总结变更范围(将
    <base>
    替换为
    main
    或默认分支)。
  6. 模板查找:查找PR正文模板(使用第一个存在的路径):
    • .github/pull_request_template.md
      (GitHub常用位置),或
    • docs/pull_request_template.md
      。 若两者都存在,除非仓库另有文档说明,否则优先使用**
      .github/pull_request_template.md
      **。将占位符和
      <!-- ... -->
      注释替换为具体内容;保留必填章节/检查清单。
  7. 创建或更新PR
    • 若当前分支无打开的PR:使用日语标题和正文(来自模板或文件)执行
      gh pr create
    • 若当前分支已有打开的PR:执行
      gh pr edit
      更新标题/正文,使其与分支的完整差异内容一致。
    • 若分支关联的PR已关闭或合并,请勿静默复用该PR——在创建新PR前请要求用户创建新分支(或遵循仓库政策)。
  8. 可选操作:在macOS上,若
    open
    命令可用且用户需要,可通过
    gh pr view --json url
    获取PR URL后使用
    open
    命令打开该链接。
  9. 向用户返回PR URL

Output

输出结果

  • A created or updated GitHub PR with Japanese title and body (unless the repo says otherwise).
  • The PR URL in the assistant’s reply.
  • 一个已创建或更新的GitHub PR,带有日语标题和正文(除非仓库另有规定)。
  • 助手回复中包含PR URL

Usage

使用示例

Reference flow (adapt
main
, paths, and flags):
sh
base=main
pnpm lint && pnpm test

git fetch origin
git diff "origin/${base}...HEAD" --stat
git log "origin/${base}..HEAD" --oneline
参考流程(根据
main
、路径和标志调整):
sh
base=main
pnpm lint && pnpm test

git fetch origin
git diff "origin/${base}...HEAD" --stat
git log "origin/${base}..HEAD" --oneline

If .github/pull_request_template.md or docs/pull_request_template.md exists, draft body from it into a temp file, then:

若存在.github/pull_request_template.md或docs/pull_request_template.md,从模板生成正文到临时文件,然后:

gh pr create --base "$base" --title "<日本語タイトル>" --body-file /tmp/pr_body.md
gh pr create --base "$base" --title "<日本語タイトル>" --body-file /tmp/pr_body.md

Or update an existing PR:

或更新现有PR:

gh pr edit --title "..." --body-file /tmp/pr_body.md

gh pr edit --title "..." --body-file /tmp/pr_body.md

gh pr view --json url -q .url
undefined
gh pr view --json url -q .url
undefined

Present Results to User

向用户展示结果

  • Include the PR URL and whether the PR was created or updated.
  • Summarize scope in one short paragraph (Japanese if the user prefers Japanese in chat).
  • If another skill should have been used first (e.g. commit, push, pull), say so explicitly and what to run next.
  • 包含PR URL以及PR是已创建还是已更新
  • 用简短段落总结变更范围(若用户偏好日语聊天则使用日语)。
  • 若应先使用其他功能(如commit、push、pull),请明确说明并告知下一步应执行的操作。

Notes

注意事项

  • Title and body must be Japanese unless AGENTS.md (or similar) requires another language.
  • Prefer
    gh pr create
    /
    gh pr edit
    with
    --body-file
    for multi-line bodies.
  • Template paths:
    .github/pull_request_template.md
    or
    docs/pull_request_template.md
    (see Procedure if both exist).
  • Auto-merge or label/reviewer rules: follow project policy (e.g. only when base is
    main
    ).
  • Do not use
    git push --force
    unless policy allows
    --force-with-lease
    after an intentional history rewrite.
  • 标题和正文必须为日语,除非AGENTS.md(或类似文档)要求使用其他语言。
  • 对于多行正文,优先使用**
    gh pr create
    /
    gh pr edit
    结合
    --body-file
    **。
  • 模板路径:
    .github/pull_request_template.md
    docs/pull_request_template.md
    (若两者都存在请查看步骤说明)。
  • 自动合并或标签/审核者规则:遵循项目政策(例如仅当基准分支为
    main
    时启用)。
  • 除非政策允许在有意重写历史后使用**
    --force-with-lease
    ,否则请勿使用
    git push --force
    **。

Troubleshooting

故障排除

SituationAction
Uncommitted changescommit-jp (or commit-and-push-jp) before PR
Branch not on
origin
/ push rejected
push; if non-fast-forward, pull then push
gh
auth errors
Report verbatim; user runs
gh auth login
No template at
.github/pull_request_template.md
or
docs/pull_request_template.md
Still write a clear Japanese body: summary, test plan, risks
PR already closed for this branchNew branch from default + cherry-pick or redo work per repo rules
场景操作
存在未提交的更改创建PR前使用commit-jp(或commit-and-push-jp
分支未在
origin
上 / 推送被拒绝
使用push;若无法快进合并,先pullpush
gh
身份验证错误
直接报告错误信息;用户需运行
gh auth login
.github/pull_request_template.md
docs/pull_request_template.md
均无模板
仍需撰写清晰的日语正文:包含摘要、测试计划、风险点
当前分支关联的PR已关闭根据仓库规则从默认分支创建新分支 + 挑选提交或重新完成工作