Help us improve
Share bugs, ideas, or general feedback.
From general
Manage git worktrees for AI agent workflows. Use when creating, listing, removing, or pruning worktrees, especially for ticket-based development where the agent needs to create isolated working directories for feature branches. Supports creating worktrees in .worktrees/ subdirectory, automatic branch creation from base branch (main), and cleanup of stale worktrees.
npx claudepluginhub bobmaertz/prompt-library --plugin generalHow this skill is triggered — by the user, by Claude, or both
Slash command
/general:git-worktree-managerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Manage git worktrees for AI agent workflows where Claude creates isolated working directories for tickets, features, or bug fixes.
Automates Git worktree creation for isolated feature branches, listing, removal, and status checks. Copies env files like .env/.nvmrc and runs npm/yarn/pnpm/bun install.
Manages git worktrees for isolated parallel development sessions with safety checks for uncommitted changes and unpushed commits.
Searches USPTO patent and trademark records from official APIs including PatentSearch, TSDR, and assignment databases.
Share bugs, ideas, or general feedback.
Manage git worktrees for AI agent workflows where Claude creates isolated working directories for tickets, features, or bug fixes.
This skill provides scripts to:
.worktrees/ with branches from a base branchWorktrees are organized in a project-based subdirectory pattern:
my-project/
├── .git/
├── src/
├── .worktrees/
│ ├── feature-add-auth/ # Created for feature/add-auth
│ ├── feature-fix-bug-123/ # Created for feature/fix-bug-123
│ └── hotfix-security/ # Created for hotfix/security
└── ...
Branch names are sanitized for directory names (e.g., feature/add-auth → feature-add-auth).
All scripts are in the scripts/ directory and should be run with Python 3.
Create a new worktree with a branch from a base branch.
Usage:
python3 scripts/create_worktree.py <branch-name> [base-branch] [repo-path]
Parameters:
branch-name (required): Name of the branch (e.g., feature/add-auth)base-branch (optional): Base branch to branch from (default: main)repo-path (optional): Path to repository (default: current directory)Behavior:
.worktrees/ directory if it doesn't exist/ with -)Examples:
# Create worktree for feature/add-auth from main
python3 scripts/create_worktree.py feature/add-auth
# Create worktree from develop branch
python3 scripts/create_worktree.py feature/new-ui develop
# Create worktree in specific repo
python3 scripts/create_worktree.py feature/fix-bug main /path/to/repo
Output:
List all worktrees with their current status.
Usage:
python3 scripts/list_worktrees.py [--json] [repo-path]
Parameters:
--json (optional): Output as JSON instead of formatted textrepo-path (optional): Path to repository (default: current directory)Output includes:
Examples:
# List worktrees in current repo
python3 scripts/list_worktrees.py
# List worktrees as JSON
python3 scripts/list_worktrees.py --json
# List worktrees in specific repo
python3 scripts/list_worktrees.py /path/to/repo
Remove a specific worktree by path or branch name.
Usage:
python3 scripts/remove_worktree.py <path-or-branch> [--force] [--delete-branch] [repo-path]
Parameters:
path-or-branch (required): Worktree path or branch name--force or -f (optional): Force removal even with uncommitted changes--delete-branch or -d (optional): Also delete the associated branchrepo-path (optional): Path to repository (default: current directory)Safety features:
--force)Examples:
# Remove by branch name
python3 scripts/remove_worktree.py feature/add-auth
# Remove by path
python3 scripts/remove_worktree.py /path/to/repo/.worktrees/feature-add-auth
# Force remove with uncommitted changes
python3 scripts/remove_worktree.py feature/old-feature --force
# Remove worktree and delete branch
python3 scripts/remove_worktree.py feature/completed --delete-branch
# Combine flags
python3 scripts/remove_worktree.py feature/abandoned --force --delete-branch
Prune stale worktrees (where directory no longer exists).
Usage:
python3 scripts/prune_worktrees.py [--dry-run] [repo-path]
Parameters:
--dry-run or -n (optional): Show what would be pruned without making changesrepo-path (optional): Path to repository (default: current directory)Behavior:
Examples:
# Preview stale worktrees
python3 scripts/prune_worktrees.py --dry-run
# Prune stale worktrees
python3 scripts/prune_worktrees.py
# Prune in specific repo
python3 scripts/prune_worktrees.py /path/to/repo
Create a worktree when:
Remove a worktree when:
Run prune regularly to:
# 1. Start work on ticket
worktree_path = create_worktree("feature/ticket-123")
# 2. Do work in worktree
os.chdir(worktree_path)
# ... make changes, commit, etc.
# 3. Clean up when done
remove_worktree("feature/ticket-123", delete_branch=True)
# 4. Periodically prune stale worktrees
prune_worktrees()
All scripts:
Common errors:
# Agent receives ticket: "Add user authentication"
python3 scripts/create_worktree.py feature/add-auth
# Work in the worktree
cd .worktrees/feature-add-auth
# ... implement feature, test, commit ...
# When done
cd ../..
python3 scripts/remove_worktree.py feature/add-auth --delete-branch
# Agent receives bug report: "Fix login crash"
python3 scripts/create_worktree.py feature/fix-login-crash
# Fix the bug
cd .worktrees/feature-fix-login-crash
# ... fix bug, test, commit ...
# Create PR, then cleanup
cd ../..
python3 scripts/remove_worktree.py feature/fix-login-crash
# Keep branch for PR, so don't use --delete-branch
# List current worktrees to see what's in progress
python3 scripts/list_worktrees.py
# Switch between tickets by changing directory
cd .worktrees/feature-ticket-123
# ... work on ticket 123 ...
cd ../feature-ticket-456
# ... work on ticket 456 ...
# Clean up completed tickets
cd ../..
python3 scripts/remove_worktree.py feature/ticket-123 --delete-branch