create-worker-worktree
Skill1 starsChanged 4 months agoMITView on GitHub
Create one permanent worker worktree so a second agent session can work in parallel without touching the main working copy. Use when a second session should open on the same repository, when the session guard reports another active session, when the user asks for parallel agents, a Codex/Claude worker, or a worktree, or when two sessions keep disturbing each other's files, index, or branch. Creates <repo>-<worker> on the protected branch <worker>-workbench from the default branch and registers it in .csk/worktrees.json.
- Reads credentials
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- 1-csk-initSkill
- 2-csk-write-specSkill
- 3-csk-architectureSkill
- 4-csk-frontendSkill
- 5-csk-backendSkill
- 6-csk-qaSkill
- 7-csk-deploySkill
- audit-plan-loopSkill
- claude-skill-proxy-syncSkill
- csk-adopt-plan-scaffoldSkill
- csk-helpSkill
- csk-refineSkill
- csk-startSkill
- finish-branchSkill
- pull-main-ffSkill
- review-loopSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
When this skill starts, first give the user one or two plain-language sentences in the user's language, for example: "Wir legen jetzt einen …
- Distinctive: line 24
One session at a time: no worktree is needed. Working on the default branch is correct and simpler.
- Very specific: line 32
Ask for the worker name if not given (short lowercase name such as codex, claude2, worker2.
- Very specific: line 54
Read the JSON result between WORKER_WORKTREE_RESULT_BEGIN/END and present, in the user's language:
- Distinctive: line 64
Create the worktree (done - once).
- Distinctive: line 83
Delete or prune worktrees.
- Distinctive: line 84
Create the worktree when the level check says one session is enough.
- Very specific: line 85
Remove the branch protection that the script recorded.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Create Worker Worktree
Give a second agent session its own permanent working folder ("worktree") next to this repository, on its own protected branch. The worker session opens directly in that folder; this main checkout stays on the default branch for the orchestrating session.
When this skill starts, first give the user one or two plain-language sentences in the user's language, for example: "Wir legen jetzt einen zweiten Arbeitsordner für die parallele Session an — beide Sessions arbeiten dann getrennt und können sich nichts mehr kaputt machen."
Level check before creating anything
Parallel work has three levels (explained for beginners in
docs/git-basics.md). Confirm the situation first:
- One session at a time: no worktree is needed. Working on the default branch is correct and simpler. Say so and stop.
- A second session on the same working copy: warn. Both sessions share files, index, and HEAD; this is a risk mode, not a permanent setup. Offer this skill as the fix.
- Real parallel work: proceed. Each additional agent gets exactly one permanent worker worktree and opens its session directly in it.
Ask for the worker name if not given (short lowercase name such as codex,
claude2, worker2; recommend the agent's product name). One worker = one
worktree = one branch, reused across many cycles - never recreate it per
task.
Run the bundled script only
python .claude/skills/create-worker-worktree/scripts/create_worker_worktree.py --worker <name>The script owns all safety checks: default branch only, clean tracked tree,
no existing ref/folder/registered worktree, verification of the created
worktree, and registration in .csk/worktrees.json (worker entry plus
protectedBranches). Its only mutating git command is git worktree add.
On failure: show the script's message completely, explain in at most two plain sentences what the user must fix manually, and stop. Do not run any other git commands, do not retry with force, and do not clean up by hand.
On success: hand the user the worker guide
Read the JSON result between WORKER_WORKTREE_RESULT_BEGIN/END and present,
in the user's language:
- Open the worker session in the new folder - the exact path
(
workerWorktreePath). The whole trick is that the worker session opens directly in its worktree, never in this folder. - Division of labour: this checkout keeps the default branch
(orchestrator). The worker works and commits only on
workerBranchinside its worktree. - The recurring cycle (also in
docs/git-basics.md):- Create the worktree (done - once).
- Work in parallel.
- Worker integrates via
/finish-branch: pull request with a real merge commit; the protected branch is re-synced, never deleted. - Orchestrator updates the default branch with
/pull-main-ff. - Continue at 2 - worktree and branch persist.
- Copy local-only files if needed: gitignored files such as
.env.localare not part of the worktree. Tell the user which ones exist and let them copy what the worker genuinely needs - never copy secrets automatically. - Propose committing
.csk/worktrees.json: until that commit reaches the default branch, other checkouts (including the new worker worktree) cannot see the registration; only the name rule (*-workbenchis always protected) covers the gap. Show the exact path and ask for commit approval with one plain sentence; declining is safe and leaves the name rule in force.
Never do
- Switch branches, pull, fetch, commit, push, stash, or reset in this skill.
- Delete or prune worktrees.
- Create the worktree when the level check says one session is enough.
- Remove the branch protection that the script recorded; removing a worker
is an explicit, informed user decision (edit
.csk/worktrees.json, remove the worktree deliberately) - never a side effect.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

