| name | code-review |
| description | Perform comprehensive code reviews covering security, style, performance, and best practices. Use when reviewing code changes before commit or merge, auditing existing code, or checking for vulnerabilities. |
Skill: code-review
Purpose: Perform comprehensive code reviews covering security, style, performance, and best practices.
When to use this Skill
Use this Skill when:
- Reviewing code changes before commit or merge.
- Auditing existing code for issues.
- Checking for security vulnerabilities.
- Ensuring code follows project conventions.
Review workflow
1. Gather context
Before reviewing:
git diff --stat
git diff
git diff path/to/file
Understand:
- What is the purpose of these changes?
- Which files are affected?
- What is the expected behavior?
2. Security audit
Check for:
Red flags:
- String concatenation in queries.
eval(), exec(), or similar.
- Hardcoded credentials or API keys.
- Missing input validation.
- Overly permissive CORS.
3. Style check
Verify:
4. Performance review
Look for:
5. Best practices
Check:
6. Generate report
Summarize findings by severity:
## Code Review Summary
### Critical (must fix)
- None found
### High (should fix)
- SQL injection risk in UserService.ts:42
### Medium (consider fixing)
- Function exceeds 50 lines in ApiHandler.ts:120
### Low (nice to have)
- Consider extracting magic number to constant
### Info
- Good use of early returns in validation logic
Severity levels
| Level | Description | Action |
|---|
CRITICAL | Security vulnerability, data loss | Must fix now |
HIGH | Bugs, significant issues | Fix before merge |
MEDIUM | Code quality, maintainability | Fix soon |
LOW | Minor improvements | Nice to have |
INFO | Observations, positive feedback | No action needed |
Common patterns
SQL injection
Bad:
const query = `SELECT * FROM users WHERE id = ${userId}`;
Good:
const query = 'SELECT * FROM users WHERE id = ?';
db.query(query, [userId]);
XSS vulnerability
Bad:
element.innerHTML = userInput;
Good:
element.textContent = userInput;
N+1 query
Bad:
const users = await getUsers();
for (const user of users) {
user.posts = await getPosts(user.id);
}
Good:
const users = await getUsersWithPosts();
Missing error handling
Bad:
const data = JSON.parse(input);
Good:
try {
const data = JSON.parse(input);
} catch (error) {
logger.error('Invalid JSON input', { error });
throw new ValidationError('Invalid input format');
}
Integration
With autonomous-ci
- Make changes.
- Run
code-review to check.
- Fix issues found.
- Run
autonomous-ci to verify.
With smart-commit
- Make changes.
- Run
code-review to check.
- Fix issues.
- Use
smart-commit to commit.
Checklist
Complete review checklist: