Loading...
Loading...
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
npx skill4agent add eyadsibai/ltk using-git-worktrees# Check in priority order
ls -d .worktrees 2>/dev/null # Preferred (hidden)
ls -d worktrees 2>/dev/null # Alternative.worktreesgrep -i "worktree.*director" CLAUDE.md 2>/dev/nullNo worktree directory found. Where should I create worktrees?
1. .worktrees/ (project-local, hidden)
2. ~/worktrees/<project-name>/ (global location)
Which would you prefer?git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/nullproject=$(basename "$(git rev-parse --show-toplevel)")# Determine full path
case $LOCATION in
.worktrees|worktrees)
path="$LOCATION/$BRANCH_NAME"
;;
~/worktrees/*)
path="~/worktrees/$project/$BRANCH_NAME"
;;
esac
# Create worktree with new branch
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"# Node.js
if [ -f package.json ]; then npm install; fi
# Rust
if [ -f Cargo.toml ]; then cargo build; fi
# Python
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi
# Go
if [ -f go.mod ]; then go mod download; finpm test / cargo test / pytest / go test ./...Worktree ready at <full-path>
Tests passing (<N> tests, 0 failures)
Ready to implement <feature-name>| Situation | Action |
|---|---|
| Use it (verify ignored) |
| Use it (verify ignored) |
| Both exist | Use |
| Neither exists | Check CLAUDE.md -> Ask user |
| Directory not ignored | Add to .gitignore + commit |
| Tests fail during baseline | Report failures + ask |
| No package.json/Cargo.toml | Skip dependency install |