Pillar 4 · Knowledge · Intro

Subagents: Context Management + Task Delegation.

Subagents are specialized helpers that Claude Code spawns into their own context window to handle a focused task and return only a summary. They keep your main conversation clean by isolating tool calls, file reads, and search noise. Use built-in subagents (Explore, Plan, General) or define custom ones with scoped system prompts and tool whitelists.

4 Skilljar lessons·~25 min on Skilljar·D1

Mirrors Anthropic's Introduction to Subagents course on Skilljar.

Original course4 lessons · ~25 min
Introduction to Subagents
Take it on Anthropic Skilljar ↗
Subagents: Context Management + Task Delegation, painterly hero showing the course's central concept with the Loop mascot as guide.
01 · What you'll learn

You'll walk away with

  1. Why subagents exist and what problem they solve in long Claude Code sessions
  2. How to invoke a built-in subagent vs spawn a custom one from a config file
  3. How to write a focused system prompt + tool whitelist that keeps a subagent on-task
  4. When to use a subagent and when to keep work inline in the main thread
02 · Prerequisites

Read these first

03 · The course mirror

Lesson outline

Every lesson from Introduction to Subagents with our one-line simplification. The Skilljar course is the source; we summarize.

#Skilljar lessonOur simplification
1What are subagents?Specialized helpers that run in their own context and return only a summary, isolating tool noise from your main thread.
2Creating a subagentDefine a markdown config with name, description, tools, and system prompt; place it in .claude/agents/ to make it discoverable.
3Designing effective subagentsScope tightly: focused role, narrow tool whitelist, explicit output format. Broad agents drift; narrow ones land.
4Using subagents effectivelyInvoke explicitly when you want isolation, accept the visibility tradeoff, and aggregate findings in the parent thread.
04 · Our simplification

The course in 6 paragraphs

Subagents exist because every Claude Code session has a finite context window, and every tool call, file read, and search result fills that window with noise. After 50 turns of debugging, you might need to scroll past dozens of intermediate tool outputs to find the answer Claude actually gave you. Subagents fix this by running their own conversation in a separate window, doing their work, and returning only a summary to the main thread. The intermediate work is discarded; you keep the answer.

