using-git-worktrees

Create and validate isolated Git worktrees for feature development.

3|2|Updated Mar 9, 2026
One-click install
npx skills add https://github.com/Moonsong-Labs/knowledge-work-plugins --skill using-git-worktrees-moonsong-labs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/Moonsong-Labs/knowledge-work-plugins/tree/main/core-engineering/skills/using-git-worktrees
Command: npx skills add https://github.com/Moonsong-Labs/knowledge-work-plugins --skill using-git-worktrees-moonsong-labs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a structured method to create isolated Git workspaces (worktrees) for feature development, so you can work on different branches without changing your current directory state or polluting the main workspace.

Core Features & Use Cases

  • Directory selection and automatic preference handling: .worktrees (preferred) or worktrees, with fallback to a global path when needed.
  • Safety verified: ensures the chosen worktree directory is ignored by Git before creation to prevent accidental commits.
  • Automatic setup: detects the project type (Node, Rust, Python, Go) and runs the appropriate setup commands after creating the worktree.
  • Flexible workflows: supports both project-local and global worktree locations, and can prompt the user when preferences are missing.

Quick Start

Ask me to set up an isolated Git worktree for your current project.

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 workspace for parallel feature development?

To create an isolated Git workspace, it uses `git worktree add` to establish a dedicated directory for parallel feature work, preventing pollution of your main workspace. It automatically detects project types like Node or Rust to run setup commands.

What is the safest way to set up Git worktrees without accidental commits?

The safest way to set up Git worktrees is verifying the target directory is ignored by Git before creation. This Skill enforces directory discovery within `.worktrees` or standard folders and validates ignore rules to prevent accidental commits.

How does Git worktree directory selection work when preferences are missing?

Git worktree directory selection prioritizes existing `.worktrees` or `worktrees` folders, then checks `CLAUDE.md` preferences. If preferences are missing, it falls back to a global path or prompts the user to specify a valid location for the isolated workspace.

Can I automatically run project setup commands after creating a Git worktree?

Yes, you can automatically run project setup commands after creating a Git worktree. This Skill detects your project type—such as Node, Rust, Python, or Go—and executes the appropriate environment setup commands immediately after adding the worktree.

Does this Git worktree setup method support both local and global directory locations?

Yes, this Git worktree setup method supports both local project directories and global locations. It applies clear priority rules to find existing `.worktrees` directories first, ensuring flexible workflows for parallel feature development across different environments.