skills/create-worktree/SKILL.md
Git worktree with env copy
npx skillsauth add laststance/skills create-worktreeInstall 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.
When running this skill in Codex, translate Claude Code-only primitives before acting: AskUserQuestion -> chat/request_user_input, TodoWrite -> update_plan, Task/TaskCreate/TeamCreate/SendMessage -> spawn_agent/send_input/wait_agent when available and allowed, and EnterPlanMode/ExitPlanMode -> a concise chat plan plus explicit approval.
Resolve Read/Write/Edit/Bash/WebSearch/WebFetch to Codex file/shell/web tools, and map ~/.claude/... paths to ~/.agents/... or ~/.codex/... unless the task explicitly targets Claude Code. EnterWorktree is Claude Code–only — on Codex, switch into the worktree with cd /absolute/path/to/new-worktree instead (the script already ran git worktree add).
When running this skill in Cursor Agent, translate Claude Code-only primitives before acting: AskUserQuestion -> AskQuestion; TodoWrite -> Cursor TodoWrite or an equivalent checklist; Task/TaskCreate/TeamCreate/SendMessage/multi-agent flows -> Cursor Task (subagents), parallel Tasks, or run_in_background when allowed (TeamCreate/SendMessage may have no exact match); EnterPlanMode/ExitPlanMode -> Plan mode (SwitchMode / CreatePlan) plus explicit user approval.
Resolve Read/Write/Edit/StrReplace/Bash/web/search/MCP via Cursor Composer or Agent equivalents. MCP names written as mcp__server__tool typically map to call_mcp_tool with configured server identifiers. Map ~/.claude/... to ~/.cursor/skills/, .cursor/skills/, and .cursor/rules/ unless the task explicitly targets Claude Code. EnterWorktree is Claude Code–only — on Cursor, switch into the worktree with cd /absolute/path/to/new-worktree instead (the script already ran git worktree add).
Creates a git worktree at <parent>/<project>-<branch>, copies .gitignored configuration files (excluding heavy build/dependency dirs), and navigates into it.
Get the branch name. Ask the user via AskUserQuestion if not provided. Suggested format: feat/..., fix/..., or any topic name.
Run the script from the current project root:
bash ~/.claude/skills/create-worktree/scripts/create-worktree.sh <branch-name>
Read the printed Path: line from the script output. The script ends with:
Path: /absolute/path/to/new-worktree
Switch the session into the new worktree using the EnterWorktree tool with the printed path. The script already registered the worktree via git worktree add, so it appears in git worktree list and EnterWorktree can enter it directly:
EnterWorktree({ path: "/absolute/path/to/new-worktree" })
This actually moves the agent's working directory into the worktree (unlike a bare cd, whose shell state does not propagate out of a Bash call). On non–Claude Code agents that lack EnterWorktree, fall back to cd /absolute/path/to/new-worktree (see compat notes).
Confirm to the user in Japanese (per global preference):
.env 等の ignored ファイルがコピー済みであることnode_modules 等の重いディレクトリはスキップしたので pnpm install が必要な旨All entries listed by git ls-files --others --ignored --exclude-standard --directory — typically .env, .env.local, .vercel/ config, .tsbuildinfo, etc.
node_modules, .next, dist, build, .cache, coverage, .turbo, .vercel/output, .serena, test-results, playwright-report, storybook-static, out, html, .yarn
HEAD/ (e.g., feat/foo) → directory uses - (e.g., corelive-feat-foo)EnterWorktree({ path }) so the switch persists for the rest of the session; a bare cd in a Bash call does not.testing
Cited research briefs
development
Daily coding habit prompts JP
development
React core deep-dive JP
data-ai
Copy last agent reply