Claude Code Workflows
Agentic workflows, subagents, multi-step tasks
Last reviewed
Recommended
Claude Code Workflows — Timed Test 3 (10 questions)
No account needed. Answers and explanations arrive when you submit.
What this topic tests
The mix every Claude Code Workflows set is built to, and the questions published against it so far. Nothing here is hidden before you start.
| Level | Target share | Published |
|---|---|---|
| Easy | 40% | 20 |
| Medium | 40% | 20 |
| Hard | 20% | 10 |
| Total | 50 |
Claude Code Workflows — the theory
Why Delegate Anything
Delegation looks like a speed trick and is mostly an economy one. What you spend is the context window of the conversation you are steering, and reading forty files into it to answer one question wastes it fastest. So delegate when the task produces verbose output you don't need in your main context — delegate the exploration so only the findings come back. The bill does not disappear, though: running several sessions or subagents at once multiplies token usage.
What a Subagent Is, and What It Never Sees
A subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions, and returns a summary.
The isolation is the feature and the price. Each starts fresh, and it doesn't see your conversation history, the skills you've already invoked, or the files Claude has already read. "Fix the bug we just discussed" reaches an agent that was not there: whatever the worker needs must be in its prompt.
A fork is the exception that proves the rule — a subagent that inherits the entire conversation so far instead of starting fresh. Use one when re-explaining would cost more than the work; a fork can't spawn further forks.
Claude picks the worker automatically based on the task description in your request. Foreground subagents block the main conversation until complete; background ones run while you keep working, their results arriving as a completion notification in a later turn.
Four Surfaces, and the Question That Chooses Between Them
Claude Code delegates four ways, and in every approach the workers are Claude sessions. What separates them is one question: who holds the plan?
- Subagents — Claude holds it, turn by turn: workers that do a side task in their own context and return a summary.
- Background sessions — you hold it: they run unattended and report only to you.
- Agent teams — a lead session holds it, coordinating work, assigning tasks, and synthesizing results.
- Dynamic workflows — a script holds it. A workflow moves the plan into code.
Anthropic draws that line directly: use subagents when you need quick, focused workers that report back; use agent teams when teammates need to share findings, challenge each other, and coordinate on their own. And one near-miss: a background bash command doesn't spawn an agent.
Agent Teams Coordinate Peers
Teammates work independently, each in its own context window, and communicate directly with each other — the difference from subagents.
- Teams don't isolate teammates in worktrees, so two teammates editing the same file leads to overwrites — break the work so each owns a different set of files.
- Consent does not delegate: a teammate denied an action can't relay it to another teammate to bypass the check.
- Teammates cannot spawn their own teammates, and the main session is the lead for its lifetime.
Coordination is explicit: a teammate shares results by messaging the lead or updating the shared task list. And they cost more: teams use significantly more tokens than a single session, and for sequential tasks, same-file edits, or work with many dependencies, a single session or subagents are more effective.
When the Plan Belongs in a Script
A dynamic workflow is a JavaScript script that orchestrates subagents at scale, written for the task you describe. What it buys is context, not concurrency: the script holds the loop, the branching, and the intermediate results itself, so Claude's context holds only the final answer. A script can even have independent agents adversarially review each other's findings before they're reported.
The price is your absence: there is no mid-run user input, so every decision is encoded before the run starts. So run the workflow on a small slice first to gauge the spend.
Isolation Is Not Coordination
The common failure in parallel work is two agents editing one file — a different problem with a different answer: worktrees isolate file edits, while subagents and agent teams coordinate the work itself.
A git worktree is a separate working directory with its own files and branch, sharing the same repository history and remote as your main checkout, so edits in one session never touch files in another. They require a git repository; outside one, sessions aren't isolated from each other. Claude Code blocks commands that reach back into the main checkout, and you can't turn this check off. Removing a worktree deletes the worktree directory and its branch, along with all the work in them.
Handing Off, and What Crosses Between Agents
A background session is a full Claude Code conversation that keeps running without a terminal attached, so you can open it, reply, and leave whenever you want. A subagent it spawns lands its file edits in the session's worktree rather than your working copy. And because it runs autonomously, it can't ask clarifying questions — the brief is the whole job.
Between sessions, a message is a piece of text one Claude writes to another, never conversation history or files; to move a whole conversation or its context, resume the session instead. No message from any agent counts as your approval for a pending permission prompt.
Splitting the Work Before You Delegate It
Decomposition is about ownership, not size: one agent, one set of files, one deliverable.
Fan out when the pieces are independent — each subagent explores its area independently, then Claude synthesizes the findings — which works best when the research paths don't depend on each other. Chain them when they do, so each passes relevant context to the next subagent.
Decide before editing, because letting Claude jump straight to coding can produce code that solves the wrong problem. And pilot anything repetitive: refine your prompt based on what goes wrong with the first 2-3 files, then run on the full set.
The Grader Must Not Be the Worker
Claude stops when the work looks done, and without a check the only thing deciding the agent is finished is the agent itself. So the longer Claude works unattended, the more an independent check matters — move the grading off the worker.
- Give Claude something that produces a pass or fail, and the loop closes on its own — then ask for the test output, the command it ran and what it returned, not an assertion.
- Review in a fresh context. A reviewer in a fresh subagent context sees only the diff and the criteria you give it, not the reasoning that produced the change, so it won't be biased toward code it just wrote — which is how the agent doing the work isn't the one grading it.
A goal adds a separate evaluator that checks your condition after every turn, so completion is decided by a fresh model rather than the one doing the work. Code Review is the same shape at scale: each agent looking for a different class of issue, then a verification step checks candidates against actual code behavior.
The trap sits inside the solution: a reviewer prompted to find gaps will usually report some, even when the work is sound, because that is what it was asked to do. So put the constraint in the brief — flag only gaps that affect correctness or the stated requirements — because chasing every finding leads to over-engineering. An unfiltered reviewer is not a stricter one.
Where a Repeatable Workflow Lives
Create a skill when you keep pasting the same instructions, checklist, or multi-step procedure into chat. For a guarantee rather than guidance, hooks are deterministic: they fire at fixed lifecycle points rather than at the model's discretion. Guidance belongs in a skill, enforcement in a hook, orchestration in a script.
Where to Go Next
Claude Code collects the subject. Claude Code Basics is the page underneath this one, and where compaction and /rewind live. MCP Integration in Claude Code adds the tools these agents reach for. AI Agents Basics generalises what changes once any assistant is given tools, and Prompt Engineering for Code covers the brief a delegated worker has to succeed from.
Sources
Official Anthropic documentation for Claude Code. Agents · Subagents · Agent teams · Workflows · Worktrees · Agent view · Cross-session messaging · Common workflows · Best practices · Glossary · Goal · Code Review · Skills
Sample questions
Three questions from this topic, with the answer and the reasoning shown.
Q1EasyA colleague arranges several Claude Code sessions as an agent team: one lead, a few teammates, and a task list shared between them. What does that arrangement add, compared with a set of workers that each hand their findings back to the session that called them?
- The same workers under a new label — one caller still hands out the tasks and collects what each one returns
- Peers that each hold their own context window and message one another directly, coordinated by a lead through a shared listCorrect
- Peers do exist, but every finding travels through the lead, which relays to the others whatever one teammate learned
- Stronger workers than the same job would otherwise get, so the work that comes back is of better quality
Explanation
The principle — a team is not a bigger subagent; what changes is who talks to whom.
Why the key is correct — three documented sentences fit together. Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. And teammates work independently, each in its own context window, and communicate directly with each other. The glossary names the two channels: a shared task list and peer-to-peer messaging.
Why the others are wrong — a relabelling would leave the topology alone, and that is what moves. A lead that relays every finding is not what is described: it assigns and synthesises while teammates talk between themselves. Capability is not what separates the surfaces.
Remember this — a team buys peers with a shared list, not better workers.
Sources — Anthropic's agent teams documentation and the glossary.
Q2EasyA dynamic workflow is a script that orchestrates subagents. What does the script itself hold that a conversation doing the same work would otherwise be holding?
- The loop, the branching and the intermediate results, so what reaches the conversation is the final answer aloneCorrect
- The wording of a prompt you saved and re-run whenever the same job comes round again, rather than anything that executes
- The arrangement for running many agents at the same time, since doing the work concurrently is what the whole thing is for
- The sequence the agents run in, while each agent's working output still arrives in your conversation as it is produced
Explanation
The principle — a workflow moves the plan out of the conversation and into something that executes, and the context saving follows from where the working state is kept.
Why the key is correct — Anthropic defines it in three steps. A dynamic workflow is a JavaScript script that orchestrates subagents at scale. A workflow moves the plan into code. And the consequence: a workflow script holds the loop, the branching, and the intermediate results itself, so Claude's context holds only the final answer.
Why the others are wrong — a saved prompt cannot loop or branch. Concurrency is a by-product rather than the purpose. And intermediate results landing in the conversation is the thing the arrangement is built to prevent.
Remember this — the script holds the working state; the conversation gets the answer.
Sources — Anthropic's Claude Code documentation on orchestrating subagents at scale.
Q3EasyA shell command sent to the background, and a prompt set to run on a schedule in the cloud, are both sometimes described as delegating work. What do they actually have in common?
- Both are lightweight agents, useful when the job does not need a full one
- Neither gives you another agent working in parallel on your machineCorrect
- Both run agents in parallel with your session, just started differently
- Both count as delegation, because neither one blocks your conversation
Explanation
The principle — two mechanisms look like parallel delegation because neither makes you wait. Neither gives you a second agent beside you.
Why the key is correct — Anthropic rules each out in its own sentence. A background bash command runs one shell command without blocking the conversation, and it doesn't spawn an agent. A routine runs a session on a schedule in the cloud, not in parallel on your machine.
Why the others are wrong — there is no lighter class of agent here — one of the two involves no agent whatever. Nor are both parallel: a scheduled run happens in the cloud on its own timetable. And treating non-blocking as the test would make almost anything delegation.
Remember this — not waiting is not the same as being helped. Ask what got started, and where.
Sources — Anthropic's Claude Code agents documentation.
Practise all 50 questions
Every published question in Claude Code Workflows, with its answer and explanation.
- A colleague arranges several Claude Code sessions as an agent team: one lead, a few teammates, and a task list shared between them. What does that arrangement add, compared with a set of workers that each hand their findings back to the session that called them?easy
- A dynamic workflow is a script that orchestrates subagents. What does the script itself hold that a conversation doing the same work would otherwise be holding?easy
- A shell command sent to the background, and a prompt set to run on a schedule in the cloud, are both sometimes described as delegating work. What do they actually have in common?easy
- A skill holds a long reference document you need only now and then. How does keeping it in the skill compare with putting the same text in CLAUDE.md?easy
- A subagent finishes a delegated fix and its summary says the change is complete. On its own, what has that summary established?easy
- A subagent has been dispatched in the foreground. Where does that leave the main conversation while the worker runs?easy
- A subagent starts on a task you have delegated. What does it start without?easy
- Before any parallel work is dispatched, a colleague suggests giving each session its own git worktree. What is a worktree, and what does it need?easy
- Claude has just written a change and offers to look over it again. You could instead send the diff to a reviewer subagent that starts fresh. Why does the fresh reviewer's verdict carry more weight?easy
- Delegated workers in one session, a team under a lead, and a script that orchestrates agents are three ways of splitting up a job. Which single question separates them most usefully when you are choosing?easy
- What does a subagent have of its own, rather than sharing it with the conversation that spawned it?easy
- What does running several subagents at once, each returning a detailed result, cost you?easy
- A refactor will take you three or four sittings this week, and one slice of it will go to a subagent that was not there for today's discussion. You have kept a detailed written plan as you worked. What does that plan buy you?easy
- What makes a fork different from every other subagent?easy
- When a subagent finishes a delegated task, what comes back into the conversation that sent it?easy
- You are dividing a piece of work across the teammates of an agent team. Why does each teammate need to own a different set of files?easy
- You can have several subagents work at the same time, or have them work one after another. What should decide which of those two you ask for?easy
- You describe a job to Claude without naming any particular worker for it, and Claude hands it to one of your project's subagents anyway. What did it match the job against?easy
- You hand a long task to a background session and close the terminal you started it from. What is a background session?easy
- You want one of your Claude Code sessions to tell another that a migration has landed, and you are also wondering whether that same mechanism could hand the second session the whole discussion you have been having in the first. What does a message from one session to another carry, and what does moving an entire conversation take instead?easy
- A background session working in its own worktree spawns a subagent, which edits several files. Where do those edits land, and what would be different if the project were not a git repository at all?medium
- A migration has three steps, and the third can only be written once the second has found which call sites actually change. You want all three delegated. What should you ask for, and what will the third worker have to go on?medium
- A reviewer subagent returns fourteen findings on a change you have good reason to believe is sound. Reading through, most are style preferences and edge cases that cannot occur. What should you do?medium
- A session running inside its own worktree tries a shell command whose working directory resolves back to your main checkout, and Claude Code blocks it. Your colleague wants the quickest way past that. What is true?medium
- A subagent is running concurrently while you keep working, and its answer is the thing your next instruction depends on. At what point can you act on what it found?medium
- A workflow you dispatched is halfway through when it reaches a decision you would normally have been asked about — which of two shapes an output should take. Your session is responsive throughout. What happens?medium
- Every sprint you paste the same five-step release procedure into the conversation. Two of its steps need subagents spawned and several files read, and the procedure runs in the conversation you are already in. Where should it live?medium
- Every sprint you spin up the same kind of worker with the same instructions, so you write it up as a custom subagent and commit the file. A colleague then asks whether moving that file somewhere else would let it use more tools. What should you tell them?medium
- Three files have to be reworked in a fixed order, because each change rests on the one before it. A colleague proposes standing up a team of five teammates to get through it faster. What is the better call here, and why?medium
- Two Claude Code sessions are working the same checkout and keep overwriting each other's edits. A colleague proposes turning them into an agent team so the work is divided properly. What actually fixes the overwriting?medium
- Two of your sessions are working the same repository in separate worktrees. One has just landed a migration, and it messages the other to say so and to ask it to approve a permission prompt that is pending there. What is the outcome?medium
- Answering one architectural question means reading roughly forty files, and you need the session you are working in to stay usable for the rest of the day. You ask Claude to delegate the reading to a subagent. What does that achieve?medium
- Three subagents have each finished a slice of a refactor, and each has reported success. You are about to run a verification pass over the combined result. What has to be true of that pass for it to tell you anything you do not already have?medium
- You and Claude spend twenty minutes narrowing a failure to a race condition in one module. You then ask Claude to delegate the fix to a subagent, and the subagent comes back asking which failure it is meant to be fixing. Why?medium
- You hand off three unrelated tasks by entering three prompts, one after another, and go and do something else. An hour later two have made progress and the third has not moved at all. What is the situation?medium
- You have a prompt meant to update two hundred files and you have never run it. Once started it runs autonomously, so it cannot stop to ask you anything. How should you begin?medium
- You have spent an hour with Claude settling a migration design. You want a second opinion from a worker that already knows the whole discussion, and you then want that worker to pass the same whole discussion on to several more workers of its own. What can you actually get?medium
- You start a team working and step away from your desk. One teammate reaches an action that needs a permission decision before it can go ahead. What happens to that prompt, and what does it take to clear it?medium
- You want a worker whose findings land back in the conversation you are steering, and you want it to keep going after you close this session. Which part of that is available, and why?medium
- You want a workflow to audit an entire repository and you cannot tell in advance what that will cost. Someone suggests writing a size guideline into the script and letting it run overnight in the background. What is the sensible first move?medium
- A long delegated change is finished and four ways of checking it are proposed. Which one puts something other than the agent that did the work in the grading seat?hard
- A review pass has independent agents adversarially check each other's findings before any is reported, and a fresh model tries to refute each one. For one finding, that attempt neither confirms it nor refutes it. How does the report treat it?hard
- A workflow of thirty agents is under way. You stop it while agent twelve is still working, and agents one to eleven have already finished. You resume in the same session a few minutes later. Which of that work is reused?hard
- A worktree from an earlier session is still on disk and holds two commits you never pushed. You run the cleanup sweep and it leaves the directory alone, so you then remove that worktree by name to tidy up. What happens at each step?hard
- Midway through a team run three things come up at once. A teammate that was denied a command asks a peer to run it instead. A second teammate wants to bring in a helper of its own. And you decide that the teammate with the clearest grasp of the problem ought to take over as lead. Which of the three can actually happen?hard
- You give a reviewer subagent the diff and a list of criteria, while the session that wrote the code stays open. Which account of that arrangement is right about what the reviewer can see, where its findings go, and what an open-ended brief will return?hard
- You leave a team working for three unattended hours. You come back to a single completion notification from one teammate and nothing else, and the file it rewrote ignores a naming decision you settled with the lead in your own session before the team started. What is actually going on?hard
- You need a dependency graph read out of a large module, and your very next instruction is going to act on what comes back. You can dispatch the worker so that it blocks the conversation, or so that it runs alongside you. Which account of the two options is right about what each costs you here?hard
- You send a built-in read-only research agent to survey a codebase, and its findings quietly ignore a naming convention your project records in its instructions file. You would like to point that out and have it carry on from where it got to. What is actually going on, and what can you do next?hard
- You set a completion condition on a substantial task and let it run without prompting each step, with a separate evaluator checking the condition after every turn. Partway through, the condition turns out to be impossible to satisfy. What happens?hard
Frequently asked
What people ask about claude code workflows.
Why does my subagent seem to ignore what we just discussed?
Should I reach for subagents or an agent team?
How do I stop two parallel agents from overwriting each other's work?
Can I trust Claude's own “done” after it has been working unattended?
Why does my reviewer subagent always find something wrong?
What does a dynamic workflow do that asking Claude to spawn subagents does not?
More Claude Code topics
Related guides
How it works · 11 min read
Why the agent stopped before it finished
You asked for five things and got one, with a confident summary and no error. An agent loop ends when the model writes a message containing no tool call — a judgement nothing checks against your task. The five ways a run ends early, each fingerprint, and the phrasing that fixes it.
How it works · 9 min read
What a Claude Code subagent can and cannot see
The docs specify how to define a subagent and never state what it inherits. A subagent starts on an empty context window, the delegation prompt is the only thing that crosses, and only its final message comes back — so it re-reads files you already read, and that is the feature working.