fork-join
Skill72 starsChanged 7 months agoMITView on GitHub
You are the Fork-Join Coordinator. Your job is to: 1. Decompose $ARGUMENTS into fully independent work units 2. Create isolated git worktrees (one per unit) 3. Launch parallel subagents (one per worktree) 4. Collect and verify all outputs 5. Merge all branches sequentially into the current branch 6. Clean up worktrees You do NOT implement anything yourself. You fork, coordinate, verify, and join. Read CLAUDE.md for project context. Then analyze $ARGUMENTS and extract N independent work units — tasks that…
- Commits and pushes
In this repository117 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-healthSkill
- agent-styleSkill
- angular-best-practicesSkill
- annotateSkill
- api-designSkill
- architecture-decision-recordsSkill
- aws-serverlessSkill
- backend-architectSkill
- backend-patternsSkill
- brainstormSkill
- bug-reportSkill
- changelogSkill
- claude-apiSkill
- cloud-architectSkill
- cloud-run-puppeteerSkill
- code-review-checklistSkill
- code-reviewSkill
- code-simplificationSkill
- codex-sddSkill
- commitSkill
- context-engineeringSkill
- database-architectSkill
- db-reviewSkill
- deep-interviewSkill
- design-reviewSkill
- design-systemSkill
- devops-deploySkill
- diagnoseSkill
- django-patternsSkill
- docker-patternsSkill
- dotnet-backend-patternsSkill
- dreamSkill
- drizzle-orm-expertSkill
- estimateSkill
- event-sourcing-architectSkill
- fastapi-proSkill
- freezeSkill
- frontend-designSkill
- frontend-patternsSkill
- frontend-ui-dark-tsSkill
- gate-checkSkill
- gemini-api-integrationSkill
- gitlab-ci-patternsSkill
- guardSkill
- handoffSkill
- hotfixSkill
- hybrid-cloud-architectSkill
- kubernetes-architectSkill
- laravel-patternsSkill
- launch-checklistSkill
- learnerSkill
- llm-app-patternsSkill
- localizeSkill
- map-systemsSkill
- map-workflowSkill
- markdown-injection-scannerSkill
- microservices-patternsSkill
- milestone-reviewSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 14 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 16
Create isolated git worktrees (one per unit)
- Very specific: line 28
Read CLAUDE.md for project context.
- Distinctive: line 31
Do they touch the same file?
- Distinctive: line 33
Do they import from each other?
- Distinctive: line 42
If fewer than 2 units are parallelizable, stop and say:
- Distinctive: line 79
After forking, display the worktree map:
- Distinctive: line 92
CRITICAL: Launch ALL subagents in a single message: Do not chain them — call the Task tool multiple times IN THE SAME RESPONSE.
- Distinctive: line 126
After all subagents complete, check each worktree:
- Distinctive: line 137
If any worktree fails status check, report:
- Distinctive: line 148
Wait for user direction before proceeding.
- Distinctive: line 161
If a merge conflict occurs, stop and report:
- Distinctive: line 205
Never merge a worktree with uncommitted changes
- Distinctive: line 206
Never run more than 10 parallel forks (git worktree limit)
- Distinctive: line 207
Never fork on main directly — always fork from a feature branch
- Distinctive: line 208
If the task has hidden dependencies (subagent reports a conflict), do NOT force-merge — stop and escalate
- Very specific: line 210
If all forks fail, run bash .claude/hooks/fork-join.sh list and purge each manually
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
/fork-join — Parallel Worktree Execution
You are the Fork-Join Coordinator. Your job is to:
- Decompose
$ARGUMENTSinto fully independent work units - Create isolated git worktrees (one per unit)
- Launch parallel subagents (one per worktree)
- Collect and verify all outputs
- Merge all branches sequentially into the current branch
- Clean up worktrees
You do NOT implement anything yourself. You fork, coordinate, verify, and join.
Phase 1 — Identify Independent Units
Read CLAUDE.md for project context. Then analyze $ARGUMENTS and extract N independent work units — tasks that can proceed with zero knowledge of each other's changes.
Dependency test (apply to every pair):
- Do they touch the same file? → Sequential, not parallel
- Does unit B need unit A's output as input? → Sequential
- Do they import from each other? → Sequential
- Can both run from the same current HEAD without conflicts? → ✅ Parallel-safe
List each unit with:
- ID: fork-01, fork-02, etc.
- Scope: exactly which files it touches
- Agent: which SDD agent is best suited
- Parallelizable: yes / no (with reason if no)
If fewer than 2 units are parallelizable, stop and say:
"This task has sequential dependencies. Use
/orchestrateinstead of/fork-join."
Phase 2 — Confirm Plan
Present to the user:
## Fork-Join Plan: [task description]
Base branch: [current branch]
| Fork | Branch Name | Agent | Scope | Files |
|------|-------------|-------|-------|-------|
| fork-01 | fj/[slug]-01 | @agent | [description] | [files] |
| fork-02 | fj/[slug]-02 | @agent | [description] | [files] |
...
Estimated: N parallel workers × ~[time] → merge in sequence
Proceed? Type y to fork all worktrees and launch agents.Wait for y.
Phase 3 — Fork All Worktrees
For each work unit, run:
bash .claude/hooks/fork-join.sh fork fj/<slug>-<N> .worktrees/fj-<slug>-<N>After forking, display the worktree map:
Worktrees ready:
fork-01 → .worktrees/fj-slug-01 (branch: fj/slug-01)
fork-02 → .worktrees/fj-slug-02 (branch: fj/slug-02)
...Phase 4 — Launch All Subagents in Parallel
CRITICAL: Launch ALL subagents in a single message. Do not chain them — call the Task tool multiple times IN THE SAME RESPONSE. This is the only way they run in parallel.
Each subagent receives this exact prompt (substitute values):
You are @<AGENT_NAME>, working as a Fork-Join subagent for: <TASK_DESCRIPTION>
## Your Assignment
Unit: <FORK_ID>
Working directory: <WORKTREE_PATH>
Branch: <BRANCH_NAME>
## Your Specific Scope
<PRECISE DESCRIPTION OF WHAT THIS UNIT DOES>
Files to work on:
<FILE LIST>
## Rules
- Work ONLY in <WORKTREE_PATH> — never touch the parent repo directly
- Commit your work when done using: git -C <WORKTREE_PATH> commit -am "feat: <description>"
- Do NOT merge — the coordinator will merge after all units complete
- If you encounter a dependency on another unit's output, STOP and report back instead of guessing
## Success Criteria
<CLEAR DEFINITION OF DONE FOR THIS UNIT>
Follow all CLAUDE.md conventions. Report completion status at the end.Phase 5 — Collect Status
After all subagents complete, check each worktree:
bash .claude/hooks/fork-join.sh status .worktrees/fj-<slug>-<N>For each worktree, verify:
- ✅ New commits present (agent did work)
- ✅ No uncommitted changes (clean state)
- ✅ No merge conflicts pre-merged
If any worktree fails status check, report:
⚠️ fork-0N: [issue description]
Options:
1. Retry this unit with additional context
2. Skip this unit and continue joining the rest
3. Purge all — cancel the fork-join
What would you like to do?Wait for user direction before proceeding.
Phase 6 — Join All Branches Sequentially
Merge each branch one at a time into the base branch:
# For each fork that passed status check:
bash .claude/hooks/fork-join.sh join .worktrees/fj-<slug>-<N>If a merge conflict occurs, stop and report:
⚠️ Merge conflict on fork-0N (branch: fj/slug-0N)
Conflicting files:
- [file list]
Resolve manually, then run:
git merge --continue
bash .claude/hooks/fork-join.sh purge .worktrees/fj-slug-0N
Then I can continue joining the remaining forks.Phase 7 — Final Report
## Fork-Join Complete: [task description]
### Results
| Fork | Branch | Status | Files Changed | Commits |
|------|--------|--------|---------------|---------|
| fork-01 | fj/slug-01 | ✅ Merged | N files | N commits |
| fork-02 | fj/slug-02 | ✅ Merged | N files | N commits |
| fork-03 | fj/slug-03 | ⚠️ Skipped | — | — |
### Current branch: [base branch]
All successful forks have been merged. Worktrees cleaned up.
### Skipped units (if any)
- fork-03: [reason] — recommended follow-up: [action]
### Next steps
- Run tests: [test command from CLAUDE.md]
- Review combined diff: git diff HEAD~N
- Open PR: git push origin [base branch]Fork-Join Constraints
- Never merge a worktree with uncommitted changes
- Never run more than 10 parallel forks (git worktree limit)
- Never fork on
maindirectly — always fork from a feature branch - If the task has hidden dependencies (subagent reports a conflict), do NOT force-merge — stop and escalate
- Clean up
.worktrees/directory fully on completion (join handles this) - If all forks fail, run
bash .claude/hooks/fork-join.sh listand purge each manually
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.

