using-git-worktrees

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

Updated Jul 29, 2026
One-click install
npx skills add https://github.com/MaiconGambini/opencode-harness-guide --skill using-git-worktrees-maicongambini
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/MaiconGambini/opencode-harness-guide/tree/main/skills/using-git-worktrees
Command: npx skills add https://github.com/MaiconGambini/opencode-harness-guide --skill using-git-worktrees-maicongambini

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Starting feature work directly in your main workspace risks mixing uncommitted changes, breaking your current branch state, and losing context. This Skill creates isolated git worktrees so you can work on multiple branches simultaneously without switching or stashing. ## Core Features & Use Cases - Smart Directory Selection: Follows a priority order (existing .worktrees/ or worktrees/ directories, then CLAUDE.md preferences, then user prompt) to pick a consistent worktree location. - Safety Verification: Checks that project-local worktree directories are git-ignored before creation, and automatically fixes .gitignore if they are not, preventing accidental commits of worktree contents. - Automated Setup and Baseline Validation: Auto-detects project type (Node.js, Rust, Python, Go), installs dependencies, and runs the test suite to confirm a clean baseline before implementation begins. - Use Case: You need to implement an authentication feature while your main checkout has unfinished work. The Skill creates .worktrees/auth on a new feature/auth branch, runs npm install, verifies all 47 tests pass, and reports the workspace is ready. ## Quick Start Use the using-git-worktrees skill to set up an isolated workspace for the new authentication feature branch.

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. This creates an isolated workspace sharing the same repository without switching your current branch.

Where should git worktrees be stored in a project?

Follow a priority order: use an existing .worktrees/ or worktrees/ directory if present, then check CLAUDE.md for a stated preference, otherwise ask the user. Project-local directories must be git-ignored; a global location like ~/.config/superpowers/worktrees needs no ignore check.

Why do git worktree contents show up in git status?

This happens when the worktree directory is not listed in .gitignore. Verify with git check-ignore before creating the worktree; if it is not ignored, add the directory to .gitignore and commit the change first.

Should I run tests before starting work in a new worktree?

Yes, run the project's test suite after setup to establish a clean baseline. If tests fail, report the failures and ask whether to proceed, otherwise you cannot distinguish new bugs from pre-existing issues.

Can git worktrees work with Node.js, Rust, Python, and Go projects?

Yes, setup is auto-detected from project files: package.json triggers npm install, Cargo.toml triggers cargo build, requirements.txt or pyproject.toml trigger Python installs, and go.mod triggers go mod download.