Every workflow you hand an agent has a shape, and the default shape, one step after another, is usually the slowest one. Austin Marchese, who builds client systems on Claude, took a course from DeepLearning.AI, the teaching platform of Stanford AI professor Andrew Ng, and came back with a short vocabulary for those shapes and a one-question test that finds the wasted time in yours. Split big AI tasks into steps and checks showed how to break one big task into jobs and mark which job depends on which; this guide names the shapes those maps take, and what breaks each one.
01Every workflow has a shape
Take a task like writing a report on the current state of AI. Written as a to-do list, it reads: research YouTube, research Google, write the report, review it, send it. Give that list to an agent and it runs exactly as written, each step starting when the one before it finishes. That shape is a chain.
The chain is what you get whenever you describe work in the order it occurred to you, which is why almost everything starts as one. Skills are workflows too: every skill file you write runs as one of these shapes, whether you chose the shape or not.
02The wait test
“Does this actually need the result of the one before it?”
Austin Marchese, “You're Prompting Claude Wrong. Use this Stanford Method Instead” · 1:59Walk the chain step by step and ask that question at each one. A yes means the wait earns its place: writing the report needs both piles of research, so it waits. A no means the step fails the test: it is waiting for something it never uses. Researching Google does not need the YouTube results, so the two searches can run at the same time.
A failed wait costs nothing to fix: run the step alongside the one it was waiting on. In the report example, running the two searches at once finishes the workflow in about half the time, with no change to what any step does.
03The four shapes
| Shape | How it runs | Reach for it when |
|---|---|---|
| Chain | One step after another, each fed by the last | Every new workflow; easiest to build and test |
| Fan-out | Several agents work at the same time, results merge into one step | Steps that fail the wait test: parallel research, code review from several angles |
| Branch | One entry point sends each request down the route that fits it | One skill serving a few related jobs |
| Loop | Do the work, check it, redo it until the check passes | Output with a clear pass or fail: builds, tests, style rules |
The shapes are building blocks, and a real workflow mixes them: a fan-out can feed a loop, and each route of a branch can hold its own chain.
Two of them deserve a closer look. A branch is how one skill serves several jobs: Marchese runs a skill that reads the conversation and picks one of a few routes: improve a skill from recent history, audit the whole system, or mine past chats for skills worth creating. One command, several destinations.
The loop is the shape with its own guide: Loop the agent until the work passes builds one part by part. The check is the piece that makes it work: a loop without a clear pass-or-fail verdict has no way to stop.
04What breaks each shape
Chain: one broken step stops everything. Slow by design, and brittle: if step three fails, steps four and five never run. Both defects are acceptable, because the chain’s job is to be the prototype. Get the work right in a chain first, then re-shape it.
Fan-out: failures are silent, and independence can be false. Each agent in a fan-out works alone, with no view of what the others are doing. Two agents can do the same work twice, or one can miss information it needed, because nothing connects them mid-run. And when one fails, the rest keep going, so the workflow looks finished with a piece missing instead of stopping at the break the way a chain does. The guards: fan out only steps the wait test shows are truly independent, and prefer tasks where one bad result is cheap to redo.
Branch: routes multiply until nobody can follow them. The first branch feels so useful that the next ten follow, and one skill ends up trying to route everything you do. Keep a branch to about five routes; past that, ask the model whether the skill should split into several.
Loop: it can run all night. One of Marchese’s clients went to sleep with a loop running; the check never passed, the loop never stopped, and he woke to thousands of dollars of model usage. Every loop gets a maximum number of iterations, after which it stops and reports a fail instead of trying again. Stop hitting your token limit covers what that burn looks like from the billing side.
05Start as a chain, then re-shape
Build every new workflow as a chain, because a chain is the easiest shape to test: run it, watch it break at a visible step, fix that step. Once it works end to end, run the wait test and upgrade only the parts the test flags: independent steps become a fan-out, a redo-until-good step becomes a loop, a growing pile of similar skills becomes one branch.
Further reading
- Austin Marchese · You’re Prompting Claude Wrong. Use this Stanford Method Instead, the video this guide distills
- DeepLearning.AI · Agentic Knowledge Graph Construction, the free short course (built with Neo4j, taught by Andreas Kollegger) the video credits as its source
- Anthropic · Claude Code subagents documentation, the mechanics behind fan-out agents and why they cannot see each other