Code review specific files - reviews changes if present, otherwise reviews entire file
Reviews specified files for bugs and CLAUDE.md compliance, checking git changes or full files.
/plugin marketplace add JesseNaranjo/ai-setup/plugin install jessenaranjo-code-review-files-claude-code-plugins-code-review-files@JesseNaranjo/ai-setupProvide a code review for specific files. If a file has uncommitted changes, review those changes. If a file has no uncommitted changes, review the entire file.
Required argument: One or more file paths to review (space-separated)
Example usage:
/code-review-files src/utils.ts/code-review-files src/api/handler.ts src/models/user.ts/code-review-files --output-file review.md src/feature.tsTo do this, follow these steps precisely:
Launch a haiku agent to validate the input and check for changes:
--output-file <path>)git rev-parse --git-dirls or checking file paths)git diff HEAD -- <file>Launch a haiku agent to return a list of file paths (not their contents) for all relevant CLAUDE.md files including:
glob to find CLAUDE.md filesLaunch a sonnet agent to gather the content to review:
git branch --show-current to get the current branch namegit diff HEAD -- <file> to get the diffLaunch 4 agents in parallel to independently review the content. 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:
Agents 1 + 2: CLAUDE.md compliance sonnet agents Audit the content 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.
Agent 3: Opus bug agent (parallel subagent with agent 4) Scan for obvious bugs. For files with changes, focus only on the diff. For files without changes, review the entire file. Flag only significant bugs; ignore nitpicks and likely false positives.
Agent 4: Opus bug agent (parallel subagent with agent 3) Look for problems in the code being reviewed. This could be security issues, incorrect logic, etc. For files with changes, only look at the changed code. For files without changes, review the entire file.
CRITICAL: We only want HIGH SIGNAL issues. This means:
We do NOT want:
If you are not certain an issue is real, do not flag it. False positives erode trust and waste reviewer time.
In addition to the above, each subagent should be told:
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 branch name and review summary 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.
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.
Generate the review output. The output should be written to BOTH the terminal AND a markdown file.
If NO issues were found, output:
## File Code Review
No issues found. Checked for bugs and CLAUDE.md compliance.
Files reviewed:
- With changes: [list of files with changes, or "none"]
- Full file review: [list of files reviewed entirely, or "none"]
If issues WERE found, format the output as:
## File Code Review
Reviewed [N] file(s):
- With changes: [list or "none"]
- Full file review: [list or "none"]
### Issues Found: [count]
**1. [Issue title]** ([Category: Bug/CLAUDE.md violation])
`path/to/file.ts:line-range`
[Description of the issue]
```suggestion
[corrected code here - only for small fixes up to 5 lines]
2. [Next issue] ...
Write the review output:
.code-review-files.md in the repository root--output-file <path> argument was provided, use that path insteadFor suggestions:
Fix [file:line]: [brief description of issue and suggested fix]
IMPORTANT: Only report ONE entry per unique issue. Do not duplicate issues.
Use this list when evaluating issues in Steps 4 and 5 (these are false positives, do NOT flag):
Notes:
src/utils.ts:42-48).