dev-git-workflow
Team Git patterns for branching, PRs, commits, and code review. Use when choosing a branching model or hardening repo collaboration.
What this skill does
# Git Workflow (Modern Team Collaboration)
Use modern Git collaboration patterns: GitHub Flow for continuous deploy, trunk-based for scale, Conventional Commits for automation, stacked diffs for large features.
Use this skill to choose a branching model, standardize PR discipline, enforce commit conventions, and harden repository settings for safe collaboration.
## Quick Start
1. Identify constraints (team size, release cadence, CI maturity, compliance).
2. Choose a branching strategy using the decision tree.
3. Apply the baseline repo settings (branch protection, approvals, checks, merge strategy).
4. Use the relevant reference doc for implementation details.
5. If asked "best practice in 2026", verify via web search using `data/sources.json` as a starting source list.
## Quick Reference
| Task | Tool/Command | When to Use | Reference |
|------|-------------|-------------|-----------|
| Create feature branch | `git switch -c feat/name main` | Start new work | [Branching Strategies](references/branching-strategies.md) |
| Create feature worktree | `git worktree add .worktrees/feature -b feature/name` | Isolate one feature per agent/branch | [AI Agent Worktrees](references/ai-agent-worktrees.md) |
| Squash WIP commits | `git rebase -i HEAD~3` | Clean up before PR | [Interactive Rebase](references/interactive-rebase-guide.md) |
| Conventional commit | `git commit -m "feat: add feature"` | All commits | [Commit Conventions](references/commit-conventions.md) |
| Force push safely | `git push --force-with-lease` | After rebase | [Common Mistakes](references/common-mistakes.md) |
| Resolve conflicts | `git mergetool` | Merge conflicts | [Conflict Resolution](references/conflict-resolution.md) |
| Create stacked PRs | `gt create stack-name` (Graphite) | Large features | [Stacked Diffs](references/stacked-diffs-guide.md) |
| Auto-generate changelog | `npx standard-version` | Before release | [Release Management](references/release-management.md) |
| Run quality gates | GitHub Actions / GitLab CI | Every PR | [Automated Quality Gates](references/automated-quality-gates.md) |
## AI Agent Feature Loop
**[AI Agent Worktrees Reference](references/ai-agent-worktrees.md)** — Full guide to worktree isolation for Claude Code, Codex, Aider, and other AI coding agents.
```mermaid
flowchart LR
A[Plan] --> B[Create worktree<br>per agent/feature]
B --> C[Verify .gitignore<br>+ install deps]
C --> D[Agent works<br>scoped commits]
D --> E[Quality gates]
E -->|pass| F[PR + merge]
E -->|fail| D
F --> G[Cleanup worktree<br>+ delete branch]
style D fill:#fff3cd,stroke:#d4a017
style F fill:#d4edda,stroke:#28a745
```
For AI-assisted engineering, prefer this default loop:
1. Create one worktree per feature branch (`git worktree add .worktrees/<feature> -b feature/<name>`).
2. Verify the worktree directory is in `.gitignore` (`git check-ignore -q .worktrees`).
3. Install dependencies and verify clean test baseline before starting work.
4. Implement scoped changes only for that feature.
5. Run repository quality gate(s) before PR.
6. Open one focused PR to the integration branch.
7. After merge, clean up: `git worktree remove` + `git branch -d`.
**Parallel agents:** One worktree per agent, disjoint file ownership, orchestrator merges from main. See [AI Agent Worktrees](references/ai-agent-worktrees.md) for setup, safety patterns, and cleanup.
If repository scripts exist (for example `scripts/git/feature-workflow.sh`), use them to enforce this loop.
## Local Safety Preflight (Before Checkout/Merge/Commit)
Use this quick sequence to avoid common local Git blockers during agent-driven work.
1. Working tree cleanliness:
- `git status --porcelain`
- If non-empty, decide explicitly: commit, stash, or abort branch switch.
2. Lock/process check:
- If Git commands fail with `index.lock`, check running Git processes first:
- `test -f .git/index.lock && ps aux | rg "[g]it"`
- Remove stale lock only after confirming no active Git process.
3. Branch switch guard:
- Do not `checkout`/`switch` when local changes would be overwritten.
- Commit/stash intentionally; avoid accidental context loss.
4. Merge conflict protocol:
- On conflict, stop new edits, resolve conflict file-by-file, rerun relevant tests, then complete merge commit.
5. Automation note:
- For recurring branch operations, prefer project scripts/worktrees over ad-hoc local branch juggling.
## Decision Tree: Choosing Branching Strategy
```text
Use this decision tree to select the optimal branching strategy for your team based on team size, release cadence, and CI/CD maturity.
Team characteristics -> What's your situation?
├─ Small team (1-5 devs) + Continuous deployment + High CI/CD maturity?
│ └─ GitHub Flow (main + feature branches)
│
├─ Medium team (5-15 devs) + Continuous deployment + High CI/CD maturity?
│ └─ Trunk-Based Development (main + short-lived branches)
│
├─ Large team (15+ devs) + Continuous deployment + Very high CI/CD maturity?
│ └─ Trunk-Based + Feature Flags (progressive rollout)
│
├─ Scheduled releases + Medium CI/CD maturity?
│ └─ GitFlow (main + develop + release branches)
│
└─ Multiple versions + Low-Medium CI/CD maturity?
└─ GitFlow (long-lived release branches)
```
## Navigation: Core Workflows
### Branching Strategies
**[Branching Strategies Comparison](references/branching-strategies.md)** - Comprehensive guide to choosing and implementing branching strategies
- GitHub Flow (recommended for modern teams): Simple, continuous deployment
- Trunk-Based Development (enterprise scale): Short-lived branches, daily merges
- GitFlow (structured releases): Scheduled releases, multiple versions
- Decision matrix: Team size, release cadence, CI/CD maturity
- Migration paths between strategies
### Pull Request Best Practices
**[PR Best Practices Guide](references/pr-best-practices.md)** - Effective code reviews and fast PR cycles
- PR size guidelines: keep PRs reviewable (often 200-400 LOC works well; split larger changes)
- Review categories: BLOCKER, WARNING, NITPICK
- Review etiquette: Collaborative feedback, code examples
- PR description templates: What, Why, How, Testing
- Data-driven insights on review efficiency
### Commit Conventions
**[Conventional Commits Standard](references/commit-conventions.md)** - Commit message formats and semantic versioning integration
- Conventional commit format: `type(scope): description`
- Commit types: feat, fix, BREAKING CHANGE, refactor, docs
- SemVer automation: Auto-bump versions from commits
- Changelog generation: Automated from commit history
- Tools: commitlint, semantic-release, standard-version
---
## Navigation: Advanced Techniques
### Stacked Diffs
**[Stacked Diffs Implementation](references/stacked-diffs-guide.md)** - Platform-specific workflows and team adoption
- What are stacked diffs: Break large features into reviewable chunks
- When to use: Features > 500 lines, complex refactoring
- GitLab native support: MR chains
- GitHub with Graphite: CLI-based stacking
- Benefits: 60% faster review cycles, better quality
### Interactive Rebase
**[Interactive Rebase & History Cleanup](references/interactive-rebase-guide.md)** - Maintain clean commit history
- Auto-squash workflow: `fixup!` and `squash!` commits
- Interactive rebase commands: pick, reword, edit, squash, fixup, drop
- Splitting commits: Break large commits into focused changes
- Reordering commits: Logical commit history
- Best practices: Never rebase public branches
### Conflict Resolution
**[Conflict Resolution Techniques](references/conflict-resolution.md)** - Merge strategies and conflict handling
- Resolution strategies: `--ours`, `--theirs`, manual merge
- Rebase vs merge: When to use each
- Merge tool setup: VS Code, Meld, custom tools
- Conflict markers: Understanding `<<<<<<<`, `=======`, `>>>>>>>`
- Prevention strategies: Frequent rebasing, small PRelated in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.