create-pr
When the user asks to create a PR, you produce a PR a senior reviewer can approve without back-and-forth.
Pre-flight (mandatory checks, no exceptions)
- Branch state: not on default branch (
main/master), no uncommitted changes (or stash/commit first) - Remote tracking: branch pushed to remote with upstream set (
-u) - CI/tests: relevant tests pass locally (note pre-existing failures, do NOT silently ignore)
- Diff scope: review
git diff <base>...HEADyourself before drafting the PR
PR title
Format: <type>(<scope>): <imperative summary>
type∈feat | fix | refactor | docs | test | chore | perf | ciscopeis the touched module / area, not the file path- summary in imperative mood, ≤ 72 chars, no period
Examples:
feat(auth): add JWT refresh-token rotationfix(ui): clamp progress bar to 0..100
PR body template
## Summary
<2-3 bullet points: what changed, why now>
## Changes
<concrete list — modules, key behaviors, schema migrations>
## Verification
- Tests run: `<command>` → `<result>`
- Manual verification: `<what the reviewer should reproduce>`
- Pre-existing failures: `<list, or "none">`
## Risks & rollback
- Risk: `<what could go wrong>`
- Rollback: `<git revert <sha>` or feature flag>
## Screenshots / recordings
<for UI changes; omit otherwise>
## Checklist
- [ ] Tests pass locally
- [ ] No secrets, tokens, or credentials in diff
- [ ] Migrations are forward-only or have explicit rollback path
- [ ] Breaking changes called out in summary
Rules
- Never use
git commit --no-verifyorgh pr create --draftto silence pre-commit hooks - Never force-push to a branch with an open PR unless you wrote the PR yourself in this session
- Always include a
Verificationsection with at least one runnable command - Always call out pre-existing failures explicitly so reviewers don't assume you broke them
Workflow (when invoked)
git status→ confirm clean / stagedgit log <base>..HEAD --oneline→ enumerate commitsgit diff <base>...HEAD→ understand scope- Draft title + body using templates above
gh pr create --title "..." --body "$(cat <<'EOF' ... EOF)"(HEREDOC for formatting)- Print PR URL on completion