Agent skill

Git Worktrees

by heyitsnoah in heyitsnoah/claudesidian

Work with git worktrees for isolated parallel development. An agent skill from heyitsnoah/claudesidian.

MITAuto-check: notesDevelopment

Install Git Worktrees

skills CLI
$ npx skills add heyitsnoah/claudesidian --skill git-worktrees -a claude-code

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

GitHub CLI
$ gh skill install heyitsnoah/claudesidian git-worktrees --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/heyitsnoah/claudesidian.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/git-worktrees .claude/skills/git-worktrees && 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
git-worktrees
GitHub stars
2.6k
Token cost
~1.1k tokens
SKILL.md length
241 words
Files
1
Skills in repo
17
Repo updated
First seen
Licence
MIT

At a glance

Work with git worktrees for isolated parallel development. An agent skill from heyitsnoah/claudesidian.

  • Starting feature work in isolation
  • SKILL.md covers Overview, When to Use Worktrees, Quick Reference and Creating Worktrees, plus 6 more sections
  • Calls git, npm and gh
  • Need separate workspace without branch switching

What it does

Git Worktrees is an agent skill from heyitsnoah/claudesidian. Work with git worktrees for isolated parallel development. Use when starting feature work in isolation, when need separate workspace without branch switching, or when cleaning up worktrees after PR merge.

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Git worktrees. It works with Git. The licence is MIT.

When your agent uses it

  • Starting feature work in isolation
  • Need separate workspace without branch switching
  • Cleaning up worktrees after PR merge

Example prompts

  • “/git-worktrees”

Requirements

  • Node.js

What it can do on your machine

Read from SKILL.md and the folder at commit 6c56f35. 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

    Shell commands in SKILL.md call:

    • git
    • npm
    • gh

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

  • Network

    No URLs in SKILL.md. Its commands use git, npm and gh, 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 Worktrees loads about 1.1k tokens when it runs. Until then it costs about 55 tokens; SKILL.md has 241 words of instructions outside code blocks.

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

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: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:76
    cp ../.env .env.local

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); files beside SKILL.md are not scanned.

SKILL.md

The full file from heyitsnoah/claudesidian at commit 6c56f35, republished under its MIT licence (© heyitsnoah). 241 words, ~1,101 tokens.

