Skip to content

Subagents

A subagent is a markdown file in agents/ defining a worker with its own system prompt, tool access, and optionally its own model. Subagents run in a fresh context window, completely separate from your main conversation. They might read dozens of files, but your session only receives a summary — this isolation is why subagents help with long sessions.

.claude/agents/code-reviewer.md
---
name: code-reviewer
description: Reviews code for correctness, security, and maintainability
tools: Read, Grep, Glob
---
You are a senior code reviewer. Review for:
1. Correctness: logic errors, edge cases, null handling
2. Security: injection, auth bypass, data exposure
3. Maintainability: naming, complexity, duplication
Every finding must include a concrete fix.

The description tells Claude when to delegate automatically; tools: restricts access (here read-only — it can inspect but never edit). Type @ to delegate directly from the autocomplete. Subagents with memory: project|local|user get their own persistent MEMORY.md.

Skill vs subagent: skills are reusable content loaded into any context; subagents are isolated workers. They combine — a subagent can preload skills via its skills: field, and a skill can run isolated with context: fork.

Question 1What returns to your main conversation when a subagent finishes?

Question 2How do you restrict a subagent to read-only inspection?