using-git-worktrees

Create isolated Git worktrees for feature branches with safety checks.

Updated Jan 18, 2026
One-click install
npx skills add https://github.com/csim-sg/yacc --skill using-git-worktrees-csim-sg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/csim-sg/yacc/tree/main/.opencode/skills/using-git-worktrees
Command: npx skills add https://github.com/csim-sg/yacc --skill using-git-worktrees-csim-sg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the risk and friction of feature development in large codebases by provisioning isolated Git worktrees. It prevents accidental changes to the main workspace while enabling concurrent work on multiple branches and fixes workflow drift.

Core Features & Use Cases

  • Directory priority-based worktree creation: checks for existing directories and CLAUDE.md preferences to determine where to create new worktrees.
  • Safety-first creation: verifies ignore rules for project-local worktrees and asks for user input when needed.
  • Automatic setup & baseline: creates the worktree and prepares the environment for immediate development.
  • Use Case: Start a new feature branch without perturbing current work in progress or the main branch.

Quick Start

Use the using-git-worktrees skill to set up an isolated workspace.

  1. Check for existing worktree directories in priority order: .worktrees, then worktrees.
  2. If a directory exists, use it. If both exist, prefer .worktrees.
  3. If none exist, check CLAUDE.md for a preferred location (and apply if specified).
  4. If still none, prompt: "Which would you prefer? .worktrees/ or ~/.config/superpowers/worktrees/<project-name>/"
  5. Create the chosen worktree (git worktree add <path> -b <branch>) and switch to the new branch.
  6. Run project setup as needed and verify a clean baseline.

Frequently Asked Questions about using-git-worktrees

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

FAQPage Schema
How do I isolate feature branch work from my main workspace using git worktrees?

Git worktrees isolate feature branch work by creating separate working directories from your main repository. This skill automates git worktree add, applies priority directory detection, and validates gitignore safety to prevent accidental changes to your active workspace.

How does git worktree directory selection work when starting new feature development?

Directory selection for git worktrees checks for existing .worktrees and worktrees directories in priority order. If none exist, it checks CLAUDE.md preferences or prompts you to choose between a local .worktrees path or a global configuration path.

Do I need to manually configure gitignore rules before creating project-local worktrees?

You do not need to manually configure gitignore rules beforehand because the skill validates gitignore safety automatically. It verifies ignore rules for project-local worktrees and prompts for user input only when needed to ensure safe creation.

What's the best way to manage multiple git branches without causing workflow drift?

Using isolated git worktrees is the best way to manage multiple branches without workflow drift. This approach provisions separate working directories for each branch, allowing concurrent feature development and debugging without perturbing your main workspace.

Can I use CLAUDE.md to specify preferred worktree locations for my repository?

Yes, you can use CLAUDE.md to specify preferred worktree locations. The skill respects CLAUDE.md preferences during directory detection, applying your specified location if standard priority directories like .worktrees or worktrees are not found.

Why should I use isolated worktrees instead of branching directly in my main git directory?

You should use isolated worktrees instead of branching in your main directory to prevent accidental changes to work in progress. Worktrees provide a dedicated environment for each branch, ensuring safety and eliminating workflow drift during concurrent feature development.