一键导入
open-pr
Compare branch against main and open a pull request via gh CLI
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Compare branch against main and open a pull request via gh CLI
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Validate project documentation against actual implementation
Generate tests following the project's existing conventions
Automatically determine minimum requirements for consuming the library
Generate release notes and prepare the next release
Verify architectural consistency and dependency rules
| name | open-pr |
| description | Compare branch against main and open a pull request via gh CLI |
Compare the current branch against main, generate a short description of the changes, and open a pull request using the gh CLI.
When invoked:
Verify gh prerequisites:
gh auth status
If not authenticated, stop and instruct the user to run gh auth login.
Identify the current branch:
git branch --show-current
Fetch latest base branch (defaults to main unless the user specifies otherwise):
git fetch origin <base-branch>
Check for unpushed commits:
git log origin/$(git branch --show-current)..HEAD --oneline
If unpushed commits exist, warn the user and ask whether to push first.
Compare current branch vs base branch:
git log origin/<base-branch>..HEAD --oneline
git diff origin/<base-branch>..HEAD --stat
Categorize changes from commit messages:
| Category | Patterns |
|---|---|
| Features | feat: |
| Fixes | fix: |
| Docs | docs: |
| Refactoring | refactor: |
| Other | chore:, test:, style:, perf: |
Generate PR title:
Use the most significant category as prefix (e.g. feat:, fix:) followed by a concise summary derived from commit messages. If the branch name is descriptive, use it as a fallback.
Generate PR body: A short description covering:
Format:
## Summary
<2–3 sentence description of changes>
## Changed Files
<list of key files/paths>
Open the pull request:
gh pr create \
--base <base-branch> \
--head $(git branch --show-current) \
--title "<generated-title>" \
--body "<generated-body>"
Report the PR URL so the user can review and merge.
If Git remote differs from the default origin, detect and use the correct remote:
git remote
main but can be overridden by the user (e.g. develop, release/x.y).