Skip to content
zero2vibecodelearn vibe coding
Level 4 · Parallel work 10 min Reviewed by the author · Oct 15, 2026 Verified against Claude Code v2.1.292 · Oct 15, 2026Official docs: Dynamic workflowsSomething out of date? Tell us

Workflows: a script for many agents

A dynamic workflow is a JavaScript script Claude writes for the task. The script launches agents and keeps their results to itself, and only the final result reaches the conversation. You can read the plan before it runs and save a good run as a /<name> command.

Level 4 · 0 / 4 lessons0%
In this lesson

In the last lesson you chose a pattern. If the task needs many agents, double-checked findings or reruns, that is a .

What it is

A workflow is a JavaScript script that Claude writes for your task. The script runs in the background, and your session stays responsive. It launches itself and keeps their results in its own variables, and only the final result reaches the conversation. The script holds the plan, not Claude.

Since the plan is code, you can:

  • read it before it runs;
  • make independent agents verify each other’s findings;
  • save it and run it again as a /<name> command.

On the Pro plan, workflows are off until you turn on the Dynamic workflows row in /config.

How to ask

Just say the word “workflow” in your request:

use a workflow to audit every file under src/ for errors that are caught and then ignored, and adversarially verify each finding before reporting it

There is also a built-in workflow, /deep-research — research with web search.

Before running, Claude Code shows the plan’s phases and asks: Yes, run it, View raw script or No. Choose View raw script or press Ctrl+G to open the script in your editor. In manual mode, Claude Code asks before every run — so you see every plan before it starts.

What a script looks like

export const meta = {
  name: 'audit-routes',
  description: 'Audit every route handler for missing auth checks',
}

const found = await agent('List every .ts file under src/routes/.', {
  schema: { type: 'object', required: ['files'], properties: { files: { type: 'array', items: { type: 'string' } } } },
})

const audits = await pipeline(found.files, file =>
  agent(`Audit ${file} for missing authentication checks.`, { label: file }),
)

return audits.filter(Boolean)
  • agent() launches one subagent;
  • pipeline() launches one agent per item in a list;
  • parallel() launches a set of agents at once;
  • args is the input you pass to a saved workflow.

The first statement is always export const meta: a plain object literal with name and description. If a variable, a function call or a spread gets in there, the /<name> command disappears from autocomplete.

The /workflows panel

While a workflow is running, type /workflows and pick the run:

KeyWhat it does
↑ ↓select a phase or an agent
Enteropen a phase, then an agent: prompt, calls, result
Escback
ppause and resume
xstop the run
ssave the script

When saving, Tab switches the location: .claude/workflows/ in the project is shared with everyone who clones the repository once you commit it; ~/.claude/workflows/ is yours alone, but in every project. From the next session, the saved script runs as /<name> and takes input, for example: Run /todo-audit on src.

The size of a run

/config workflowSizeGuideline=small

small asks Claude to plan as few agents as possible. The setting is stored in ~/.claude.json, not in the repository, and applies from the next request. It is guidance, not a limit. If a run grows large, a Large workflow warning appears in the progress line, but it neither pauses nor limits the run. To save money, start the session with --model sonnet: unless something else sets the model, workflow agents run on the session’s model.

A run stopped with x does not resume with p: ask Claude to rerun the same script.

Quick check

Claude offers to run a workflow it has just written. What do you do first?

Careful

Practice in the terminal

Check your understanding

Answered 0/3
Mode:

How is a workflow different from asking Claude to run several subagents?

What does /config workflowSizeGuideline=small mean?

A saved script stopped showing up in autocomplete as /todo-audit. What most likely broke?

Finish the task in the terminal and answer the questions to complete the lesson.

📝 My notes

Saved automatically in this browser · shows up on the Notes page.

Task

Save a workflow draft in .claude/workflows/todo-audit.js: the first line is a literal export const meta object with name and description, the second is an agent() call that takes the folder from args.

Tab complete · ↑ history · Ctrl+L clear · help commands

  • Not done: The script starts with a literal export const meta
  • Not done: meta has a description
  • Not done: The folder comes from args

Lesson Q&A

How is a workflow different from asking Claude to run several subagents?

A script holds the plan and the intermediate results, and only the final result reaches the conversation; you can read the plan in advance and rerun it — The script keeps the agents' results in its own variables. That is why it can launch many agents, cross-check their findings and rerun the same way.

What does /config workflowSizeGuideline=small mean?

Guidance for Claude on how many agents to plan into the script; it is not a limit — The size is a hint for writing the script. It is stored in ~/.claude.json, and the Large workflow warning neither pauses nor limits the run.

A saved script stopped showing up in autocomplete as /todo-audit. What most likely broke?

The first statement is no longer a literal export const meta object — a variable or function call got in there, for example — export const meta must come first and be a plain literal with name and description. A variable, a function call or a spread removes /<name> from autocomplete.

Claude offers to run a workflow it has just written. What do you do first?

The plan is code. Read it before it runs: how many agents, what they do, whether they edit files.

Commands in this lesson

Terms in this lesson

Move between lessons with ← → · search with ⌘K

Written and reviewed by Mikhail Kuzmitskii