managing-worktrees

Create, prune, and land isolated Git worktrees for parallel Claude sessions.

125|42|Updated May 19, 2025
One-click install
npx skills add https://github.com/SocketDev/socket-mcp --skill managing-worktrees-socketdev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: managing-worktrees
Source: https://github.com/SocketDev/socket-mcp/tree/main/.claude/skills/fleet/managing-worktrees
Command: npx skills add https://github.com/SocketDev/socket-mcp --skill managing-worktrees-socketdev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

CLAUDE fleet sessions require isolated worktrees to avoid interfering with the main checkout. This skill provides a safe, multi-mode mechanism to create, fan out, prune, and land worktrees as needed.

Core Features & Use Cases

  • Mode new creates a dedicated worktree at ../<repo>-<task-name>/ for a new task.
  • Mode pr-fanout ensures a worktree is available for every open PR so parallel sessions can review concurrently.
  • Mode prune cleans up stale worktrees that are safe to remove according to the base branch and merge status.
  • Mode land fast-forwards or cherry-picks verified commits onto origin/<base> to keep the primary checkout clean.
  • Use Case: Start a task with a distinct worktree, review PRs in parallel, then prune when finished.

Quick Start

Provide a task name to create a new worktree; I will spin up a dedicated workspace at ../<repo>-<task-name>/ and confirm the path.

Frequently Asked Questions about managing-worktrees

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create isolated git worktrees for parallel Claude sessions?

To create isolated git worktrees for parallel Claude sessions, use the new mode by providing a task name, which spawns a dedicated workspace at ../<repo>-<task-name>/ without disturbing the primary checkout.

What is the best way to review multiple open PRs locally in parallel?

The best way to review multiple open PRs locally in parallel is using the pr-fanout mode, which ensures a dedicated worktree is available for every open PR so concurrent sessions can review them without conflicts.

How do I clean up stale git worktrees after finishing parallel tasks?

To clean up stale git worktrees after finishing parallel tasks, use the prune mode, which safely removes worktrees based on their base branch and merge status to keep your repository organized.

Can I land verified commits onto a base branch without affecting the primary checkout?

Yes, you can land verified commits onto origin/<base> without affecting the primary checkout by using the land mode, which fast-forwards or cherry-picks commits to keep the main checkout clean.

Does this worktree workflow support checking out existing branches?

No, this worktree workflow enforces safety constraints by creating new worktrees only, explicitly avoiding the checkout of existing ones to prevent conflicts and maintain session isolation.

When do I need to use git worktrees for my development workflow?

You need to use git worktrees when running a CLAUDE fleet of parallel sessions that require isolated workspaces, preventing concurrent tasks from interfering with your main repository checkout.