/commit-push-pr - Git Workflow Automation
Version: 3.1.0 | Type: Terminal Skill Role: Commit, push, and create PR in one command Pipeline: After /synthesis COMPLETE (pipeline endpoint)
1. Purpose
Automates the complete git workflow:
- Analyze staged/unstaged changes
- Generate or use provided commit message
- Stage and commit changes
- Push with upstream tracking
- Create/update pull request
2. Invocation
/commit-push-pr # Auto-generate message
/commit-push-pr "feat: Add auth module" # Provide message
/commit-push-pr --workload <slug> # Pipeline completion
3. L1/L2/L3 Output Format
L1 Summary (returned to main context)
taskId: commit-{timestamp}
agentType: commit-push-pr
status: success
summary: "Committed abc1234, pushed to origin/feature-branch, PR #123 created"
branch: "feature/auth-module"
commitHash: "abc1234"
filesChanged: 5
prUrl: "https://github.com/owner/repo/pull/123"
l2Path: .agent/prompts/{slug}/commit-push-pr/l2_index.md
requiresL2Read: false
nextActionHint: "Pipeline complete"
L2 Report Structure
# Commit Summary
**Branch:** feature/auth-module
**Commit:** abc1234
**Message:** feat: Add user authentication flow
## Files Changed
- src/auth/login.py (+42, -10)
- tests/test_auth.py (+25, -0)
## Push Status
Pushed to origin/feature/auth-module
## PR Status
PR #123 created: https://github.com/owner/repo/pull/123
4. Execution Strategy
Phase 1: Analyze Changes
git status # View untracked and modified
git diff --cached # View staged changes
git diff # View unstaged changes
git log --oneline -5 # Recent commits for style
Phase 2: Stage and Commit
Commit Message Format:
<type>: <concise description>
<optional body explaining why>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Types: feat, fix, refactor, docs, test, chore, style
Phase 3: Push to Remote
git push -u origin $(git branch --show-current)
Phase 4: Create/Update PR
# Check if PR exists
gh pr view --json state 2>/dev/null
# Create PR if none exists
gh pr create --title "<title>" --body "<body>"
5. Safety Validations
| Condition | Action |
|---|---|
| Branch is main/master | WARN, ask confirmation |
| Committing .env files | BLOCK unless explicit |
| Committing credentials | BLOCK - security risk |
| Empty commit | SKIP - nothing to commit |
P6: Git Safety Validation
const gitSafetyChecks = {
maxRetries: 2,
checks: [
"branch !== 'main' && branch !== 'master'",
"!stagedFiles.some(f => f.includes('.env'))",
"!stagedFiles.some(f => f.includes('credential'))",
"commitMessage.match(/^(feat|fix|refactor|docs|test|chore|style):/)"
],
onFailure: "BLOCK and prompt user for correction"
};
6. Pipeline Integration
/synthesis (COMPLETE)
|
+-- /commit-push-pr <-- THIS SKILL (Terminal)
|
+-- Pipeline terminates
Upstream
- /synthesis with COMPLETE status
Output
- No downstream skill (terminal)
7. Handoff Contract
handoff:
skill: "commit-push-pr"
workload_slug: "{slug}"
status: "completed"
timestamp: "2026-01-28T14:35:00Z"
next_action:
skill: null
arguments: null
required: false
reason: "Pipeline completed - changes committed and PR created"
8. Post-Compact Recovery
if (isPostCompactSession()) {
const slug = await getActiveWorkload();
if (slug) {
const lastCommit = await Bash("git log -1 --oneline");
console.log(`Last commit: ${lastCommit}`);
}
// Continue with current git state
}
Version History
| Version | Change |
|---|---|
| 3.1.0 | Cleaned duplicate blocks, normalized frontmatter |
| 3.0.0 | EFL Pattern integration, git-safety-check hook |
| 2.2.0 | Standalone execution, handoff contract |
| 2.1.0 | V2.1.19 spec compatibility |
| 1.1.1 | Initial git workflow automation |