workflow-patterns
Skill17 starsChanged 9 months agoMITView on GitHub
Load when one Workflow must run different nodes in its branches at the same time (a different prompt or model for each branch), or loops back to a state (a polling loop). Named branches, the router pattern, examples that compile.
8 other projects use a version of this.
Adopted by
Most recently taken up by
- xfstudio/skillstheir own version, first seen Oct 13, 2026
- Samueladewole/claude-skillstheir own version, first seen Oct 13, 2026
- caobingsheng/skillstheir own version, first seen Oct 11, 2026
- QuintinShaw/pi-dynamic-workflowstheir own version, first seen Oct 5, 2026
- terrene-foundation/pacttheir own version, first seen Apr 6, 2026
- ai4brands-design/claude-skillstheir own version, first seen Mar 22, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- QuintinShaw/pi-dynamic-workflows★ 597same name
- wpank/ai★ 11same name
- xfstudio/skills★ 9same name
- ai4brands-design/claude-skills★ 2same name
- CodeWithBehnam/cc-docs★ 2same name
- caobingsheng/skills★ 1same name
- Samueladewole/claude-skills★ 0same name
- terrene-foundation/pact★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository57 other files it gives its agents.
- packages/sdk/examples/repo-workspaces/seed/home/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agent-repair-loopSkill
- duroxide-orchestration-versioningSkill
- editorial-standardsSkill
- finance-research-standardsSkill
- valuation-methodsSkill
- pilotswarm-architectureSkill
- deployment-safetySkill
- incident-responseSkill
- add-activitySkill
- add-eventSkill
- add-testSkill
- add-toolSkill
- agent-versioningSkill
- azure-ps-test-runner-vmSkill
- debug-orchestrationSkill
- debug-testSkill
- horizondb-idiosyncrasiesSkill
- horizon-facts-eval-sweepSkill
- investigate-duroxide-runtimeSkill
- pilotswarm-aks-deploySkill
- pilotswarm-aks-resetSkill
- pilotswarm-new-env-deploySkill
- pilotswarm-perfSkill
- pilotswarm-portal-app-regSkill
- pilotswarm-portal-auth-assignmentsSkill
- pilotswarm-releaseSkill
- pilotswarm-tuiSkill
- pilotswarm-vpn-client-profileSkill
- portal-ux-testingSkill
- schema-migrationSkill
- tla-formal-validationSkill
- notesSkill
- share-a-fileSkill
- cost-latency-analysisSkill
- graph-debugSkill
- orchestration-session-lifecycleSkill
- resourcemgrSkill
- sweeperSkill
- canvas-appsSkill
- html-visualsSkill
- workflow-authoringSkill
- workflow-referenceSkill
- workflow-toolsSkill
- workflow-testingSkill
- pilotswarm-agent-versioningSkill
- pilotswarm-aks-identitySkill
- pilotswarm-azure-deployerSkill
- pilotswarm-azure-lessonsSkill
- pilotswarm-cli-builderSkill
- pilotswarm-duroxide-versioningSkill
- pilotswarm-hybrid-datastoreSkill
- pilotswarm-knowledge-harvesterSkill
- pilotswarm-portal-builderSkill
- pilotswarm-sdk-builderSkill
- pilotswarm-three-tierSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
0
Distinctive
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
- Very specific: line 8
Call load_skill with name workflow-authoring first.
- Very specific: line 12
When different branches must run different nodes at the same time (a different prompt, or a different model for each), write ONE parallel …
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Workflow patterns
Call load_skill with name workflow-authoring first. This skill adds three patterns to it.
Different work in each branch at once: named branches
When different branches must run different nodes at the same time (a
different prompt, or a different model for each), write ONE parallel state
with named branches. Do not split it into several Workflows.
- Each branch is its own graph:
initial,statesand an optionalinputtemplate (else the value that arrived). - Its routes stay inside it. Each end is a branch end:
succeededis success. A branch has nocatchAll; an error it does not route ends it. - State ids are unique across the Workflow, so each agent node has its own
agent_modelsentry at start. concurrencydefaults to the number of branches: all run at once. Above 16 branches, set it (at most 16).joinedgives{ <name>: output }. Withjoin: { first: k }(k at most the branches) it holds the winners only; ablockedortimed_outreport lists every branch with itsname.${branch.name}(a script'scontext.branch.name) names the branch.- Give the parallel state
timeoutSecondsand atimed_outroute when a branch runs an agent: without one, the join waits as long as the slowest branch (the compiler warnsWORKFLOW_BRANCH_UNBOUNDED).
# example: two-views
apiVersion: pilotswarm.dev/v1
kind: Workflow
metadata: { name: two-views, version: "1.0.0" }
description: Summarizes one text twice at once and joins both by name.
inputs:
schema:
type: object
additionalProperties: false
required: [text]
properties:
text: { type: string, minLength: 1 }
initial: views
initialInput: { text: "${inputs.text}" }
states:
views:
type: parallel
timeoutSeconds: 2400 # bounds the join: a branch runs an agent
branches:
quick:
initial: quick_summary
states:
quick_summary: # its own state id: its own agent_models entry
type: agent
invoke: { prompt: "Summarize the text in your input in one sentence." }
outcomes: [done]
timeoutSeconds: 600
transition: { next: { done: quick_done, failure: quick_failed } }
quick_done: { type: terminal, outcome: succeeded, output: "${input}" }
quick_failed: { type: terminal, outcome: failed, output: "${runtime.error}" }
careful:
initial: careful_summary
states:
careful_summary:
type: agent
invoke: { prompt: "Read the text in your input closely and summarize it in one paragraph. Keep every number and name." }
outcomes: [done]
timeoutSeconds: 1800
transition: { next: { done: careful_done, failure: careful_failed } }
careful_done: { type: terminal, outcome: succeeded, output: "${input}" }
careful_failed: { type: terminal, outcome: failed, output: "${runtime.error}" }
transition:
next: { joined: done, blocked: failed, timed_out: failed, failure: failed }
done: { type: terminal, outcome: succeeded, output: "${input}" } # { quick: ..., careful: ... }
failed: { type: terminal, outcome: failed, output: "${input}" }When the branches are data: the router pattern
The older form, for branches that come from a list (each item names its
lane): a parallel state over the list, with a router script first in the
body that sets its outcome to the lane and routes to that lane's node.
concurrency is the number of lanes and join is all. Every lane ends at
one item end whose output names the lane; the results arrive in the list's
order. The router decides nothing: it reads a lane written in the list, so it
is mechanical work, which scripts may do. Judgment still goes to an agent
node. There is no switch node type.
# example: two-lane-summary
apiVersion: pilotswarm.dev/v1
kind: Workflow
metadata: { name: two-lane-summary, version: "1.0.0" }
description: Summarizes one text twice at once, one lane per item.
inputs:
schema:
type: object
additionalProperties: false
required: [text]
properties:
text: { type: string, minLength: 1 }
initial: lanes
states:
lanes:
type: parallel
forEach: [{ lane: quick }, { lane: careful }] # one item per lane
concurrency: 2 # every lane at once
join: all
body:
initial: route
states:
route:
type: script
timeoutSeconds: 30
outcomes: [quick, careful]
source: |
await setResult(context.branch.item.lane, { lane: context.branch.item.lane, text: context.inputs.text });
transition:
next: { quick: quick_summary, careful: careful_summary, failure: lane_failed }
quick_summary:
type: agent
invoke: { prompt: "Summarize the text in your input in one sentence." }
outcomes: [done]
timeoutSeconds: 600
transition: { next: { done: lane_done, failure: lane_failed } }
careful_summary:
type: agent
invoke: { prompt: "Read the text in your input closely and summarize it in one paragraph. Keep every number and name." }
outcomes: [done]
timeoutSeconds: 1800
transition: { next: { done: lane_done, failure: lane_failed } }
lane_done:
type: terminal
outcome: succeeded
output: { lane: "${branch.item.lane}", summary: "${input}" }
lane_failed:
type: terminal
outcome: failed
output: { lane: "${branch.item.lane}", error: "${runtime.error}" }
transition:
next: { joined: done, blocked: failed, failure: failed }
done: { type: terminal, outcome: succeeded, output: "${input}" }
failed: { type: terminal, outcome: failed, output: "${input}" }A polling loop
A route back to a state brings it the previous state's output. Here
check_ci's closed inputSchema refuses ciState, so wait_ci maps the
output back with input:; KV is read with a default. get_ci_state stands
for a tool of your own.
# example: ci-poll
apiVersion: pilotswarm.dev/v1
kind: Workflow
metadata: { name: ci-poll, version: "1.0.0" }
description: Checks CI until it is not pending.
initial: check_ci
initialInput: { checks: 0 }
states:
check_ci:
type: script
inputSchema: { type: object, additionalProperties: false, required: [checks], properties: { checks: { type: integer } } }
outcomes: [pending, done]
source: |
const checks = context.input.checks + 1;
const { state } = await callTool("get_ci_state", {});
const most = context.kv.maxChecks ?? 30; // KV may be unset
await setResult(state === "pending" && checks < most ? "pending" : "done", { checks, ciState: state });
transition: { next: { pending: wait_ci, done: done, failure: failed } }
wait_ci:
type: wait
seconds: "${kv.pollSeconds ?? 60}"
input: { checks: "${input.checks}" } # what check_ci takes, not ciState
transition: { next: { elapsed: check_ci, failure: failed } }
done: { type: terminal, outcome: succeeded, output: "${input}" }
failed: { type: terminal, outcome: failed, output: "${runtime.error}" }Testing these patterns
A test's fixtures (workflow-tools) answer by state id, so each branch's
agent node has its own: { operation: agent, state: quick_summary, ... }
and { operation: agent, state: careful_summary, ... }. A For each body's
node runs once per item; one fixture answers every item, and visit
counts per item. In a loop, visit: n answers the n-th round of a state;
a fixture without visit answers the other rounds. A receive gets its
message from { operation: receive, state: <id>, visit?, response: { kind:
success, value: <message> } }. The report's path names each step's
branch (its name, or item N) and enteredBy.
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.

