Week 4

Skills

Different Models

Connectors (MCP)

Subagents

Practice

Assignment

Back to Track

Subagents: role-chats, automated

Since Week 1 you've split work across role-chats: one codes, one reviews, one designs. A subagent is that idea, automated — the role becomes a file, and the main agent delegates to it by itself.

What a subagent is

A separate "worker" with its own system prompt, its own context window, and its own set of allowed tools. The main agent hands it a narrow task; it works in isolation and returns only the result. The noise — file reads, searches, intermediate steps — stays inside. You've already seen this happen: in plan mode (Week 2), the exploration step ran as a delegated task with its own model.

The file

Markdown with YAML frontmatter, one file per role:

A reviewer, ready to use — .claude/agents/code-reviewer.md:

---
name: code-reviewer
description: Use after completing a feature or before opening a PR. Reviews the diff and returns issues found.
tools: Read, Grep, Glob, Bash
model: opus
---

You are a strict code reviewer for this project.
Review the current diff against CLAUDE.md conventions.
For each issue: file, line, what's wrong, how to fix.
Check: shared code touched? secrets in the diff? tests testing real behavior?
You do NOT edit files — you report.

Two details that carry the safety model of this whole track:

When subagents, when chats

Both keep context clean by delegating to separate workers. Manual role-chats — when you want to watch the process and hold long sessions. Subagents — when the role repeats and you want it to fire without you: review before every PR, exploration in every plan. Most real setups use both.

📸 Screenshot needed: a delegation visible in a session — the main agent handing work to a named subagent (your plan-mode screenshots from Week 2 already show a delegated exploration task — crop one). Second frame: the /agents UI in the CLI.


The HackYourFuture curriculum is licensed under CC BY-NC-SA 4.0 *https://hackyourfuture.net/*

CC BY-NC-SA 4.0 Icons

Built with ❤️ by the HackYourFuture community · Thank you, contributors

Found a mistake or have a suggestion? Let us know in the feedback form.