git:create-worktree

neolabhq/context-engineering-kit · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/neolabhq/context-engineering-kit --skill git:create-worktree
0 commentsdiscussion
summary

Your job is to create and setup git worktrees for parallel development, with automatic detection and installation of project dependencies.

skill.md

Claude Command: Create Worktree

Your job is to create and setup git worktrees for parallel development, with automatic detection and installation of project dependencies.

Instructions

CRITICAL: Perform the following steps exactly as described:

  1. Current state check: Run git worktree list to show existing worktrees and git status to verify the repository state is clean (no uncommitted changes that might cause issues)

  2. Fetch latest remote branches: Run git fetch --all to ensure local has knowledge of all remote branches

  3. Parse user input: Determine what the user wants to create:

    • <name>: Create worktree with auto-detected type prefix
    • --list: Just show existing worktrees and exit
    • No input: Ask user interactively for the name
  4. Auto-detect branch type from name: Check if the first word is a known branch type. If yes, use it as the prefix and the rest as the name. If no, default to feature/.

    Known types: feature, feat, fix, bug, bugfix, hotfix, release, docs, test, refactor, chore, spike, experiment, review

    Examples:

    • refactor auth systemrefactor/auth-system
    • fix login bugfix/login-bug
    • auth systemfeature/auth-system (default)
    • hotfix critical errorhotfix/critical-error

    Name normalization: Convert spaces to dashes, lowercase, remove special characters except dashes/underscores

  5. For each worktree to create: a. Branch name construction: Build full branch name from detected type and normalized name:

    • <prefix>/<normalized-name> (e.g., feature/auth-system)

    b. Branch resolution: Determine if the branch exists locally, remotely, or needs to be created:

    • If branch exists locally: git worktree add ../<project>-<name> <branch>
    • If branch exists remotely (origin/): git worktree add --track -b <branch> ../<project>-<name> origin/<branch>
    • If branch doesn't exist: Ask user for base branch (default: current branch or main/master), then git worktree add -b <branch> ../<project>-<name> <base>

    c. Path convention: Use sibling directory with pattern ../<project-name>-<name>

    • Extract project name from current directory
    • Use the normalized name (NOT the full branch with prefix)
    • Example: feature/auth-system../myproject-auth-system

    d. Create the worktree: Execute the appropriate git worktree add command

    e. Dependency detection: Check the new worktree for dependency files and determine if setup is needed:

    • package.json -> Node.js project (npm/yarn/pnpm/bun)
    • requirements.txt or pyproject.toml or setup.py -> Python project
    • Cargo.toml -> Rust project
    • go.mod -> Go project
    • Gemfile -> Ruby project
    • composer.json -> PHP project

    f. Package manager detection (for Node.js projects):

    • bun.lockb -> Use bun install
    • pnpm-lock.yaml -> Use pnpm install
    • yarn.lock -> Use yarn install
    • package-lock.json or default -> Use npm install

    g. Automatic setup: Automatically run dependency installation:

    • cd to worktree and run the detected install command
    • Report progress: "Installing dependencies with [package manager]..."
    • If installation fails, report the error but continue with worktree creation summary
  6. Summary: Display summary of created worktrees:

    • Worktree path
    • Branch name (full name with prefix)
    • Setup status (dependencies installed or failed)
    • Quick navigation command: cd <worktree-path>

Worktree Path Convention

Worktrees are created as sibling directories to maintain organization:

~/projects/
  myproject/                # Main worktree (current directory)
  myproject-add-auth/       # Feature branch worktree (feature/add-auth)
  myproject-critical-bug/   # Hotfix worktree (hotfix/critical-bug)
  myproject-pr-456/         # PR review worktree (review/pr-456)

Naming rules:

  • Pattern: <project-name>-<name> (uses the name part, NOT the full branch)
  • Branch name: <type-prefix>/<name> (e.g., feature/add-auth)
  • Directory name uses only the <name> portion for brevity

Examples

Feature worktree (default):

> /git:create-worktree auth system
# Branch: feature/auth-system
# Creates: ../myproject-auth-system

Fix worktree:

> /git:create-worktree fix login error
# Branch: fix/login-error
# Creates: ../myproject-login-error

Refactor worktree:

> /git:create-worktree refactor api layer
# Branch: refactor/api-layer
# Creates: ../myproject-api-layer

Hotfix worktree:

