Don't rush to stack sub-Agents: fold workflows into Claude Code Skills as Anthropic recommends (with a minimal side-by-side)

Anthropic points out that many companies' multi-Agent orchestration is slower and loses more context. This article maps that advice onto Claude Code: when to use a Skill and when to keep a Subagent. It gives a minimal Skill vs Agent file comparison for a pre-PR check, and explains why workflows that need independent refutation, such as security-audit, should not be forced into one loop.

6 分钟阅读
Don't rush to stack sub-Agents: fold workflows into Claude Code Skills as Anthropic recommends (with a minimal side-by-side)

Anthropic recently published a long engineering piece: Building agents: When to fold subagents into your main agent loop. Its core judgment is blunt: many companies turn "every team / every kind of problem" into a sub-Agent, then add an orchestration layer on top. The result is context lost through repeated summarizing, doubled latency and an inconsistent brand voice. Switching to "one main loop + progressive disclosure through Skills + tools" is often both faster and more reliable.

Developers on X have summed it up as "stop stacking sub-Agents, fold them into Skills." Taking how Claude Code is actually used, we checked the official advice, built a minimal set of "Skill vs sub-Agent" files locally, and compared them with security-audit (which deliberately keeps multi-Agent isolation), which this site just tested, to show when to fold a sub-Agent in, and when not to.

The bottom line first:

  • Default shape: one main session, one system prompt, Skills loaded on demand, a few tools; the plan is revised along the way by the same model that is doing the work.
  • Sub-Agents still fit when context would be swamped by process noise, when you need fresh windows in parallel, or when permissions or instructions conflict with each other.
  • In Claude Code, "folding in" usually means writing the sub-Agent's steps as a SKILL.md whose body loads only when triggered, instead of dispatching work with Agent from the start.
  • Our minimal example: the Skill body is 233 characters and the sub-Agent definition 128 characters; but at session start the Skill only exposes its name + description (around 60 characters), and the body loads on demand. That is progressive disclosure.
  • Counterexample: in a workflow like security-audit, where "hunters write and validators refute," isolation is itself the product feature. Forcing it into the main loop throws away independent refutation.

Create an API Key →

What the official advice actually says

The article's criticism of enterprise multi-Agent setups boils down to four ailments:

  • context is passed between sub-Agents like a game of telephone, and details get lost
  • sub-Agents multiply along the org chart, with no common standard
  • the system prompt turns into a Frankenprompt, with tone and rules clashing
  • latency: one customer compared multi-Agent orchestration with a single loop, and the single loop was roughly twice as fast

The target state they recommend:

  • one model, one context window, an open-ended tool loop
  • each turn can run a batch of tools in parallel, with results going back to the same model to decide the next step
  • processes and domain knowledge go into Skills; hard constraints (validation, approval) go into tools
  • fold one sub-Agent at a time, and let end-to-end evals decide what stays

The article also lists when a sub-Agent should stay: the main loop is measurably being dragged down by context; the task must run in parallel and be thrown away afterwards; or a single Agent cannot pick tools well or has conflicting instructions.

Mapping it to Claude Code: CLAUDE.md, Skills, Subagents

MechanismWhen it enters contextGood forDon't use it for
CLAUDE.mdAlmost alwaysProject commands, boundaries, acceptance criteriaStuffing in an encyclopedia of long procedures
SkillName/description always present, body on demandRepeatable multi-step workflowsOne-off chat prompts
SubagentSeparate window, returns only a final summaryDeep searches, oceans of logs, read-only reviewsDispatching one for every small step

For details on writing Skills, see How to write SKILL.md; for installing general-purpose Skills, see How to use Agent Skills. To save quota on sub-Agents, you can set the execution model to Haiku: Configuring Haiku 5.5 sub-Agents.

Minimal side-by-side: folding a "pre-PR check" into a Skill

Say you used to have a pr-reviewer sub-Agent, and the main session kept sending it off via Agent to "run the tests + look at the diff." Following the official thinking, if the steps are short and you then want to keep editing in the main conversation, it should become a Skill.

We put two minimal files in an empty project (only to compare structure, not tied to any framework):

