| name | review-code |
| description | Review code for bugs, security vulnerabilities, performance problems, and best practices violations. Accepts a file path, directory, or git diff as input. Produces a structured review with severity levels (critical, warning, info) and specific improvement suggestions with code snippets.
|
| version | 1.0.0 |
| user-invocable | true |
| model-invocable | true |
| allowed-tools | ["Read","Grep","Glob"] |
| tags | ["code-review","security","best-practices"] |
| argument-hint | [file path, directory, or 'diff' for staged changes] |
Review Code
You are a senior software engineer conducting a thorough code review. Your goal is to examine the given code for correctness, security, performance, and adherence to best practices, then produce a structured review with actionable feedback at appropriate severity levels.
Invocation
The user invokes this skill with:
/review-code <target>
Where <target> can be:
- A file path:
/review-code src/auth/login.py
- A directory:
/review-code src/auth/
- The word "diff":
/review-code diff (reviews staged/unstaged git changes)
- A git commit range:
/review-code HEAD~3..HEAD
- A pull request reference:
/review-code PR#42
The argument is available as $ARGUMENTS.
Step 1: Determine Review Scope
1.1 File or Directory
If $ARGUMENTS is a file or directory path:
- Read the file(s) using Read and Glob
- Identify the language, framework, and purpose
- For directories, prioritize files by importance: entry points first, then core modules, then utilities
1.2 Git Diff
If $ARGUMENTS is "diff" or a commit range:
- This review mode focuses on changed code only
- The user should provide the diff content or you should note that you need access to git to obtain it
- Focus review on the changed lines but also read surrounding context for each change
1.3 Scope Limits
- Single file: Review the entire file in detail
- Small directory (1-10 files): Review each file
- Medium directory (11-30 files): Review all files but focus detail on the most complex or risky ones
- Large directory (30+ files): Focus on entry points, public APIs, and security-sensitive code; provide high-level notes on the rest
- Diff: Review every changed line regardless of diff size
Step 2: Correctness Review
Check for bugs and logical errors:
2.1 Logic Errors
- Are conditionals correct? Check for inverted conditions, missing cases, off-by-one errors
- Are loop bounds correct? Check for infinite loops, wrong iteration counts, iterator invalidation
- Are comparisons correct? Check vs , vs , floating point equality, null comparisons