worktrees
Git Worktrees for Parallel Development
Overview
This skill enables parallel development by using git worktrees. Each worktree provides an isolated working directory with its own branch, allowing multiple agents to work on different features simultaneously without conflicts.
When to Use This Skill
Use this skill when:
- User explicitly requests to work in a new worktree (e.g., "Work in a new worktree")
- User wants to develop a feature in isolation while preserving the main working directory
- Multiple agents need to work on different tasks in parallel
Workflow
1. Determine Branch Name
Choose a descriptive branch name for the feature or task to be worked on. The branch name should follow standard git naming conventions (lowercase, hyphen-separated, e.g., add-user-authentication, fix-login-bug).
2. Create Worktree
Create a new worktree in the .worktrees/ directory within the current project:
git worktree add .worktrees/<branch-name> -b <branch-name>
This command:
- Creates a new directory at
.worktrees/<branch-name> - Creates and checks out a new branch named
<branch-name> - Links the worktree to the current repository
3. Switch to Worktree
Change the working directory to the newly created worktree:
cd .worktrees/<branch-name>
4. Work in Isolation
Proceed with development tasks in the worktree. This environment is completely isolated from the main working directory, allowing independent work without interference.
All standard git operations (commit, push, pull, etc.) work normally within the worktree.
Note: If this project runs services (web apps, docker-compose, etc.), see apps.md for setup steps including environment file copying, port allocation, and service startup.
5. List Active Worktrees (Optional)
To view all active worktrees:
git worktree list
This displays all worktrees, their paths, and the branches they're on.
6. Remove Worktree (Optional)
When you're done with a worktree, you can remove it:
git worktree remove .worktrees/<branch-name>
Note: Don't automatically remove worktrees. Leave that decision to the user. If the worktree is running services (see apps.md), make sure to stop those services first before removing the worktree.
Important Notes
- The
.worktrees/directory should be added to.gitignoreif not already present - Each worktree maintains its own working directory but shares the same git repository
- Worktrees enable true parallel development without the need for stashing or branch switching
- After creating and switching to a worktree, inform the user of the new working directory path
More from nilecui/skillsbase
using-shadcn-ui
Use when building React UI components, implementing design systems, or needing pre-built accessible components - leverages shadcn/ui primitives and shadcnblocks.com (829 production-ready blocks) for rapid interface development
22architecture-diagrams
Create system architecture diagrams using Mermaid, PlantUML, C4 model, flowcharts, and sequence diagrams. Use when documenting architecture, system design, data flows, or technical workflows.
19llm-docs-optimizer
Optimize documentation for AI coding assistants and LLMs. Improves docs for Claude, Copilot, and other AI tools through c7score optimization, llms.txt generation, question-driven restructuring, and automated quality scoring. Use when asked to improve, optimize, or enhance documentation for AI assistants, LLMs, c7score, Context7, or when creating llms.txt files. Also use for documentation quality analysis, README optimization, or ensuring docs follow best practices for LLM retrieval systems.
14documentation-generation
Create comprehensive technical documentation including API docs, component libraries, README files, architecture diagrams, and developer guides using tools like JSDoc, Storybook, or Docusaurus. Use when documenting APIs, creating component documentation, writing README files, generating API references, documenting architecture decisions, creating onboarding guides, maintaining changelogs, documenting configuration options, or building developer documentation sites.
12deepresearch-integrator
Consolidate multiple deepresearch results into a single comprehensive report following best practices for iterative processing
11mermaid
Guide for creating mermaid diagrams. This skill should be used when users want to create a mermaid diagram (or update an existing diagram).
11