Paths/Claude Engineer/Subagents & Automation / Subagents
Define a Subagent
A subagent is a small, specialised prompt with its own tools. Write the definition for a reviewer that only reads.
Validator
IDLE — checks run live as you type commands; submit when done
01Requirements
live checks- Directory ~/project/.claude/agents exists○
- File ~/project/.claude/agents/reviewer.md exists○
- The definition names the agent and describes when to use it○
- The definition lists the tools the agent may use○
02Walkthrough
4 steps- 01
Create the agents directory
Subagents live in the repository, so the whole team gets the same specialists.
mkdir -p ~/project/.claude/agents - 02
Write the front matter
name identifies the agent, description says when the main agent should hand over to it, tools lists what it may use.
echo 'name: reviewer\ndescription: reviews a diff for correctness, security and missing tests. Use it before opening a pull request.\ntools: Read, Grep, Bash' > ~/project/.claude/agents/reviewer.md - 03
Write the instructions
The body is the job. Say what a good review looks like and what the output should contain.
echo '\n## Job\n\nRead the diff, list the findings with a file and a line, and give a verdict: approve, approve with changes, or request changes. Never change a file yourself.' >> ~/project/.claude/agents/reviewer.md - 04
Verify and submit
cat the definition, then submit for validation.
cat ~/project/.claude/agents/reviewer.md
03Stuck?
0 of 3 revealedTake a hint without losing the lab — each one points at the thing to look at, not at the answer.
04AI Tutor
guides, never solvesTell me what you're stuck on — I'll nudge, not solve. Which requirement are you looking at?
04Notebook
saved locally in this browserlearner@lab — ubuntu:24.04
Session is disposable
↑/↓ recalls commands · Ctrl+Enter submits · type help for the command list