git-workflow-agentslisted
Install: claude install-skill eric-sabe/engsys
# Git Workflow for Agents
This skill guides AI agents through implementing GitHub issues in **isolated worktrees** to prevent source tree conflicts during parallel work.
## Why Worktrees?
Git worktrees provide independent working directories while sharing the same `.git` repository, preventing:
- File conflicts between agents
- Branch collisions
- Build interference
- Test pollution
- Context confusion
## Quick Start: Implementing an Issue
### Phase 1: Session Initialization
#### Step 1: Claim the Issue
```bash
# Preferred: gh CLI
gh issue edit 42 --repo <owner>/<repo> --add-assignee @me
```
The `github` MCP server (in [.mcp.json](../../../.mcp.json)) is a fallback for when `gh` auth or network fails. Project board operations (priorities, fields, statuses) **must** still use `gh project` / `gh api graphql` — the MCP server doesn't support ProjectV2.
#### Step 2: Create Worktree and Branch
**CRITICAL**: Create branch and worktree together using `-b` flag:
```bash
# Navigate to main repo
cd <repo-root> # e.g. /Users/<you>/git/<project>
# Update main branch
git fetch origin
git checkout main
git pull origin main
# Create worktree AND branch together (required)
git worktree add ../worktrees/issue-<number>-<slug> -b agent/<issue>-<slug>
# Example:
git worktree add ../worktrees/issue-42-tenant-validation -b agent/42-tenant-validation
```
**Common Mistake to Avoid:**
```bash
# ❌ WRONG - Don't create branch first
git checkout -b agent/42-tenant-validation
git workt