Agent skill

git-worktree-setup

Use PROACTIVELY when working on multiple branches simultaneously or creating parallel Claude Code sessions. Automates git worktree creation with prerequisite checking, development environment initialization, and safe cleanup. Supports single worktree, batch creation, and worktree removal. Not for non-git projects or branch management without worktrees.

Stars 4
Forks 2

Install this agent skill to your Project

npx add-skill https://github.com/cskiro/claudex/tree/main/plugins/git-worktree-setup/skills/git-worktree-setup

SKILL.md

Git Worktree Setup

Automates git worktree creation for parallel Claude Code sessions without conflicts.

When to Use

Trigger Phrases:

  • "create a worktree for [branch-name]"
  • "set up worktree for [feature]"
  • "create worktrees for [branch1], [branch2]"
  • "remove worktree [name]"
  • "list my worktrees"

Use Cases:

  • Working on multiple features simultaneously
  • Parallel Claude Code sessions on different branches
  • Code review while continuing development
  • Emergency hotfixes without interrupting work

Quick Decision Matrix

Request Mode Action
"create worktree for X" Single Create one worktree
"set up worktrees for X, Y" Batch Create multiple
"remove worktree X" Cleanup Remove specific
"list worktrees" List Display status

Workflow Overview

Phase 0: Prerequisites (Mandatory)

bash
# Verify git repo
git rev-parse --is-inside-work-tree

# Check uncommitted changes
git status --porcelain

# Get repo name
basename $(git rev-parse --show-toplevel)

Phase 1: Gather Information

  • Branch name (required)
  • New or existing branch
  • Location (default: ../repo-branch)
  • Setup dev environment

Phase 2: Create Worktree

bash
# New branch
git worktree add ../project-feature -b feature

# Existing branch
git worktree add ../project-bugfix bugfix

Phase 3: Dev Environment Setup

  • Detect package manager
  • Run install
  • Copy .env files

Phase 4: Next Steps

  • Show worktree path
  • Provide navigation commands
  • List all worktrees

Quick Reference Commands

bash
# Create with new branch
git worktree add ../project-branch -b branch-name

# Create from existing
git worktree add ../project-branch branch-name

# List all
git worktree list

# Remove worktree
git worktree remove ../project-branch

# Remove worktree and branch
git worktree remove ../project-branch
git branch -D branch-name

Package Manager Detection

Lock File Manager
pnpm-lock.yaml pnpm
yarn.lock yarn
bun.lockb bun
package-lock.json npm

Common Issues

Issue Cause Fix
"invalid reference" Branch doesn't exist Use -b for new
"already exists" Directory exists Choose different location
"uncommitted changes" Dirty working dir Commit or stash

Safety Protocols

Before Creating:

  • Verify git repository
  • Check clean working directory
  • Validate target directory available

Before Cleanup:

  • Confirm user intent
  • Check for uncommitted changes
  • Warn about permanent branch deletion

Example Output

✓ Worktree created: /Users/connor/myapp-feature-auth
✓ Branch: feature-auth (new)
✓ Dependencies installed

Next steps:
  cd ../myapp-feature-auth
  claude

All worktrees:
- /path/to/main (main) ← current
- /path/to/worktree (feature-auth) ← new

Success Criteria

  • Worktree in correct location
  • Branch checked out properly
  • Files visible in directory
  • Dev environment ready
  • Appears in git worktree list
  • User can start Claude Code

Reference Materials

  • modes/ - Detailed mode workflows
  • templates/ - Setup script templates
  • data/best-practices.md
  • data/troubleshooting.md

Version: 1.0.0 | Author: Connor

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

cskiro/claudex

e2e-testing

Use PROACTIVELY when setting up end-to-end testing, debugging UI issues, creating visual regression suites, or automating browser testing. Uses Playwright with LLM-powered visual analysis, screenshot capture, and fix recommendations. Zero-setup for React, Next.js, Vue, Node.js, and static sites. Not for unit testing, API-only testing, or mobile native apps.

4 2
Explore
cskiro/claudex

github-repo-setup

Use PROACTIVELY when user needs to create a new GitHub repository or set up a project with best practices. Automates repository creation with four modes - quick public repos (~30s), enterprise-grade with security and CI/CD (~120s), open-source community standards (~90s), and private team collaboration with governance (~90s). Not for existing repo configuration or GitHub Actions workflow debugging.

4 2
Explore
cskiro/claudex

sub-agent-creator

Use PROACTIVELY when creating specialized Claude Code sub-agents for task delegation. Automates agent creation following Anthropic's official patterns with proper frontmatter, tool configuration, and system prompts. Generates domain-specific agents, proactive auto-triggering agents, and security-sensitive agents with limited tools. Not for modifying existing agents or general prompt engineering.

4 2
Explore
cskiro/claudex

accessibility-audit

Use PROACTIVELY when user asks for accessibility review, a11y audit, WCAG compliance check, screen reader testing, keyboard navigation validation, or color contrast analysis. Audits React/TypeScript applications for WCAG 2.2 Level AA compliance with risk-based severity scoring. Includes MUI framework awareness to avoid false positives. Not for runtime accessibility testing in production, automated remediation, or non-React frameworks.

4 2
Explore
cskiro/claudex

otel-monitoring-setup

Use PROACTIVELY when setting up OpenTelemetry monitoring for Claude Code usage tracking, cost analysis, or productivity metrics. Provides local PoC mode (full Docker stack with Grafana) and enterprise mode (centralized infrastructure). Configures telemetry collection, imports dashboards, and verifies data flow. Not for non-Claude telemetry or custom metric definitions.

4 2
Explore
cskiro/claudex

json-outputs-implementer

Use PROACTIVELY when extracting structured data from text/images, classifying content, or formatting API responses with guaranteed schema compliance. Implements Anthropic's JSON outputs mode with Pydantic/Zod SDK integration. Covers schema design, validation, testing, and production optimization. Not for tool parameter validation or agentic workflows (use strict-tool-implementer instead).

4 2
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results