create-pr-jp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate 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: or
.github/pull_request_template.md(see Procedure for lookup order).docs/pull_request_template.md - Run before submitting the PR (or the repo’s standard checks per AGENTS.md).
pnpm lint && pnpm test
- 为当前分支打开新的GitHub PR或更新现有PR。
- 填写日语标题和正文(除非AGENTS.md或仓库另有指定)。
- 使描述与仓库的PR模板保持一致:或
.github/pull_request_template.md(查看步骤了解查找顺序)。docs/pull_request_template.md - 在提交PR前运行****(或AGENTS.md中指定的仓库标准检查)。
pnpm lint && pnpm test
Prerequisites
前提条件
- CLI installed, authenticated (
gh), and able to act on this repository.gh auth status - Remote points at GitHub; the branch exists on
origin(or you will push it in this flow—prefer the push skill for push-only work).origin - Default base branch is usually ; use the repo’s default if different (
main, etc.).master
- 已安装**CLI**并完成身份验证(
gh),且能对该仓库执行操作。gh auth status - 远程仓库**指向GitHub;分支已存在于
origin(或您将在此流程中推送分支——仅推送操作请优先使用push**功能)。origin - 默认基准分支通常为;若仓库有不同默认分支则使用仓库默认分支(如
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功能)。
- 用户仅需要推送或与远程基准分支同步(请使用push或pull功能——此功能无法替代它们)。
- 目标仅为将现有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 after commits exist; create-pr-jp assumes the branch is reachable on GitHub.
origin - pull: Merge (or the appropriate base) into the current branch when the branch is behind or push was rejected—before pushing and opening/updating the PR.
origin/main - 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:提交完成后将分支发布到;create-pr-jp功能假设分支已在GitHub上可访问。
origin - pull:当分支落后于目标基准分支或推送被拒绝时,将(或相应基准分支)合并到当前分支——请在推送并打开/更新PR之前执行此操作。
origin/main - commit-and-push-jp:一次性完成提交和推送;若用户仍需PR,之后可使用create-pr-jp功能。
Procedure
操作步骤
- 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.
- Sync with base: If the branch is behind the target base or would be non-fast-forward, use pull first, then push (or push after pull per repo rules).
git push - Push: Ensure the branch is on (
origin/git push). If the user only asked to push, defer to push; if push fails, fix with pull then push again.-u origin HEAD - Checks: Run (or project-documented scripts). If checks fail, do not finalize the PR description as “ready” without fixing or noting the gap per repo policy.
pnpm lint && pnpm test - Review the change: Use ,
git diff <base>...HEAD, andgit log <base>..HEADto summarize scope (adaptgit diff <base>...HEAD --statto<base>or the default branch).main - Template: Locate a PR body template (use the first path that exists):
- (GitHub’s usual location), or
.github/pull_request_template.md - . If both exist, prefer
docs/pull_request_template.mdunless the repo documents otherwise. Replace placeholders and.github/pull_request_template.mdcomments with concrete content; keep required sections/checklists.<!-- ... -->
- Create or update:
- If no open PR exists for this branch: with a Japanese title and body (from template or file).
gh pr create - If an open PR already exists: to update title/body so they match the full branch diff.
gh pr edit - 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.
- If no open PR exists for this branch:
- Optional: On macOS, if is available and the user benefits from it,
openthe PR URL fromopen.gh pr view --json url - Return the PR URL to the user.
- 工作区:若用户希望PR包含未提交的更改,请使用commit-jp(若用户要求提交+推送则使用commit-and-push-jp)。请勿在未提交的情况下打开包含未暂存工作的PR。
- 与基准分支同步:若分支落后于目标基准分支或无法快进合并,请先使用pull,再使用push(或遵循仓库规则在pull后推送)。
git push - 推送分支:确保分支已存在于(使用
origin/git push)。若用户仅要求推送,请使用push功能;若推送失败,请先使用pull修复后再重新push。-u origin HEAD - 执行检查:运行****(或项目文档中记录的脚本)。若检查失败,除非根据仓库政策修复或注明差异,否则请勿将PR描述标记为“就绪”。
pnpm lint && pnpm test - 审查变更:使用、
git diff <base>...HEAD和git log <base>..HEAD总结变更范围(将git diff <base>...HEAD --stat替换为<base>或默认分支)。main - 模板查找:查找PR正文模板(使用第一个存在的路径):
- (GitHub常用位置),或
.github/pull_request_template.md - 。 若两者都存在,除非仓库另有文档说明,否则优先使用**
docs/pull_request_template.md**。将占位符和.github/pull_request_template.md注释替换为具体内容;保留必填章节/检查清单。<!-- ... -->
- 创建或更新PR:
- 若当前分支无打开的PR:使用日语标题和正文(来自模板或文件)执行。
gh pr create - 若当前分支已有打开的PR:执行更新标题/正文,使其与分支的完整差异内容一致。
gh pr edit - 若分支关联的PR已关闭或合并,请勿静默复用该PR——在创建新PR前请要求用户创建新分支(或遵循仓库政策)。
- 若当前分支无打开的PR:使用日语标题和正文(来自模板或文件)执行
- 可选操作:在macOS上,若命令可用且用户需要,可通过
open获取PR URL后使用gh pr view --json url命令打开该链接。open - 向用户返回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 , paths, and flags):
mainsh
base=main
pnpm lint && pnpm test
git fetch origin
git diff "origin/${base}...HEAD" --stat
git log "origin/${base}..HEAD" --oneline参考流程(根据、路径和标志调整):
mainsh
base=main
pnpm lint && pnpm test
git fetch origin
git diff "origin/${base}...HEAD" --stat
git log "origin/${base}..HEAD" --onelineIf .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
undefinedgh pr view --json url -q .url
undefinedPresent 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 createwithgh pr editfor multi-line bodies.--body-file - Template paths: or
.github/pull_request_template.md(see Procedure if both exist).docs/pull_request_template.md - Auto-merge or label/reviewer rules: follow project policy (e.g. only when base is ).
main - Do not use unless policy allows
git push --forceafter an intentional history rewrite.--force-with-lease
- 标题和正文必须为日语,除非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
故障排除
| Situation | Action |
|---|---|
| Uncommitted changes | commit-jp (or commit-and-push-jp) before PR |
Branch not on | push; if non-fast-forward, pull then push |
| Report verbatim; user runs |
No template at | Still write a clear Japanese body: summary, test plan, risks |
| PR already closed for this branch | New branch from default + cherry-pick or redo work per repo rules |
| 场景 | 操作 |
|---|---|
| 存在未提交的更改 | 创建PR前使用commit-jp(或commit-and-push-jp) |
分支未在 | 使用push;若无法快进合并,先pull再push |
| 直接报告错误信息;用户需运行 |
| 仍需撰写清晰的日语正文:包含摘要、测试计划、风险点 |
| 当前分支关联的PR已关闭 | 根据仓库规则从默认分支创建新分支 + 挑选提交或重新完成工作 |