microsoft/windowsappsdk/worktree-manager
Claude Code and agent skill by microsoft/windowsappsdk
- vendor
Checking that the SKILL.md file is still in the repository.
Create and manage Git worktrees for parallel development workflows. Use when multiple self-contained issues should NOT be fixed in a single branch, when human-Copilot iteration requires isolated environments with separate chat history and commits, or when parallel work items need independent build/test results. Triggers on requests involving branch isolation, work item separation, parallel development, or avoiding messy branch switching.
Install
npx vskill@latest install microsoft/windowsappsdk/worktree-managerSKILL.md
The same SKILL.md was published earlier as microsoft/windowsappsdk/worktree-manager.
Git Worktree Manager
This skill provides helper scripts and workflows for creating and managing Git worktrees, enabling parallel development across multiple branches without cloning the repository multiple times.
When to Use This Skill
Primary triggers — Create a new worktree when:
- Multiple self-contained issues exist — Different problems should NOT be fixed together in a single branch. Each issue deserves its own branch with isolated commits, separate PR, and independent review.
- Human-Copilot iteration is needed — Step-by-step collaboration requires an isolated environment where:
- Each worktree has its own Copilot chat history and context
- Plan and TODO progress stays scoped to that specific issue
- Commits are atomic and traceable to one problem
- Parallel work avoids branch-switching chaos — Instead of constantly switching branches (which mixes up build artifacts, test results, and Copilot context), worktrees let you:
- Keep each VS Code window focused on one task
- Run builds/tests independently without cross-contamination
- Resume work instantly without stashing or context loss
Anti-patterns — Do NOT use worktrees when:
- A quick one-liner fix can be committed directly
- Changes are tightly coupled and belong in the same PR
- You're just reading code (no commits planned)
Prerequisites
- Git installed and configured
- PowerShell 5.1+ (Windows) or PowerShell Core (cross-platform)
- VS Code installed (for automatic workspace opening)
- Repository must be a Git repository (not inside a worktree already)
Available Scripts
This skill provides focused scripts for each worktree operation.
New-WorktreeFromBranch.ps1
Create or reuse a worktree for an existing local or remote branch.
Location: ./scripts/New-WorktreeFromBranch.ps1
| Parameter | Required | Default | Description | |
|---|---|---|---|---|
-Branch | Yes | - | Branch name (local or origin/<name> form) | |
-NoFetch | No | $false | Skip remote fetch if branch missing locally |
Examples:
New-WorktreeFromIssue.ps1
Start a new work item branch with consistent naming and create a worktree for it.
Location: ./scripts/New-WorktreeFromIssue.ps1
| Parameter | Required | Default | Description | |
|---|---|---|---|---|
-Number | Yes | - | Azure DevOps work item number for branch naming | |
-Title | No | - | Descriptive title (slugified into branch name) | |
-Base | No | origin/main | Base ref to branch from |
Examples:
Delete-Worktree.ps1
Remove a worktree and optionally its associated branch.
Location: ./scripts/Delete-Worktree.ps1
| Parameter | Required | Default | Description | |
|---|---|---|---|---|
-Pattern | Yes | - | Partial branch name or path to match | |
-Force | No | $false | Force removal even with uncommitted changes | |
-KeepBranch | No | $false | Don't delete the local branch |
Examples:
List Worktrees
Use Git directly to list worktrees:
Step-by-Step Workflows
Workflow 1: Work on an Azure DevOps Work Item
- Note the work item number and title
- Create work item branch and worktree:
``powershell ./scripts/New-WorktreeFromIssue.ps1 -Number 1234 -Title "Fix null reference" ``
- Build, test, and develop as normal
- Commit, push, and open PR
- Delete worktree when PR is merged:
``powershell ./scripts/Delete-Worktree.ps1 -Pattern workitem/1234 ``
Workflow 2: Parallel Feature Development
- Create worktrees for each feature:
``powershell ./scripts/New-WorktreeFromBranch.ps1 -Branch feature/login ./scripts/New-WorktreeFromBranch.ps1 -Branch feature/dashboard ``
- Work on each independently (different VS Code windows)
- Keep ≤ 3 active worktrees to manage cognitive load
Worktree Naming & Locations
| Source | Local Branch Name | Worktree Folder | |
|---|---|---|---|
| Local/remote branch | Same as branch | <RepoName>-<hash>/ | |
| Work item | workitem/<number>-<slug> | <RepoName>-<hash>/ |
Worktrees are created as sibling folders to the repository root (e.g., MyRepo/ and MyRepo-ab12/).
Best Practices
- Keep ≤ 3 active worktrees per developer to reduce cognitive load
- Delete stale worktrees early — each adds file watchers and build churn
- Avoid editing the same file across multiple worktrees simultaneously
- Run `git fetch --all --prune` periodically in the primary repo, not every worktree
- Use targeted builds inside worktrees instead of full builds
Troubleshooting
| Symptom | Solution | |
|---|---|---|
| Cannot lock ref (*.lock error) | Run git worktree prune or delete stale .lock file manually | |
| Worktree already exists | Use git worktree list to find existing path; reuse that folder | |
| Local branch missing for remote | Run git branch --track <name> origin/<name> then retry | |
| Submodules not initialized | Run git submodule update --init --recursive in the worktree |
Common Commands Reference
Security Notes
- Scripts do not store credentials — they rely on your existing Git credential helper
- No destructive operations without explicit
-Forceflag
Script Locations
All implementation is self-contained within this skill folder:
Scripts (master source):
- New-WorktreeFromBranch.ps1 — create worktree from branch
- New-WorktreeFromIssue.ps1 — create worktree for work item
- Delete-Worktree.ps1 — remove worktree and branch
- WorktreeLib.ps1 — shared helper functions
Human-friendly wrappers (in tools/git/):
tools/git/New-WorktreeFromBranch.cmd— delegates to skill's master scripttools/git/New-WorktreeFromIssue.cmd— delegates to skill's master scripttools/git/Delete-Worktree.cmd— delegates to skill's master scripttools/git/Worktree-Guidelines.md— quick reference for developers
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 1 Oct 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/worktree-manager/SKILL.md
Popularity
- Repository stars
- 4,696
- Repository forks
- 478
- 7-day trend score
- 42
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 8 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/microsoft/windowsappsdk/worktree-manager)