Commit and push
Step 0: Gather context
Run these Bash commands before proceed:
git status -sb -- worktree 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
Prerequisites
- Verify inside git repo
- Verify git remote exist:
git remote -v -- if none, stop + explain
Your task
Run full commit-and-push flow below in one response.
Phase 0: Pre-flight -- verify review skill ran
- Check if review skill invoked this session:
/simplify -- small fixes/tweaks
/improve-codebase-architecture -- refactors (prefer this; /request-refactor-plan is deprecated)
/improve-codebase-architecture -- cleanup (oversized files, shallow modules, tangled deps)
/prototype -- redesign module or layout (prefer this; /design-an-interface is deprecated)
/visual-review -- browser-based review for frontend/visual diffs
- If frontend diff and
/visual-review has not run: run /visual-review or record explicit skip reason before pushing.
- If NONE ran: warn -- "Lifecycle requires review skill before shipping. Recommend:
/simplify for small changes, /improve-codebase-architecture for cleanup, /visual-review for frontend changes."
- Proceed only if review skill ran or user confirm skip
Phase 1: Scope confirmation
- Inspect status + diff above
- If worktree has unrelated changes, ask user which files belong -- no default
git add -A
- Show file list grouped by category for confirm before proceed
Phase 2: Branch strategy
- If on default branch -> make new branch
type/description (e.g. feat/add-commit-push-command) + switch
- Else stay on current branch
- Check existing PR:
gh pr list --head $(git branch --show-current) --json number,url --jq '.[0]' -- if PR exist, tell user (push update it)
Phase 3: Categorized commits
Analyze changed files, group by purpose into conventional commit types:
| Type |
Matches |
docs |
*.md, SKILL.md, REFERENCE.md, comments-only changes |
test |
*.test.ts, *.test.tsx, *.spec.ts, EVAL.ts, agent-evals/ |
refactor |
restructure without behavior change |
style |
formatting, whitespace, lint-only fixes |
fix |
bug fixes, error corrections |
feat |
new features, components, endpoints |
chore |
config, deps, build scripts, tooling |
perf |
perf improvements |
ci |
CI/CD pipeline changes |
build |
build system changes |
Each category with files:
- Stage only relevant files explicit paths:
git add <file1> <file2> ... -- never git add -A or git add .
- Commit:
type(scope): terse description
- Infer scope from dir/module
- Lowercase first letter, 5-72 chars, no trailing period
- Include
Co-Authored-By trailer
- Next category
File fit multiple categories -> pick most specific.
Phase 4: Pre-push review
- Show what push:
git log --oneline origin/<branch>..HEAD 2>/dev/null || git log --oneline -5
- Confirm commit count + branch target with user before push
Phase 5: Push
- Push with tracking:
git push -u origin $(git branch --show-current)
- Never force push --
--force-with-lease OK when needed (after rebase)
Phase 6: Verify and summarize
- Run
git status + git diff to confirm clean worktree
- If anything uncommitted, warn user
- Summarize: branch name, commits made, remote URL, remaining user actions
Safety
- Never stage unrelated changes silent
- Never push without confirm scope when worktree mixed
- Never force push --
--force-with-lease OK when needed (after rebase)
- No git remote reachable -> stop + explain blocker
1---2name: commit-push3description: Analyze changes, create categorized conventional commits, and push. Use when user asks to commit and push, invokes `/commit-push`, or requests conventional commits without a PR.4---56# Commit and push78## Step 0: Gather context910Run these Bash commands before proceed:1112- `git status -sb` -- worktree state13- `git diff HEAD` -- staged + unstaged changes14- `git branch --show-current` -- current branch15- `gh repo view --json defaultBranchRef -q '.defaultBranchRef.name'` -- default branch16- `git log --oneline -5` -- recent commits for style1718## Prerequisites19201. Verify inside git repo212. Verify git remote exist: `git remote -v` -- if none, stop + explain2223## Your task2425Run full commit-and-push flow below in one response.2627### Phase 0: Pre-flight -- verify review skill ran28291. Check if review skill invoked this session:30 - `/simplify` -- small fixes/tweaks31 - `/improve-codebase-architecture` -- refactors (prefer this; `/request-refactor-plan` is deprecated)32 - `/improve-codebase-architecture` -- cleanup (oversized files, shallow modules, tangled deps)33 - `/prototype` -- redesign module or layout (prefer this; `/design-an-interface` is deprecated)34 - `/visual-review` -- browser-based review for frontend/visual diffs352. If frontend diff and `/visual-review` has not run: run `/visual-review` or record explicit skip reason before pushing.363. If NONE ran: warn -- "Lifecycle requires review skill before shipping. Recommend: `/simplify` for small changes, `/improve-codebase-architecture` for cleanup, `/visual-review` for frontend changes."374. Proceed only if review skill ran or user confirm skip3839### Phase 1: Scope confirmation40411. Inspect status + diff above422. If worktree has unrelated changes, **ask user** which files belong -- no default `git add -A`433. Show file list grouped by category for confirm before proceed4445### Phase 2: Branch strategy46471. If on default branch -> make new branch `type/description` (e.g. `feat/add-commit-push-command`) + switch482. Else stay on current branch493. Check existing PR: `gh pr list --head $(git branch --show-current) --json number,url --jq '.[0]'` -- if PR exist, tell user (push update it)5051### Phase 3: Categorized commits5253Analyze changed files, group by purpose into conventional commit types:5455| Type | Matches |56|------|---------|57| `docs` | *.md, SKILL.md, REFERENCE.md, comments-only changes |58| `test` | *.test.ts, *.test.tsx, *.spec.ts, EVAL.ts, agent-evals/ |59| `refactor` | restructure without behavior change |60| `style` | formatting, whitespace, lint-only fixes |61| `fix` | bug fixes, error corrections |62| `feat` | new features, components, endpoints |63| `chore` | config, deps, build scripts, tooling |64| `perf` | perf improvements |65| `ci` | CI/CD pipeline changes |66| `build` | build system changes |6768**Each category with files:**69701. Stage only relevant files explicit paths: `git add <file1> <file2> ...` -- never `git add -A` or `git add .`712. Commit: `type(scope): terse description`72 - Infer scope from dir/module73 - Lowercase first letter, 5-72 chars, no trailing period74 - Include `Co-Authored-By` trailer753. Next category7677File fit multiple categories -> pick most specific.7879### Phase 4: Pre-push review80811. Show what push: `git log --oneline origin/<branch>..HEAD 2>/dev/null || git log --oneline -5`822. Confirm commit count + branch target with user before push8384### Phase 5: Push85861. Push with tracking: `git push -u origin $(git branch --show-current)`872. Never force push -- `--force-with-lease` OK when needed (after rebase)8889### Phase 6: Verify and summarize90911. Run `git status` + `git diff` to confirm clean worktree922. If anything uncommitted, warn user933. Summarize: branch name, commits made, remote URL, remaining user actions9495### Safety9697- Never stage unrelated changes silent98- Never push without confirm scope when worktree mixed99- Never force push -- `--force-with-lease` OK when needed (after rebase)100- No git remote reachable -> stop + explain blocker