AGENT SKILL

fan-out

ALWAYS invoke this skill first when the user says "fan out", "split this across agents", "solve this with parallel sub-agents", or lets sub-agents spawn their own helpers, even when only a plan is asked for. Splits the prompt into independent subtasks, runs them as parallel sub-agents under a fixed depth, width and total-agent budget, and merges compact results. Not for small tasks or a single question: use `subagent-orchestration` to route those.

License 许可
MIT
最近更新
2026-11-15
Stars
★ 1
Forks
0

01 前言 Front Matter

name
fan-out
license
MIT
description
ALWAYS invoke this skill first when the user says "fan out", "split this across agents", "solve this with parallel sub-agents", or lets sub-agents spawn their own helpers, even when only a plan is asked for. Splits the prompt into independent subtasks, runs them as parallel sub-agents under a fixed depth, width and total-agent budget, and merges compact results. Not for small tasks or a single question: use `subagent-orchestration` to route those.
allowed-tools
Bash(node ${CLAUDE_SKILL_DIR}/scripts/ts/limits.ts *)
argument-hint
[--budget N] [--depth N] [--width N] <prompt>

02 资源文件 9

03 SKILL.md 正文

Fan out

Contract

  • Input: $ARGUMENTS: the prompt to solve, optionally preceded by --budget N, --depth N, --width N to override the defaults in the Limits table.
  • Output: one merged answer, a one-line account of how the work was split, and which subtasks failed or were skipped.
  • Does not: decide whether a task deserves heavy parallelism (that is subagent-orchestration), queue agents, or run past the budget.

Limits

Resolve the limits with the script, not by hand. Pass only the limit flags, never the prompt: the prompt is free text and must not reach a shell command line (a $(...) or ; in it would run). Copy only the leading --budget, --depth and --width tokens from $ARGUMENTS, and only when the value is digits:

node ${CLAUDE_SKILL_DIR}/scripts/ts/limits.ts [--budget N] [--depth N] [--width N]

It prints one JSON object: budget, depth, width and shares, the budget each first-wave child gets. Use those numbers as given; the prompt is whatever follows the flags in $ARGUMENTS. Exit 2 with {"error": ...} means an invalid flag: tell the user the message and stop. A limit given in plain words ("at most 8 agents") has no flag, so pass it as one (--budget 8). If a flag value is not digits, report it as invalid instead of passing it on. If Bash is unavailable, apply the table by hand: whole numbers only, budget at least 1, depth 0 to 3, an unset budget is the env value (else 20), and bad input is rejected, not clamped.

Limit Default Meaning
depth 2 Layers of sub-agents below you, 0 to 3.
width 4 Children one agent may spawn at once. At most budget minus 1.
budget current max sub-agent count (env value, else 20) Total agents in the whole run, all layers.

The harness also caps concurrent sub-agents (CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS, default 20) and nesting (CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH), per the sub-agents docs. Stay under those; the skill's limits are the tighter, per-run layer on top, so no queue is needed.

The concurrency cap is configurable and shared by the whole tree. If it is set below your width, treat it as your effective width: spawn that many children, and start the remaining subtasks as running ones finish. A spawn refused for the concurrency limit is staging, not a failed child.

Procedure

  1. Decide whether to fan out. If the prompt is one question, touches one file, or has dependent steps, do it directly or with one Agent and say so. Fan out only when the prompt splits into subtasks that need no one else's output.
  2. Split. Name the subtasks and what each reads or writes. Subtasks that edit files need disjoint file surfaces or their own worktrees; shared generated files count as a surface.
  3. Divide the budget before spawning. You hold budget. Reserve 1 for yourself and give each child its entry in shares. Shares sum to at most what you hold. Below the first layer, split what you were given the same way. Spawn the first wave of children (up to width, or the concurrency cap if lower) in one message.
  4. Brief each child with: its subtask, its depth/width/budget remaining (depth minus 1, its own budget share), the handback cap (summary under 10 lines), and step 5, Leaf rule.
  5. Leaf rule. An agent with depth 0, budget 1, or a subtask that is one bounded piece of work does it itself and does not spawn.
  6. Merge. Children return the compact handback from subagent-orchestration (summary, findings, files_changed, next_actions). Each parent folds its children's results into one handback of the same shape before returning it up.
  7. Failures. A child that fails or times out is reported by name in the merge; retry it once at most, and only if unspent budget remains (a retry is a new agent). Use the retry's result if it succeeds; if it fails or times out, or no budget remains, continue the run without that child.

Stop conditions

Stop spawning and finish with what you have when the budget is spent. State the budget and the split up front in one or two lines so the cost is visible before it is incurred.

04 同仓库更多 Skills

dfadler
dfadler/agent-config

youtube-transcript

