| name | worktree |
| description | Create git worktrees for parallel feature development. Use when working on multiple features simultaneously. |
| argument-hint | ["branch-name"] |
Worktree Management Skill
Instructions
When the user invokes this skill:
-
Fetch latest changes
git fetch origin
-
Ensure .gitignore is configured
- Check if
.worktrees/ is in .gitignore
- If not, append
.worktrees/ to .gitignore
-
Determine branch type - Check if the branch already exists:
git branch -a | grep -E "(^|\s)feat/<name>$|origin/feat/<name>"
-
Determine base branch (only needed for new branches):
git branch -r | grep -E "origin/(develop|master)$"
- Use
origin/develop if it exists
- Fall back to
origin/master if develop doesn't exist
-
Create the worktree
If branch does NOT exist → create new branch from base branch:
git worktree add .worktrees/<name> -b feat/<name> origin/develop
git worktree add .worktrees/<name> -b feat/<name> origin/master
If branch EXISTS → use existing branch:
git worktree add .worktrees/<name> feat/<name>
-
Report the result
- Show
git worktree list
- Provide the worktree path:
.worktrees/<name>
Examples
User: /worktree auth-refactor
→ Branch feat/auth-refactor doesn't exist
→ origin/develop exists
→ Creates .worktrees/auth-refactor on NEW branch feat/auth-refactor (from origin/develop)
User: /worktree new-feature
→ Branch feat/new-feature doesn't exist
→ origin/develop doesn't exist, using origin/master
→ Creates .worktrees/new-feature on NEW branch feat/new-feature (from origin/master)
User: /worktree metaknow_url_header
→ Branch feat/metaknow_url_header already exists
→ Creates .worktrees/metaknow_url_header using EXISTING branch
Cleanup
git worktree remove .worktrees/<name>
git worktree list