git-worktrees — Claude Code skill: what it does, how to install
Teaches your AI coding assistant to manage multiple linked Git working trees. Helpful for handling hotfixes, PR reviews, and parallel builds without stashing changes.
npx skills add NeoLabHQ/context-engineering-kit --skill git-worktrees -a claude-codeWhat git-worktrees does
This skill guides coding agents through Git worktree workflows. Instead of cloning a repository twice or stashing work, developers can keep multiple checkouts linked to the same .git object database. Context switching happens simply by changing directories.
The instructions cover creating linked trees, tracking remote branches, side-by-side file comparisons, and cleaning up stale references. Git enforces a strict rule: a single branch cannot be checked out in two worktrees at once. Deleting a dirty directory requires the --force flag. That safeguard protects uncommitted edits from accidental loss during project cleanup.
What it helps with
- isolate urgent hotfixes without stashing ongoing work
- inspect pull requests in dedicated folders while keeping code active
- diff implementations across two distinct branches side by side
- run background test suites in a clean directory
- cherry-pick selected changes across multiple working copies
Example prompts for the agent
- Create a new worktree for branch hotfix-456 from main in a sibling directory.
- Set up an isolated worktree to review pull request 123 and run tests there.
- Compare src/module.js between the main worktree and feature-1 worktree.
How to install git-worktrees
1Skills CLI (Vercel)
npx skills add NeoLabHQ/context-engineering-kit --skill git-worktrees -a claude-code2Manually: put the files in place
~/.claude/skills/git-worktrees/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/git-worktrees/
1Skills CLI (Vercel)
npx skills add NeoLabHQ/context-engineering-kit --skill git-worktrees -a codex2Manually: put the files in place
.agents/skills/git-worktrees/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add NeoLabHQ/context-engineering-kit --skill git-worktrees -a cursor2Manually: put the files in place
.cursor/skills/git-worktrees/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install NeoLabHQ/context-engineering-kit git-worktrees2Manually: put the files in place
.github/skills/git-worktrees/SKILL.md1Skills CLI (Vercel)
npx skills add NeoLabHQ/context-engineering-kit --skill git-worktrees -a gemini-cli2Platform CLI
gemini skills install https://github.com/NeoLabHQ/context-engineering-kit --path skills/git-worktreesManually: put the files in place
.devin/skills/git-worktrees/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add NeoLabHQ/context-engineering-kit --skill git-worktrees -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about git-worktrees
How to install git-worktrees in Claude Code?
Run this command in your terminal: npx skills add NeoLabHQ/context-engineering-kit --skill git-worktrees -a claude-code. The skill will register with your agent configuration.
What does git-worktrees do?
It provides workflow rules and CLI patterns for linked Git working directories. The agent learns to create separate folders sharing one repository without duplicating objects.
Can multiple worktrees share the same branch simultaneously?
No, Git locks each branch to one active worktree. If you need that branch elsewhere, remove or switch the existing worktree first.