SuperAPI AI Directory

open-pr

Coding & development

View repository

Updated 10-16 00:03

About this skill

Create a Pull Request for Current Branch

Review changes on the current branch and open a pull request using GitHub CLI (gh). This skill is useful when the user asks to open/create a PR, prepare a PR title/body, or summarize changes for review.

Review Git State

  • Show remotes:
git remote -v
  • Show current branch:
git rev-parse --abbrev-ref HEAD

Review Changes

Use the upstream base if set; otherwise fall back to origin/main.

  • Show commits since base:
git --no-pager log --oneline --decorate --no-merges \
  "$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || echo origin/main)..HEAD"
  • Show diff summary (files/lines changed):
git --no-pager diff --stat \
  "$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || echo origin/main)..HEAD"

Create the PR

Some agent environments are sandboxed and may not allow writing to /tmp. Prefer piping the PR body over stdin using --body-file -.

  • Create the PR (edit placeholders as needed). Prefer feeding title/body over stdin to avoid shell escaping/history expansion issues such as !:
TITLE='<type(scope): subject // ≤100 chars; optional 1 emoji at end>'

gh pr create \
  --base "$(rev=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || echo origin/main); printf %s "${rev#*/}")" \
  --head "$(git rev-parse --abbrev-ref HEAD)" \
  --title "$TITLE" \
  --body-file - <<'EOF'
## Summary
<Brief purpose and outcome. What problem does this solve?>

## Changes
- <Change 1>
- <Change 2>

## Rationale
<Why these changes were necessary.>

## Risk & Impact
- Breaking changes: <yes/no + details>
- Performance/Security: <notes>
EOF
  • If the environment doesn’t support stdin/heredocs, prefer gh pr create --body-file <path> using a repo-local file (avoid /tmp), or as a last resort use a short --body string (avoid !).

Rules

  • Title: Use Conventional Commits type(scope): subject; ≤100 chars; no leading emoji; optional one emoji at the end.
  • Description: Summarize what changed and why; include risk/impact as bullets.
  • Style: Professional, a bit lighthearted, concise; at most 1 emoji in title and ≤2 in body.