openspec-sp-git-worktree

Create isolated Git worktrees with branch naming and baseline tests.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/cenmiao/openspec-pro --skill openspec-sp-git-worktree
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openspec-sp-git-worktree
Source: https://github.com/cenmiao/openspec-pro/tree/main/.claude/skills/openspec-sp-git-worktree
Command: npx skills add https://github.com/cenmiao/openspec-pro --skill openspec-sp-git-worktree

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creates isolated, reproducible working directories for branch-specific development to prevent workspace contamination, accidental commits of ephemeral files, and environment drift.

Core Features & Use Cases

  • Safe directory selection and policy: Prioritizes existing worktrees directories, project preferences, or explicit user choice.
  • Safety validation: Verifies git ignore status and updates .gitignore when necessary to avoid accidental commits.
  • Worktree creation and setup: Creates named branches in dedicated worktrees, runs project setup commands, and verifies baseline tests for feature development, bugfixes, or experiments.
  • Use Case: Spin up a feature branch worktree, run dependency installation, and confirm tests before starting implementation.

Quick Start

Create an isolated worktree at worktrees/feature-auth on a new branch feature/auth, ensure the directory is git-ignored, run the project setup commands for the repository, and execute baseline tests to confirm the environment is ready.

Frequently Asked Questions about openspec-sp-git-worktree

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

FAQPage Schema
How do I create an isolated Git workspace for a feature branch?

To create an isolated Git workspace, you can use a Git worktree to set up a dedicated working directory for your feature branch. This approach separates branch workspaces, preventing contamination and environment drift while ensuring independent project setup.

Why do I need to validate .gitignore when setting up Git worktrees?

Validating .gitignore when setting up Git worktrees prevents accidental commits of ephemeral files into your isolated workspace. Safety validation checks the git ignore status and updates the configuration file when necessary to keep your branch clean.

Can I run project dependency installation and baseline tests inside a new Git worktree?

Yes, after worktree creation with branch naming, you can run project dependency installation and execute baseline tests. This verifies the isolated environment is ready for feature development, bugfixes, or experiments before you start coding.

What is the best way to manage multiple branch workspaces without workspace contamination?

Using Git worktrees is the best way to manage multiple branch workspaces without contamination. Worktree directory selection prioritizes existing directories or project preferences, creating isolated, reproducible working directories for branch-specific development.

Do I need Git installed in my environment to create isolated worktrees for bugfix branches?

Yes, you need Git available in your local repository environment to create isolated worktrees. Worktree creation requires Git to manage branch naming, directory selection, and workspace isolation for your bugfix branches.

When should I use a Git worktree instead of cloning a repository for experiments?

Use a Git worktree instead of cloning when you need isolated working directories sharing a single repository history for experiments. Worktrees prevent environment drift and workspace contamination while avoiding the overhead of managing multiple full clones.