skills/coding/git-branch-strategy/SKILL.md
Master Git branching decisions: when to create branches, naming conventions, branch lifecycle management, and cleanup strategies. Use when user mentions branching, branch names, git workflow, branch management, or when they're unsure about which branch to create or how to organize branches. Triggers especially when user says "should I create a branch?", "what should I name this branch?", "branch naming convention", "how to organize branches", or "when to create a branch".
npx skillsauth add ImaginerLabs/skill-manager git-branch-strategyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Git-branch-strategy is a behavioral specification skill that encapsulates the judgment of when to create branches, how to name them, and when to clean them up.
This skill embodies the decision-making framework of developers who've worked with various branching models and know which approach fits which context.
"Every branch is a promise. The promise: 'I will integrate this work back into the main line.' The cost: managing that promise across time and changes."
Branches are cheap, but they have a cognitive cost. Each branch you maintain is context you switch between. The question isn't "can I create a branch?" — it's "should I?"
┌─────────────────────────────────────────────────────────────────┐
│ BRANCHING COMPLEXITY │
│ │
│ ┌───────────┐ ┌──────────────┐ ┌──────────────────┐ │
│ │ TRUNK │ ──► │ FEATURE │ ──► │ LONG-LIVED │ │
│ │ (main) │ │ BRANCH │ │ FEATURE BRANCH │ │
│ │ │ │ (1-2 days) │ │ (1+ weeks) │ │
│ └───────────┘ └──────────────┘ └──────────────────────┘ │
│ │ │ │ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ Ship fast, Feature isolated Needs coordination │
│ merge carefully Easy to review Higher integration │
│ │
└─────────────────────────────────────────────────────────────────┘
| Condition | Action | Rationale | |-----------|--------|-----------| | Work will take >1 day | Branch | Avoid blocking others | | Multiple people involved | Branch | Coordinate parallel work | | Risky experiment | Branch | Can discard safely | | Affects shared code | Branch | Test before affecting team | | Release-specific fix | Branch | Isolate release concerns |
| Condition | Alternative | Rationale | |-----------|-------------|-----------| | Quick fix (<1 hour) | Commit directly | Less overhead | | Solo work, no risk | Commit directly | Fewer context switches | | Exploratory spike | Branch from feature | Keep feature clean | | Trivial change | Commit directly | Branch overhead > benefit |
┌──────────────────┬──────────────────┐
│ < 1 DAY │ > 1 DAY │
┌───────────────────┼──────────────────┼──────────────────┤
│ SOLO, LOW RISK │ Direct commit │ Feature branch │
├───────────────────┼──────────────────┼──────────────────┤
│ SOLO, HIGH RISK │ Feature branch │ Feature branch │
├───────────────────┼──────────────────┼──────────────────┤
│ TEAM, ANY RISK │ Feature branch │ Feature branch │
└───────────────────┴──────────────────┴──────────────────┘
<type>/<ticket-id>-<short-description>
Example: feature/PROJ-123-user-authentication
| Type | When to Use | Examples |
|------|-------------|----------|
| feature/ | New feature work | feature/PROJ-123-user-auth |
| fix/ | Bug fixes | fix/PROJ-456-login-crash |
| hotfix/ | Urgent production fixes | hotfix/PROJ-789-security-patch |
| release/ | Release preparation | release/v2.3.0 |
| bugfix/ | Non-urgent bug fixes | bugfix/PROJ-101-typo |
| refactor/ | Code restructuring | refactor/PROJ-202-payment-module |
| docs/ | Documentation only | docs/PROJ-303-api-docs |
| test/ | Test additions | test/PROJ-404-coverage |
| chore/ | Maintenance tasks | chore/PROJ-505-deps-upgrade |
DO:
feature/user-authfix/login-redirectadd-user-auth, remove-deprecated-apiDON'T:
feature/alex-user-authfeature/workfeature/2024-04-17-auth (hard to understand later)# GOOD Examples
feature/PROJ-123-user-registration
fix/PROJ-456-null-pointer-exception
hotfix/PROJ-789-security-vulnerability
refactor/PROJ-101-payment-processing
docs/PROJ-202-api-documentation
# BAD Examples
alex-feature (personal branches)
feature-new (what does this do?)
branch1 (meaningless)
fix-bug (which one?)
2024-04-17 (just a date)
1. CREATE feature/PROJ-123-auth
│
2. DEVELOP commits on branch
│
3. CODE REVIEW │ PR created
│
4. INTEGRATE │ Merged to main
│
5. CLEANUP feature/PROJ-123-auth ──► DELETE
Delete WHEN:
Keep WHEN:
# After merge, clean up local and remote
git checkout main
git pull origin main
git branch -d feature/PROJ-123-auth # Local
git push origin --delete feature/PROJ-123-auth # Remote
# Find stale branches (>2 weeks inactive)
git fetch --prune
git branch -vv | grep ": gone]"
Best for: Small teams, continuous deployment
main ───────────────────────────────►
│
└── feature/PROJ-123 ───────────► (PR & merge)
│
└── feature/PROJ-456 ─────► (PR & merge)
Rules:
Best for: Release cycles, multiple versions
main ────► ────► ────► ────► ────►
│ │ │ │
▼ ▼ ▼ ▼
release release │ hotfix
│ │ │ │
develop ──┴──► ────► │ ────► │
│ │ │
▼ ▼ ▼
feature feature hotfix
Rules:
Best for: CI/CD heavy teams, continuous integration
main ────────►───────►───────►
│ │ │ │
▼ ▼ ▼ ▼
(short-lived feature branches, <1 day)
Rules:
Analysis:
- Fix estimate: 30 minutes
- Solo work
- Low risk (single file)
Recommendation: Direct commit to main with clear message:
fix/PROJ-123-remove-debug-log
Analysis:
- Working on feature/PROJ-123
- Need to start feature/PROJ-456 (related)
Options:
A) Branch from feature/PROJ-123
Pros: Can share work if needed
Cons: Dependency, harder to merge
B) Branch from main
Pros: Independent, cleaner
Cons: Can't share partial work
Recommendation: Branch from main (cleaner)
If truly related, coordinate in single branch
# Step 1: List all branches
git branch -a
# Step 2: Find merged branches (gone remote)
git fetch --prune
git branch -vv | grep ": gone]"
# Step 3: Clean up
git branch -d <merged-branch>
git push origin --delete <merged-branch>
BRANCH DECISION CHECKLIST
=========================
□ How long will this work take?
└─ < 1 day: Consider direct commit
└─ > 1 day: Branch recommended
□ Is this work risky?
└─ Yes: Branch (can discard safely)
└─ No: Consider direct commit
□ Will others be affected?
└─ Yes: Branch (test before affecting team)
└─ No: Consider direct commit
□ Is there a naming convention?
└─ Follow team convention
└─ Use type prefix + ticket ID + description
□ What's the branch lifecycle?
└─ Create → Develop → Review → Merge → Delete
RECOMMENDATION: [Create branch / Direct commit]
If your work affects shared code, branch. If it doesn't, consider committing directly.
Your branch name helps teammates understand what you're working on. Make it scannable.
The longer a branch lives, the harder it is to merge. Aim for <1 week.
Old branches create clutter and confusion. Clean up immediately.
Feature branches usually come from main (or develop in GitFlow). Don't unnecessarily nest.
git-commit — Branch strategy affects commit organizationgit-rebase-safety — Rebase often needed to keep branches currentpre-commit-review — Review process applies to all branchessafe-refactor — Refactoring often involves branch managementdevelopment
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.
devops
Create a new implementation plan file for new features, refactoring existing code or upgrading packages, design, architecture or infrastructure.
tools
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
documentation
Generates standardized porting documentation from completed feature changes. Analyzes commit diffs or file contents, extracts change intent, and outputs Markdown documentation for cross-team understanding. Should be used when the user needs to document a change for cross-team or cross-project consumption. Distinguished from cross-branch-fix-porter which actively re-implements fixes, this skill documents changes.