> /git:create-worktree hotfix critical bug
# Branch: hotfix/critical-bug
# Creates: ../myproject-critical-bug

List existing worktrees:

> /git:create-worktree --list
# Shows: git worktree list output

Setup Detection Examples

Node.js project with pnpm:

Detected Node.js project with pnpm-lock.yaml
Installing dependencies with pnpm...
✓ Dependencies installed successfully

Python project:

Detected Python project with requirements.txt
Installing dependencies with pip...
✓ Dependencies installed successfully

Rust project:

Detected Rust project with Cargo.toml
Building project with cargo...
✓ Project built successfully

Common Workflows

Quick Feature Branch

> /git:create-worktree new dashboard
# Branch: feature/new-dashboard
# Creates worktree, installs dependencies, ready to code

Hotfix While Feature In Progress

# In main worktree, working on feature
> /git:create-worktree hotfix critical bug
# Branch: hotfix/critical-bug
# Creates separate worktree from main/master
# Fix bug in hotfix worktree
# Return to feature work when done

PR Review Without Stashing

> /git:create-worktree review pr 123
# Branch: review/pr-123
# Creates worktree for reviewing PR
# Can run tests, inspect code
# Delete when review complete

Experiment or Spike

> /git:create-worktree spike new architecture
# Branch: spike/new-architecture
# Creates isolated worktree for experimentation
# Discard or merge based on results

Important Notes

  • Branch lock: Each branch can only be checked out in one worktree at a time. If a branch is already checked out, the command will inform you which worktree has it.

  • Shared .git: All worktrees share the same Git object database. Changes committed in any worktree are visible to all others.

  • Clean working directory: The command checks for uncommitted changes and warns if present, as creating worktrees is safest with a clean state.

  • Sibling directories: Worktrees are always created as sibling directories (using ../) to keep the workspace organized. Never create worktrees inside the main repository.

  • Automatic dependency installation: The command automatically detects the project type and package manager, then runs the appropriate install command without prompting.

  • Remote tracking: For remote branches, worktrees are created with proper tracking setup (--track flag) so pulls/pushes work correctly.

Cleanup

When done with a worktree, use the proper removal command:

git worktree remove ../myproject-add-auth

Or for a worktree with uncommitted changes:

git worktree remove --force ../myproject-add-auth

Never use rm -rf to delete worktrees - always use git worktree remove.

Troubleshooting

"Branch is already checked out"

  • Run git worktree list to see where the branch is checked out
  • Either work in that worktree or remove it first

"Cannot create worktree - path already exists"

  • The target directory already exists
  • Either remove it or choose a different worktree path

"Dependency installation failed"

  • Navigate to the worktree manually: cd ../myproject-<name>
  • Run the install command directly to see full error output
  • Common causes: missing system dependencies, network issues, corrupted lockfile

"Wrong type detected"

  • The first word is used as the branch type if it's a known type
  • To force a specific type, start with: fix, hotfix, docs, test, refactor, chore, spike, review
  • Default type is feature/ when first word isn't a known type
how to use git:create-worktree

How to use git:create-worktree on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add git:create-worktree
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/neolabhq/context-engineering-kit --skill git:create-worktree

The skills CLI fetches git:create-worktree from GitHub repository neolabhq/context-engineering-kit and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/git:create-worktree

Reload or restart Cursor to activate git:create-worktree. Access the skill through slash commands (e.g., /git:create-worktree) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.834 reviews
  • Min Gupta· Dec 8, 2024

    Useful defaults in git:create-worktree — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Xiao Tandon· Nov 27, 2024

    git:create-worktree has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Noor Brown· Nov 19, 2024

    git:create-worktree fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Valentina Nasser· Oct 18, 2024

    Solid pick for teams standardizing on skills: git:create-worktree is focused, and the summary matches what you get after install.

  • Henry Malhotra· Oct 10, 2024

    We added git:create-worktree from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Yash Thakker· Sep 13, 2024

    I recommend git:create-worktree for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • William Perez· Sep 9, 2024

    git:create-worktree is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Mia Bansal· Sep 1, 2024

    Keeps context tight: git:create-worktree is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • William Mensah· Aug 28, 2024

    Keeps context tight: git:create-worktree is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Benjamin Reddy· Aug 20, 2024

    git:create-worktree is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

showing 1-10 of 34

1 / 4