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
Goes with Episode 9"How do I get a second pair of eyes?". The video is being made. This page teaches the same steps, at your own pace.
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.

At work, nobody reviews their own pull request. Someone else reads it, with fresh eyes.

The question for this chapter

Can Claude Code give you a second pair of eyes?

A helper with its own context

A subagent is a helper Claude starts for one job. It works in its own context and sends back only the answer, so your session stays short. 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: the file, the lines, and every caller. It also says 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.
It runs in the background, so you can keep typing while it reads.
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

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.
A negative length used to slip past the size check. Now it gets a 400, and all 9 tests pass. 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.

What a subagent costs

A subagent has its own context, so it uses its own tokens. A review of one file is cheap, but a review of the whole project is not.

And our reviewer only reads code. It cannot see the app running in the browser. In chapter 10, Claude sees the app.

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 tests.