You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Unified code and security review for a pull request
4
4
---
5
5
6
-
Provide a code review for the given pull request.
6
+
Provide a comprehensive code review for the given pull request, covering both code quality and security.
7
7
8
8
Create a todo list before starting.
9
9
@@ -16,7 +16,7 @@ To do this, follow these steps precisely:
16
16
1. Launch a haiku agent to check if any of the following are true:
17
17
- The pull request is closed
18
18
- The pull request is a draft
19
-
- The pull request does not need code review (e.g. automated PR, trivial change that is obviously correct)
19
+
- The pull request does not need review (e.g. automated PR, trivial change that is obviously correct)
20
20
- Claude has already commented on this PR (check `gh pr view <PR> --comments` for comments left by claude)
21
21
22
22
If any condition is true, stop and do not proceed.
@@ -29,39 +29,42 @@ To do this, follow these steps precisely:
29
29
30
30
3. Launch a sonnet agent to view the pull request and return a summary of the changes.
31
31
32
-
4. Launch 4 agents in parallel to independently review the changes. Each agent should return the list of issues, where each issue includes a description and the reason it was flagged (e.g. "CLAUDE.md adherence", "bug"). The agents should do the following:
32
+
4. Launch 4 agents in parallel to independently review the changes. Each agent should return the list of issues, where each issue includes a description and the reason it was flagged. The agents should do the following:
33
33
34
34
Agents 1 + 2: CLAUDE.md compliance sonnet agents
35
-
Audit changes for CLAUDE.md compliance in parallel. Note: When evaluating CLAUDE.md compliance for a file, you should only consider CLAUDE.md files that share a file path with the file or parents.
35
+
Audit changes for CLAUDE.md compliance in parallel, including both general and security-specific rules. Note: When evaluating CLAUDE.md compliance for a file, you should only consider CLAUDE.md files that share a file path with the file or parents.
36
36
37
-
Agent 3: Opus bug agent (parallel subagent with agent 4)
38
-
Scan for obvious bugs. Focus only on the diff itself without reading extra context. Flag only significant bugs; ignore nitpicks and likely false positives. Do not flag issues that you cannot validate without looking at context outside of the git diff.
37
+
Agent 3: Opus code quality agent
38
+
Scan for obvious bugs and code quality issues. Focus only on the diff itself without reading extra context. Flag only significant bugs; ignore nitpicks and likely false positives. Do not flag issues that you cannot validate without looking at context outside of the git diff.
39
39
40
-
Agent 4: Opus bug agent (parallel subagent with agent 3)
41
-
Look for problems that exist in the introduced code. This could be security issues, incorrect logic, etc. Only look for issues that fall within the changed code.
40
+
Agent 4: Opus security agent
41
+
Look for security vulnerabilities in the introduced code. This includes injection, auth bypass, data exposure, unsafe deserialization, or other exploitable issues. Only look for issues that fall within the changed code.
42
42
43
43
**CRITICAL: We only want HIGH SIGNAL issues.** Flag issues where:
44
44
- The code will fail to compile or parse (syntax errors, type errors, missing imports, unresolved references)
45
45
- The code will definitely produce wrong results regardless of inputs (clear logic errors)
46
+
- There is a clear, exploitable security vulnerability (e.g., injection, auth bypass, RCE, sensitive data exposure)
46
47
- Clear, unambiguous CLAUDE.md violations where you can quote the exact rule being broken
47
48
48
49
Do NOT flag:
49
-
- Code style or quality concerns
50
+
- Code style or quality concerns that don't affect correctness
50
51
- Potential issues that depend on specific inputs or state
51
52
- Subjective suggestions or improvements
53
+
- Security issues that depend on speculative inputs or unverified assumptions
54
+
- Denial of Service (DoS) or rate limiting issues without concrete exploitability
52
55
53
56
If you are not certain an issue is real, do not flag it. False positives erode trust and waste reviewer time.
54
57
55
58
In addition to the above, each subagent should be told the PR title and description. This will help provide context regarding the author's intent.
56
59
57
-
5. For each issue found in the previous step by agents 3 and 4, launch parallel subagents to validate the issue. These subagents should get the PR title and description along with a description of the issue. The agent's job is to review the issue to validate that the stated issue is truly an issue with high confidence. For example, if an issue such as "variable is not defined" was flagged, the subagent's job would be to validate that is actually true in the code. Another example would be CLAUDE.md issues. The agent should validate that the CLAUDE.md rule that was violated is scoped for this file and is actually violated. Use Opus subagents for bugs and logic issues, and sonnet agents for CLAUDE.md violations.
60
+
5. For each issue found in the previous step by agents 3 and 4, launch parallel subagents to validate the issue. These subagents should get the PR title and description along with a description of the issue. The agent's job is to review the issue to validate that the stated issue is truly an issue with high confidence. Use Opus subagents for bugs and security issues, and sonnet agents for CLAUDE.md violations.
58
61
59
62
6. Filter out any issues that were not validated in step 5. This step will give us our list of high signal issues for our review.
60
63
61
64
7. If issues were found, skip to step 8 to post inline comments directly.
62
65
63
66
If NO issues were found, post a summary comment using `gh pr comment` (if `--comment` argument is provided):
64
-
"No issues found. Checked for bugs and CLAUDE.md compliance."
67
+
"No issues found. Checked for bugs, security vulnerabilities, and CLAUDE.md compliance."
65
68
66
69
8. Create a list of all comments that you plan on leaving. This is only for you to make sure you are comfortable with the comments. Do not post this list anywhere.
67
70
@@ -79,7 +82,7 @@ Use this list when evaluating issues in Steps 4 and 5 (these are false positives
79
82
- Something that appears to be a bug but is actually correct
80
83
- Pedantic nitpicks that a senior engineer would not flag
81
84
- Issues that a linter will catch (do not run the linter to verify)
82
-
- General code quality concerns (e.g., lack of test coverage, general security issues) unless explicitly required in CLAUDE.md
85
+
- General code quality concerns (e.g., lack of test coverage) unless explicitly required in CLAUDE.md
83
86
- Issues mentioned in CLAUDE.md but explicitly silenced in the code (e.g., via a lint ignore comment)
84
87
85
88
Notes:
@@ -92,7 +95,7 @@ Notes:
92
95
93
96
## Code review
94
97
95
-
No issues found. Checked for bugs and CLAUDE.md compliance.
98
+
No issues found. Checked for bugs, security vulnerabilities, and CLAUDE.md compliance.
Copy file name to clipboardExpand all lines: README.md
+7-9Lines changed: 7 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Claude Code Reviewer
2
2
3
-
An AI-powered code review GitHub Action using Claude to analyze code changes. Runs two focused passes: a code quality review (correctness, reliability, performance, maintainability, testing) and a dedicated security review. This action provides intelligent, context-aware review for pull requests using Anthropic's Claude Code tool for deep semantic analysis.
3
+
An AI-powered code review GitHub Action using Claude to analyze code changes. Uses a unified multi-agent approach for both code quality (correctness, reliability, performance, maintainability, testing) and security in a single pass. This action provides intelligent, context-aware review for pull requests using Anthropic's Claude Code tool for deep semantic analysis.
4
4
5
5
Based on the original work from [anthropics/claude-code-security-review](https://github.com/anthropics/claude-code-security-review).
6
6
@@ -12,7 +12,7 @@ Based on the original work from [anthropics/claude-code-security-review](https:/
12
12
-**Contextual Understanding**: Goes beyond pattern matching to understand code semantics and intent
13
13
-**Language Agnostic**: Works with any programming language
14
14
-**False Positive Filtering**: Advanced filtering to reduce noise and focus on real issues
15
-
-**Dual-Pass Review**: Runs focused code quality and security passes separately for better signal
15
+
-**Unified Multi-Agent Review**: Combines code quality and security analysis in a single efficient pass
16
16
17
17
## Quick Start
18
18
@@ -63,8 +63,6 @@ This action is not hardened against prompt injection attacks and should only be
63
63
| `false-positive-filtering-instructions` | Path to custom false positive filtering instructions text file | None | No |
64
64
| `custom-review-instructions` | Path to custom code review instructions text file to append to the audit prompt | None | No |
65
65
| `custom-security-scan-instructions` | Path to custom security scan instructions text file to append to the security section | None | No |
66
-
| `run-general-review` | Whether to run the code quality review pass (correctness, reliability, performance, maintainability, testing) | `true` | No |
67
-
| `run-security-review` | Whether to run the dedicated security review pass | `true` | No |
68
66
69
67
### Action Outputs
70
68
@@ -135,17 +133,17 @@ Follow the Quick Start guide above. The action handles all dependencies automati
135
133
136
134
To run the reviewer locally against a specific PR, see the [evaluation framework documentation](claudecode/evals/README.md).
137
135
138
-
<a id="security-review-slash-command"></a>
136
+
<a id="review-slash-command"></a>
139
137
140
-
## Claude Code Integration: /code-review Command
138
+
## Claude Code Integration: /review Command
141
139
142
-
This repository includes `/code-review` and `/security-review` [slash commands](https://docs.anthropic.com/en/docs/claude-code/slash-commands) that provide the same review capabilities as the GitHub Action workflow. Use `/code-review` for a broad review (correctness, reliability, performance, maintainability, testing, and security), and `/security-review` for a security-focused review.
140
+
This repository includes a `/review` [slash command](https://docs.anthropic.com/en/docs/claude-code/slash-commands) that provides the same review capabilities as the GitHub Action workflow. The command performs a comprehensive review covering code quality (correctness, reliability, performance, maintainability, testing) and security using a multi-agent approach.
143
141
144
142
### Customizing the Command
145
143
146
-
The default commands are designed to work well in most cases, but they can also be customized based on your specific requirements. To do so:
144
+
The default command is designed to work well in most cases, but it can also be customized based on your specific requirements. To do so:
147
145
148
-
1. Copy the [`code-review.md`](https://github.com/PSPDFKit-labs/claude-code-review/blob/main/.claude/commands/code-review.md?plain=1) or [`security-review.md`](https://github.com/PSPDFKit-labs/claude-code-review/blob/main/.claude/commands/security-review.md?plain=1) file from this repository to your project's `.claude/commands/` folder.
146
+
1. Copy the [`review.md`](https://github.com/PSPDFKit-labs/claude-code-review/blob/main/.claude/commands/review.md?plain=1) file from this repository to your project's `.claude/commands/` folder.
149
147
2. Edit the copied file to customize the review instructions.
0 commit comments