Download SKILL.mdSave it as .claude/skills/git-worktrees/SKILL.md (or your agent's skills folder).
name
git-worktrees
description
Work with git worktrees for isolated parallel development. Use when starting feature work in isolation, when need separate workspace without branch switching, or when cleaning up worktrees after PR merge.

Git Worktrees

Overview

Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching. Each worktree is a separate directory with its own working tree, but they share the same .git history.

When to Use Worktrees

  • Parallel development: Work on feature A while feature B builds/tests
  • Code review: Check out PR branch without disrupting current work
  • Experiments: Try something risky without affecting main workspace
  • Long-running tasks: Keep main branch available while feature develops

Quick Reference

ActionCommand
List worktreesgit worktree list
Create worktreegit worktree add <path> -b <branch>
Create from existing branchgit worktree add <path> <branch>
Remove worktreegit worktree remove <path>
Prune stale worktreesgit worktree prune

Creating Worktrees

New Feature Branch
bash
# Create worktree with new branch
git worktree add .worktrees/my-feature -b feat/my-feature

# Or specify base branch
git worktree add .worktrees/my-feature -b feat/my-feature main
From Existing Branch
bash
# Check out existing remote branch
git worktree add .worktrees/pr-review origin/fix-bug

# Check out existing local branch
git worktree add .worktrees/hotfix hotfix/urgent-fix

Directory Structure

project/
├── .git/                    # Shared git history
├── .worktrees/              # Convention: keep worktrees here
│   ├── feature-a/           # First worktree
│   └── feature-b/           # Second worktree
└── src/                     # Main worktree files

Setup After Creating Worktree

After creating a worktree, you typically need to:

bash
cd .worktrees/my-feature

# Install dependencies
npm install  # or pnpm install, yarn, etc.

# Copy any required env files
cp ../.env .env.local

# Verify setup
npm test

Safety Rules

NEVER remove a worktree with uncommitted changes without confirmation.

bash
# Check for uncommitted changes first
git -C .worktrees/my-feature status --porcelain

# If empty, safe to remove
git worktree remove .worktrees/my-feature

# Delete the branch after merge (-d is safe, fails if not merged)
git branch -d feat/my-feature
Removal Decision Matrix
PR Merged?Uncommitted Changes?Action
YesNoSafe to remove
YesYesAsk user - changes will be lost
NoNoDo NOT remove - work not preserved
NoYesDo NOT remove - active work

Cleaning Up Worktrees

Manual Cleanup
bash
# 1. Check if work is merged (if using GitHub)
gh pr list --head feat/my-feature --state merged

# 2. Check for uncommitted changes
git -C .worktrees/my-feature status --porcelain

# 3. Remove worktree (only if merged or confirmed with user)
git worktree remove .worktrees/my-feature

# 4. Delete branch
git branch -d feat/my-feature
Prune Stale Worktrees

If a worktree directory was deleted manually:

bash
git worktree prune

Common Patterns

Review a PR
bash
# Create worktree from PR branch
git fetch origin pull/123/head:pr-123
git worktree add .worktrees/pr-123 pr-123

# Review, test, then clean up
git worktree remove .worktrees/pr-123
git branch -D pr-123
Parallel Feature Development
bash
# Main work continues in project root
# Start new feature in worktree
git worktree add .worktrees/new-api -b feat/new-api

# Work on both simultaneously
code .worktrees/new-api  # Opens new VS Code window

Troubleshooting

"Branch already checked out"

A branch can only be checked out in one worktree at a time:

bash
# Find where branch is checked out
git worktree list

# Remove that worktree first, or use different branch
"Worktree directory not empty"
bash
# Force add if directory exists but isn't a worktree
git worktree add --force <path> <branch>
Locked Worktree

If a worktree is locked (prevents accidental removal):

bash
# Unlock it
git worktree unlock <path>

# Then remove
git worktree remove <path>

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

Files

Just SKILL.md in .agents/skills/git-worktrees of heyitsnoah/claudesidian.

Open the folder on GitHubat commit 6c56f35

Compare with similar skills

Git Worktrees 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 Worktrees compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Git Worktrees this skillheyitsnoah/claudesidian2.6k—~1.1kAutomated safety check: NotesMIT
Git Worktree IsolationjnMetaCode/superpowers-zh8.3k1 repos~982Automated safety check: PassMIT
WorktreeAgentsMesh/AgentsMesh2.4k—~553Automated safety check: NotesCustom licence
Cursor Composer Task DelegateChachamaru127/claude-code-harness3.2k—~4.4kAutomated safety check: NotesMIT
Git Worktree Setupk8zdev/k8z155—~930Automated safety check: PassNone
New Featuremichaelshimeles/skills1.3k1 repos~699Automated safety check: PassNone

Similar skills

  • 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
  • Worktree

    AgentsMesh/AgentsMesh

    Creates or reuses an isolated AgentsMesh Git worktree from a verified base branch, preserves existing changes, and optionally starts the worktree-scoped development environment.

    2.4k GitHub stars~553 tokensUpdated 14 days ago
    DevelopmentAuto-check: notes
  • Cursor Composer Task Delegate

    Chachamaru127/claude-code-harness

    Hands one implementation task to Cursor Composer in an isolated git worktree, then reviews its diff and cherry-picks the result into the main branch.

    3.2k GitHub stars~4.4k tokensUpdated 2 days ago
    DevelopmentAuto-check: notes
  • Automate git worktree creation and copy private files (not tracked in git) to new workdirs.

    155 GitHub stars~930 tokensUpdated 3 mo ago
    DevelopmentAuto-check passed
  • New Feature

    michaelshimeles/skills

    Start a new task in an isolated Git worktree branched from origin/main so multiple agents can work on the same repo in parallel without conflicts.

    1.3k GitHub starsUsed in 1 repo~699 tokens
    DevelopmentAuto-check passed
  • Use Mori CLI to enable agent-to-agent communication and coordination across Mori-managed panes.

    303 GitHub stars~1.7k tokensUpdated 2 mo ago
    DevelopmentAuto-check passed

More from heyitsnoah/claudesidian

All 17 skills in this repo
  • JSON Canvas

    heyitsnoah/claudesidian

    Create and edit JSON Canvas files (.canvas) with nodes, edges, groups, and connections.

    2.6k GitHub starsUsed in 18 repos~3.5k tokens
    Auto-check passed
  • Add Frontmatter

    heyitsnoah/claudesidian

    Add or update YAML frontmatter properties to enhance Obsidian note organization.

    2.6k GitHub stars~951 tokensUpdated 5 mo ago
    Auto-check passed
  • De AI Ify

    heyitsnoah/claudesidian

    Remove AI-generated jargon and restore human voice to text. An agent skill from heyitsnoah/claudesidian.

    2.6k GitHub stars~526 tokensUpdated 5 mo ago
    Auto-check passed
  • Download Attachment

    heyitsnoah/claudesidian

    Download files from URLs to the Obsidian attachments folder and organize them with descriptive names.

    2.6k GitHub stars~836 tokensUpdated 5 mo ago
    Auto-check passed
  • Install Claudesidian Command

    heyitsnoah/claudesidian

    Install claudesidian shell command to launch Claude Code from anywhere.

    2.6k GitHub stars~2.7k tokensUpdated 5 mo ago
    Auto-check passed
  • Pragmatic Review

    heyitsnoah/claudesidian

    Interactive pragmatic code review focusing on YAGNI and KISS principles.

    2.6k GitHub stars~2.6k tokensUpdated 5 mo ago
    Auto-check passed

Works with

Questions about Git Worktrees

What does Git Worktrees do?

Work with git worktrees for isolated parallel development. An agent skill from heyitsnoah/claudesidian. Git Worktrees is an agent skill from heyitsnoah/claudesidian. Work with git worktrees for isolated parallel development.

When should I use Git Worktrees?

Git Worktrees fits situations like: starting feature work in isolation; need separate workspace without branch switching; cleaning up worktrees after PR merge.

How do I install Git Worktrees in Claude Code?

Run `npx skills add heyitsnoah/claudesidian --skill git-worktrees -a claude-code`. Or copy the skill folder (.agents/skills/git-worktrees in heyitsnoah/claudesidian) into .claude/skills/git-worktrees in your project. Claude Code loads it when a task matches its description.

How do I install Git Worktrees in Codex?

Run `npx skills add heyitsnoah/claudesidian --skill git-worktrees -a codex`. Or copy the skill folder (.agents/skills/git-worktrees in heyitsnoah/claudesidian) into .agents/skills/git-worktrees in your project. Codex loads it when a task matches its description.

Can I use Git Worktrees 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 heyitsnoah/claudesidian --skill git-worktrees -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/git-worktrees, .gemini/skills/git-worktrees, .github/skills/git-worktrees and .opencode/skills/git-worktrees in your project.

What does Git Worktrees need to run?

Going by SKILL.md and its folder, Git Worktrees needs the command-line tools its instructions call (git, npm and gh). Our summary lists: Node.js.

Does Git Worktrees access the network?

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

Is Git Worktrees safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Git Worktrees use?

Git Worktrees 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 Worktrees use?

About 1.1k tokens (SKILL.md is roughly 4.4k 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 Worktrees?

Skills that share tags, products or a category with Git Worktrees: Git Worktree Isolation (jnMetaCode/superpowers-zh, 8.3k stars), Worktree (AgentsMesh/AgentsMesh, 2.4k stars), Cursor Composer Task Delegate (Chachamaru127/claude-code-harness, 3.2k stars) and Git Worktree Setup (k8zdev/k8z, 155 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Git Worktrees?

heyitsnoah (a GitHub user) maintains it in heyitsnoah/claudesidian, which has 2,597 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on April 11, 2026.

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