using-git-worktrees

Creates isolated git worktree workspaces with baseline test verification before feature implementation.

1|Updated Jul 6, 2015
One-click install
npx skills add https://github.com/ksolomon/dotfiles --skill using-git-worktrees-ksolomon
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/ksolomon/dotfiles/tree/main/AI/.claude/plugins/cache/claude-plugins-official/superpowers/6.1.1/skills/using-git-worktrees
Command: npx skills add https://github.com/ksolomon/dotfiles --skill using-git-worktrees-ksolomon

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Starting feature work directly in your main checkout risks polluting your current branch and mixing unrelated changes. This Skill ensures every implementation task begins in an isolated workspace, using native worktree tools when available or git worktree as a fallback. ## Core Features & Use Cases - Isolation Detection: Checks whether you are already inside a linked worktree or a submodule before creating anything, preventing nested worktrees. - Native Tool Preference with Git Fallback: Uses platform-native worktree tools (e.g., EnterWorktree) first, falling back to git worktree add only when no native tool exists. - Safe Directory Selection: Follows a priority order for worktree placement (explicit instructions > existing .worktrees/ or worktrees/ > default .worktrees/) and verifies the directory is git-ignored before creation. - Project Setup and Baseline Verification: Auto-detects Node.js, Rust, Python, or Go projects, installs dependencies, and runs tests to confirm a clean baseline. - Use Case: Before implementing a new feature branch, the Skill detects your repo state, creates an ignored worktree at .worktrees/feature-x, runs npm install and npm test, and reports a clean baseline ready for implementation. ## Quick Start Set up an isolated git worktree for my new feature branch and verify the project tests pass before I start implementing.

Frequently Asked Questions about using-git-worktrees

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

FAQPage Schema
How do I create an isolated git worktree for feature development?▼

Run `git worktree add <path> -b <branch-name>` to create a linked worktree on a new branch. Prefer placing it in a `.worktrees/` directory at the project root, and verify the directory is listed in .gitignore before creating it.

How do I check if I am already inside a git worktree?▼

Compare `git rev-parse --git-dir` with `git rev-parse --git-common-dir`. If the resolved paths differ, you are in a linked worktree; also run `git rev-parse --show-superproject-working-tree` to rule out being inside a submodule.

Should I use git worktree add or a native worktree tool?▼

Use a native worktree tool such as EnterWorktree or a /worktree command whenever one is available, since it handles placement, branching, and cleanup automatically. Only fall back to `git worktree add` when no native tool exists.

Why should the worktrees directory be added to .gitignore?▼

Project-local worktree directories like `.worktrees/` must be ignored so their contents are never tracked or committed to the repository. Verify with `git check-ignore` and commit the .gitignore change before creating the worktree.

What happens if git worktree creation fails with a permission error?▼

A permission error usually means the sandbox blocked worktree creation. In that case, inform the user, work in the current directory instead, and still run project setup and baseline tests in place.

Why run tests before starting work in a new worktree?▼

Running the project's test suite establishes a clean baseline so new bugs can be distinguished from pre-existing failures. If tests fail, report the failures and get explicit permission before proceeding.