pr-creator
PR Creator
Create a pull request from the current branch to a destination branch. Use simple, short English for title and body.
Step-by-Step Process
Step 1: Get destination branch
If user did not specify destination branch, ask:
"Which branch do you want to merge into? (e.g., main, develop, staging)"
Wait for user reply before continuing.
Step 2: Gather git info
Run these commands in parallel:
git branch --show-current— get current branch namegit status --porcelain— check if working tree is cleangit log origin/$(git branch --show-current)..HEAD --oneline 2>/dev/null || echo "NOT_PUSHED"— check if branch is pushed to remotegit log main..HEAD --oneline 2>/dev/null || git log $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')..HEAD --oneline 2>/dev/null— get commits ahead of basegit diff --stat HEAD~1 2>/dev/null || git diff --stat— get changed files summary
Step 3: Check blockers — ask user to confirm if any
If git status is NOT clean (output from git status --porcelain is non-empty):
"You have uncommitted changes: [show the dirty files]
Continue anyway? (yes/no)"
If branch NOT pushed to remote (remote tracking branch does not exist or commits ahead):
"Branch '[branch-name]' is not pushed to remote yet.
Continue anyway? (yes/no)"
If user says no to either → stop, tell user to fix then retry.
If user says yes → push branch first with git push -u origin [branch-name] then continue.
Step 4: Generate PR title and body
Analyze: current branch name + commits + changed files.
Rules for title:
- Max 70 characters
- Simple present tense ("Add login", "Fix bug in auth", "Update readme")
- No emoji, no ticket prefix unless branch name has one (e.g.,
feature/AUTH-123-...→ includeAUTH-123) - English only, shortest possible
Rules for body:
- Plain English, short sentences
- Sections: What, Why, How to test (skip sections with nothing useful)
- No fluff, no "This PR...", just facts
- Max 10 bullet points total
Step 5: Create PR
Use gh pr create:
gh pr create \
--base [destination-branch] \
--title "[generated title]" \
--body "$(cat <<'EOF'
[generated body]
EOF
)"
If gh not installed or not authenticated: tell user to run gh auth login first.
Step 6: Report result
Show PR URL after creation. Done.
Error Handling
| Error | Action |
|---|---|
gh: command not found |
"Install GitHub CLI: brew install gh then gh auth login" |
gh auth error |
"Run gh auth login first" |
| Branch already has open PR | Show existing PR URL, ask if user wants to update description instead |
| Push rejected | Show error, ask user to fix conflict then retry |
| Destination branch does not exist on remote | Warn user, confirm to continue |
Example Output
PR created: https://github.com/org/repo/pull/42
Title: Add user authentication with JWT
Branch: feature/auth → main
More from nguyenhuy158/skills
odoo-code-review
Review Odoo (Python & XML) code for best practices, standards, and common errors. Use this skill when the user asks to review Odoo modules, Python files in an Odoo context, or XML views/data files.
45copilot-commit-style
Use this skill when the user asks to write, generate, draft, or format a git commit message. It enforces the Conventional Commits specification with mandatory emojis and strict formatting rules.
9git-branch-clean
Use this skill when user wants to clean up local git branches whose remote tracking branches are gone/deleted. Triggers on phrases like "clean branches", "delete stale branches", "prune branches", "git branch clean", "dọn branch", "xóa branch cũ".
3code-polish
Polish Python code in git-changed files. Removes all comments and docstrings, eliminates magic strings and numbers, makes code self-documenting via naming. Python only — skips other languages. Use when user says "code-polish", "polish code", "clean code", "self-documenting", "remove comments", "làm sạch code".
2