Worktree Manager
Create, manage, and cleanup git worktrees with Claude Code agents across all projects
Worktree Manager is a development skill for creating and managing Git worktrees, covering automated branch isolation, parallel development workflows, and cleanup operations
What Is This?
Overview
Worktree Manager is a Git utility skill that enables Claude Code agents to create, manage, and clean up Git worktrees across multiple projects. It automates the process of setting up isolated working directories for different branches, allowing developers to work on multiple features simultaneously without switching branches constantly. The skill integrates seamlessly with Claude's code execution environment to handle worktree lifecycle management programmatically.
This skill is particularly valuable for teams using complex branching strategies or developers juggling multiple feature branches. Instead of manually creating worktrees and tracking their locations, the skill provides automated commands that handle setup, organization, and cleanup in a single operation. By abstracting away the manual steps of worktree management, it reduces the risk of human error and ensures consistency across development environments.
Worktree Manager also supports advanced operations such as batch worktree creation, automated detection of stale worktrees, and integration with project-specific scripts. It is designed to scale from individual developers working on a single repository to large teams managing dozens of parallel branches across multiple projects. The skill’s API is accessible through Claude Code agents, making it easy to incorporate into automated workflows, CI/CD pipelines, and custom development tools.
Who Should Use This
Developers working on multiple feature branches simultaneously, teams managing complex Git workflows, and anyone using Claude Code agents to automate development tasks will benefit from this skill. It is especially useful for organizations that require strict branch isolation, frequent context switching, or automated environment setup for testing and review.
Why Use It?
Problems It Solves
Manual worktree management is error-prone and time-consuming, especially when handling multiple projects or branches. Developers often forget to clean up old worktrees, leading to disk space waste and repository clutter. Switching between branches repeatedly disrupts workflow and context. This skill eliminates these friction points by automating worktree creation, organization, and removal through Claude Code agents.
Additionally, manual tracking of worktree locations can lead to confusion and accidental data loss. Worktree Manager centralizes worktree metadata, making it easy to list, inspect, and manage all active worktrees from a single interface. Automated cleanup routines prevent the buildup of obsolete directories, reducing maintenance overhead and improving repository performance.
Core Highlights
Worktree Manager automates the creation of isolated Git worktrees for parallel development without constant branch switching. The skill provides intelligent cleanup operations that remove stale worktrees and maintain repository hygiene. It supports multi-project workflows, allowing agents to manage worktrees across different repositories simultaneously. The skill integrates with Claude Code agents to enable fully automated branch management and development environment setup.
Other highlights include support for custom worktree naming conventions, compatibility with pre-commit and post-checkout hooks, and detailed status reporting for each worktree. These features help teams maintain clarity and control over their development environments.
How to Use It?
Basic Usage
const manager = new WorktreeManager(projectPath);
await manager.createWorktree('feature-branch');
const worktrees = await manager.listWorktrees();
await manager.cleanupWorktrees();Real-World Examples
Creating a worktree for a new feature branch and checking its status:
const manager = new WorktreeManager('./my-project');
await manager.createWorktree('feature/user-auth');
const status = await manager.getWorktreeStatus('feature/user-auth');
console.log(status);Cleaning up multiple stale worktrees across a project:
const manager = new WorktreeManager('./my-project');
const stale = await manager.findStaleWorktrees(7);
await manager.removeWorktrees(stale);Advanced Tips
Use the skill's batch operations to create multiple worktrees for related features in a single command, reducing setup time significantly. Configure automatic cleanup schedules to periodically remove worktrees older than a specified threshold, keeping your repository organized without manual intervention. Leverage integration hooks to trigger custom scripts during worktree creation or removal, such as environment setup or notification routines.
When to Use It?
Use Cases
Feature development workflows where multiple developers work on different branches simultaneously without interfering with each other's environments. Release management processes that require maintaining stable branches while developing new features in parallel. Code review scenarios where reviewers need isolated environments to test changes without affecting main development branches. Experimentation and prototyping where developers create temporary worktrees to test ideas without cluttering the main working directory.
Related Topics
This skill complements Git branch management, continuous integration workflows, and development environment automation tools.
Important Notes
Requirements
Git 2.7 or later must be installed on your system. The skill requires read and write permissions to the target Git repository. Claude Code agent execution environment must have access to the file system where repositories are stored.
Usage Recommendations
- Regularly review your list of active worktrees and remove those that are no longer needed to prevent clutter and free up disk space.
- Establish clear naming conventions for worktrees to make identification and management easier, especially when collaborating with multiple team members.
- Schedule automated cleanup routines for stale worktrees to maintain repository hygiene and avoid performance degradation over time.
- Integrate worktree management commands into your CI/CD pipelines to ensure temporary environments are created and cleaned up as part of your automated workflows.
- Always verify that your changes are committed or stashed before removing a worktree to prevent accidental data loss.
Limitations
- The skill relies on underlying Git features; repositories with submodules or unusual configurations may require manual intervention or additional setup.
- Worktree Manager does not resolve merge conflicts or handle complex rebase operations—these must be managed directly using Git.
- Automated cleanup routines may not detect uncommitted changes in worktrees; users should ensure all work is saved before triggering removals.
- Simultaneous modifications to the same branch from multiple worktrees can result in conflicts or inconsistent state if not coordinated carefully.
More Skills You Might Like
Explore similar skills to enhance your workflow
Product Analytics
Use when defining product KPIs, building metric dashboards, running cohort or retention analysis, or interpreting feature adoption trends across produ
Spawn
Launch N parallel subagents in isolated git worktrees to compete on the session task
Reflexion
Self-refinement loop that forces the LLM to reflect on previous output and correct itself
Webapp Testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, ca
Java MCP Server Generator
java-mcp-server-generator skill for programming & development
Implement Feature
Implements a feature from its specification. Reads the spec, designs architecture, writes code and tests. Delegates to the Forja (Dev) agent