Local Review
System Prompt
⚠️ EXECUTION DIRECTIVE: When the user invokes this command, you MUST:
- IMMEDIATELY execute - no questions, no explanations first
- ALWAYS show full output from script/tool execution
- ALWAYS provide summary after execution completes
DO NOT:
- Say "I don't need to take action" - you ALWAYS execute when invoked
- Ask for confirmation unless
requires_confirmation: truein frontmatter - Skip execution even if it seems redundant - run it anyway
The user invoking the command IS the confirmation.
Usage
/local-review [path]
Set up review environment for: $ARGUMENTS
You are tasked with setting up a local review environment for a colleague's branch. This involves creating a worktree, setting up dependencies, and launching a new Claude Code session.
Arguments
$ARGUMENTS - Branch Specification (required)
Specify the branch to review:
- Format: "gh_username:branchName"
- Example: "johndoe:feature/auth-improvement"
- With ticket: "alice:eng-1234-add-validation"
Default Behavior
If no arguments:
- Prompts for branch in format:
gh_username:branchName - Extracts ticket number if present
- Creates worktree with appropriate naming
Process
When invoked with a parameter like gh_username:branchName:
-
Parse the input:
- Extract GitHub username and branch name from the format
username:branchname - If no parameter provided, ask for it in the format:
gh_username:branchName
- Extract GitHub username and branch name from the format
-
Extract ticket information:
- Look for ticket numbers in the branch name (e.g.,
eng-1696,ENG-1696) - Use this to create a short worktree directory name
- If no ticket found, use a sanitized version of the branch name
- Look for ticket numbers in the branch name (e.g.,
-
Set up the remote and worktree:
- Check if the remote already exists using
git remote -v - If not, add it:
git remote add USERNAME git@github.com:USERNAME/humanlayer - Fetch from the remote:
git fetch USERNAME - Create worktree:
git worktree add -b BRANCHNAME ~/wt/humanlayer/SHORT_NAME USERNAME/BRANCHNAME
- Check if the remote already exists using
-
Configure the worktree:
- Copy Claude settings:
cp .claude/settings.local.json WORKTREE/.claude/ - Run setup:
make -C WORKTREE setup - Initialize thoughts:
cd WORKTREE && humanlayer thoughts init --directory humanlayer
- Copy Claude settings:
Error Handling
- If worktree already exists, inform the user they need to remove it first
- If remote fetch fails, check if the username/repo exists
- If setup fails, provide the error but continue with the launch
Example Usage
/local-review samdickson22:sam/eng-1696-hotkey-for-yolo-mode
This will:
- Add 'samdickson22' as a remote
- Create worktree at
~/wt/humanlayer/eng-1696 - Set up the environment
Action Policy
<default_behavior> This command analyzes and recommends without making changes. Provides:
- Detailed analysis of current state
- Specific recommendations with justification
- Prioritized action items
- Risk assessment
User decides which recommendations to implement. </default_behavior>
Success Output
When local-review completes:
✅ COMMAND COMPLETE: /local-review
Branch: <username>:<branch>
Worktree: ~/wt/<project>/<short-name>
Remote: <username> added
Setup: Complete
Completion Checklist
Before marking complete:
- Username/branch parsed
- Remote configured
- Worktree created
- Settings copied
- Setup executed
Failure Indicators
This command has FAILED if:
- ❌ Invalid branch format
- ❌ Remote fetch failed
- ❌ Worktree creation failed
- ❌ Setup failed
When NOT to Use
Do NOT use when:
- Reviewing own branch
- Remote already setup
- No worktree needed
Anti-Patterns (Avoid)
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Skip fetch | Stale branch | Always fetch first |
| Wrong format | Parse error | Use username:branch format |
| Existing worktree | Conflict | Remove old worktree first |
Principles
This command embodies:
- #3 Complete Execution - Full setup workflow
- #1 Self-Provisioning - Auto-configure environment
- #6 Clear, Understandable - Clear worktree path
Full Standard: CODITECT-STANDARD-AUTOMATION.md