Subagents keep a big schema out of your main chat

A data warehouse has hundreds of tables. Reading them all fills Claude Code's context before the real work starts. A subagent searches in its own context window and hands back only the summary. When to use one and how to write it.

Short answer: a subagent is a helper Claude Code hands a job to. It works in its own context window with its own tools, and only its summary comes back. On a data project, send it to search: "find every view that uses the orders table and list the columns they use". It reads the hundred files; your main conversation gets the twenty lines that matter. Make one with /agents, or a Markdown file in .claude/agents/.

Context is the working memory of a conversation. Ask Claude to read a whole warehouse's DDL and that memory is full of tables you will never touch, which makes the rest of the session slower and less precise.

Nothing loads from YouTube until you press play. Then Google receives your IP address and may set its own storage. Narrated with an AI-generated voice. Privacy

Why does a subagent help with big schemas?

The question"Which views depend on dbo.Orders, and which columns do they use?"
Without a subagent300 files read into the main chat; the context fills up
With a subagentit reads in its own context and returns a 20-line list
Where the reading happens

What does a schema-search subagent look like?

---
name: schema-scout
description: Use to find tables, views and columns in the warehouse schema files. Read-only.
tools: Read, Grep, Glob
---
Search the files under schema/ for what you are asked.
Answer with a list: object name, file path, and the columns that matter.
Never edit files. Do not include whole file contents in the answer.

The tools line limits it to reading and searching, so it cannot change anything. The description says when to use it, which is how Claude decides to hand it the job.

When is it worth it?

TaskSubagent?
Find every use of a column across 300 filesYes
Summarise what each of 40 stored procedures doesYes
Change one measure in one fileNo: do it in the main chat
A question about one table you already pointed at with @No

Where can you check this?

Where do you start?

Claude Code already has a read-only Explore agent for searching; build your own when you want a fixed answer format. For an agent that reviews queries, see a custom SQL reviewer agent.

Keep reading

More from the blog.

Every post

Next

Building this? Say hello.

A question about this post, a pattern you would build differently, or the next thing you want written out: Behnia reads every message.