Ensures all file operations occur in the correct worktree directory to prevent accidental changes to the wrong codebase. Use when implementing, reviewing, testing, or documenting code in worktree-based development workflows.
Verifies the current working directory and git branch before any file operations. Claude will use this whenever a worktree path is provided to ensure all changes are made in the correct isolated directory.
/plugin marketplace add binee108/nine-step-workflow-plugin/plugin install nine-step-workflow@lilylab-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
If worktree path provided:
cd {{worktree_path}}pwd and git branchIf NO path provided:
Multiple features develop in parallel using separate worktrees. Wrong directory = contaminate another feature's code or main project.
Parallel development scenario:
Main Project: /project/
├─ Worktree A: /project/.worktree/feature-auth/
├─ Worktree B: /project/.worktree/feature-api/
└─ Worktree C: /project/.worktree/fix-bug/
Without path verification:
With path verification:
# Conductor: "Implement Phase 1 in .worktree/feature-auth/"
# 1. Navigate and verify
cd .worktree/feature-auth/
pwd # Output: /project/.worktree/feature-auth
git branch # Output: * feature/auth
# 2. Confirm
Working directory: .worktree/feature-auth/
Current branch: feature/auth
✅ Path verification complete
# 3. Now safe to work
Read("{{src_directory}}/{{service_file}}")
Edit("{{src_directory}}/{{service_file}}", ...)
Before EVERY task:
[ ] Worktree path received from conductor?
[ ] If NO: Asked conductor and STOPPED?
[ ] Navigated: cd {{worktree_path}}?
[ ] Verified: pwd + git branch?
[ ] Confirmed in output?
During task:
[ ] ALL operations within worktree?
[ ] NO cross-worktree access?
[ ] NO main project access?
Conductor assigns:
📍 Working Context
- Worktree Path: .worktree/feature-payment/
- Branch: feature/payment
- Current Phase: Phase 2 - Payment Gateway Integration
- Current Step: Step 3 (Code Implementation)
Agent response:
# Step 1: Navigate
cd .worktree/feature-payment/
# Step 2: Verify
pwd
# Output: /Users/{{user}}/{{project}}/.worktree/feature-payment
git branch
# Output: * feature/payment
# Step 3: Confirm
✅ Working directory verified:
Path: .worktree/feature-payment/
Branch: feature/payment
# Step 4: Begin work
Starting Phase 2 implementation...
Conductor assigns (MISSING PATH):
Implement payment validation logic
Agent response:
⚠️ STOPPED: Worktree path not provided
Before proceeding, I need:
1. Worktree path (e.g., .worktree/{{feature-name}}/)
2. Branch name (e.g., feature/{{feature-name}})
3. Current Phase and Step
Please provide the working context.
DO NOT:
Phase 1 complete, starting Phase 2:
Conductor:
Phase 1 complete. Continue to Phase 2 in same worktree:
- Worktree Path: .worktree/feature-payment/
- Branch: feature/payment
- Current Phase: Phase 2
Agent response:
# Re-verify (even if same worktree)
pwd
# Output: /Users/{{user}}/{{project}}/.worktree/feature-payment
git branch
# Output: * feature/payment
✅ Path re-verified for Phase 2
Continuing in same worktree...
Why re-verify?
Sometimes need to reference another worktree:
Allowed:
# Current: .worktree/feature-payment/
# Need to check how authentication works in feature-auth
# Read-only reference
Read("/project/.worktree/feature-auth/{{src}}/auth_service.py")
# But NEVER write to it
# ❌ Edit("/project/.worktree/feature-auth/...") # FORBIDDEN
Rule:
# Agent starts working without verification
Edit("{{src}}/payment_service.py", ...)
# But current directory is main project!
pwd
# Output: /Users/{{user}}/{{project}}/ # ❌ WRONG!
Impact: Main project contaminated, production broken
Prevention:
# Always verify FIRST
cd .worktree/feature-payment/
pwd # Confirm worktree path
# THEN work
Edit("{{src}}/payment_service.py", ...)
# Agent in .worktree/feature-auth/
cd .worktree/feature-auth/
# But accidentally edits feature-payment
Edit("../.worktree/feature-payment/{{src}}/payment.py", ...) # ❌ WRONG!
Impact: feature-payment corrupted by feature-auth agent
Prevention:
# Only work within current worktree
Edit("{{src}}/auth_service.py", ...) # ✅ Relative to current worktree
# Never use .. to access other worktrees
# Conductor says "work in feature-payment"
# Agent assumes path without verification
Edit("{{src}}/payment_service.py", ...) # ❌ Where am I?
Impact: Unknown working directory, unpredictable results
Prevention:
# Always verify explicitly
cd .worktree/feature-payment/
pwd && git branch # Verify both path and branch
# THEN work
Agents should use this pattern:
# ===== WORKTREE PATH VERIFICATION =====
# Provided: {{worktree_path}}
# Navigate
cd {{worktree_path}}
# Verify path
CURRENT_PATH=$(pwd)
echo "Current path: $CURRENT_PATH"
# Verify branch
CURRENT_BRANCH=$(git branch --show-current)
echo "Current branch: $CURRENT_BRANCH"
# Confirm
echo "✅ Verification complete:"
echo " Path: {{worktree_path}}"
echo " Absolute: $CURRENT_PATH"
echo " Branch: $CURRENT_BRANCH"
# ===== BEGIN WORK =====
Step 2.5 (User Approval):
.worktree/{{feature-name}}/Step 3-9 (All work in worktree):
After Step 9 (All phases complete):
Always provide this information to Step 3-9 agents:
📍 Working Context
- Worktree Path: .worktree/{{feature-name}}/
- Branch: feature/{{feature-name}}
- Current Phase: Phase X - {{description}}
- Current Step: Step Y ({{step_name}})
- Work Scope: {{files/directories}}
Never assume agents know the path Never skip path verification
For detailed guidelines, see reference.md For more examples, see examples.md
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.