| name | dynamic-workflows |
| description | Use when orchestrating multi-step, multi-agent work in Claude Code and one agent turn isn't enough — when a script should hold the loop, the branching, and the intermediate results while your context only sees the final answer. Provides the six canonical dynamic-workflow patterns as runnable scripts: Classify-And-Act, Fanout-And-Synthesize, Adversarial Verification, Generate-And-Filter, Tournament, and Loop Until Done. Trigger on: "fan out / parallelize across N", "verify/refute findings before reporting", "rank or pick the best of several attempts", "sweep until done / find them all", "triage a backlog", "synthesize across sources", or any task that needs a reusable orchestration shape rather than a one-shot prompt. |
Dynamic Workflows
Six canonical orchestration shapes for when a task needs more than one agent
turn. Each ships as a runnable <key>.workflow.js you can invoke with the
Workflow tool, plus a <key>.md that teaches the shape in depth.
How to choose — match the shape to what you have and want
| If you… | Use | File |
|---|
| have one item and must decide how to handle it (route by type, triage) | Classify-And-Act | classify-and-act.workflow.js |
| have one task that splits into independent pieces you must combine | Fanout-And-Synthesize | fanout-and-synthesize.workflow.js |
| have output that might be plausible-but-wrong and false positives are costly | Adversarial Verification | adversarial-verification.workflow.js |
| want breadth then a curated shortlist (keep some, discard the rest) | Generate-And-Filter | generate-and-filter.workflow.js |
| want the single best of several whole attempts, judged comparatively | Tournament | tournament.workflow.js |
| can't know up front how much work there is (discover until clean) | Loop Until Done | loop-until-done.workflow.js |
Disambiguating the close calls:
- Route 1 input → 1 handler = Classify-And-Act. Keep k of N candidates = Generate-And-Filter.
- Merge every branch (N→1) = Fanout-And-Synthesize. Select a subset (N→k) = Generate-And-Filter.
- Survive/die against a rubric, no competitor = Adversarial Verification. Head-to-head, one advances = Tournament.
- Branch once on a label = Classify-And-Act. Re-run on a predicate over an unknown horizon = Loop Until Done.
If your task looks like a combination of these (e.g. fan out searches → verify
each claim → loop until no gaps), that's expected: real workflows compose the
core shapes. The richer catalog of named compositions ("deep research", "code
review", "migration", "judge panel", …) and why each reduces to these six is in
TAXONOMY.md.
How to invoke
Each file is a self-contained workflow script. Run it with the Workflow tool by
scriptPath, or save it as a /<name> command (below). Every script:
- reads
args — pass your real input as the Workflow args value; with no
args it runs a tiny built-in demo so it's runnable standalone.
- has a
smoke mode — pass { smoke: true } for the cheapest real pass
(tiny hardcoded input, low effort, minimum agents) to confirm wiring before a
full run. All six pass smoke (see TEST-REPORT.md).
- returns the documented shape — read each
<key>.md for its return value.
Read the matching <key>.md before adapting a script: it documents the exact
fan-out/barrier/loop arrangement, the schema each agent emits, when not to
use the shape, and the anti-patterns.
Packaging (per the dynamic-workflows blog)
- Save a run as a reusable command: press
s in /workflows to save it into
.claude/workflows (project) or ~/.claude/workflows (personal).
- Share by shipping the
*.workflow.js inside a skill folder next to a
SKILL.md (this file) that references it — anyone who installs the skill runs
the same workflow.
Authoring note (so a script actually runs)
When you adapt or write one of these: the file is export const meta = { … }
(a pure literal) followed by a top-level body that uses top-level await and
ends with a top-level return. Do not wrap the body in export default or a
function — the engine runs the post-meta body directly, and a second export
throws Unexpected keyword 'export'.