create-worktree

Create flat git worktrees under the repository root for agents.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/declanshanaghy/fenrir-ledger --skill create-worktree-declanshanaghy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-worktree
Source: https://github.com/declanshanaghy/fenrir-ledger/tree/main/.claude/skills/create-worktree
Command: npx skills add https://github.com/declanshanaghy/fenrir-ledger --skill create-worktree-declanshanaghy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Create a safe, flat, non-nesting git worktree under the main repository root to isolate agents and avoid nesting bugs, ensuring a predictable working directory structure.

Core Features & Use Cases

  • Repo-root resolution: Always resolves the repo root first to prevent nesting under a subdirectory.
  • Flat worktree creation: Creates worktrees at <repo-root>/.claude/worktrees/<name> to avoid nested worktrees.
  • Validation & cleanup: Includes checks to prevent nested worktrees and provides cleanup steps to remove stale worktrees.

Quick Start

Create a new worktree named agent-<id> under the main repository root to ensure a flat, non-nested path.

Frequently Asked Questions about create-worktree

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

FAQPage Schema
How do I create an isolated git worktree for an agent without nesting issues?

To create an isolated git worktree safely, resolve the repository root first to prevent nesting. Worktrees are generated under a flat directory path at the main repository root to provide a predictable working directory structure for agents.

Why does my git worktree keep creating nested directories?

Git worktree nesting occurs when the repository root is not resolved before creation. Enforce a multi-step workflow that identifies the main repository root first, defining a flat worktree path to prevent subdirectories from triggering nesting bugs.

What is the best way to isolate agents working in the same git repository?

The best way to isolate agents is creating flat git worktrees under the main repository root. This approach provides each agent its own working directory while enforcing repo-root resolution to prevent nested worktree paths and bugs.

How do I clean up stale git worktrees after agent tasks are finished?

Clean up stale git worktrees by following the optional cleanup steps in the worktree workflow. After validation, remove the flat worktree directories located under the main repository root to ensure no isolated working directories remain.

Do I need to manually resolve the repository root before spawning a git worktree?

You do not need to manually resolve the repository root if your worktree workflow enforces it automatically. The creation process must always resolve the repository root first to guarantee a flat, non-nested path under the main repository.

Does git worktree validation prevent agents from overwriting files?

Git worktree validation prevents nesting bugs by checking paths before creation, ensuring each agent gets an isolated working directory. This flat structure under the repository root stops directory conflicts, though standard git branching handles file overwrites.