Learn Claude Code by Building DevPulse · Chapter 9

A code reviewer of our own

The same Claude that wrote DevPulse has been checking it, so how do you get a second pair of eyes? By the end of this chapter, DevPulse has its own read-only code reviewer, and its most serious finding is fixed with a test.

One sitting~7 min read, ~15 min to build along
You start fromchapter 8's DevPulse, with standup.ps1
You builda code-reviewer subagent, and one fix with a test
Chapter 9 of 15a second pair of eyes

Prefer to watch? This chapter goes with Episode 9 (5:08). Open it on YouTube.

Subscribe on YouTube

Goes with Episode 9"How do I get a second pair of eyes in Claude Code?". Watch it just above, or read this page at your own pace. It teaches the same steps.
In a hurry?Jump to the quick reference: every command and key in this chapter, what it does, and when to use it.
Every prompt, ready to copyThis chapter's prompts and commands, each with a Copy button. Type them yourself first; copy if you are stuck or behind.
Where you areDevPulse with tests, a standup skill and standup.ps1, from chapters 1 to 8. Start claude in your project folder.

Who checks the code?

DevPulse has a server, a page, a streak and a standup now. Claude wrote most of it, and when we asked for checks, the same Claude did those too.

Say you wrote your resume and read it three times before sending it. Then a friend reads it once, and circles a spelling mistake in the very first line. You kept reading what you meant to write; your friend reads only what is on the page. And your friend does not rewrite it: they mark the mistake, and you fix it.

A hand-drawn resume page with the heading Sofware Developer. A friend with a pen has circled Sofware in mustard and written sp? under it.
Fresh eyes read what is on the page. The friend marks the mistake; you fix it.
The question for this chapter

How do you get a second pair of eyes on your code, from someone who did not write it?

A helper with its own context

Claude Code can give you a friend like that. Claude can start a helper for one job, and that helper works in its own context. It starts fresh, without your long conversation, and sends back only its answer, so your own session stays short.

That helper is what Claude Code calls a subagent. One is built in: Explore, which only reads.

Type this into Claude CodeUse the Explore subagent to find where the streak is calculated and what calls it.
The Explore result: index.html loads /streak.js and calls computeStreak and bestStreak in renderWeek; server.py only serves the file; streak.test.js covers both functions. Agent Find streak calculation and callers finished in 19s.
19 seconds: everything that uses the streak code, with line numbers, and what it did not search. The grey Run the streak tests is only a suggestion.

Make your own reviewer

You may know /agents from older guides. In this version, it tells you to ask Claude instead.

/agents: The /agents wizard has been removed. Ask Claude to create or update subagents for you, or edit the files directly: .claude/agents/ for this project, ~/.claude/agents/ for all projects.
Project subagents live in .claude/agents/. Personal ones, for every project, live in ~/.claude/agents/.
Type this into Claude Code, as one lineCreate a project subagent called code-reviewer in .claude/agents/code-reviewer.md. Read-only tools (Read, Grep, Glob), model sonnet. It reviews for bugs, security and readability and reports findings with file and line, most serious first.
I created the code-reviewer subagent at .claude\agents\code-reviewer.md. Tools: Read, Grep and Glob only, so it can't edit anything; model sonnet. Bugs first, then security, then readability. Each finding gives severity, category, file:line, the problem and a fix. The current session may need a restart.
Read-only, so it can only report. It even knows our project rules. The grey Use the code-reviewer to review streak.js is only a suggestion.
Careful here

A new subagent may not be seen by the session that made it. Type /exit, then start claude again. That is what we did.

Ask for the review

Call the reviewer by its name, and give it one file.

Type this into Claude CodeUse the code-reviewer subagent to review server.py.
code-reviewer(Review server.py): Backgrounded agent. The code-reviewer subagent is now reviewing server.py in the background. Waiting for 1 background agent to finish. At the bottom: main, and code-reviewer Review server.py, 24s, 12.4k tokens.
It runs in the background: the bottom line shows your main session, and the subagent beside it, with its own token count. The grey fix the issues it finds is only a suggestion.
The end of the review: finding 6, file reads not fully guarded; 7, readability; 8, a failed send on a broken pipe. No problems found with path traversal, the atomic write, locking or ID matching. It did not review the front end. Findings 1-4 matter most.
The end of 8 findings, in 27 seconds. Note what it checked and found fine, and what it did not check: the front end. The grey fix findings 1-4 is only a suggestion.

Eight findings is a lot to fix at once. Take the most serious first, and one at a time, so each fix gets its own test.

Fix the first one, with a test

Our server has had its own tests since chapter 2, in test_server.py. Ask Claude to fix finding 1, add one more test, and run them all.

Type this into Claude CodeFix finding 1 and add a test for it, then run the tests.
Finding 1 is fixed, and all 9 tests pass, including the new one. Fix: _read_json now returns 400 Bad Content-Length when the length is negative. Test: test_negative_content_length. I didn't run it against the unfixed code, so I haven't seen it fail without the fix.
The new test sends a length of -1 and expects the server to refuse it. Before, a negative length got past the size cap; now it gets a 400, and all 9 server tests pass, the new one included. The grey commit this is only a suggestion.

Read the honest line: it never saw the new test fail. A test you never saw fail may not test anything. We committed the fix with /commit-commands:commit. The commit left our new .claude/agents/code-reviewer.md out; we committed it ourselves, so anyone who clones the project gets the reviewer too.

What a subagent costs

A subagent has its own context, so it uses its own tokens. In our run, Explore used 26.0k tokens for one search, and the reviewer 12.6k for one file: the counts on the bottom line while each one works. A review of one file is cheap, but a review of the whole project is not.

Our reviewer reads every line of DevPulse, but it has never seen DevPulse on a screen. In the next chapter, Claude opens it in a real browser, at the size of a phone. Claude Code does that through what it calls an MCP server.

Quick reference

The prompts from this chapter, ready to copy: every prompt, chapter 9.

Command or keyWhat it doesUse it when
Use the Explore subagent to find …A read-only helper searches the code and reports backYou need to know where something is, without filling your session
Create a project subagent called … in .claude/agents/….mdWrites the subagent's file for youYou want the same kind of helper again and again
Read-only tools (Read, Grep, Glob)The subagent can look, but not change anythingA reviewer should report, not edit
Use the code-reviewer subagent to review fileRuns your subagent on that fileBefore you commit a change
/exit, then claudeStarts a new session that sees the new subagentClaude says it may not pick the subagent up yet
Fix finding 1 and add a test for itActs on one finding at a timeThe review lists more than one problem

References

Where each command and file on this page comes from. Every screenshot is from our own recording on 29 Oct 2026, Claude Code 2.1.312.

  1. Anthropic · Subagents in Claude Code What a subagent is, the built-in Explore agent, project subagents in .claude/agents, and their tools and model. https://code.claude.com/docs/en/sub-agents
  2. My own recording · 29 Oct 2026, Windows 11 Explore answered in 19 seconds; the review took 27 seconds and found 8 issues; the fix passed all 9 server tests, the new one included.