using-git-worktrees

Creates isolated git worktrees with directory selection, ignore verification, and baseline test validation.

Updated May 22, 2026
One-click install
npx skills add https://github.com/viniciuscs84/sdd-toolkit --skill using-git-worktrees-viniciuscs84
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/viniciuscs84/sdd-toolkit/tree/main/skills/using-git-worktrees
Command: npx skills add https://github.com/viniciuscs84/sdd-toolkit --skill using-git-worktrees-viniciuscs84

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working on multiple branches simultaneously often requires stashing changes or cloning the repository again, which disrupts the current workspace and wastes disk space. This Skill sets up isolated git worktrees so feature work can proceed without touching the main checkout. ## Core Features & Use Cases - Smart Directory Selection: Follows a priority order of existing .worktrees/ or worktrees/ directories, then CLAUDE.md preferences, then asks the user before creating anything. - Safety Verification: Confirms project-local worktree directories are git-ignored before creation, and automatically fixes and commits the .gitignore entry if missing. - Automated Setup and Baseline Checks: Detects project type (Node.js, Rust, Python, Go), installs dependencies, and runs the test suite to verify a clean baseline before implementation begins. - Use Case: Before executing an approved implementation plan, create a worktree at .worktrees/feature-auth on a new branch, run npm install and npm test, and start coding only after all 47 tests pass. ## Quick Start Set up an isolated git worktree for the new authentication feature and verify the test baseline is clean 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 a git worktree for a new feature branch?

Run git worktree add with a target path and the -b flag to create a new branch, for example git worktree add .worktrees/auth -b feature/auth. Then change into that directory and install project dependencies before starting work.

Where should git worktrees be stored in a project?

Prefer an existing .worktrees or worktrees directory, with .worktrees winning if both exist. If neither exists, check CLAUDE.md for a stated preference, otherwise ask the user to choose between a project-local or global location.

Do git worktree directories need to be in .gitignore?

Yes, project-local worktree directories must be ignored or their contents will pollute git status and risk being committed. Verify with git check-ignore, and if missing, add the entry to .gitignore and commit it before creating the worktree.

Why run tests before starting work in a new worktree?

Running the test suite establishes a clean baseline so you can distinguish new bugs from pre-existing failures. If tests fail, report the failures and get explicit permission before proceeding with implementation.

When should I use a git worktree instead of switching branches?

Use a worktree when you need isolation from the current workspace, such as executing implementation plans or working on multiple branches simultaneously. Worktrees share the same repository, avoiding a full re-clone while keeping checkouts independent.