Vibe Coder · Unit 9: Claude Code Commands and Extensions · Lesson 5 of 10

Subagents

Engineers: a subagent does a side task in its own context and returns only the result, keeping your main session focused.

Read the short notes and pictures.Do everything inside a blue frame.

Delegating inside a session

Subagents are separate instances that Claude Code can start for a task. Whatever they read stays in their own context, and only their final report comes back. That makes them ideal for exploration and for independent review.

A 3D scene of coloured blocks and cards. : Main session, Subagent.
A subagent has its own context window.

Good uses

Search

"Find every place we call the payments API."

Review

A reviewer that did not write the code.

Parallel work

Independent tasks that do not touch the same files.

A 3D scene of coloured blocks and cards. Define your own: a reviewer, a test writer, a researcher.
Each can have a role and limited tools.

Defining one

  1. Give it a clear role

    One job.

  2. Limit its tools

    A reviewer needs to read, not to write.

  3. Describe when to use it

    So the main agent delegates at the right time.

  4. Commit it

    To share with the team.

ActivityBuild stepYour Claude Code setup

Add a reviewer subagent

Define a read-only reviewer subagent with your review checklist. Use it on your next change and compare what it finds with your own review.

Done when

Run it before every merge.

Keep these

  • Subagents work in their own context.
  • Only the result returns.
  • Give each a role and limited tools.