using-git-worktrees

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

2|Updated Jul 11, 2026
One-click install
npx skills add https://github.com/MoofonLi/dev-ready --skill using-git-worktrees-moofonli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/MoofonLi/dev-ready/tree/main/src/dev_ready/templates/claude/skills/using-git-worktrees
Command: npx skills add https://github.com/MoofonLi/dev-ready --skill using-git-worktrees-moofonli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Starting feature work directly in your main checkout risks polluting the current branch and mixing unrelated changes. This Skill ensures every piece of feature work happens in an isolated workspace, detecting existing isolation first and falling back to manual git worktrees only when no native tool exists. ## Core Features & Use Cases - Isolation Detection: Runs git rev-parse checks to determine whether you are already inside a linked worktree or a submodule before creating anything, avoiding nested or duplicate worktrees. - Native Tool Preference: Uses platform-native worktree tools (such as EnterWorktree or a /worktree command) when available, falling back to manual git worktree add only when necessary. - Safe Directory Management: Selects .worktrees/ or worktrees/ directories, verifies they are git-ignored before creation, and handles sandbox permission errors gracefully. - 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 your agent to set up an isolated workspace; it will create a worktree at .worktrees/feature-x, install dependencies, and confirm all tests pass before coding begins. ## Quick Start Ask your agent to set up an isolated git worktree for the new feature branch and verify the baseline 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 feature development?

Run git worktree add with a target path and new branch name, such as git worktree add .worktrees/my-feature -b my-feature. The Skill automates this after checking for native worktree tools and verifying the directory is git-ignored.

How to check if I am already inside a git worktree?

Compare git rev-parse --git-dir with --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 shows the same difference.

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

Prefer a native tool like EnterWorktree or a /worktree command when available, since it manages directory placement, branching, and cleanup. Manual git worktree add creates state the harness cannot track, so use it only as a fallback.

Why does git worktree creation fail with a permission error?

Sandboxed agent environments can block git worktree add with a permission denial. When this happens, the Skill reports the sandbox block and continues working in the current directory instead of failing outright.

What happens if the worktree directory is not in .gitignore?

An unignored worktree directory risks committing the entire worktree contents into the repository. The Skill runs git check-ignore before creation and, if missing, adds the directory to .gitignore and commits that change first.