How to spawn subagents in Claude Code
Spawn Claude Code subagents for parallel research, isolated reviews, custom agent files and safer agentic workflows.

Put it into practice
What you will produce
A bounded brief, a read-only or file-owned scope, a completion condition and a findings report with source paths.
- 01
Choose independent work
Delegate research or implementation that can progress without editing the same files as the parent task.
Expected result: Delegation avoids competing ownership.
- 02
Write a bounded assignment
Name question, allowed sources or owned files, required evidence, and concrete done condition.
Expected result: The subagent knows its scope and completion target.
- 03
Coordinate file ownership
Assign files and state that others may work elsewhere; avoid overlapping edits.
Expected result: Parallel work has boundaries that can be integrated safely.
- 04
Review returned evidence
Compare findings with source paths or diff, resolve contradictions, and check the parent task’s acceptance criteria.
Expected result: The parent remains responsible for correctness.
Define and invoke a read-only repository researcher
# .claude/agents/repo-researcher.md
---
name: repo-researcher
description: Trace one repository question and return file-backed findings. Use for read-only investigation.
tools: Read, Grep, Glob
---
Read the repository instructions first.
Investigate only the assigned question.
Cite file paths and symbols for every finding.
Do not edit files or run commands.
List unresolved questions separately.Save this project-scoped definition at `.claude/agents/repo-researcher.md`, start Claude Code from the repository, then ask: `Use the repo-researcher agent to trace where this route gets its account ID. Return the source paths and stop without editing.` Confirm the delegation appears in the transcript and inspect the cited paths yourself. The read-only tool list narrows this agent's tools; it is not a substitute for operating-system security.
Acceptance checks
- Delegation avoids competing ownership.
- Parallel work has boundaries that can be integrated safely.
- The parent remains responsible for correctness.
Limits and trade-offs
Parallel agents add coordination and context cost. Delegate only work that can progress independently and review all findings.
Official sources
Read the subagents guide
Related guides
Claude Code Subagents: Parallel Agents
Learn when Claude Code subagents help, how to split parallel work, and how to configure a focused custom subagent without creating conflicts.
Subagents are useful when a task can be split cleanly: one agent searches the authentication code, another traces the database path, and the main conversation compares what they found. They add little to "read this file" or to work where every step depends on the same context. Short version: delegate independent research or a separate review when the results are worth the extra context and usage. Give each agent a narrow scope, the files or area to inspect, and a specific report format. Keep dependent work in the main conversation. Claude Code agents vs subagents Claude Code's documentation calls delegated workers subagents and uses Agent for the tool that starts them. When people search for Claude Code agents in this context, they usually mean subagents: workers that handle a delegated task in their own context and return a result to the main conversation. Claude Code's subagent documentation uses this terminology.…
Read the guide