Agent skill
worktrees
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 this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/worktrees
SKILL.md
Git worktrees create isolated workspaces sharing the same repository. Create worktrees in .worktree/<branch> inside the project directory using git worktree add .worktree/<branch> -b <branch>. For ~/.dotfiles repo use ./bin/git-worktree-crypt <branch> instead (creates at .worktrees/<branch>, uses git-crypt). Avoid branch names with / as they create nested directories.
Before finishing your implementation use /rebuild skill to rebuild or test the rebuild in the worktree changes. If your implementation works, and you rebuilt and tested or manually tested, continue to PR creation.
Push to remote and create PR/MR with gh or glab. Run PR commands from main repo directory (not worktree) to avoid git detection issues: cd /path/to/repo && gh pr create --head <branch> --title "..." --body "...". Monitor CI with gh pr checks <number> or glab ci status. Share the PR/MR link and continue with /pr-iteration for code review handling.
Maintain worktree isolation throughout the session. If worktree breaks due to deleted CWD or git-crypt issues, recreate rather than falling back to main. After PR merged or pending review, return to main workspace and rebuild from main branch so system returns to stable state. Keep worktree locally for follow-up work.
<red_flags>
Never skip tests before declaring ready. Never commit to main when worktree isolation was requested. In ~/.dotfiles, never use plain git worktree add.
</red_flags>
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?