| name | commit |
| description | Standardized git commit, push, and PR creation workflow. |
| triggers | ["commit","push","commit-push-pr"] |
| allowed-tools | Bash, Read, Glob |
| model | opus |
| user-invocable | true |
| argument-hint | [type] [message] |
Commit Workflow
Working Tree
!git status --short 2>/dev/null
!git diff --stat HEAD 2>/dev/null | tail -5
!git log --oneline -5 2>/dev/null
Quick Commit
git status --short
git diff --stat
git add src/components/new-feature.tsx src/lib/utils.ts
git commit -m "feat: add playlist drag-drop reorder"
Conventional Commits (Required)
<type>: <short description>
[optional body]
| Type | When |
|---|
feat | New feature |
fix | Bug fix |
refactor | Code restructure, no behavior change |
chore | Dependencies, config, tooling |
docs | Documentation only |
test | Add or update tests |
perf | Performance improvement |
Rules:
- Subject line < 70 chars
- Imperative mood: "add" not "added"
- No period at end
- Body explains WHY, not WHAT
- Include story ID when available:
feat(S13-001): add playlist UI
Commit + Push
git add <files>
git commit -m "feat: description"
git push origin HEAD
Branch Strategy
Check before branching:
CONTRIBUTORS=$(git shortlog -sn --all 2>/dev/null | wc -l)
HAS_REMOTE=$(git remote 2>/dev/null | head -1)
- Solo project (1 contributor or no remote): commit directly to main — branching adds ceremony with zero value.
- Team project (2+ contributors or CI/branch protection): create a feature branch from main.
if [ "$CONTRIBUTORS" -gt 1 ] && [ -n "$HAS_REMOTE" ]; then
BRANCH=$(git branch --show-current)
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
git checkout -b feat/[descriptive-name]
fi
fi
Post-Commit Quick Check
After every commit, run a 5-second sanity check:
npm run build 2>&1 | tail -3
curl -s http://localhost:3000 > /dev/null 2>&1 && agent-browser open http://localhost:3000 && agent-browser snapshot -i
If errors found, fix immediately and amend the commit.
Full PR Flow (commit-push-pr)
BRANCH=$(git branch --show-current)
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
git checkout -b feat/[descriptive-name]
fi
git add <files>
git commit -m "feat: add playlist UI with drag-drop"
git push -u origin HEAD
Auto-Generate PR Description from prd.json
If prd.json exists and has completed stories, generate the PR body from them:
node -e "
const p=require('./prd.json');
const stories=p.stories||{};
const done=Object.entries(stories).filter(([,s])=>s.passes===true);
if(done.length){
console.log('## Changes');
done.forEach(([id,s])=>console.log('- **'+id+'**: '+s.title+(s.resolution?' ('+s.resolution+')':'')));
console.log('\n## Test Plan');
done.forEach(([id,s])=>console.log('- [ ] Verify '+s.title));
}
"
Use this output as the PR body:
gh pr create --title "[Sprint summary]" --body "[generated from prd.json]"
Safety Checks
Before committing (if ANY fail, fix before proceeding):
Before pushing:
If issues found: fix them, re-stage, re-run checks, THEN commit.
Version Sync Check (claude-auto-dev repo only)
When committing to this repo, check for stale version strings before staging:
VERSION=$(cat VERSION 2>/dev/null)
grep -rn "4\.9\.4\|v4\.9" --include="*.md" --include="*.json" --include="*.ps1" --include="*.sh" . \
| grep -v CHANGELOG.md | grep -v node_modules | grep -v .git
If stale versions found: fix them before committing.
Files to check: VERSION, package.json, manifest.json, README.md badge, commands.md, install.sh fallback, install.ps1 fallback.
The current version is: !cat VERSION 2>/dev/null
Batch Commit (During Auto Mode)
During auto, commit every 3 tasks:
git add -A -- ':!.env*' ':!*.pem' ':!*.key' ':!*.secret'
git commit -m "feat: complete S9-1 through S9-3
- S9-1: Playlist UI with drag-drop
- S9-2: Song extend from timestamp
- S9-3: Onboarding wizard"
Amend Last Commit
Only if not pushed yet:
git add <missed-files>
git commit --amend --no-edit
Undo Last Commit (Keep Changes)
git reset --soft HEAD~1