isoapp

Claude Worktree Hooks — Git skill for Claude Code

Git community

Claude Code hooks for fully functional git worktrees — symlinks node_modules, env files, .vercel, and Claude settings automatically.

How to install Claude Worktree Hooks

This entry records only its repository, not the path inside it, so there is no exact command to give. Open isoapp/claude-worktree-hooks and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Worktree Hooks does

Claude Code hooks for fully functional git worktrees — symlinks node_modules, env files, .vercel, and Claude settings automatically.

Alternatives in Git

  • 使用 Git Worktrees — 创建孤立的 Git worktrees,带有智能目录选择与安全验证 115.1k ★
  • Git Worktree Setup — Create isolated git worktrees with instant feedback and background Rust verification 25.5k ★
  • Worktree Parallel Init — Create multiple git worktrees for parallel development: $ARGUMENTS 23.4k ★

README

Claude Code Worktree Hooks

Makes Claude Code worktrees work out of the box — symlinks `node_modules`, `.env` files, `.vercel/`, and Claude settings so you don't have to reinstall anything or deal with missing config.

What it does

When Claude Code creates a worktree, the hook automatically:

  • Symlinks node_modules from the main repo (instant, no reinstall, no extra disk)
  • Symlinks all .env.* files (root + nested packages) so secrets carry over
  • Symlinks .vercel/ so Vercel env management works
  • Symlinks .claude/settings.local.json so your personal Claude config carries over
  • Runs proto install to install the right Node/pnpm versions
  • Falls back to pnpm install only if no node_modules exist yet

Worktrees are stored in `~/.superset/worktrees//`.

Setup

1. One-time machine setup

# Install jq if you don't have it
brew install jq

# Create the worktrees directory
mkdir -p ~/.superset/worktrees

2. Add to your repo

From the root of any repo you want worktree support in:

# Create the hooks directory
mkdir -p .claude/hooks

# Copy the hook scripts
cp path/to/claude-worktree-hooks/hooks/worktree-create.sh .claude/hooks/
cp path/to/claude-worktree-hooks/hooks/worktree-remove.sh .claude/hooks/

# Make them executable
chmod +x .claude/hooks/*.sh

3. Configure Claude Code

If your repo **doesn't have** `.claude/settings.json` yet:

cp path/to/claude-worktree-hooks/settings.json .claude/settings.json

If your repo **already has** `.claude/settings.json`, add the hooks key to it:

{
  "hooks": {
    "WorktreeCreate": [
      {
        "hooks": [
          {
            "type": "command",
            "command": ".claude/hooks/worktree-create.sh"
          }
        ]
      }
    ],
    "WorktreeRemove": [
      {
        "hooks": [
          {
            "type": "command",
            "command": ".claude/hooks/worktree-remove.sh"
          }
        ]
      }
    ]
  }
}

4.