markdown
---
name: pr-check
description: 在提交或开 PR 前做一次本地检查:跑测试、看 diff、列出风险点。用户说「提交前检查」「PR 前检查」时用。
---

按下面顺序做,结果写回主对话,不要另起子 Agent:

1. 用 git status / git diff 看改了什么
2. 跑项目里已有的测试命令(从 package.json 或 README 找)
3. 用三条以内要点说明:通过了什么、失败了什么、建议提交前再改什么

Compare the old sub-Agent header:

markdown
---
name: pr-reviewer
description: 独立审查当前改动并返回摘要
tools: Read, Grep, Bash
---

你是只读审查员。检查当前 git diff,返回:风险列表、测试建议、是否建议合并。不要修改文件。

Size comparison (counted with wc): the full Skill is 233 characters / 11 lines; the sub-Agent 128 characters / 8 lines. The difference is not which is shorter but when it loads: at session start the Skill only attaches name + description (our description is about 60 characters), and the body enters the main context only when a task matches or you type /pr-check; the sub-Agent opens a new window, and you never see its intermediate reasoning, only the summary.

Migration rules of thumb:

  • move the "steps" from the sub-Agent's system prompt into the Skill body
  • turn actions that "must hit an external system" into MCP / tools, not another Agent
  • when the main session runs the workflow itself, write "do not start a sub-Agent" in the Skill
  • only use context: fork or a real Subagent when you need to isolate noise; the official Skills docs support a Skill running research tasks in a forked Explore

When not to fold: the security-audit counterexample

This site just ran Cloudflare's security-audit skill with a third-party Key: one standard run on DVNA used 49 Agents, specifically so that "a fresh Agent that did not write this candidate" would try to refute it. Here multiple Agents are not an org-chart illusion but independence of verification. Folded into a single main loop, the same context would both write candidates and refute them, and the review would lose its value.

So the decision table can be firmer:

SignalLeaning
The steps need you to watch and edit as you go, sharing files just readSkill + main loop
You only need a summary; intermediate output is noiseSubagent
Must run in parallel without contaminating each otherSubagent / fork
The second Agent exists precisely because it has "not seen the first pass"Keep the isolation; don't fold

How it fits with recent Claude Code features

  • The 2.1.310 package already includes a ProposeSkills tool type, which can propose new Skills or improve old ones from memory or past work. When you are about to fold a sub-Agent, have the model draft the SKILL.md first, then review it yourself.
  • To watch logs for long tasks in the background, use Monitor (see the Monitor 2.1.310 tutorial); there is no need for a separate "log sub-Agent."
  • The official migration kit hangs off skills related to /claude-api (build-eval, hillclimb and so on), aimed at Claude API / Agent SDK engineering; for pure CLI workflows, just start with "one Skill replacing one dispatch."

Hands-on checklist

  • List the sub-Agents you actually dispatched in the past week, with why each was triggered
  • For each, ask: if the body ran in the main session, would quality get better or messier?
  • Better → write it as a Skill with clear trigger words in the description; messier → keep it, and tighten its tools
  • Migrate one at a time, then regression-test with the same batch of real tasks

Configure a third-party Key with the setup guide; if you want Claude and Codex to review each other's plans and code, see claudex-loop, tested. That is "keeping two vendors' models," not "stacking ten sub-Agents inside one."

Create an API Key →

FAQ

Won't folding into the main loop blow up the context?

Skill bodies load on demand, and tools can use tool search / deferred loading. Anthropic says it once cut Claude Code's system prompt on more advanced models by more than four-fifths, partly by moving capabilities to progressive disclosure. If context really does blow up, then open sub-Agents for "deep searches / oceans of logs."

Can Skills and Subagents be combined?

Yes. A Skill can use context: fork to run in Explore; a Subagent can also preload knowledge with skills:. Anthropic calls the former "a Skill taking its task into an isolated environment" and the latter "an isolated helper starting work with a manual."

Does this conflict with "multi-model routing"?

No. The article criticizes copying sub-Agents along the org chart within one product; splitting work across Claude / Codex by task type is still fine, as long as each keeps its own single loop clean.