Using Git Worktrees
When This Skill Activates
- •After a spec is approved and before implementation begins
- •When starting any new feature or significant change
- •When the
/worktreecommand is invoked
Process
Option A: Git Worktree (Preferred for Larger Features)
- •
Create the worktree:
bashgit worktree add ../[feature-name] -b feature/[feature-name]
- •
Navigate to the worktree and install dependencies:
bashcd ../[feature-name] npm install # or equivalent
- •
Verify clean baseline:
bash# Run the full test suite npm test # or equivalent
All tests MUST pass before proceeding. If they don't, fix the baseline first.
- •
Set up the worktree as the working directory for all subsequent tasks.
Option B: Git Branch (For Smaller Features)
- •
Ensure clean working tree:
bashgit status # must be clean
- •
Create and switch to feature branch:
bashgit checkout -b feature/[feature-name]
- •
Verify clean baseline — same as above.
Branch Naming Convention
- •Features:
feature/[descriptive-name] - •Bugfixes:
fix/[issue-description] - •Refactors:
refactor/[what-is-changing]
After Feature Completion
- •Run full verification (see
verification-before-completionskill) - •Ensure all commits are clean and descriptive
- •If using worktree, report to user that work is ready for merge
- •Clean up worktree after merge:
bash
git worktree remove ../[feature-name]
Output
An isolated workspace with a verified clean baseline, ready for implementation.