.claude/skills/worktree-create/SKILL.md
Create a new git worktree with dedicated branch and bootstrapped dev environment
npx skillsauth add the-agency-ai/the-agency .claude/skills/worktree-createInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create a new git worktree under .claude/worktrees/ with a dedicated branch and bootstrapped dev environment.
$ARGUMENTS: Two supported forms:
<name> in kebab-case (e.g., fix-auth-bug, refactor-cart) — for experiments and standalone branches that don't belong to a workstream.--workstream <ws> --agent <ag> — for agents working on a declared workstream. The worktree directory name is computed from these two via the collapse rule below.Both forms accept optional --from <branch> to branch off a specific ref instead of current HEAD.
Per the worktree naming convention (dispatches #166, #169), when both --workstream and --agent are given, the worktree directory name is computed:
if agent == workstream OR agent.startswith(workstream + "-"):
name = agent # collapse: drop the workstream prefix
else:
name = "workstream-agent" # full form: join with hyphen
Examples:
| Workstream | Agent | Worktree name |
|-----------|-------|---------------|
| devex | devex | devex (exact match → collapse) |
| iscp | iscp | iscp (exact match → collapse) |
| mdpal | mdpal-app | mdpal-app (prefix match → collapse) |
| mdpal | mdpal-cli | mdpal-cli (prefix match → collapse) |
| agency | captain | agency-captain (no match → full form) |
| fleet | captain | fleet-captain (no match → full form) |
The claude/tools/worktree-create --compute-only --workstream <ws> --agent <ag> mode prints the computed name without creating anything — useful if you want to check the canonical name before committing to a worktree layout.
If $ARGUMENTS is empty, ask for either a name OR a workstream+agent pair.
Parse:
--workstream <ws> and --agent <ag> are both present, compute the name via the collapse rule above (workstream agent form)--from <branch> is present, record as base ref--workstream/--agent is an error (ambiguous)--agent <agent-name> is present WITHOUT --workstream, record as agent name for identity binding (the tool's .agency-agent file handling continues to support this)git worktree list — abort if .claude/worktrees/<name> already existsgit show-ref refs/heads/<name> — abort if branch existsIf --from <branch> was specified: git rev-parse --verify <branch> — abort if invalid.
git worktree add .claude/worktrees/<name> -b <name> [<base-ref>]
Write the agent name to .claude/worktrees/<name>/.agency-agent so agent-identity resolves correctly in this worktree.
--agent <agent-name> was provided, use that<name> as the agent nameecho "<agent-name>" > .claude/worktrees/<name>/.agency-agent
This file is gitignored (worktrees are local state) but critical for ISCP — without it, the worktree agent resolves as captain.
If ./claude/tools/dependencies-install exists, run it in the worktree directory to install project dependencies.
Otherwise, check for common dependency files and install:
package.json → run the project's package manager installGemfile → bundle installrequirements.txt → pip install -r requirements.txtgo.mod → go mod downloadWorktree created:
Path: .claude/worktrees/<name>/
Branch: <name>
Base: <base-ref or current HEAD>
To work in this worktree:
cd .claude/worktrees/<name>/ && claude
business
Sync worktree with master — merge, copy settings, run sandbox-sync, report changes
tools
List all git worktrees with status info (branch, clean/dirty, deps)
tools
Remove a git worktree and optionally delete its branch
development
Create a new git worktree with dedicated branch and bootstrapped dev environment