using-git-worktrees

Validate Git worktree directory safety and tracked state before feature work.

6|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/caitengwei/my-skills --skill using-git-worktrees-caitengwei
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/caitengwei/my-skills/tree/main/superpowers/skills/using-git-worktrees
Command: npx skills add https://github.com/caitengwei/my-skills --skill using-git-worktrees-caitengwei

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents you from accidentally polluting commits or leaking tracked worktree paths when you start isolated feature development using Git worktrees.

Core Features & Use Cases

  • Safe project-local directory selection: Ensures chosen .worktrees/ or worktrees/ paths are both git-ignored and not already tracked before creation.
  • Post-create main-worktree verification: Detects whether the new worktree path appears in the main worktree’s status or tracked state immediately after git worktree add.
  • Guided setup and baseline tests: Auto-installs common dependencies and runs a clean test baseline based on project files, then reports readiness to implement a feature.
  • Use Case: When implementing a risky change, create an isolated branch in a worktree so your current workspace stays stable and verifiable.

Quick Start

Use the Skill to set up a new isolated git worktree directory for your feature branch, run the appropriate dependency install and tests, and confirm the workspace is safe to proceed.

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 work with git worktrees without polluting commits?▼

Git worktrees isolate feature work by verifying directory safety and tracking state. This prevents accidental commit pollution and leaking tracked worktree paths by ensuring chosen paths are git-ignored and not already tracked before creation.

What is the safest way to set up a project-local git worktree directory?▼

Safe project-local git worktree setup requires choosing ignored-and-untracked paths like `.worktrees/`. The process validates that the directory is both git-ignored and not already tracked before running `git worktree add` to prevent path leakage.

How do I verify a new git worktree does not appear in the main worktree's tracked state?▼

Post-create main-worktree verification detects whether the new worktree path appears in the main worktree’s status or tracked state immediately after `git worktree add`, ensuring the isolated branch does not pollute the primary workspace.

Can I automatically install dependencies and run baseline tests when creating a git worktree?▼

Yes, guided setup auto-installs common dependencies and runs a clean test baseline based on project files. After creating the git worktree, it reports workspace readiness so you can safely proceed to implement a feature.

When should I use git worktrees for branching strategy and workspace isolation?▼

Use git worktrees for workspace isolation when implementing a risky change. Creating an isolated branch in a separate worktree keeps your current workspace stable and verifiable while you run the implementation plan.