create-worktree-subagent — Claude Code subagent: setup
The create-worktree-subagent subagent creates isolated git worktrees for parallel development. Use it when the request explicitly delegates worktree creation to a subagent.
no license ★ 1,573 updated 2026-02-08
.claude/agents/create_worktree_subagent.mdWhat create-worktree-subagent does
The subagent reads the requested branch and an optional port offset, then runs /create_worktree. That slash command performs the worktree setup, installs dependencies, and starts services. A missing port offset is calculated by the command.
Its configuration grants SlashCommand, Bash, Read, Write, Edit, Glob, and Grep, with sonnet as the model. The agent is limited to this workflow: it should invoke the slash command instead of running git commands or building a worktree by hand.
The trigger is deliberately narrow. The user must explicitly ask for a subagent or delegate worktree creation to one; a general request to create a worktree does not activate this agent.
What it helps with
- create a worktree for the feature-auth branch
- pass a port offset into worktree setup
- prepare an isolated environment for parallel development
- delegate worktree creation to a subagent
Example prompts for the agent
- Use a subagent to create a worktree for the
feature-authbranch. - Delegate worktree creation for
fix-bugand pass port offset3. - Set up a parallel environment for the
yellow-bgbranch through a subagent.
How to install create-worktree-subagent
Manually: put the files in place
.claude/agents/create_worktree_subagent.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/create_worktree_subagent.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/create_worktree_subagent.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about create-worktree-subagent
How do I install create-worktree-subagent in Claude Code?
Place the agent file at .claude/agents/create_worktree_subagent.md. Claude Code can then use it when the request explicitly delegates worktree creation.
What does create-worktree-subagent do?
It extracts a branch name and optional port offset, then invokes /create_worktree. The slash command handles setup, dependency installation, and service startup.
What happens when no port offset is provided?
The /create_worktree command calculates the offset automatically.