worktree-setup

Create data/shared symlink and data/local directory after git worktree add.

Updated Jan 25, 2026
One-click install
npx skills add https://github.com/barikata1984/.agent --skill worktree-setup-barikata1984
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree-setup
Source: https://github.com/barikata1984/.agent/tree/main/skills/worktree-setup
Command: npx skills add https://github.com/barikata1984/.agent --skill worktree-setup-barikata1984

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill automates the post-worktree-creation setup by creating the shared data symlink and a per-worktree local directory, ensuring data protection before starting work in a new worktree.

Core Features & Use Cases

  • Automates creation of a persistent data/shared symlink to the main repository's shared data, and creates a per-worktree data/local directory
  • Enforces preconditions (requires the main repo to run worktree-init) and provides a wrapper that runs after git worktree add
  • Supports deterministic setup for new worktrees to prevent data loss and ensure isolated workspaces

Quick Start

Run the wrapper after creating a new git worktree to initialize data/shared and data/local directories.

Frequently Asked Questions about worktree-setup

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

FAQPage Schema
How do I automate data directory setup for a new git worktree?

Automating data directory setup for a git worktree requires running a post-creation script that generates a persistent data/shared symlink and a local data directory. This ensures the workspace is isolated and ready before development begins.

Why do I need a symlink for shared data in my git worktree?

A symlink for shared data in a git worktree links new working directories to the main repository's persistent data. This prevents data duplication and loss by keeping shared files accessible while maintaining isolated local directories.

What happens if I skip worktree-init before adding a new worktree?

Skipping worktree-init prevents the setup script from executing because the skill enforces preconditions requiring the main repository to run initialization first. Without these preconditions met, the deterministic data directory setup will fail.

How do I create isolated data directories for multiple git worktrees?

Creating isolated data directories for multiple git worktrees involves using a setup script after running git worktree add. The script automatically creates a per-worktree data/local directory alongside a shared data symlink for consistent workspace isolation.

Does this worktree setup script run automatically after git worktree add?

The worktree setup script functions as a wrapper that runs after git worktree add. It delegates to a deterministic setup process to create the required shared symlinks and local directories, ensuring data protection immediately after worktree creation.