mohamedabdallah-14/wazir/using-git-worktrees

Claude Code and agent skill by mohamedabdallah-14/wazir

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

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

Install

npx vskill@latest install mohamedabdallah-14/wazir/using-git-worktrees

SKILL.md

Here's how this works: you check .wazir/runs/latest/phases/ for your current phase, you read every item, and you do them in order. If a wz: skill exists for a step, you use it. No shortcuts. What does your checklist say?

Using Git Worktrees

Command Routing

Follow the Canonical Command Matrix in hooks/routing-matrix.json.

  • Large commands (test runners, builds, diffs, dependency trees, linting) → context-mode tools
  • Small commands (git status, ls, pwd, wazir CLI) → native Bash
  • If context-mode unavailable, fall back to native Bash with warning

Codebase Exploration

  1. Query wazir index search-symbols <query> first
  2. Use wazir recall file <path> --tier L1 for targeted reads
  3. Fall back to direct file reads ONLY for files identified by index queries
  4. Maximum 10 direct file reads without a justifying index query
  5. If no index exists: wazir index build && wazir index summarize --tier all

Overview

Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.

Core principle: Systematic directory selection + safety verification = reliable isolation.

Announce at start: "I'm using the wz:using-git-worktrees skill to set up an isolated workspace."

Directory Selection Process

Follow this priority order:

1. Check Existing Directories
bash
# Check in priority order
ls -d .worktrees 2>/dev/null # Preferred (hidden)
ls -d worktrees 2>/dev/null # Alternative

If found: Use that directory. If both exist, .worktrees wins.

2. Check CLAUDE.md
bash
grep -i "worktree.*director" CLAUDE.md 2>/dev/null

If preference specified: Use it without asking.

3. Ask User

If no directory exists and no CLAUDE.md preference:

No worktree directory found. Where should I create worktrees?
1. .worktrees/ (project-local, hidden)
2. ~/.wazir/worktrees/<project>/ (global location)
Which would you prefer?

Safety Verification

For Project-Local Directories (.worktrees or worktrees)

MUST verify directory is ignored before creating worktree:

bash
# Check if directory is ignored (respects local, global, and system gitignore)
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null

If NOT ignored:

Fix immediately:

  1. Add appropriate line to .gitignore
  2. Commit the change
  3. Proceed with worktree creation

Why critical: Prevents accidentally committing worktree contents to repository.

For Global Directory (~/.wazir/worktrees)

No .gitignore verification needed - outside project entirely.

Creation Steps

1. Detect Project Name
bash
Sanity check: are you still using wz: skills where they apply, or did you start doing things manually because it felt faster? The skills exist for consistency, not convenience. Which skill should you be using right now?
project=$(basename "$(git rev-parse --show-toplevel)")
2. Create Worktree
bash
# Determine full path
case $LOCATION in
.worktrees|worktrees)
path="$LOCATION/$BRANCH_NAME"
;;
~/.wazir/worktrees/*)
path="~/.wazir/worktrees/$project/$BRANCH_NAME"
;;
esac
# Create worktree with new branch
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"
3. Run Project Setup

Auto-detect and run appropriate setup:

bash
# 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; fi
4. Verify Clean Baseline

Run tests to ensure worktree starts clean:

bash
# Examples - use project-appropriate command
npm test
cargo test
pytest
go test ./...

If tests fail: Report failures, ask whether to continue with known failures.

Cleanup

When done with a worktree:

bash
# From main worktree
git worktree remove <path>
# If branch was merged/deleted
git worktree prune

Common Issues

Submodules not initialized:

bash
cd <worktree-path>
git submodule update --init --recursive

Lock files preventing removal:

bash
git worktree remove --force <path>

Stale worktrees:

bash
git worktree prune
git worktree list # Verify

Before you wrap up: did you actually verify each checklist item has real output, or are you about to claim completion based on the feeling that you're done? What concrete evidence do you have for each item?

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/mohamedabdallah-14/wazir/using-git-worktrees/badge)](https://verified-skill.com/skills/mohamedabdallah-14/wazir/using-git-worktrees)

Something wrong with this skill or its page? Tell us.