Ship PR
Create a pull request. Enforce project standards before anything leaves the branch.
Prerequisites
Fail immediately with an explicit error if any check fails.
ghinstalled:command -v ghghauthenticated:gh auth status- Inside a git repo:
git rev-parse --is-inside-work-tree
Step 1 -- Inspect
Run in parallel:
git status,git diff --staged,git diff-- working tree stategit log --oneline -10-- recent historygit rev-parse --abbrev-ref HEAD-- current branchgit rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo "no-upstream"-- tracking
Base branch: use $ARGUMENTS if provided, else main. Verify with git rev-parse --verify origin/<base>. Compute full diff: git diff origin/<base>...HEAD.
Step 2 -- Standards Review (BLOCKING GATE)
This step is mandatory. It cannot be skipped silently.
Read every applicable conventions file:
~/.claude/CLAUDE.md(user global)CLAUDE.mdin repo root (project).claude/CLAUDE.mdin repo root (alternate location)AGENTS.mdin repo root (if present)
Extract all actionable conventions. Review the full diff against every convention.
If discrepancies are found: STOP. Present a findings table:
| File | Standard | Issue | Fix |
|------|----------|-------|-----|
| src/foo.ts | Commit msg format | Missing conventional prefix | Amend to "feat: ..." |
| lib/bar.go | No fmt errors | gofmt diff detected | Run gofmt -w lib/bar.go |
Offer exactly these options:
- Fix all -- apply every fix, re-run review
- Fix some -- user picks which fixes to apply
- Proceed anyway -- create PR with known discrepancies
- Discuss -- explain findings before deciding
Do NOT proceed until the user confirms a path forward.
If no discrepancies: report "Standards review: all clear" and continue.
Step 3 -- Branch
If on main or master: do NOT commit to the default branch. Ask user for a branch name with conventional prefix (feat/, fix/, chore/, refactor/, docs/, test/). Create with git checkout -b <prefix>/<name>.
If already on a feature branch, continue on it.
Step 4 -- Stage and Commit
Stage files using explicit paths. Never use git add -A or git add ..
If nothing to commit, skip this step.
Write a conventional commit via HEREDOC:
git commit -m "$(cat <<'EOF'
type: short description
EOF
)"
Follow commit conventions from CLAUDE.md. Default: type: short description.
Step 5 -- Push
git push -u origin <branch>
If remote is already current, skip and report.
Step 6 -- Create PR
Read references/templates.md. Select the smallest tier that fits:
- Small: docs-only, config tweaks, single-file low-risk
- Standard: behavior changes, multi-file, new features
- Complex: schema migrations, auth changes, breaking changes
Create with gh pr create and HEREDOC body:
gh pr create --base <base> --title "<title>" --body "$(cat <<'EOF'
<filled template>
EOF
)"
Title under 70 characters. Detail goes in the body.
Step 7 -- Report
Print the PR URL. Nothing else.
Idempotency
Before creating, check for an existing PR:
gh pr list --head <branch> --json url --jq '.[0].url'
If a PR exists: push new commits to update, report existing URL. Do not create a duplicate.
Arguments
$ARGUMENTS -- base branch for the PR. Default: main.