ALWAYS invoke before fetching a transcript, captions or description for a YouTube video, even when only asked how you would get them. Given a YouTube URL (youtube.com/watch, youtu.be, shorts), save the video's English auto-captions as plain text and its description to files with `yt-dlp`, and print the title, channel and duration. Use when asked to "get the transcript for this video", "grab the captions", "summarize this YouTube video", "put these videos' transcripts in an artifact", or when a YouTube link is pasted and its spoken content is needed. Do not drive the browser's transcript panel or try `youtube-transcript-api` first: both were tried and are slower or empty.

★ 1
dfadler
dfadler/agent-config

git-worktree-usage

Load this before pushing to, or opening a PR from, a branch whose earlier PR already merged (a squash merge leaves its commits off the default branch, so a new PR from it shows stale history), even when only advising: it defines the fresh-branch and cherry-pick fix. Create worktrees with the `EnterWorktree` tool, never raw `git worktree add`. Git worktree and branch mechanics for isolating non-trivial work: locking and the stale-worktree sweep, picking what to parallelize by file surface, the repo-wide `git stash` collision hazard and its `git restore` alternative, branch naming, catching a branch up to a moved `main` via merge (not rebase), CI/coverage gotchas after a merge, conflict-resolution escalation levels, and PR-splitting sequencing. Also ships two SessionStart hooks that self-heal a project's own symlinked-worktree-directory convention and auto-prune merged worktrees, and a commit-branch guard hook that asks before a git commit lands on the default or an unrelated checked-out branch. Use when creating, entering, or cleaning up a git worktree, including before starting work in an existing worktree that another session may be using; deciding how to parallelize agent sessions across a repo; hitting a `git stash` collision between sessions; resolving a merge/rebase conflict; splitting an already-written diff into multiple PRs; or a stale or wrongly-linked worktree directory needs diagnosing. Do not use for a plain `git stash` in a single clone with no other worktrees or sessions, for rewriting an unpushed branch's history, or for running commands in a worktree the user just created.

★ 1
dfadler
dfadler/agent-config

url-to-audio

ALWAYS invoke before answering any request to narrate or convert a URL or article to audio, even when only asked what you would do or which backend you would use (including when `OPENAI_API_KEY` is unset and the fallback is `say`). Turn a web article into a narrated audio file: fetch the page, extract the clean reading text, and synthesize it with macOS `say` by default (free, local, already installed, no API key) or OpenAI TTS optionally (when `OPENAI_API_KEY` is set and a `say` voice isn't good enough). Voice and speed are configurable per call, with env var defaults. Produces a `.m4a`/`.mp3` file at a predictable path and prints it. Use when asked to "read this article to me", "convert this page/URL to audio", "make an audio version of this link", or "text-to-speech this article" — including when asked only for the commands or plan, or when `OPENAI_API_KEY` is unset.

★ 1
dfadler
dfadler/agent-config

subagent-orchestration

Use FIRST, before answering or planning, whenever the user hands over a list of two or more separate tasks ("do A, B and C", numbered or in no order) that each need real exploration, even if they only ask how you would tackle them: it triages which can run as parallel sub-agents and which must stay serial. Also use when asked how to configure a sub-agent already chosen for a large search or exploration (agent type, model tier), and when about to spawn a sub-agent, fan out with the Workflow tool, or run a task that would put large tool output (more than ~50 lines, or ~3 file reads) into the main context. Routes the work to the main context, a single Agent call, or a Workflow; defines the compact handback a delegated agent should return; and picks the model tier. Use for "should I delegate this", "which agent do I use", or "keep my context small".

★ 1
dfadler
dfadler/agent-config

config

Internal primitive that reads YAML frontmatter from vault config files via mcp__obsidian__* tools, and returns it as merged key-value data. Not a user-facing slash command — this skill is never triggered by a user request directly; other agent-config skills (screen-capture, and second-brain's own capture/query skills) invoke it to load their own settings. Degrades to an empty config, never a hard failure, when the Obsidian MCP is disconnected or the config file doesn't exist. Parse `$ARGUMENTS` as `<skill-name> [project-name]`.

★ 1
dfadler
dfadler/agent-config

lighthouse

Run a Lighthouse CLI pass (mobile + desktop) against a URL and store the results in the second-brain vault under knowledge/lighthouse/<project>/. ALWAYS invoke this skill first when asked to run, repeat or script a Lighthouse pass or performance/accessibility audit against a URL, before writing any `lighthouse` command, including when the config disables it (it defines the no-op behaviour). Complements, not replaces, a manual responsive resize-and-look pass. Not for advice about fixing a Lighthouse finding. Config-driven: which form factors run, whether the skill runs at all, and where results land are all controlled by lighthouse_enabled, lighthouse_form_factors, and lighthouse_output_dir.

★ 1