Agent Skill
2/7/2026git-worktree
Internal skill for workspace isolation. Detects current git state and offers worktree/branch options. Called by iterative:implementing, not user-invocable.
T
tmchow
18GitHub Stars
1Views
npx skills add tmchow/tmc-marketplace
SKILL.md
| Name | git-worktree |
| Description | Internal skill for workspace isolation. Detects current git state and offers worktree/branch options. Called by iterative:implementing, not user-invocable. |
name: git-worktree description: Internal skill for workspace isolation. Detects current git state and offers worktree/branch options. Called by iterative:implementing, not user-invocable. user-invocable: false
Git Worktree (Workspace Isolation)
Ensures agent has an isolated workspace to avoid conflicts with human work.
When Called
- At the start of
iterative:implementingskill - At the start of feature work requiring isolation from the current branch
- When workspace isolation is needed
- Not directly invocable by users
Workflow
- Sync with remote. Pull latest from default branch.
- Detect current state. Check if in worktree (
git rev-parse --git-dircontains/worktrees/), get current branch (git branch --show-current), get default branch (git remote show origin | grep "HEAD branch"). - Choose workspace based on current state:
- Already in worktree: confirm it's for this feature, then proceed
- On default branch: ask the user — A) Create worktree (recommended), B) Create branch, C) Continue on main (requires explicit consent)
- On feature branch: ask the user — A) Continue on this branch, B) Create new worktree
- Execute choice. If worktree:
git worktree add ../[repo]-[branch] -b [branch]. If new branch:git checkout -b [branch-name]. If continue: proceed. - Verify. Report: "Ready on branch [name] in [directory]"
Worktree Creation
When creating a worktree:
- Generate branch name from feature/task context
- Create worktree:
git worktree add ../[repo]-[branch] -b [branch] - Copy necessary files (.env, etc.) if they exist
- Verify worktree is functional
Output
Returns to calling skill:
- Branch name
- Directory path (if worktree created)
- Isolation status confirmed
Skills Info
Original Name:git-worktreeAuthor:tmchow
Download