dev-worktree
This skill should be used when the user asks to "create an isolated worktree", "set up worktree for feature", "create a feature branch worktree", or needs workspace isolation with automatic dependency setup and test verification.
Best use case
dev-worktree is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
This skill should be used when the user asks to "create an isolated worktree", "set up worktree for feature", "create a feature branch worktree", or needs workspace isolation with automatic dependency setup and test verification.
Teams using dev-worktree should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/dev-worktree/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How dev-worktree Compares
| Feature / Agent | dev-worktree | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
This skill should be used when the user asks to "create an isolated worktree", "set up worktree for feature", "create a feature branch worktree", or needs workspace isolation with automatic dependency setup and test verification.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Create Development Worktree
Create an isolated git worktree for feature work, ensuring workspace isolation and clean baseline.
## The Process
### Step 1: Ensure .worktrees/ is Gitignored
**CRITICAL:** Verify worktree directory is gitignored to prevent accidental commits.
**Run:**
```bash
if ! git check-ignore -q .worktrees 2>/dev/null; then
echo "Adding .worktrees/ to .gitignore"
echo ".worktrees/" >> .gitignore
git add .gitignore
git commit -m "chore: add .worktrees/ to gitignore
Co-Authored-By: Claude <noreply@anthropic.com>"
fi
```
**Description:** dev-worktree: check if .worktrees is gitignored and add if missing
### Step 2: Determine Branch Name
Extract from `.planning/PLAN.md` first line or infer from feature name:
**Run:**
```bash
# Extract from PLAN.md if exists
feature_name=$(grep -m1 '^# ' .planning/PLAN.md 2>/dev/null | sed 's/^# //' | tr '[:upper:] ' '[:lower:]-' | sed 's/[^a-z0-9-]//g')
# Or ask user if needed
```
**Description:** dev-worktree: extract or prompt for feature name
Branch name format: `feature/${feature_name}`
### Step 3: Create Worktree
**Run:**
```bash
# Create worktree with new branch
git worktree add .worktrees/${feature_name} -b feature/${feature_name}
# Change to worktree directory
cd .worktrees/${feature_name}
```
**Description:** dev-worktree: create isolated git worktree with feature branch
### Step 4: Run Project Setup
Auto-detect and run setup based on project files:
**Run:**
```bash
# Node.js
if [ -f package.json ]; then
npm install
fi
# Python
if [ -f requirements.txt ]; then
pip install -r requirements.txt
fi
if [ -f pyproject.toml ]; then
poetry install || pip install -e .
fi
if [ -f pixi.toml ]; then
pixi install
fi
# Rust
if [ -f Cargo.toml ]; then
cargo build
fi
# Go
if [ -f go.mod ]; then
go mod download
fi
```
**Description:** dev-worktree: auto-detect project type and install dependencies
### Step 5: Verify Clean Baseline (MANDATORY)
<EXTREMELY-IMPORTANT>
**You MUST run tests to verify baseline. This is not optional.**
A worktree without a verified baseline is a trap. You will not know if failures are yours or pre-existing.
**Run:**
```bash
# Examples - auto-detect test command
if [ -f package.json ] && grep -q '"test"' package.json; then
npm test
elif [ -f Cargo.toml ]; then
cargo test
elif [ -f pytest.ini ] || [ -f pyproject.toml ]; then
pytest
elif [ -f go.mod ]; then
go test ./...
fi
```
**Description:** dev-worktree: auto-detect and run project test suite
**If tests fail:** Report failures and note that baseline has issues. Do NOT proceed silently.
**If tests pass:** Report clean baseline.
### Baseline Facts
- A worktree is not the main checkout: different env, paths, and symlinks mean green-on-main does not imply green-in-worktree, and install success != test success. Claiming a clean baseline without running tests is an unverified claim presented as fact — every later failure becomes ambiguous, and you can't tell which bugs are yours and which were inherited.
</EXTREMELY-IMPORTANT>
### Step 6: Report Ready
Report completion status:
```
✓ Worktree created: .worktrees/${feature_name}
✓ Branch: feature/${feature_name}
✓ Dependencies installed
✓ Tests passing (or note if failed)
Ready for implementation.
```
## Safety Checks
**Execute before creating worktree:**
- Verify .worktrees/ is gitignored
- Add to .gitignore if missing
- Commit gitignore change
**Execute after creating worktree:**
- Run project setup (npm install, etc.)
- Verify clean baseline with tests
- Report status
## Red Flags
**Critical - Never deviate from these rules:**
- Do not create worktree without verifying gitignore
- Do not skip project setup commands
- Do not proceed without reporting test status
**Critical - Always follow these rules:**
- Verify .worktrees/ is ignored before creating
- Auto-detect project type and run appropriate setup
- Report test baseline status
## Common Patterns
### Node.js Project
```bash
# .worktrees/ gitignored → create worktree → npm install → npm test
```
### Python Project
```bash
# .worktrees/ gitignored → create worktree → pixi install → pytest
```
### Rust Project
```bash
# .worktrees/ gitignored → create worktree → cargo build → cargo test
```
## Workflow Transition
After worktree creation, the workspace is ready. Proceed to dev-implement to start implementing tasks.
Current working directory: `.worktrees/${feature_name}`
All implementation work happens here, keeping main workspace clean.Related Skills
writing
This skill should be used when the user asks to 'write a paper', 'start a writing project', 'draft an article', 'write about', 'brainstorm writing topics', 'gather sources for a paper', 'what should I write about', or needs the writing workflow entry point for any writing task.
writing-validate
Validate draft sections cover all PRECIS claims before review.
writing-setup
Internal skill for creating PRECIS.md, OUTLINE.md, and ACTIVE_WORKFLOW.md. Called after brainstorm sources are gathered.
writing-revise
This skill should be used when the user asks to 'revise writing', 'fix review issues', 'polish draft', 'apply review feedback', 'complete writing workflow', or after /writing-review produces REVIEW.md with issues to fix.
writing-review
Internal skill for hierarchical document review. Called by writing-validate after claim validation passes.
writing-precis-reviewer
Internal skill used by writing-setup at exit gate. Dispatches a reviewer subagent to verify PRECIS.md quality before outlining. NOT user-facing.
writing-outline
Internal skill for creating detailed section outlines. Called by /writing workflow after PRECIS and master OUTLINE are complete.
writing-outline-reviewer
Internal skill used by writing-outline at exit gate. Dispatches a reviewer subagent to verify OUTLINE.md quality before drafting. NOT user-facing.
writing-lit-review
Internal skill for literature review and source materialization. Called after brainstorm, before setup. NOT user-facing.
writing-legal
Internal skill for academic legal writing. Loaded by /writing when style=legal. Based on Volokh's "Academic Legal Writing".
writing-handoff
Create structured handoff document for writing workflow session pause/resume.
writing-general
Internal skill for Strunk & White writing rules. Loaded by /writing for quick edits or as base layer for domain skills.