Code Review Workflow
Claude Code helps at both stages of code review: the PR author's self-review, and the reviewer's examination. Strengthening both stages with Claude significantly improves review quality.
PR Author: Self-Review Workflowโ
Step 1: Self-review before the PRโ
Before you open a PR, review your work together with Claude:
> Look at git diff main...HEAD and find what I missed:
- Logic that's missing tests
- Hardcoded values
- Places with no error handling
- Anything that deviates from our conventions
Step 2: Generate a commit message automaticallyโ
> /commit
A custom Skill generates a commit message in Conventional Commits format automatically.
Step 3: Draft the PR description automaticallyโ
> Write the description for this PR.
Include the following:
- Why the change was made (Why)
- A summary of what changed (What)
- How to test it
- Whether screenshots are needed
Use git diff main...HEAD and the commit messages as reference.
A complete self-review Skillโ
.claude/commands/pre-pr.md:
Run a final check before I open the PR.
## Step 1: Analyze the changes
Use git diff main...HEAD to understand the changes.
## Step 2: Self-review
Check the following items:
- [ ] New features include tests
- [ ] Error handling is complete
- [ ] No hardcoded values
- [ ] No stray console.log statements
- [ ] No type errors (tsc --noEmit)
- [ ] Lint passes (npm run lint)
## Step 3: Draft the PR description
Based on the check results, write the PR description in Markdown.
## Step 4: Run the actual tests
Run npm test and report the results.
Reviewer: Claude-Assisted Review Workflowโ
Understand the review contextโ
Quickly grasp the changes in the PR you're reviewing:
> Summarize the changes in PR #42.
Explain what problem it solves and how it was implemented.
(Run gh pr diff 42 to check.)
Request a deep reviewโ
> Review PR #42 from a senior developer's perspective.
Focus especially on:
1. Architectural fit (consistency with existing patterns)
2. Performance impact (queries, loops, memory)
3. Security (input validation, authentication, exposure)
4. Edge case handling
5. Test completeness
Write any issues you find as GitHub comments:
filename:line โ issue description and suggested improvement
Draft review comments automaticallyโ
> Write a GitHub review comment for the following code.
Be constructive and specific, and include how to improve it:
[code snippet]
Defining Review Quality Standardsโ
Include a team review checklist in CLAUDE.mdโ
## Code Review Standards
### Required pass conditions
- All tests pass
- Type check passes (tsc --noEmit)
- Lint passes
- Build succeeds
### Review points (in priority order)
1. Security issues (blocker)
2. Functional bugs (blocker)
3. Performance problems (important)
4. Code quality (normal)
5. Style (optional)
### Policy for using Claude in reviews
- PR author: running the /pre-pr Skill before opening a PR is required
- Reviewer: for complex logic, ask Claude to analyze it first
- Feedback: Claude's suggestions must always be reviewed by a human before being delivered
In Practice: A Complete Review Cycleโ
Author sideโ
# 1. After finishing development, self-review
/pre-pr
# 2. Apply Claude's suggestions
claude "Fix the [issue] that the review just flagged"
# 3. Final commit and open the PR
/commit
gh pr create --title "..." --body "..."
Reviewer sideโ
# 1. Get an overview of the PR
claude "Run gh pr diff $PR_NUM and summarize the changes"
# 2. Deep review
claude "Focus your analysis on the security and performance issues in this PR"
# 3. Understand specific code
claude "Explain why this function is implemented this way: [code]"
# 4. Help drafting review comments
claude "Write a comment that constructively conveys the problem with this logic"
Managed Code Review Serviceโ
On the Teams/Enterprise plans, you can use managed Code Review. Once you install the GitHub App, reviews run automatically whenever a PR is created or updated.
- Multiple specialized agents analyze the diff and surrounding code in parallel
- Detects logic errors, security vulnerabilities, edge cases, and regression bugs
- Posts findings as inline comments with severity tags (Normal/Nit/Pre-existing)
- Review standards can be customized with
CLAUDE.mdandREVIEW.md - Does not approve or block PRs, so it's compatible with your existing review workflow
Setup: enable it at claude.ai/admin-settings/claude-code
Tracking Review Metricsโ
> Analyze the PRs merged this month.
Pull the list with gh pr list --state merged --limit 50 and report:
- Average review time
- Common types of review comments
- Patterns that often require re-requests after fixes
Suggest team coding practices we could improve.
Level 4 Complete!โ
By finishing this level, you can use Claude Code at an advanced level. You've gained the ability to automate team workflows with custom Skills, build complex pipelines with the Agent SDK, and run agents safely in Docker environments.