| name | workflows-git |
| description | Git workflow orchestrator guiding developers through workspace setup, clean commits, and work completion across git-worktrees, git-commit, and git-finish skills |
| allowed-tools | Read, Bash, mcp__code_mode__call_tool_chain |
| version | 1.5.0 |
Git Workflows - Git Development Orchestrator
Unified workflow guidance across workspace isolation, commit hygiene, and work completion.
1. π― WHEN TO USE
When to Use This Orchestrator
Use this orchestrator when:
- Starting new git-based work
- Unsure which git skill to use
- Following complete git workflow (setup β work β complete)
- Looking for git best practices (branch naming, commit conventions)
When NOT to Use
- Simple
git statusorgit logqueries (use Bash directly) - Non-git version control systems
Keyword Triggers
worktree, branch, commit, merge, pr, pull request, git workflow, conventional commits, finish work, integrate changes, github, issue, review
2. π GITHUB MCP INTEGRATION (REMOTE)
GitHub MCP Server provides programmatic access to GitHub's remote operations via Code Mode (call_tool_chain).
Prerequisites
- PAT configured in
.utcp_config.jsonwith appropriate scopes (repo, issues, pull_requests)
When to Use GitHub MCP vs Local Git vs gh CLI
| Operation | Tool | Rationale |
|---|---|---|
| commit, diff, status, log, merge | Local git (Bash) |
Faster, no network required |
| worktree management | Local git (Bash) |
Local filesystem operation |
| Create/list PRs | gh CLI OR GitHub MCP |
Both work; gh CLI simpler for basic ops |
| PR reviews, comments | GitHub MCP | Richer API for review workflows |
| Issue management | GitHub MCP | Full CRUD on issues |
| CI/CD status, logs | GitHub MCP | Access workflow runs and job logs |
| Search repos/code remotely | GitHub MCP | Cross-repo searches |
Available Tools (Code Mode Access)
Access Pattern: github.github_{tool_name}({...})
| Category | Tools | Description |
|---|---|---|
| Pull Requests | github_create_pull_requestgithub_list_pull_requestsgithub_get_pull_requestgithub_merge_pull_requestgithub_create_pull_request_reviewgithub_add_pull_request_review_commentgithub_get_pull_request_filesgithub_get_pull_request_statusgithub_update_pull_request_branchgithub_get_pull_request_commentsgithub_get_pull_request_reviews |
Create, list, merge PRs; add reviews and comments; get files, status, and reviews |
| Issues | github_create_issuegithub_get_issuegithub_list_issuesgithub_search_issuesgithub_add_issue_commentgithub_update_issue |
Full issue lifecycle management |
| Repository | github_get_file_contentsgithub_create_branchgithub_list_branchesgithub_search_repositoriesgithub_list_commits |
Read files, manage branches, search |
| CI/CD | github_list_workflow_runsgithub_get_workflow_rungithub_get_job_logs |
Monitor CI status, debug failures |
Usage Examples
// List open PRs
call_tool_chain(`github.github_list_pull_requests({
owner: 'owner',
repo: 'repo',
state: 'open'
})`)
// Create PR with full details
call_tool_chain(`github.github_create_pull_request({
owner: 'owner',
repo: 'repo',
title: 'feat(auth): add OAuth2 login',
head: 'feature/oauth',
base: 'main',
body: '## Summary\\n- Implements OAuth2 flow\\n- Adds token management'
})`)
// Get issue details
call_tool_chain(`github.github_get_issue({
owner: 'owner',
repo: 'repo',
issue_number: 123
})`)
// Check CI workflow status
call_tool_chain(`github.github_list_workflow_runs({
owner: 'owner',
repo: 'repo',
branch: 'main'
})`)
// Add PR review comment
call_tool_chain(`github.github_add_pull_request_review_comment({
owner: 'owner',
repo: 'repo',
pull_number: 42,
body: 'Consider extracting this to a helper function',
commit_id: 'abc123',
path: 'src/auth.js',
line: 25
})`)
// Get files changed in PR
call_tool_chain(`github.github_get_pull_request_files({
owner: 'owner',
repo: 'repo',
pull_number: 42
})`)
// Get PR status checks
call_tool_chain(`github.github_get_pull_request_status({
owner: 'owner',
repo: 'repo',
pull_number: 42
})`)
Best Practice: Prefer local git commands for local operations (faster, offline-capable). Use GitHub MCP for remote state queries and collaboration features.
Error Handling
Failed PR Creation
// Handle PR creation failures
try {
const result = await call_tool_chain(`github.github_create_pull_request({
owner: 'owner',
repo: 'repo',
title: 'feat: new feature',
head: 'feature-branch',
base: 'main',
body: 'Description'
})`);
} catch (error) {
// Common errors:
// - 422: Branch doesn't exist or no commits between branches
// - 403: Insufficient permissions
// - 404: Repository not found
console.error('PR creation failed:', error.message);
}
Merge Conflicts
// Check for merge conflicts before merging
const pr = await call_tool_chain(`github.github_get_pull_request({
owner: 'owner',
repo: 'repo',
pull_number: 42
})`);
if (pr.mergeable === false) {
console.log('Merge conflict detected. Resolve before merging.');
// Option 1: Update branch from base
await call_tool_chain(`github.github_update_pull_request_branch({
owner: 'owner',
repo: 'repo',
pull_number: 42
})`);
// Option 2: Resolve conflicts locally
// git fetch origin main && git merge origin/main
}
3. π§ SMART ROUTING
Phase Detection
GIT WORKFLOW CONTEXT
β
βββΊ Starting new work / need isolated workspace
β βββΊ PHASE 1: Workspace Setup (git-worktrees)
β βββΊ Load: worktree_workflows.md, worktree_checklist.md
β
βββΊ Ready to commit changes
β βββΊ PHASE 2: Commit (git-commit)
β βββΊ Load: commit_workflows.md, commit_message_template.md
β
βββΊ Work complete / ready to integrate
β βββΊ PHASE 3: Finish (git-finish)
β βββΊ Load: finish_workflows.md, pr_template.md
β
βββΊ Need command reference / conventions
β βββΊ Load: shared_patterns.md
β
βββΊ Quick overview needed
βββΊ Load: quick_reference.md
Resource Router
def route_git_resources(task):
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Phase 1: Workspace Setup (git-worktrees)
# Purpose: Complete 7-step worktree creation workflow
# Key Insight: Directory selection priority, safety verification, branch strategies
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
if task.needs_isolated_workspace or "worktree" in task.keywords:
return load("references/worktree_workflows.md") # 7-step creation workflow
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Phase 2: Commit Workflow (git-commit)
# Purpose: Complete 6-step commit workflow
# Key Insight: File categorization, artifact filtering, Conventional Commits
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
if task.has_staged_changes or "commit" in task.keywords:
load("references/commit_workflows.md") # 6-step commit workflow
if task.needs_message_help:
return load("assets/commit_message_template.md") # Conventional Commits examples
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Phase 3: Completion/Integration (git-finish)
# Purpose: Complete 5-step completion workflow
# Key Insight: Test verification gate, 4 options (merge/PR/keep/discard)
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
if task.ready_to_integrate or "merge" in task.keywords or "pr" in task.keywords:
load("references/finish_workflows.md") # 5-step completion workflow
if task.creating_pr:
return load("assets/pr_template.md") # PR description template
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Quick Reference
# Purpose: One-page cheat sheet
# Key Insight: Skill selection flowchart, essential commands
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
if task.needs_quick_reference:
return load("references/quick_reference.md") # one-page cheat sheet
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Shared Patterns
# Purpose: Common git patterns and command reference
# Key Insight: Branch naming, git commands, Conventional Commits format
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
if task.needs_command_reference or task.needs_conventions:
return load("references/shared_patterns.md")
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Worktree Checklist
# Purpose: Step-by-step worktree creation checklist
# Key Insight: Validation checkpoints for workspace setup
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
if task.setting_up_worktree:
return load("assets/worktree_checklist.md") # step-by-step validation
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# STATIC RESOURCES (always available, not conditionally loaded)
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# assets/commit_message_template.md β Format guide with real-world examples
# assets/pr_template.md β Structured PR descriptions with examples
4. π¨ WORKSPACE CHOICE ENFORCEMENT
MANDATORY: The AI must NEVER autonomously decide between creating a branch or worktree.
Enforcement (Manual)
The AI must follow this workflow manually and ask the user before proceeding with any git workspace operations.
When git workspace triggers are detected (new feature, create branch, worktree, etc.), the AI MUST ask the user to explicitly choose:
| Option | Description | Best For |
|---|---|---|
| A) Create a new branch | Standard branch on current repo | Quick fixes, small changes |
| B) Create a git worktree | Isolated workspace in separate directory | Parallel work, complex features |
| C) Work on current branch | No new branch created | Trivial changes, exploration |
AI Behavior Requirements
- ASK user for workspace choice before proceeding with git work
- WAIT for explicit user selection (A/B/C)
- NEVER assume which workspace strategy the user wants
- RESPECT the user's choice throughout the workflow
- If user has already answered this session, reuse their preference
Override Phrases
Power users can state preference explicitly:
"use branch"/"create branch"β Branch selected"use worktree"/"in a worktree"β Worktree selected"current branch"/"on this branch"β Current branch selected
Session Persistence
Once user chooses, reuse their preference for the session unless:
- User explicitly requests a different strategy
- User starts a new conversation
5. π οΈ HOW IT WORKS
Git Development Lifecycle Map
Git development flows through 3 phases:
Phase 1: Workspace Setup (Isolate your work)
- git-worktrees - Create isolated workspace with short-lived temp branches
- Prevents: Branch juggling, stash chaos, context switching
- Output: Clean workspace ready for focused development
- See: worktree_workflows.md
Phase 2: Work & Commit (Make clean commits)
- git-commit - Analyze changes, filter artifacts, write Conventional Commits
- Prevents: Accidental artifact commits, unclear commit history
- Output: Professional commit history following conventions
- See: commit_workflows.md
Phase 3: Complete & Integrate (Finish the work)
- git-finish - Merge, create PR, or discard work (with tests gate)
- Prevents: Incomplete work merged, untested code integrated
- Output: Work successfully integrated or cleanly discarded
- See: finish_workflows.md
Phase Transitions
- Setup β Work: Worktree created, ready to code
- Work β Complete: Changes committed, tests passing
- Complete β Setup: Work integrated, start next task
6. π RULES
β ALWAYS
- Use conventional commit format - All commits must follow
type(scope): descriptionpattern - Create worktree for parallel work - Never work on multiple features in the same worktree
- Verify branch is up-to-date - Pull latest changes before creating PR
- Use descriptive branch names - Format:
type/short-description(e.g.,feat/add-auth,fix/login-bug) - Reference spec folder in commits - Include spec folder path in commit body when applicable
- Clean up after merge - Delete local and remote feature branches after successful merge
- Squash commits for clean history - Use squash merge for feature branches with many WIP commits
β NEVER
- Force push to main/master - Protected branches must never receive force pushes
- Commit directly to protected branches - Always use feature branches and PRs
- Leave worktrees uncleaned - Remove worktree directories after merge
- Commit secrets or credentials - Use environment variables or secret management
- Create PRs without description - Always include context, changes, and testing notes
- Merge without CI passing - Wait for all checks to complete
- Rebase public/shared branches - Only rebase local, unpushed commits
β οΈ ESCALATE IF
- Merge conflicts cannot be auto-resolved - Complex conflicts require human decision on which changes to keep
- GitHub MCP returns authentication errors - Token may be expired or permissions insufficient
- Worktree directory is locked or corrupted - May require manual cleanup with
git worktree prune - Force push to protected branch is requested - This requires explicit approval and understanding of consequences
- CI/CD pipeline fails repeatedly - May indicate infrastructure issues beyond code problems
- Branch divergence exceeds 50 commits - Large divergence suggests need for incremental merging strategy
- Submodule conflicts detected - Submodule updates require careful coordination
7. πΊοΈ SKILL SELECTION DECISION TREE
What are you doing?
Workspace Setup (Phase 1)
- Starting new feature/fix? β git-worktrees
- Need isolated workspace for parallel work
- Want clean separation from other branches
- Avoid branch juggling and stash chaos
- See: worktree_workflows.md for complete 7-step workflow
- Quick fix on current branch? β Skip to Phase 2 (commit directly)
Work & Commit (Phase 2)
- Ready to commit changes? β git-commit
- Analyze what changed (filter artifacts)
- Determine single vs. multiple commits
- Write Conventional Commits messages
- Stage only public-value files
- See: commit_workflows.md for complete 6-step workflow
- Templates: commit_message_template.md
- No changes yet? β Continue coding, return when ready
Complete & Integrate (Phase 3)
- Tests pass, ready to integrate? β git-finish
- Choose: Merge locally, Create PR, Keep as-is, or Discard
- Cleanup worktree (if used)
- Verify final integration
- See: finish_workflows.md for complete 5-step workflow
- Templates: pr_template.md
- Tests failing? β Return to Phase 2 (fix and commit)
Common Workflows
Full Workflow (new feature):
git-worktrees (create workspace) β Code β git-commit (commit changes) β git-finish (integrate)
Quick Fix (current branch):
Code β git-commit (commit fix) β git-finish (integrate)
Parallel Work (multiple features):
git-worktrees (feature A) β Code β git-commit
git-worktrees (feature B) β Code β git-commit
git-finish (feature A) β git-finish (feature B)
8. π‘ INTEGRATION EXAMPLES
Example 1: New Authentication Feature
Flow:
- Setup: git-worktrees β
.worktrees/auth-featurewithtemp/auth - Work: Code OAuth2 flow β Run tests
- Commit: git-commit β Stage auth files β
feat(auth): add OAuth2 login flow - Complete: git-finish β Merge to main β Tests pass β Cleanup worktree
- Result: β Feature integrated, clean history, workspace removed
Example 2: Quick Hotfix
Flow:
- Work: Fix null reference bug on current branch
- Commit: git-commit β Filter coverage reports β
fix(api): handle null user response - Complete: git-finish β Create PR β Link to issue #123
- Result: β PR created with descriptive commit, ready for review
Example 3: Parallel Features
Flow:
- Setup A: git-worktrees β
.worktrees/feature-a - Setup B: git-worktrees β
.worktrees/feature-b - Work: Switch between terminals, code both features
- Commit A: cd feature-a β git-commit β
feat(search): add filters - Commit B: cd feature-b β git-commit β
feat(export): add CSV export - Complete A: git-finish β Merge A
- Complete B: git-finish β Merge B
- Result: β Two features developed in parallel, integrated sequentially
9. ποΈ QUICK REFERENCE
For one-page cheat sheet: See quick_reference.md
Git Workflow Principles:
ISOLATION: Use worktrees for parallel work
CLARITY: Write conventional commits with clear descriptions
QUALITY: Run tests before integration (git-finish gate)
CLEANUP: Remove worktrees after completion
Remember: This skill orchestrates three specialized workflows - Worktree Management, Commit Hygiene, and Work Completion. All integrate seamlessly for a professional git development lifecycle.