Official agent skill

Git Worktree Manager

by microsoft in microsoft/WindowsAppSDK

Creates and manages Git worktrees with PowerShell scripts so separate issues and Copilot sessions each get an isolated branch, build and test environment.

OfficialMITAuto-check passedDevelopment

Install Git Worktree Manager

skills CLI
$ npx skills add microsoft/WindowsAppSDK --skill worktree-manager -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install microsoft/WindowsAppSDK worktree-manager --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/microsoft/WindowsAppSDK.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/worktree-manager .claude/skills/worktree-manager && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
worktree-manager
GitHub stars
4.7k
Token cost
~2k tokens
SKILL.md length
669 words
Files
5 (incl. scripts)
Skills in repo
3
Repo updated
First seen
Licence
MIT

At a glance

Creates and manages Git worktrees with PowerShell scripts so separate issues and Copilot sessions each get an isolated branch, build and test environment.

  • Works in 3 steps: Multiple self-contained issues exist —… → Human-Copilot iteration is needed —… → Parallel work avoids branch-switching…
  • Fixing several unrelated issues in separate branches at the same time
  • SKILL.md covers When to Use This Skill, Prerequisites, Available Scripts and Step-by-Step Workflows, plus 6 more sections
  • Runs PowerShell scripts from its folder; calls git

What it does

The skill is for parallel development without constant branch switching. It recommends a new worktree when several self-contained issues should not share a branch, when step-by-step work with Copilot needs its own chat history, plan and atomic commits, or when parallel items need independent build and test results. Quick one-line fixes, tightly coupled changes and read-only code browsing are listed as cases to skip.

Helper scripts cover each operation: one creates or reuses a worktree for an existing local or remote branch, with an option to skip the fetch, another starts a new work-item branch with consistent naming from an issue, and another deletes a worktree, all sharing a common library script. Prerequisites are Git, PowerShell 5.1 or PowerShell Core, VS Code for opening the workspace automatically, and a repository that is not already inside a worktree.

When your agent uses it

  • Fixing several unrelated issues in separate branches at the same time
  • Giving a Copilot session its own isolated worktree and chat history
  • Running builds and tests for parallel work items independently
  • Opening an existing branch in its own worktree

Example prompts

  • “Create a worktree for the feature/login branch so I can keep working on main.”
  • “Start a new worktree for issue work on the null reference crash.”
  • “Remove the worktree for the finished branch.”

