Agent skill
git-workflow-policy
Git workflow policies including commit rules and worktree cleanup sequence. Use when managing git operations, commits, or merges.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/productivity/git-workflow-policy
SKILL.md
Git Workflow Policy
Instructions
Core policies
- Never commit without explicit user approval
- Phase commits at Step 9 only
- No direct commits to main
- Worktree → merge pattern
- 4-step cleanup in order (plan → services → worktree → branch)
Commit policy
Before committing:
- Present changes with rationale
- Show affected code/logs
- Get explicit user approval
- Focus minimal scope
Worktree 4-step cleanup
CRITICAL ORDER:
1. rm .plan/{{feature_name}}_plan.md
2. cd .worktree/{{feature-name}} && {{cleanup_command}}
3. git worktree remove .worktree/{{feature-name}}
4. git branch -d feature/{{feature-name}}
Why: Plan first (project cleanup) → Services (prevent orphans) → Worktree (directory) → Branch (git)
Note: {{cleanup_command}} = project-specific cleanup
Common Cleanup Commands by Stack:
Python/Flask/Django:
# Stop services
pkill -f "python.*{{app_name}}"
# Or docker-based:
docker-compose down
# Clean artifacts
rm -rf __pycache__ *.pyc .pytest_cache
Node.js/Express:
# Stop services
pm2 stop {{app_name}}
# Or kill process:
pkill -f "node.*{{app_name}}"
# Clean artifacts
rm -rf node_modules/.cache dist build
Go:
# Stop services
pkill -f "{{binary_name}}"
# Clean artifacts
rm -rf {{binary_name}} *.test
Java/Spring:
# Stop services
pkill -f "java.*{{app_name}}"
# Clean artifacts
./gradlew clean # or: mvn clean
Docker-based (Any stack):
# Stop and remove containers
docker-compose -f docker-compose.{{env}}.yml down
docker rm -f {{container_name}}
# Clean volumes (optional)
docker volume prune -f
Example
# ❌ Wrong
git worktree remove .worktree/feature-x # Services orphaned!
# ✅ Correct
rm .plan/feature-x_plan.md
cd .worktree/feature-x && {{project_cleanup_command}}
git worktree remove .worktree/feature-x
git branch -d feature/feature-x
Workflow
Code complete
↓
Present to user
↓
User approves
↓
Commit at Step 9
↓
All phases done
↓
Merge to main
↓
4-step cleanup
For detailed policies, see reference.md For more examples, see examples.md
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?