using-git-worktrees

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

Updated Aug 13, 2026
One-click install
npx skills add https://github.com/Viranya2006/Lumen --skill using-git-worktrees-viranya2006
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/Viranya2006/Lumen/tree/main/SKILLS/using-git-worktrees
Command: npx skills add https://github.com/Viranya2006/Lumen --skill using-git-worktrees-viranya2006

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 begins in a properly isolated workspace, detecting existing isolation, preferring native worktree tools, and falling back to manual git worktrees only when necessary. ## Core Features & Use Cases - Isolation Detection: Checks whether you are already inside a linked worktree or a git submodule before creating anything, avoiding duplicate or phantom workspaces. - Native Tool Priority: Uses platform-native worktree tools (e.g., EnterWorktree, /worktree commands) when available, falling back to git worktree add only when no native option exists. - Safe Directory Management: Selects .worktrees/ or worktrees/ directories, verifies they are git-ignored before creation, and commits the ignore rule if missing. - Baseline Verification: Auto-detects the project type (Node.js, Rust, Python, Go), installs dependencies, and runs the test suite to confirm a clean starting state. - Use Case: Before implementing a new feature branch, ask the assistant to set up an isolated workspace; it will create a worktree, install dependencies, and confirm all tests pass before any code changes begin. ## Quick Start Ask the assistant to set up an isolated git worktree for your new feature branch and verify the project tests pass before starting implementation.

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 worktree for a new feature branch?

Run `git worktree add <path> -b <branch-name>` from your repository root to create a linked worktree on a new branch. This Skill automates that flow, including directory selection, git-ignore verification, and dependency setup.

How do I check 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 run `git rev-parse --show-superproject-working-tree` to rule out being inside a submodule, which produces the same signal.

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

Prefer a native tool (such as EnterWorktree or a /worktree command) whenever one is available, because it manages placement, branching, and cleanup automatically. Manual `git worktree add` is only a fallback and can create state the harness cannot track.

Why must the worktrees directory be added to .gitignore?

If the worktree directory is not ignored, git will treat the entire nested worktree as untracked content and may commit it into the repository. The Skill verifies ignore status with `git check-ignore` and commits the .gitignore update before creating anything.

What happens if git worktree creation fails due to sandbox permissions?

When `git worktree add` fails with a permission error, the Skill reports the sandbox restriction and continues working in the current directory instead. It still runs dependency installation and baseline tests in place before proceeding.

When should I not create a new git worktree?

Skip creation when you are already inside a linked worktree, when the user declines isolation, or when a native harness tool already manages the workspace. Creating another worktree in these cases produces redundant or conflicting state.