Promptheus/commands36 commands · free · CC0Promptheus hub ↗
← All commands
/pr

Review & ship

Open a PR

Branch → a PR with a real description and test notes.

pull-requestgitgh
CategoryReview & ship
Argumentsnone
Allowed toolsBash(git:*)Bash(gh:*)Read
What it does

Push the branch and open a pull request with a clear title, a context/why body, and how it was tested.

.claude/commands/pr.md.claude/commands/ (project) · ~/.claude/commands/ (global)
Install into your repo
npx promptheus-commands add pr

The prompt

Open a pull request for the current branch. Base the title and body strictly on the branch's real commits and diff — never describe a change that is not in the diff.

Parse $ARGUMENTS

  • The exact token draft (case-insensitive) requests a draft PR — it is never a base branch. Consume it first and remove it from the argument list.
  • After removing draft, any remaining token is a requested base branch: accept it only if git rev-parse --verify <token> succeeds; otherwise warn and fall back to auto-detection.

Steps

  1. Detect the remote: take the current branch's upstream remote from git rev-parse --abbrev-ref @{u} (the part before /); else if git remote lists exactly one, use it; else use origin. Call it <remote> and use it in every command below.
  2. Detect the base branch (unless $ARGUMENTS supplied one): run git symbolic-ref --short refs/remotes/<remote>/HEAD — it returns <remote>/<name>, so strip the leading <remote>/ to get the bare <base>. If that fails, use whichever of main/master git rev-parse --verify finds.
  3. Confirm you are not on the base branch and the branch is ahead: git log --oneline <base>..HEAD. If zero commits ahead, stop and say so.
  4. Read what changed: git log <base>..HEAD for the messages, git diff <base>...HEAD --stat (three dots = diff from the merge-base), then the full git diff <base>...HEAD. Read enough to state every meaningful change precisely.
  5. Check the working tree with git status. If uncommitted changes belong in this PR, tell the user and ask whether to commit them first — never commit silently.
  6. Push: git push -u <remote> HEAD. If the upstream branch has diverged, report it rather than force-pushing.
  7. Check for an existing PR with gh pr view --json url,state,isDraft. If one is open, update it in place (see Create) instead of opening a duplicate.

PR content

  • Title: one imperative line, <=70 chars, stating the net change (not "fix stuff" — name it). Follow the repo's log style; use a Conventional Commits prefix if the history does.
  • Body sections:
    • Context — the problem or motivation. Add Closes #N when a commit or the branch name references an issue.
    • What changed — bullets grouped by area, each tied to the diff. Call out user-facing, API, schema, or config/behavior changes explicitly.
    • How tested — the exact commands you ran and their outcome. If you ran none (this command does not run tests), do not just write "not tested": state whether the diff adds or updates tests, and note that CI will verify — after creation, report gh pr checks status if available. Never claim a test passed that you did not run.
  • If .github/PULL_REQUEST_TEMPLATE.md (or pull_request_template.md) exists, fill that template instead of inventing your own structure.

Create

  • Write the body to a temp file and pass it via --body-file (or a heredoc) to preserve Markdown; never inline multi-line Markdown in --body.
  • New PR: gh pr create --base <base> --head <branch> --title "…" --body-file <file>. Add --draft when $ARGUMENTS requested draft.
  • Existing open PR (from step 7): update it instead — gh pr edit --title "…" --body-file <file>. Do not create a second PR.
  • Print the resulting PR URL, then run gh pr checks and report the CI status if it returns.

If gh is unavailable

Probe gh --version first. If gh is missing or unauthenticated, still push, then print the title and full Markdown body in one copy-paste block plus the compare URL (https://<host>/<owner>/<repo>/compare/<base>...<branch>), deriving <host>/<owner>/<repo> from git remote get-url <remote>.

Rules

  • Never invent, inflate, or drop changes — the body must match the diff exactly.
  • Never claim tests passed unless you actually ran them in this session.
  • Never force-push, amend, rebase, or edit source files; this command only pushes and opens or edits the PR.
  • Keep the body skimmable — no filler, no restating the diff line by line.

Add it to your toolkit

Save it as .claude/commands/pr.md or .cursor/commands/pr.md, then invoke it with /pr.

Back to top ↑