用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/me2resh/apexyard --skill fan-out命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | fan-out |
| description | Spawn N parallel Agent calls in one message (per-task agent type, worktree isolation, background mode). |
| disable-model-invocation | false |
| argument-hint | <task1, task2, ...> | <path/to/tasks.md> | --from-tickets <ref1,ref2,...> |
| effort | medium |
Spawns multiple specialised agents in parallel — each on its own task, optionally in its own git worktree — so independent work items progress concurrently instead of being silently serialised behind a single agent's session.
This skill is the happy path for parallel execution. The companion rule .claude/rules/parallel-work.md defines when to offer fan-out proactively. Read both before invoking.
The trigger heuristic is in parallel-work.md. The short version: use /fan-out when the user's request decomposes into ≥ 2 work items that are file-independent, context-independent, and individually substantial.
Do NOT use when:
Accept tasks from any of these forms:
$ARGUMENTS as a comma-separated list: "audit hooks dir, audit skills dir, audit rules dir"/fan-out tasks.md — one task per line, blank lines and # comments ignored--from-tickets <list>: /fan-out --from-tickets apexyard#109,apexyard#110,apexyard#111 — fetch each issue title + body via gh issue view and use them as task descriptions$ARGUMENTS is empty, prompt: "Paste your tasks, one per line. Blank line to finish."Trim whitespace, drop empties. If the result is fewer than 2 tasks, stop: fan-out is overkill for one item.
For each task, infer the answer from the description first, then ask only when ambiguous.
Agent type — default general-purpose. Options:
| Agent | Use for |
|---|---|
general-purpose | Implementation, multi-step research, anything mixed |
Explore | Read-only research, codebase questions, audits |
code-reviewer | Reviewing an existing PR (read-only) |
security-reviewer | Security audit of a PR (read-only) |
Plan | Plan-mode — produces a plan, no edits |
| Custom | Any subagent in .claude/agents/ |
If a task obviously needs editing (verbs like implement, add, fix, refactor, migrate, write), reject any read-only agent type and suggest general-purpose.
Isolation — default worktree if any agent will write code; shared if all agents are read-only research. Infer from the task verb. Ask only when ambiguous.
Mode — default foreground (≤ 2-minute estimated runtime); background if estimated > 2 minutes. Estimate from task scope (single-file edit ≈ short; cross-cutting refactor ≈ long; full audit ≈ long). Ask only when ambiguous.
For every task that involves code edits (not pure research), verify a ticket marker exists:
<ops_root>/.claude/session/tickets/<project> if the task targets a managed project's workspace/<name>/<ops_root>/.claude/session/current-ticket for ops-fork editsIf missing, refuse the entire fan-out and tell the user:
Cannot fan out — task "<task>" needs an active ticket. Run:
/start-ticket <ref>
…then re-run /fan-out.
The require-active-ticket.sh hook would block edits anyway. Failing fast at fan-out time is kinder UX than letting 3 of 5 agents start, then 2 fail mid-run.
Heuristically detect tasks that target the same file paths. Compare file paths mentioned in each task description (literal paths, glob patterns, or implied file scope).
If two or more tasks share write targets, refuse parallel and recommend serial:
Cannot fan out — these tasks share write targets:
- Task 2: edits .claude/hooks/pre-push-gate.sh
- Task 4: edits .claude/hooks/pre-push-gate.sh
Run them serially, or split task boundaries so each owns distinct files.
The alternative is git worktree merge conflicts on merge-back — recoverable but always painful.
Print a table:
| # | Task | Agent | Isolation | Mode |
|---|------|-------|-----------|------|
| 1 | … | general-purpose | worktree | foreground |
| 2 | … | Explore | shared | foreground |
…
Wait for the user's yes / confirm / go before spawning. Edits to the plan in this step are fine — re-print the table and re-ask.
This is the only step where parallelism actually happens. Emit a SINGLE assistant message containing N Agent tool calls (one per task). Looping Agent invocations across multiple messages serialises them — the second agent will not start until the first returns.
Spawning 4 agents in parallel…
[Agent call 1]
[Agent call 2]
[Agent call 3]
[Agent call 4]
Each agent's prompt must be self-contained — sub-agents do not inherit the parent's conversation context. Include in each prompt:
For tasks with isolation: worktree, pass isolation: worktree in the Agent call. For long-running tasks with mode: background, pass run_in_background: true.
Foreground tasks return inline — wait for all of them. Background tasks return asynchronously — note their IDs and tell the user how to check on them later.
For each returned result, capture:
If any agents used worktree isolation, list the branches they created. Then offer to sequence the merge-back:
Worktree branches to merge:
1. feature/#117-add-fan-out-skill (agent 1)
2. feature/#118-add-parallel-rule (agent 2)
3. fix/#120-bug-in-X (agent 3)
Merge back in order? [y/n/select]
For each branch in turn:
git checkout)Each project owns one merge-back attempt. If the user wants to skip a branch (e.g. open as its own PR instead), record that and continue.
Fan-out complete (N tasks, M succeeded, K background still running).
| # | Task | Status | Branch | Follow-ups |
|---|------|--------|--------|------------|
| 1 | … | done | … | … |
…
Background tasks running: <ids>. They'll surface results when done.
Agent tool calls for a single fan-out MUST be in the SAME assistant message. Multi-message loops do not get concurrency — they serialise. This is the most important rule in this skill.isolation: worktree whenever any agent will write code. Required to prevent file-level races between agents sharing one working directory.Explore, code-reviewer, security-reviewer, and Plan cannot write. If the task verb says "implement" / "fix" / "add" / "refactor", suggest general-purpose.Part of ApexYard — multi-project SDLC framework for Claude Code · MIT.