swarm · backnotprop — Claude Code skill: parallel workers, one report
Fans out N parallel workers on one job, drains them, and returns a single consolidated report. Useful for coverage, model races and exploration.
npx skills add backnotprop/pstack --skill swarm -a claude-codeWhat swarm does
The skill runs in four phases: Frame, Fan out, Aggregate, Report. You state the done predicate and the artifact the swarm must return. Then you pick the shape: partition the work into slices, race N workers on identical briefs, or mix both. For a race, the selection rule (first pass, rank all, best-of) gets declared before anything spawns.
The worker model comes from the swarm workers line in the pstack settings file: ~/.claude/rules/pstack-models.md in Claude, ~/.cursor/rules/pstack-models.mdc in Cursor, ~/.agents/pstack-models.md in other harnesses. If that file or line is missing, the skill suggests starting with grok-4.7-xhigh-fast. With auto or inherit-parent you omit model and workers run on the parent model. Every brief stands alone: goal, scope, exact slice or race arm, how to verify, what to report.
In Claude workers spawn through the Agent tool and run locally, so each one needs its own worktree or output path. The environment: "cloud" and cloud_base_branch parameters belong to Cursor's Task tool — other harnesses simply don't have them. If a worker drops out, the run continues with N-1 and notes it. A result that doesn't record the SHAs and method named in its brief is dropped and that worker respawned once; after a second miss the skill records a gap, and a gap never counts as a pass.
What it helps with
- check several code slices at once
- compare models on the same task
- collect provable defects instead of the first one
- explore an unfamiliar codebase in parallel
- get one consolidated report instead of scattered answers
Example prompts for the agent
- swarm this: audit error handling in
src/api/and return a report - race three workers on the same brief, best-of rule
- split the refactor into slices and run them in parallel
How to install swarm
1Skills CLI (Vercel)
npx skills add backnotprop/pstack --skill swarm -a claude-code2Manually: put the files in place
~/.claude/skills/swarm/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/swarm/
1Skills CLI (Vercel)
npx skills add backnotprop/pstack --skill swarm -a codex2Manually: put the files in place
.agents/skills/swarm/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add backnotprop/pstack --skill swarm -a cursor2Manually: put the files in place
.cursor/skills/swarm/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install backnotprop/pstack swarm2Manually: put the files in place
.github/skills/swarm/SKILL.md1Skills CLI (Vercel)
npx skills add backnotprop/pstack --skill swarm -a gemini-cli2Platform CLI
gemini skills install https://github.com/backnotprop/pstack --path skills/swarmManually: put the files in place
.devin/skills/swarm/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add backnotprop/pstack --skill swarm -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about swarm
How do I install swarm in Claude?
Run npx skills add backnotprop/pstack --skill swarm -a claude-code. The skill lands at ~/.claude/skills/swarm/SKILL.md.
What does swarm do?
It fans out N parallel workers on one job, drains them, and returns a single consolidated report with a result table, issue one-liners and gaps.
Do I need the pstack settings file?
No. If the swarm workers line is missing, workers launch on grok-4.7-xhigh-fast.
Source text
SKILL.md · MIT
--- name: swarm description: "Fan out N parallel workers, drain them, and return one report. Use for /swarm, 'swarm this', or parallel coverage, races, gauntlets, and exploration." disable-model-invocation: true --- # Swarm ## Start Open a todolist with one entry per phase before launching anything. 1. Frame 2. Fan out 3. Aggregate 4. Report ## Phase A: Frame 1. State the done predicate and the artifact or report the swarm must return. 2. Choose the shape. Partition into slices, race N workers on identical briefs, or mix both. For a race or mixed shape, declare `first pass`, `rank all`, or `best-of` before spawning. 3. Pick the worker model from the `swarm workers` line in the pstack settings file (`~/.cursor/rules/pstack-models.mdc` in Cursor, `~/.claude/rules/pstack-models.md` in Claude Code, `~/.agents/pstack-models.md` in other harnesses). If the file or that line is missing, use `grok-4.7-xhigh-fast`. For `auto` or `inherit-parent`, omit `model` so the workers run on the parent model. If your subagent tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message or your harness's model list. For a model race, name each arm's model up front. Pick each subagent's reasoning level and fast or standard speed for the job, per the Subagents section of the **poteto-mode** skill. 4. Give each worker its own writable output when it writes. When workers verify or measure commits, each brief names the exact SHAs. A measurement brief also names the method (sample count, what one sample is, order). The worker records both in its result. ## Phase B: Fan out Spawn all N workers in one message with `subagent_type: generalPurpose`, `environment: "cloud"`, `run_in_background: true`, and the step 3 model, left unset for `auto` or `inherit-parent`. Use `environment: "local"` only when the worker needs access to something on the user's computer. When a worker must start from a non-default pushed branch, pass `cloud_base_branch`. **Other harnesses.** These parameters belong to Cursor's `Task` tool, and `environment: "cloud"` runs a Cursor cloud agent. In another harness, use its subagent tool: `Agent` in Claude Code (`subagent_type: general-purpose`), `task` in OpenCode (`subagent_type: general`), `spawn_agent` in Codex. Workers run locally there, so give each one its own worktree or output path. Keep the brief and the model. Drop parameters your tool doesn't have. If your harness has no subagent tool, as in Pi without an extension, run the workers yourself, one after another. Every brief stands alone. Include the goal, scope, exact slice or race arm, how to verify, and what to report. Reports use `PASS`, `ISSUES`, or `BLOCKED` with evidence. A worker that can prove a defect reports `ISSUES` and lists every issue it can prove, not only the first. If a worker drops out, proceed with N-1 and note it. ## Phase C: Aggregate Read the terminal results. Drop a result that does not record the SHAs and method its brief names, and respawn that worker once. After a second miss, record a gap. A gap does not count as a pass. For coverage, every required slice needs a result. For a race, apply the selection rule declared up front. Use first pass, rank all, or best-of. Do not paste raw worker dumps. ## Phase D: Report Return one consolidated in-chat report with a result table, issue one-liners, gaps or dropouts, and the race rule when used.
© backnotprop · MIT · backnotprop/pstack
Similar skills
All skills for Agent setup: memory, context, orchestration →swarm by other authors comes first.