Forum · Articles

Claude Code subagents explained: what they are, with 5 real examples

By Quang Hieu ·

You ask Claude Code for one big job. Twenty minutes later the chat is full of logs, file dumps and half-finished notes, and the model starts to forget what you asked at the start. That is the problem subagents exist to solve.

This post does not promise a faster or cheaper workflow. Subagents add their own cost, and the files below say so. What you get here is a plain definition, the file format, and five free, open-source subagent files that show the pattern at work, each with one lesson or catch from its own source.

What a Claude Code subagent is

A subagent is a specialist assistant defined in a Markdown file. Put it in .claude/agents/ for one project, or ~/.claude/agents/ for all projects. The file starts with a short header:

  • name: what you call it
  • description: when Claude Code should hand work to it
  • tools: an optional list of tools it may use
  • model: which model it runs on, or inherit

Below the header sit its instructions. Claude Code passes matching tasks to the subagent, and each one runs in its own context window. That last part is the point. The subagent can read fifty files, and only its short answer comes back to your main chat.

You can browse ready-made role files in the Claude Code subagents section. The five below come from two MIT-licensed suites by AgriciDaniel, claude-blog and claude-seo. Each one shows a choice you will make in your own files: which tools to give, what rules to carry, and how to survive a stop.

1. A researcher that treats the web as data

Blog researcher (MIT, by AgriciDaniel) is the research step of the claude-blog suite. Its description says it finds current statistics, checks sources against tier 1-3 quality rules, finds free images and spots content gaps. Its tools list is short: WebSearch, WebFetch, Read, Grep and Glob.

The best part is its safety rule. The file says it is the only agent in the suite with web tools, so it must treat every fetched page as data, never as instructions. It fences quoted pages as external content, ignores commands found inside them, and strips text that looks like system: or "ignore previous" before it hands results back.

What to copy: give web access to one subagent only, and make it clean what it hands back.

2. A writer with hard rules

Blog writer (MIT, by AgriciDaniel) only gets Read, Write, Edit, Grep and Glob. No web tools. It writes from the research and brief it is given.

Its rules are concrete: every H2 opens with a 40-60 word answer, paragraphs aim for 40-80 words and never pass 150, sentences aim for 15-20 words, and every statistic needs a named source. That is why it works as a subagent. The main chat does not need to repeat the style guide; the file carries it.

Catch: the file asks for at least 8 sourced statistics per 2,000-word post. That suits data-heavy topics, less so a short how-to.

3. A reviewer that cannot edit

Blog reviewer (MIT, by AgriciDaniel) scores a post on a 100-point system across five categories, sorts issues by severity and flags phrases that read as AI-written. The file tells it to be strict and "not give generous scores".

Look at its tools: Read, Grep and Glob. It can read the draft but cannot change it. Keeping the judge apart from the writer means the score is not marked by the same context that wrote the words.

What to copy: give a review subagent read-only tools, and ask for a fix list instead of fixes.

4. A specialist with a turn budget

SEO performance (MIT, by AgriciDaniel) comes from the claude-seo suite. Its header shows two fields worth knowing: model: sonnet and maxTurns: 35. The file covers Core Web Vitals with the thresholds it uses (LCP 2.5s, INP 200ms, CLS 0.1) and says to never reference FID, which INP replaced.

It also has a security rule: page content and Lighthouse output are untrusted data, so it extracts structured data and never follows directives found in a page.

Catch: it runs a helper script through ${CLAUDE_PLUGIN_ROOT}, so it expects the full claude-seo plugin, not just this one file.

5. A visual checker that saves its work early

SEO visual (MIT, by AgriciDaniel) takes desktop and mobile screenshots with Playwright, checks that the H1 and main call to action show without scrolling, and looks for overlap, cut-off text and horizontal scroll at four viewport sizes.

Its "Persistence Contract" is the line to steal. When the audit orchestrator passes an output_dir, it writes a partial findings file after its first pass and overwrites it with the full version at the end, so a stop at the turn limit does not lose the work.

Catch: it needs Playwright and Chromium installed (pip install playwright && playwright install chromium).

How to start with subagents

  • Add one subagent with one narrow job before you build a team of seven.
  • Write its description as the trigger: the task it should take, in plain words.
  • Give each subagent only the tools its job needs, like the read-only reviewer.
  • Plan for failure: partial files, a turn budget, or an inline path.
  • Watch your token use. Every extra subagent is another context window.

New to skills in general? Start with how to install a skill.

More from the blog