worktree

Create or resume isolated git worktrees on claude branches with sandbox settings.

2|Updated Sep 12, 2016
One-click install
npx skills add https://github.com/paulnsorensen/dotfiles --skill worktree-paulnsorensen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree
Source: https://github.com/paulnsorensen/dotfiles/tree/main/claude/skills/worktree
Command: npx skills add https://github.com/paulnsorensen/dotfiles --skill worktree-paulnsorensen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Isolates task work from the main repository by creating persistent, separate git worktrees to keep the primary workspace clean and focused on the task at hand.

Core Features & Use Cases

  • Create a worktree at .worktrees/<slug> on branch claude/<slug> (or resume if it already exists)
  • Symlink Claude project permissions from the main repository to the worktree
  • Disable pre-commit hooks to avoid cache write issues inside the sandbox
  • Seed .claude/settings.local.json with sandbox configuration and permissions

Quick Start

Run ccw-init <slug> to create or resume a task worktree and seed sandbox settings.

Frequently Asked Questions about worktree

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

FAQPage Schema
How do I create an isolated git worktree for a specific task?

To create an isolated git worktree, run the init command with a slug to generate a worktree at .worktrees/<slug> on a dedicated branch. If the worktree already exists, the command resumes it instead of recreating the directory.

What is a git worktree and when do I need a sandboxed branch?

A git worktree is a separate working directory linked to the same repository. You need a sandboxed branch when you want to isolate task work from the main repository, keeping your primary workspace clean and focused on the task at hand.

How do I keep Claude project permissions synced to a new git worktree?

To keep Claude project permissions synced, the worktree creation process symlinks permissions from the main repository to the new worktree directory. It also seeds .claude/settings.local.json with the required sandbox configuration.

Why are pre-commit hooks disabled inside a sandboxed git worktree?

Pre-commit hooks are disabled inside a sandboxed git worktree to avoid cache write issues within the isolated environment. This ensures that sandboxed task work proceeds without interruption from repository hook configurations.

Can I resume an existing git worktree if my task was interrupted?

Yes, you can resume an existing git worktree by running the init command with the original slug. The process validates the repository and resumes the worktree at .worktrees/<slug> on its claude/<slug> branch if it already exists.

Does this worktree setup require any external dependencies or tools?

No, this worktree setup requires no external dependencies or additional component tools. It operates directly on your git repository to validate the repo, create the branch, symlink permissions, and seed the local settings file.