Requirements

  • Git
  • PowerShell 5.1 or PowerShell Core
  • VS Code, for opening the worktree automatically

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Multiple self-contained issues exist — Different problems should NOT be fixed together in a single branch. Each issue deserves its own…
  2. Human-Copilot iteration is needed — Step-by-step collaboration requires an isolated environment where
  3. Parallel work avoids branch-switching chaos — Instead of constantly switching branches (which mixes up build artifacts, test results, and…

What it can do on your machine

Read from SKILL.md and the folder at commit 0ff7257. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 4 files in scripts/ (PowerShell), which the agent can run.

    Shell commands in SKILL.md call:

    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Git Worktree Manager loads about 2k tokens when it runs. Until then it costs about 115 tokens; SKILL.md has 669 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~115
When it runs · the whole SKILL.md, loaded when a task matches
~2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from microsoft/WindowsAppSDK at commit 0ff7257, republished under its MIT licence (© microsoft). 669 words, ~2,048 tokens.

Download SKILL.mdSave it as .claude/skills/worktree-manager/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
worktree-manager
description
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.

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:

  1. 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.

  2. 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
  3. 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

powershell
./scripts/New-WorktreeFromBranch.ps1 -Branch <branch-name> [-NoFetch]
ParameterRequiredDefaultDescription
-BranchYes-Branch name (local or origin/<name> form)
-NoFetchNo$falseSkip remote fetch if branch missing locally

Examples:

powershell
# From a local or remote branch
./scripts/New-WorktreeFromBranch.ps1 -Branch feature/login

# From origin remote (normalizes automatically)
./scripts/New-WorktreeFromBranch.ps1 -Branch origin/bugfix/nullref

New-WorktreeFromIssue.ps1

Start a new work item branch with consistent naming and create a worktree for it.

Location: ./scripts/New-WorktreeFromIssue.ps1

powershell
./scripts/New-WorktreeFromIssue.ps1 -Number <workitem-number> [-Title <description>] [-Base <ref>]
ParameterRequiredDefaultDescription
-NumberYes-Azure DevOps work item number for branch naming
-TitleNo-Descriptive title (slugified into branch name)
-BaseNoorigin/mainBase ref to branch from

Examples:

powershell
# Work item branch with title
./scripts/New-WorktreeFromIssue.ps1 -Number 1234 -Title "Crash on launch"
# Creates: workitem/1234-crash-on-launch

# Work item branch from different base
./scripts/New-WorktreeFromIssue.ps1 -Number 42 -Base origin/develop

# Simple work item branch (no title slug)
./scripts/New-WorktreeFromIssue.ps1 -Number 999
# Creates: workitem/999

Delete-Worktree.ps1

Remove a worktree and optionally its associated branch.

Location: ./scripts/Delete-Worktree.ps1

powershell
./scripts/Delete-Worktree.ps1 -Pattern <pattern> [-Force] [-KeepBranch]
ParameterRequiredDefaultDescription
-PatternYes-Partial branch name or path to match
-ForceNo$falseForce removal even with uncommitted changes
-KeepBranchNo$falseDon't delete the local branch

Examples:

powershell
# Delete worktree by branch pattern
./scripts/Delete-Worktree.ps1 -Pattern feature/perf-tweak

# Force delete with uncommitted changes
./scripts/Delete-Worktree.ps1 -Pattern workitem/1234 -Force

# Delete worktree but keep the branch
./scripts/Delete-Worktree.ps1 -Pattern feature/ui -KeepBranch

List Worktrees

Use Git directly to list worktrees:

powershell
git worktree list --porcelain

Step-by-Step Workflows

Workflow 1: Work on an Azure DevOps Work Item
  1. Note the work item number and title
  2. Create work item branch and worktree:
    powershell
    ./scripts/New-WorktreeFromIssue.ps1 -Number 1234 -Title "Fix null reference"
  3. Build, test, and develop as normal
  4. Commit, push, and open PR
  5. Delete worktree when PR is merged:
    powershell
    ./scripts/Delete-Worktree.ps1 -Pattern workitem/1234
Show full SKILL.md (265 more words)Show less
Workflow 2: Parallel Feature Development
  1. Create worktrees for each feature:
    powershell
    ./scripts/New-WorktreeFromBranch.ps1 -Branch feature/login
    ./scripts/New-WorktreeFromBranch.ps1 -Branch feature/dashboard
  2. Work on each independently (different VS Code windows)
  3. Keep ≤ 3 active worktrees to manage cognitive load

Worktree Naming & Locations

SourceLocal Branch NameWorktree Folder
Local/remote branchSame as branch<RepoName>-<hash>/
Work itemworkitem/<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

SymptomSolution
Cannot lock ref (*.lock error)Run git worktree prune or delete stale .lock file manually
Worktree already existsUse git worktree list to find existing path; reuse that folder
Local branch missing for remoteRun git branch --track <name> origin/<name> then retry
Submodules not initializedRun git submodule update --init --recursive in the worktree

Common Commands Reference

powershell
# List all worktrees
git worktree list --porcelain

# List local branches with tracking info
git branch -vv

# List remotes
git remote -v

# Prune stale worktree references
git worktree prune

# Force remove a worktree with uncommitted changes
git worktree remove --force <path>

Security Notes

  • Scripts do not store credentials — they rely on your existing Git credential helper
  • No destructive operations without explicit -Force flag

Script Locations

All implementation is self-contained within this skill folder:

Scripts (master source):

Human-friendly wrappers (in tools/git/):

  • tools/git/New-WorktreeFromBranch.cmd — delegates to skill's master script
  • tools/git/New-WorktreeFromIssue.cmd — delegates to skill's master script
  • tools/git/Delete-Worktree.cmd — delegates to skill's master script
  • tools/git/Worktree-Guidelines.md — quick reference for developers

© microsoft, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (scripts) in .github/skills/worktree-manager of microsoft/WindowsAppSDK.

  • SKILL.md
  • scripts/Delete-Worktree.ps1
  • scripts/New-WorktreeFromBranch.ps1
  • scripts/New-WorktreeFromIssue.ps1
  • scripts/WorktreeLib.ps1

Open the folder on GitHubat commit 0ff7257

Compare with similar skills

Git Worktree Manager next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Git Worktree Manager compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Git Worktree Manager this skillmicrosoft/WindowsAppSDK4.7k—~2kAutomated safety check: PassMIT
Finishing a Development Branchobra/superpowers296k5 repos~1.9kAutomated safety check: PassMIT
Git Worktree Cleanuplobehub/lobehub83k—~2.8kAutomated safety check: PassCustom licence
Ccmanager Configkbwo/ccmanager1.3k—~1.5kAutomated safety check: PassMIT
Roo Conflict Resolutionzgsm-ai/costrict4.4k—~2.3kAutomated safety check: PassApache-2.0
Git Worktree IsolationjnMetaCode/superpowers-zh8.3k1 repos~982Automated safety check: PassMIT

Similar skills

  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    296k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Git Worktree Cleanup

    lobehub/lobehub

    Audits stale Git worktrees and branches with a bundled script, classifies each one, and deletes only after you approve the exact candidates.

    83k GitHub stars~2.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Ccmanager Config

    kbwo/ccmanager

    Set up, review, or repair a CCManager config — .ccmanager.json at a git repository root, or the global ~/.config/ccmanager/config.json.

    1.3k GitHub stars~1.5k tokensUpdated 10 days ago
    DevelopmentAuto-check passed
  • Roo Conflict Resolution

    zgsm-ai/costrict

    Provides comprehensive guidelines for resolving merge conflicts intelligently using git history and commit context.

    4.4k GitHub stars~2.3k tokensUpdated 7 days ago
    DevelopmentAuto-check passed
  • Git Worktree Isolation

    jnMetaCode/superpowers-zh

    Sets up an isolated workspace before feature work or plan execution, preferring native worktree tools and falling back to git worktree, with instructions in Chinese.

    8.3k GitHub starsUsed in 1 repo~982 tokens
    DevelopmentAuto-check passed
  • Git Commit

    tisfeng/Easydict

    起草、创建或汇报 Angular-style 本地 Git 提交。用于明确的提交交付;分支集成使用 worktree-rebase-merge,不 push。

    15k GitHub stars~535 tokensUpdated yesterday
    DevelopmentAuto-check passed

More from microsoft/WindowsAppSDK

  • Official

    Generates GitHub Feature Area Status reports for the Windows App SDK repository, scoring issues so teams can see what needs attention in each area.

    4.7k GitHub stars~3.4k tokensUpdated today
    Auto-check passed
  • WinAppSDK Triage Meeting Prep

    microsoft/WindowsAppSDK

    Official

    Prepares the triage meeting summary for WinAppSDK Needs-Triage issues, with research-backed area suggestions, draft replies and a diff since the last triage.

    4.7k GitHub stars~2.8k tokensUpdated today
    Auto-check passed

Categories

Questions about Git Worktree Manager

What does Git Worktree Manager do?

Creates and manages Git worktrees with PowerShell scripts so separate issues and Copilot sessions each get an isolated branch, build and test environment. The skill is for parallel development without constant branch switching. It recommends a new worktree when several self-contained issues should not share a branch, when step-by-step work with Copilot needs its own chat history, plan and atomic commits, or when parallel items need independent build and test results.

When should I use Git Worktree Manager?

Git Worktree Manager fits situations like: fixing several unrelated issues in separate branches at the same time; giving a Copilot session its own isolated worktree and chat history; running builds and tests for parallel work items independently; opening an existing branch in its own worktree.

How do I install Git Worktree Manager in Claude Code?

Run `npx skills add microsoft/WindowsAppSDK --skill worktree-manager -a claude-code`. Or copy the skill folder (.github/skills/worktree-manager in microsoft/WindowsAppSDK) into .claude/skills/worktree-manager in your project. Claude Code loads it when a task matches its description.

How do I install Git Worktree Manager in Codex?

Run `npx skills add microsoft/WindowsAppSDK --skill worktree-manager -a codex`. Or copy the skill folder (.github/skills/worktree-manager in microsoft/WindowsAppSDK) into .agents/skills/worktree-manager in your project. Codex loads it when a task matches its description.

Can I use Git Worktree Manager in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add microsoft/WindowsAppSDK --skill worktree-manager -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/worktree-manager, .gemini/skills/worktree-manager, .github/skills/worktree-manager and .opencode/skills/worktree-manager in your project.

What does Git Worktree Manager need to run?

Going by SKILL.md and its folder, Git Worktree Manager needs PowerShell for the scripts in its folder and the command-line tools its instructions call (git). Our summary lists: Git; PowerShell 5.1 or PowerShell Core; VS Code, for opening the worktree automatically.

Does Git Worktree Manager access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Git Worktree Manager safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Git Worktree Manager use?

Git Worktree Manager is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Git Worktree Manager use?

About 2k tokens (SKILL.md is roughly 8.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Git Worktree Manager?

Skills that share tags, products or a category with Git Worktree Manager: Finishing a Development Branch (obra/superpowers, 296k stars), Git Worktree Cleanup (lobehub/lobehub, 83k stars), Ccmanager Config (kbwo/ccmanager, 1.3k stars) and Roo Conflict Resolution (zgsm-ai/costrict, 4.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Git Worktree Manager?

microsoft (a GitHub organization, an official publisher) maintains it in microsoft/WindowsAppSDK, which has 4,697 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on October 6, 2026.

Source: microsoft/WindowsAppSDK on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.