GitLab Issue Worktree Creation
Overview
Use this skill to execute the existing workflow migrated from gitlab/create-worktree.md.
Follow the playbook below and adapt commands to the current repository context.
Playbook
GitLab Issue Worktree Creation
Create a git worktree for a GitLab issue in the parent directory to keep the main working directory clean.
Command Usage
Provide a GitLab issue URL or issue number: $ARGUMENTS
Workflow
- •
Check glab CLI installation via
~/.claude/scripts/check_glab.sh- •Executes the
~/.claude/scripts/check_glab.shscript without any arguments to verifyglabis installed and authenticated. - •The script will stop execution and provide instructions if
glabis not found or configured.
- •Executes the
- •
Extract and validate issue
- •Parse issue number from URL or direct number input
- •Fetch issue details using
glab issue view - •Display issue title and description
- •
Determine branch name
- •Fetch latest branches from remote using
git fetch --all --prune - •Search for existing branches with the issue number (e.g.,
feature/123,issue-123) - •If no branch exists, create branch name from issue (e.g.,
feature/123-feature-description)
- •Fetch latest branches from remote using
- •
Create Git Worktree
- •Executes
~/.claude/scripts/git-create-worktree.shpassing the determined branch name (e.g.,feature/123-feature-description) as the sole argument. - •This script handles the logic for creating the worktree and outputs its path.
- •Example:
~/.claude/scripts/git-create-worktree.sh <branch_name>
- •Executes
- •
Create tmux Development Session
- •Executes
~/.claude/scripts/tmux-create-session.shwith two arguments:- •Session Name:
{issue_number}-develop - •Target Directory: The path to the newly created worktree directory from step 4.
- •Session Name:
- •Example:
~/.claude/scripts/tmux-create-session.sh {issue_number}-develop <path_to_worktree>
- •Executes
Notes
- •Worktrees are created in
../worktrees/to keep the main project clean - •The command handles both issue URLs and issue numbers
- •Uses
git fetchto update branch list instead ofglabfor better reliability - •Automatically detects existing branches associated with the issue (supports
feature/{number},issue-{number}patterns) - •Creates descriptive branch names from issue title if no branch exists (format:
feature/{number}-{slug}) - •Supports both local and remote branches
- •Automatically creates a tmux session named
{issue-number}-developif tmux is installed - •Automatically starts claude code in the tmux session for immediate development