Agent skill

git-worktrees

Use git worktrees when running multiple Claude Code instances in parallel for different features - creates isolated workspaces with separate branches and virtual environments

Stars 106
Forks 13

Install this agent skill to your Project

npx add-skill https://github.com/trailofbits/dropkit/tree/main/.claude/skills/git-worktrees

SKILL.md

Parallel Development with Git Worktrees

Overview

Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching. This is essential when running multiple Claude Code instances in parallel.

Core principle: One worktree per Claude Code instance ensures isolation and prevents conflicts.

Announce at start: "I'm using the git-worktrees skill to set up an isolated workspace."

When to Use

  • Running multiple Claude Code instances for different features
  • Need to work on a feature branch while keeping main branch accessible
  • Parallel development on separate tasks

Setup

bash
# Create worktrees for parallel development
git worktree add ../dropkit-feature-a feature-a
git worktree add ../dropkit-feature-b feature-b

# Each worktree gets its own directory with full codebase
# Run Claude Code in each directory independently

Guidelines for Parallel Instances

  1. One worktree per Claude Code instance - Never run multiple instances in the same directory
  2. Separate branches - Each worktree should be on its own feature branch
  3. Independent uv sync - Run uv sync in each worktree (creates separate .venv)
  4. Tests run independently - Each worktree can run its own test suite without conflicts
  5. Merge via main branch - When features are complete, merge branches to main

Managing Worktrees

bash
# List all worktrees
git worktree list

# Remove a worktree when done
git worktree remove ../dropkit-feature-a

# Prune stale worktree entries
git worktree prune

Potential Conflicts to Avoid

Resource Risk Mitigation
~/.config/dropkit/ User config is shared Don't modify during parallel dev
~/.ssh/config SSH config is shared Coordinate droplet names
DigitalOcean API Creating droplets with same name Use unique droplet names per worktree

Quick Reference

Situation Action
Starting parallel work Create new worktree with feature branch
New worktree created Run uv sync to create isolated venv
Feature complete Merge to main, remove worktree
Stale worktrees Run git worktree prune

Example Workflow

You: I'm using the git-worktrees skill to set up an isolated workspace.

[Create worktree: git worktree add ../dropkit-auth feature/auth]
[Run uv sync]
[Run uv run pytest - all passing]

Worktree ready at ../dropkit-auth
Tests passing
Ready to implement auth feature

Expand your agent's capabilities with these related and highly-rated skills.

trailofbits/skills

gh-cli

Enforces authenticated gh CLI workflows over unauthenticated curl/WebFetch patterns. Use when working with GitHub URLs, API access, pull requests, or issues.

4,181 369
Explore
trailofbits/skills

supply-chain-risk-auditor

Identifies dependencies at heightened risk of exploitation or takeover. Use when assessing supply chain attack surface, evaluating dependency health, or scoping security engagements.

4,181 369
Explore
trailofbits/skills

zeroize-audit

Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C/C++/Rust code handling secrets, keys, passwords, or other sensitive data.

4,181 369
Explore
trailofbits/skills

sharp-edges

Identifies error-prone APIs, dangerous configurations, and footgun designs that enable security mistakes. Use when reviewing API designs, configuration schemas, cryptographic library ergonomics, or evaluating whether code follows 'secure by default' and 'pit of success' principles. Triggers: footgun, misuse-resistant, secure defaults, API usability, dangerous configuration.

4,181 369
Explore
trailofbits/skills

insecure-defaults

Detects fail-open insecure defaults (hardcoded secrets, weak auth, permissive security) that allow apps to run insecurely in production. Use when auditing security, reviewing config management, or analyzing environment variable handling.

4,181 369
Explore
trailofbits/skills

dwarf-expert

Provides expertise for analyzing DWARF debug files and understanding the DWARF debug format/standard (v3-v5). Triggers when understanding DWARF information, interacting with DWARF files, answering DWARF-related questions, or working with code that parses DWARF data.

4,181 369
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results