Commit, push, and open PR
See REFERENCE.md for commit-type table, auto-label map, PR body template.
Step 0: Gather context
Run these Bash commands before proceed:
git status -sb -- working-tree state
git diff HEAD -- staged + unstaged changes
git branch --show-current -- current branch
gh repo view --json defaultBranchRef -q '.defaultBranchRef.name' -- default branch
git log --oneline -5 -- recent commits for style ref
gh pr list --head $(git branch --show-current) --json number,url,title --jq '.[0] // empty' -- existing PR on branch
Prerequisites
- Verify
gh --version -- if missing, stop, ask user install
- Verify
gh auth status -- if not authed, ask user run gh auth login and stop
- Verify inside git repo
Your task
Execute full commit-push-PR flow below in single response.
Phase 0: Pre-flight -- verify review skill ran
Check REFERENCE.md for review skill list. If NONE ran this session, warn and block unless user confirms skip.
Phase 1: Scope confirmation
- Inspect status and diff above
- PR exists on branch (from context) -> inform user, new commits update existing PR. Skip to Phase 3.
- Worktree has unrelated changes -> ask user which files belong. Never default
git add -A
- Present file list grouped by category for confirmation before proceed
Phase 2: Branch strategy
- On default branch -> create new branch
type/description (e.g. feat/add-commit-push-command) and switch
- Else stay on current branch
Phase 3: Categorized commits
Group changed files by conventional commit type (see REFERENCE.md type table).
For each category with files:
- Stage only relevant files with explicit paths:
git add <file1> <file2> ... -- never git add -A or git add .
- Commit:
type(scope): terse description
- Infer scope from directory/module
- Lowercase first letter, 5-72 chars, no trailing period
- Include
Co-Authored-By trailer
- Next category
Record commit types created -- used for auto-labeling Phase 5.
Phase 4: Push
- Show what push:
git log --oneline origin/<branch>..HEAD 2>/dev/null || git log --oneline -5
- Push with tracking:
git push -u origin $(git branch --show-current)
- Never force push --
--force-with-lease OK when needed (after rebase)
Phase 5: Open pull request
PR exists (from context) -> skip to Phase 6, push updated it already.
- Determine base branch from context
- Build
gh pr create with --base, --fill-verbose, --assignee @me
- Auto-label from commit types (see REFERENCE.md auto-label map)
- Override auto-filled body with structured template (see REFERENCE.md PR body template)
- Frontend change detected (REFERENCE.md rule) -> include Screenshots table summarizing visual changes. One row per affected view (before/after/notes). Omit section if no frontend diff
- Print PR URL
Phase 6: Watch CI (MANDATORY)
- Always stream CI checks:
gh pr checks <PR_NUMBER> --watch via Monitor tool
- Never use
sleep + polling -- use --watch flag
- Never skip -- CI failures caught here save time
- Checks fail -> read logs, diagnose, fix, commit, push, re-watch
- No CI configured -> note and proceed
Phase 7: Verify and summarize
- Run
git status and git diff to confirm clean worktree
- Anything uncommitted remains -> warn user
- Summarize: branch name, commits, PR URL (or existing PR URL), CI status, remaining user actions
Safety
- Never stage unrelated changes silently
- Never push without confirming scope when worktree mixed
- Never force push --
--force-with-lease OK when needed (after rebase)
- No accessible git remote -> stop, explain blocker
gh pr create fails -> show error, suggest --recover flag for retry
1---2name: commit-push-pr3description: Analyze changes, create categorized conventional commits, push, and open a PR. Use when user asks to open a PR, invokes `/commit-push-pr`, or requests a full commit -> push -> PR flow with CI monitoring.4---56# Commit, push, and open PR78See [REFERENCE.md](REFERENCE.md) for commit-type table, auto-label map, PR body template.910## Step 0: Gather context1112Run these Bash commands before proceed:1314- `git status -sb` -- working-tree state15- `git diff HEAD` -- staged + unstaged changes16- `git branch --show-current` -- current branch17- `gh repo view --json defaultBranchRef -q '.defaultBranchRef.name'` -- default branch18- `git log --oneline -5` -- recent commits for style ref19- `gh pr list --head $(git branch --show-current) --json number,url,title --jq '.[0] // empty'` -- existing PR on branch2021## Prerequisites22231. Verify `gh --version` -- if missing, stop, ask user install242. Verify `gh auth status` -- if not authed, ask user run `gh auth login` and stop253. Verify inside git repo2627## Your task2829Execute full commit-push-PR flow below in single response.3031### Phase 0: Pre-flight -- verify review skill ran3233Check REFERENCE.md for review skill list. If NONE ran this session, warn and block unless user confirms skip.3435### Phase 1: Scope confirmation36371. Inspect status and diff above382. PR exists on branch (from context) -> inform user, new commits update existing PR. Skip to Phase 3.393. Worktree has unrelated changes -> **ask user** which files belong. Never default `git add -A`404. Present file list grouped by category for confirmation before proceed4142### Phase 2: Branch strategy43441. On default branch -> create new branch `type/description` (e.g. `feat/add-commit-push-command`) and switch452. Else stay on current branch4647### Phase 3: Categorized commits4849Group changed files by conventional commit type (see REFERENCE.md type table).5051**For each category with files:**52531. Stage only relevant files with explicit paths: `git add <file1> <file2> ...` -- never `git add -A` or `git add .`542. Commit: `type(scope): terse description`55 - Infer scope from directory/module56 - Lowercase first letter, 5-72 chars, no trailing period57 - Include `Co-Authored-By` trailer583. Next category5960Record commit types created -- used for auto-labeling Phase 5.6162### Phase 4: Push63641. Show what push: `git log --oneline origin/<branch>..HEAD 2>/dev/null || git log --oneline -5`652. Push with tracking: `git push -u origin $(git branch --show-current)`663. Never force push -- `--force-with-lease` OK when needed (after rebase)6768### Phase 5: Open pull request6970**PR exists** (from context) -> skip to Phase 6, push updated it already.71721. Determine base branch from context732. Build `gh pr create` with `--base`, `--fill-verbose`, `--assignee @me`743. Auto-label from commit types (see REFERENCE.md auto-label map)754. Override auto-filled body with structured template (see REFERENCE.md PR body template)765. Frontend change detected (REFERENCE.md rule) -> include Screenshots table summarizing visual changes. One row per affected view (before/after/notes). Omit section if no frontend diff776. Print PR URL7879### Phase 6: Watch CI (MANDATORY)80811. **Always** stream CI checks: `gh pr checks <PR_NUMBER> --watch` via Monitor tool822. Never use `sleep` + polling -- use `--watch` flag833. Never skip -- CI failures caught here save time844. Checks fail -> read logs, diagnose, fix, commit, push, re-watch855. No CI configured -> note and proceed8687### Phase 7: Verify and summarize88891. Run `git status` and `git diff` to confirm clean worktree902. Anything uncommitted remains -> warn user913. Summarize: branch name, commits, PR URL (or existing PR URL), CI status, remaining user actions9293### Safety9495- Never stage unrelated changes silently96- Never push without confirming scope when worktree mixed97- Never force push -- `--force-with-lease` OK when needed (after rebase)98- No accessible git remote -> stop, explain blocker99- `gh pr create` fails -> show error, suggest `--recover` flag for retry