create-pr
3
总安装量
2
周安装量
#59462
全站排名
安装命令
npx skills add https://github.com/soyio-id/skills --skill create-pr
Agent 安装分布
mcpjam
2
claude-code
2
replit
2
junie
2
windsurf
2
zencoder
2
Skill 文档
Create Pull Request
Goal
Open a high-quality PR that is easy to review and safe to merge:
- includes only intended changes
- uses a clear title and useful body
- follows repo PR template when present
- reports final PR status and next actions
Inputs
base_branch(optional, default: repo default branch)is_draft(true/false, default:false)title_hint(optional)extra_context(optional: issue links, rollout notes, risks)
Safety rules
- Never create a PR from
main/masterdirectly. - Never include unrelated unstaged/uncommitted changes.
- Do not rewrite branch history unless explicitly requested.
- If history rewrite is required, use
--force-with-leaseonly. - If a PR already exists for the branch, do not create a duplicate.
Workflow
-
Check prerequisites
gh auth statusgit status --short --branchgit branch --show-current
-
Determine base branch
- Prefer user input.
- Otherwise use repo default branch:
gh repo view --json defaultBranchRef -q .defaultBranchRef.name
-
Review branch content
git log --oneline origin/<base_branch>..HEADgit diff --stat origin/<base_branch>...HEAD- Confirm scope is coherent and PR-ready.
-
Ensure branch is pushed
- If no upstream:
git push -u origin HEAD - Otherwise:
git push
- If no upstream:
-
Build PR content
- Title: concise, outcome-focused; Conventional Commit style preferred.
- Body:
- If
.github/pull_request_template.md(or equivalent) exists, follow it exactly. - Otherwise include: context, summary, testing, risk/rollback, related issue.
- If
-
Create or reuse PR
- Check existing PR first:
gh pr view --json url,number,state 2>/dev/null
- If existing PR found, return it and summarize status.
- If no PR exists, create it:
- Check existing PR first:
gh pr create --title "<title>" --body "<body>" --base <base_branch>
For draft PR:
gh pr create --title "<title>" --body "<body>" --base <base_branch> --draft
- Post-create checks
gh pr view --json url,number,title,state,mergeStateStatus,reviewDecision- Report CI/review state and what remains before merge.
Validation
- Prefer smallest relevant checks before PR creation (lint/unit/targeted tests).
- Include test commands and concise outcomes in the PR body.
- If checks were not run, state why and call it out explicitly.
Output format
Return:
- PR number + URL
- base/head branches
- draft or ready status
- merge/check state
- test summary (commands + results)
- recommendation: ready for review, wait for CI, or needs follow-up
Error handling
- If working tree is dirty, ask to commit or stash first.
- If no commits ahead of base, report no PR needed.
- If
ghauth fails, instruct to rungh auth login. - If creation fails due to permissions, report exact error and next step.