git-worktree▌
everyinc/compound-engineering-plugin · updated May 7, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
This skill provides a unified interface for managing Git worktrees across your development workflow. Whether you're reviewing PRs in isolation or working on features in parallel, this skill handles all the complexity.
Git Worktree Manager
This skill provides a unified interface for managing Git worktrees across your development workflow. Whether you're reviewing PRs in isolation or working on features in parallel, this skill handles all the complexity.
What This Skill Does
- Create worktrees from main branch with clear branch names
- List worktrees with current status
- Switch between worktrees for parallel work
- Clean up completed worktrees automatically
- Interactive confirmations at each step
- Automatic .gitignore management for worktree directory
- Automatic .env file copying from main repo to new worktrees
- Automatic dev tool trusting for mise and direnv configs with review-safe guardrails
CRITICAL: Always Use the Manager Script
NEVER call git worktree add directly. Always use the worktree-manager.sh script.
The script handles critical setup that raw git commands don't:
- Copies
.env,.env.local,.env.test, etc. from main repo - Trusts dev tool configs with branch-aware safety rules:
- mise: auto-trust only when unchanged from a trusted baseline branch
- direnv: auto-allow only for trusted base branches; review worktrees stay manual
- Ensures
.worktreesis in.gitignore - Creates consistent directory structure
# ✅ CORRECT - Always use the script
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh create feature-name
# ❌ WRONG - Never do this directly
git worktree add .worktrees/feature-name -b feature-name main
When to Use This Skill
Use this skill in these scenarios:
- Code Review (
/ce:review): If NOT already on the target branch (PR branch or requested branch), offer worktree for isolated review - Feature Work (
/ce:work): Always ask if user wants parallel worktree or live branch work - Parallel Development: When working on multiple features simultaneously
- Cleanup: After completing work in a worktree
How to Use
In Claude Code Workflows
The skill is automatically called from /ce:review and /ce:work commands:
# For review: offers worktree if not on PR branch
# For work: always asks - new branch or worktree?
Manual Usage
You can also invoke the skill directly from bash:
# Create a new worktree (copies .env files automatically)
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh create feature-login
# List all worktrees
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh list
# Switch to a worktree
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh switch feature-login
# Copy .env files to an existing worktree (if they weren't copied)
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh copy-env feature-login
# Clean up completed worktrees
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh cleanup
Commands
create <branch-name> [from-branch]
Creates a new worktree with the given branch name.
Options:
branch-name(required): The name for the new branch and worktreefrom-branch(optional): Base branch to create from (defaults tomain)
Example:
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh create feature-login
What happens:
- Checks if worktree already exists
- Updates the base branch from remote
- Creates new worktree and branch
- Copies all .env files from main repo (.env, .env.local, .env.test, etc.)
- Trusts dev tool configs with branch-aware safety rules:
- trusted bases (
main,develop,dev,trunk,staging,release/*) compare against themselves - other branches compare against the default branch
- direnv auto-allow is skipped on non-trusted bases because
.envrccan source unchecked files
- trusted bases (
- Shows path for cd-ing to the worktree
list or ls
Lists all available worktrees with their branches and current status.
Example:
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh list
Output shows:
- Worktree name
- Branch name
- Which is current (marked with ✓)
- Main repo status
switch <name> or go <name>
Switches to an existing worktree and cd's into it.
Example:
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh switch feature-login
Optional:
- If name not provided, lists available worktrees and prompts for selection
cleanup or clean
Interactively cleans up inactive worktrees with confirmation.
Example:
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh cleanup
What happens:
- Lists all inactive worktrees
- Asks for confirmation
- Removes selected worktrees
- Cleans up empty directories
Workflow Examples
Code Review with Worktree
# Claude Code recognizes you're not on the PR branch
# Offers: "Use worktree for isolated review? (y/n)"
# You respond: yes
# Script runs (copies .env files automatically):
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh create pr-123-feature-name
# You're now in isolated worktree for review with all env vars
cd .worktrees/pr-123-feature-name
# After review, return to main:
cd ../..
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh cleanup
Parallel Feature Development
# For first feature (copies .env files):
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh create feature-login
# Later, start second feature (also copies .env files):
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh create feature-notifications
# List what you have:
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh list
# Switch between them as needed:
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh switch feature-login
# Return to main and cleanup when done:
cd .
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh cleanup
Key Design Principles
KISS (Keep It Simple, Stupid)
- One manager script handles all worktree operations
- Simple commands with sensible defaults
- Interactive prompts prevent accidental operations
- Clear naming using branch names directly
Opinionated Defaults
- Worktrees always created from main (unless specified)
- Worktrees stored in .worktrees/ directory
- Branch name becomes worktree name
- .gitignore automatically managed
Safety First
- Confirms before creating worktrees
- Confirms before cleanup to prevent accidental removal
- Won't remove current worktree
- Clear error messages for issues
Integration with Workflows
/ce:review
Instead of always creating a worktree:
1. Check current branch
2. If ALREADY on target branch (PR branch or requested branch) → stay there, no worktree needed
3. If DIFFERENT branch than the review target → offer worktree:
"Use worktree for isolated review? (y/n)"
- yes → call git-worktree skill
- no → proceed with PR diff on current branch
/ce:work
Always offer choice:
1. Ask: "How do you want to work?
1. New branch on current worktree (live work)
2. Worktree (parallel work)"
2. If choice 1 → create new branch normally
3. If choice 2 → call git-worktree skill to create from main
Troubleshooting
"Worktree already exists"
If you see this, the script will ask if you want to switch to it instead.
"Cannot remove worktree: it is the current worktree"
Switch out of the worktree first (to main repo), then cleanup:
cd $(git rev-parse --show-toplevel)
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh cleanup
Lost in a worktree?
See where you are:
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh list
.env files missing in worktree?
If a worktree was created without .env files (e.g., via raw git worktree add), copy them:
bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh copy-env feature-name
Navigate back to main:
cd $(git rev-parse --show-toplevel)
Technical Details
Directory Structure
.worktrees/
├── feature-login/ # Worktree 1
│ ├── .git
│ ├── app/
│ └── ...
├── feature-notifications/ # Worktree 2
│ ├── .git
│ ├── app/
│ └── ...
└── ...
.gitignore (updated to include .worktrees)
How It Works
- Uses
git worktree addfor isolated environments - Each worktree has its own branch
- Changes in one worktree don't affect others
- Share git history with main repo
- Can push from any worktree
Performance
- Worktrees are lightweight (just file system links)
- No repository duplication
- Shared git objects for efficiency
- Much faster than cloning or stashing/switching
How to use git-worktree on Cursor
AI-first code editor with Composer
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-worktree
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches git-worktree from GitHub repository everyinc/compound-engineering-plugin and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate git-worktree. Access the skill through slash commands (e.g., /git-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
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.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 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▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.7★★★★★50 reviews- ★★★★★Pratham Ware· Dec 20, 2024
git-worktree is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Yuki Srinivasan· Dec 16, 2024
Registry listing for git-worktree matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Shikha Mishra· Dec 4, 2024
I recommend git-worktree for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Mei Abebe· Dec 4, 2024
Keeps context tight: git-worktree is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Kiara Singh· Dec 4, 2024
Solid pick for teams standardizing on skills: git-worktree is focused, and the summary matches what you get after install.
- ★★★★★Lucas Khan· Nov 23, 2024
git-worktree is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Zara Garcia· Nov 23, 2024
Registry listing for git-worktree matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Yash Thakker· Nov 11, 2024
Keeps context tight: git-worktree is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Emma Choi· Nov 11, 2024
git-worktree reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Zara Martinez· Oct 14, 2024
Useful defaults in git-worktree — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
showing 1-10 of 50