Mechanically, a subagent receives two inputs at spawn: a custom system prompt (defining role and behavior) and a task description (written by the parent agent based on the user's request). It then runs its own loop with whatever tools it has access to, isolated from the parent's context. When it returns, only the summary lands in the main thread. The parent never sees the intermediate steps, which is both the value (cleaner context) and the limitation (less debuggability if the subagent reaches a wrong answer).

Claude Code ships three built-in subagents: General (multi-step tasks needing both exploration and action), Explore (fast search and navigation), and Plan (used during plan mode for research before producing a plan). For most tasks, the built-ins are enough — Claude picks which one to use automatically when you ask the right shape of question. The customization story matters when your team has recurring specialist patterns — a code reviewer, a test writer, a docs generator — that warrant a fixed config.

Custom subagents live as markdown files in .claude/agents/ (or ~/.claude/agents/ for personal). Each file declares: a name, a description (which Claude reads to decide when to invoke), a tool whitelist, and a system prompt. The tool whitelist is load-bearing: a code-reviewer subagent should have [Read, Grep, Glob] only, never [Edit, Write]. Tool overscoping is the canonical anti-pattern. Claude is allowed to call any whitelisted tool but will never call one outside the list, so the whitelist is your safety contract.

Designing effective subagents comes down to three rules: scope tightly (one role, not three), constrain tools (minimum needed for the role), and define output format (so the parent can aggregate cleanly). A subagent without an output schema wanders. A subagent with [Read, Grep, Glob, Bash, Edit, Write] is just another general-purpose agent in disguise. The narrow ones land; the broad ones drift, every time.

When you should *not* use a subagent: short tasks where the noise is minimal, exploratory work where you want to see the journey, or anything where you'll need to debug the path to the answer. The clean-context benefit is also a visibility cost — once the subagent returns, you cannot ask it follow-up questions, and the intermediate state is gone. For inline reasoning that should remain in the parent thread, just stay inline. Subagents are for delegation, not micro-isolation.

05 · Listicle pattern

3 anti-patterns when designing subagents

Each of these will be a question on the exam in disguise. Watch for the failure mode behind each.

  1. Tool overscoping

    Granting [Read, Edit, Write, Bash] to a code-reviewer subagent. The reviewer should never edit; the whitelist is the contract. Restrict to [Read, Grep, Glob] so accidents become impossible.

    Concept: tool-calling
  2. No output format

    A subagent without a defined output schema wanders for 30+ turns and returns a wall of prose. Define a structured shape ({findings: [], confidence: number}) so the parent can aggregate.

    Concept: structured-outputs
  3. Treating subagents as inheritance

    Subagents do NOT inherit the parent's chat history. Pass every fact the subagent needs in the task string. This is the single most-tested distractor pattern.

    Concept: subagents
06 · Key takeaways

5 takeaways with cross-pillar bridges

Subagents run in their own context window and return only a summary, isolating tool noise from the parent thread.

Claude Code ships three built-in subagents (General, Explore, Plan); custom ones live as markdown files in .claude/agents/.

Tool whitelist is the load-bearing contract for safety — restrict to the minimum needed for the role; never trust prompt-only constraints.

Subagents do NOT inherit the parent's conversation; pass every required fact in the task string explicitly.

Define a structured output format in the subagent's system prompt to bound runtime and enable clean parent-side aggregation.

07 · Exam mapping

How this maps to the CCA-F exam

Domains
D1 Agentic Architectures
Blueprint
27% (D1)
What it advances
Direct prep for D1 task statements on agent-to-subagent delegation, hub-and-spoke topology, and context isolation. Subagents appear in P3.3 multi-agent-research and the developer-productivity scenario.
08 · Curated supplementary sources

2 hand-picked extras

These amplify the Skilljar course beyond what the course itself covers. Each was picked for a specific reason.

09 · Concepts wired

Concepts in this course

10 · Scenarios in play

Where you'll see this in production

11 · Sibling Knowledge

Other course mirrors you may want next

12 · AEO FAQ

7 questions answered

Phrased as the way real students search. Tagged by intent so you can scan to what you actually need.

DefinitionWhat is a subagent in Claude Code and how is it different from the main agent?
A subagent is a specialized helper that runs in its own separate context window, does a focused task, and returns only a summary to the main thread. The main agent stays clean of all the intermediate file reads, searches, and tool calls the subagent performed. Subagents are stateless across invocations and do not inherit the parent's conversation.
ComparisonWhen should I use a subagent vs keep work inline in the main Claude Code session?
Use a subagent when the task is bounded, well-described, and you don't need to see the journey — exploration, research, code review, automated tests. Stay inline when you want visibility into the reasoning, when the work is short enough that context noise doesn't matter, or when you'll iterate based on intermediate findings.
How-toHow do I create a custom subagent in Claude Code?
Create a markdown file in .claude/agents/<name>.md with frontmatter declaring name, description, tools (the whitelist), and system_prompt. Claude Code auto-discovers files in this directory and uses the description field to decide when to invoke the subagent. Place personal subagents in ~/.claude/agents/ and project ones in .claude/agents/.
TroubleshootWhy does my subagent return wrong answers about facts the main conversation already established?
Subagents do not inherit the parent's conversation history. The parent must pass every required fact in the task string explicitly. If the parent says `investigate the refund flow` without naming which customer, file, or service, the subagent has nothing to anchor on and will guess. The fix is to embed all needed context in the task description.
How-toWhat tools should I give a code-review subagent?
Restrict to [Read, Grep, Glob] — strictly read-only. Reviewers should never edit, write, or run code. Tool overscoping is the canonical anti-pattern: granting Edit or Write to a reviewer means accidents become possible. The whitelist is your safety contract; the prompt alone won't enforce it.
ScopeAre subagents and Claude API agents the same thing?
No. Subagents are a Claude Code specific feature for delegating work inside a coding session. Agentic loops on the Claude API are a more general pattern where any client harness orchestrates messages.create calls with tool use. The mental model is similar (parent dispatches, child does focused work), but the runtime, tool surface, and configuration are distinct.
DefinitionHow many built-in subagents does Claude Code have and what do they do?
Three: General for multi-step tasks needing both exploration and action; Explore for fast search and codebase navigation; Plan for research and analysis during plan mode. Claude picks which built-in to invoke based on the task shape. Custom subagents extend this set with team-specific specialists like reviewers, test writers, or docs generators.
Last reviewed: 2026-05-06·Refresh cadence: 90 days; or whenever Skilljar updates the Introduction to Subagents course·View on Skilljar ↗
K · Intro · D1 · Agentic Architectures

Subagents: Context Management + Task Delegation, complete.

You've covered the full ten-section breakdown for this primitive, definition, mechanics, code, false positives, comparison, decision tree, exam patterns, and FAQ. One technical primitive down on the path to CCA-F.

Share your win →