using-git-worktrees

Creates isolated git worktree workspaces with native tool detection and baseline test verification.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Starting feature work directly in your main checkout risks polluting your current branch and mixing unrelated changes. This Skill ensures every implementation task runs in an isolated workspace, detecting existing isolation first and falling back to git worktrees only when no native tool exists. ## Core Features & Use Cases - Isolation Detection: Checks whether you are already inside a linked worktree or a git submodule before creating anything, preventing nested worktrees. - Native Tool Preference: Uses platform-native worktree tools (e.g., EnterWorktree) when available, falling back to manual git worktree add only when necessary. - Safe Directory Selection: Follows a priority order for worktree placement (existing .worktrees/, legacy global path, declared preference, default) and verifies the directory is git-ignored before creation. - Baseline Verification: Auto-detects the project type (Node, Rust, Python, Go), installs dependencies, and runs tests to confirm a clean starting state. - Use Case: Before implementing a new payment feature, ask the assistant to set up an isolated workspace; it creates a worktree on a new branch, installs dependencies, and confirms all tests pass before coding begins. ## Quick Start Set up an isolated git worktree for my next feature branch and verify the test baseline is clean.

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 workspace with git worktrees?▼

Run `git worktree add <path> -b <branch-name>` to create a linked worktree on a new branch, then cd into it. The Skill automates this after checking for existing isolation and verifying the target directory is git-ignored.

Should I use git worktree add or a native worktree tool?▼

Prefer the native worktree tool if your platform provides one, such as an EnterWorktree command. Native tools handle directory placement, branch creation, and cleanup automatically; manual git worktree commands are only a fallback.

How do I know if I am already inside a git worktree?▼

Compare `git rev-parse --git-dir` with `git rev-parse --git-common-dir`; if they differ, you are in a linked worktree. Also check `git rev-parse --show-superproject-working-tree` to rule out being inside a submodule, which shows the same difference.

Why must the worktree directory be in .gitignore?▼

Project-local worktree directories like `.worktrees/` must be ignored so their contents never appear in git status or get committed accidentally. The Skill verifies this with `git check-ignore` and commits a .gitignore update if needed.

What happens if git worktree creation fails with a permission error?▼

A permission error usually means the sandbox blocked worktree creation. The Skill reports the sandbox denial and continues working in the current directory, running setup and baseline tests in place.