code-reviewer
8
总安装量
5
周安装量
#35392
全站排名
安装命令
npx skills add https://github.com/alirezarezvani/claude-code-tresor --skill code-reviewer
Agent 安装分布
claude-code
3
trae
2
opencode
2
gemini-cli
2
replit
1
Skill 文档
Code Reviewer Skill
Lightweight automatic code quality checks while you code.
When I Activate
- â Files modified or saved
- â Git diff run
- â Code mentioned in conversation
- â User asks about code quality
- â Before commits
What I Check
Quick Wins
- Code style and formatting issues
- Common anti-patterns
- Obvious bugs (null checks, undefined references)
- Basic security patterns (hardcoded secrets)
- Import/export issues
- Unused variables and functions
What I Don’t Do
- Deep architectural review â Use @code-reviewer sub-agent
- Comprehensive security audit â Use security-auditor skill
- Performance profiling â Use @architect sub-agent
- Full refactoring plans â Use @code-reviewer sub-agent
Relationship with @code-reviewer Sub-Agent
Me (Skill): Fast, lightweight, real-time feedback @code-reviewer (Sub-Agent): Deep analysis with examples and strategy
Workflow
- You write code
- I auto-analyze (instant feedback)
- I flag: “â ï¸ Potential issue on line 42”
- You want details â Invoke @code-reviewer sub-agent
- Sub-agent provides comprehensive analysis
Analysis Examples
JavaScript/TypeScript
// You write this code:
function getUser(id) {
return db.query(`SELECT * FROM users WHERE id = ${id}`);
}
// I immediately flag:
// ð¨ Line 2: SQL injection vulnerability
// ð¡ Use parameterized queries
React
// You write:
function UserList({ users }) {
return users.map(user => <User data={user} />);
}
// I flag:
// â ï¸ Missing key prop in list rendering (line 2)
// ð¡ Add key={user.id} to User component
Python
# You write:
def process_data(data):
return data['user']['profile']['name']
# I flag:
# â ï¸ Potential KeyError - no safety checks (line 2)
# ð¡ Use .get() or add try/except
Check Categories
Code Style
- Inconsistent naming conventions
- Missing semicolons (JavaScript)
- Improper indentation
- Long functions (>50 lines)
- Magic numbers
Potential Bugs
- Null/undefined access without checks
- Array access without bounds checking
- Type mismatches (TypeScript)
- Unreachable code
- Infinite loops
Basic Security
- Hardcoded API keys or secrets
- SQL injection patterns
- eval() or exec() usage
- Insecure random number generation
- Missing input validation
Best Practices
- Missing error handling
- Console.log in production code
- Commented-out code blocks
- TODO comments without context
- Overly complex conditions
Output Format
ð¤ code-reviewer skill:
[Severity] Issue description (file:line)
ð¡ Quick fix suggestion
ð Reference: [link to learn more]
Severity Levels
- ð¨ CRITICAL: Must fix (security, data loss)
- â ï¸ HIGH: Should fix (bugs, performance)
- ð MEDIUM: Consider fixing (maintainability)
- ð¡ LOW: Nice to have (style, readability)
When to Invoke Sub-Agent
After I flag issues, invoke @code-reviewer sub-agent for:
- Detailed explanation of the issue
- Multiple fix alternatives with pros/cons
- Architectural recommendations
- Refactoring strategies
- Best practice guidelines
Example:
Me: "â ï¸ Potential N+1 query detected"
You: "@code-reviewer explain the N+1 issue and show optimal solution"
Sub-agent: [Provides comprehensive analysis with examples]
Sandboxing Compatibility
Works without sandboxing: â Yes (default, recommended for learning) Works with sandboxing: â Yes (no special configuration needed)
- Filesystem: Read-only access to project files
- Network: None required
- Configuration: None required
Customization
Want different checks or patterns?
-
Copy this skill:
cp -r ~/.claude/skills/development/code-reviewer ~/.claude/skills/development/my-code-reviewer -
Edit
SKILL.md:- Modify
descriptionto adjust triggers - Customize check categories
- Add language-specific patterns
- Modify
-
Restart Claude Code:
claude --restart
See ../../TEMPLATES.md for customization guide.
Examples in Action
TypeScript Function
// Before:
async function fetchUsers(ids) {
const users = [];
for (let id of ids) {
const user = await User.findById(id); // N+1 query!
users.push(user);
}
return users;
}
// I flag:
// â ï¸ N+1 query pattern detected (line 4)
// ð¡ Use User.findByIds(ids) for batch loading
// After fix:
async function fetchUsers(ids) {
return await User.findByIds(ids);
}
React Component
// Before:
function UserCard({ user }) {
const [data, setData] = useState();
useEffect(() => {
fetch(`/api/users/${user.id}`)
.then(res => res.json())
.then(setData);
}, []); // Missing dependency!
return <div>{data?.name}</div>;
}
// I flag:
// â ï¸ useEffect dependency array incomplete (line 6)
// ð¡ Add user.id to dependencies: [user.id]
// After fix:
useEffect(() => {
fetch(`/api/users/${user.id}`)
.then(res => res.json())
.then(setData);
}, [user.id]);
Integration with /review Command
The /review command aggregates my findings with deep sub-agent analysis:
/review --scope staged --checks all
# Command workflow:
# 1. Collects my automatic findings
# 2. Invokes @code-reviewer sub-agent for deep analysis
# 3. Invokes @security-auditor sub-agent
# 4. Generates comprehensive report with priorities
Performance Impact
- Activation time: < 100ms
- Analysis time: < 1 second per file
- Memory usage: Minimal (read-only)
- Background operation: Non-blocking
This skill operates asynchronously and won’t slow down your coding workflow.
Language Support
Fully Supported
- JavaScript/TypeScript (ES6+, React, Node.js)
- Python (3.8+, Django, FastAPI)
- Java (Spring Boot patterns)
- Go (standard patterns)
Partial Support
- Ruby, PHP, C#, Rust
- Framework-agnostic patterns apply
Want to add language-specific patterns? See customization guide above.
Tips for Best Results
- Write code first, then review – Let me catch issues as you go
- Don’t ignore warnings – Each flagged issue is worth reviewing
- Use sub-agent for learning – Invoke @code-reviewer to understand “why”
- Customize for your stack – Add project-specific patterns
- Combine with /review – Use command for comprehensive pre-commit checks
Related Tools
- security-auditor skill: Deeper security vulnerability scanning
- test-generator skill: Auto-suggest tests for your code
- @code-reviewer sub-agent: Comprehensive code review with examples
- /review command: Full workflow with multiple agents
Learn More
- Architecture: ../../../ARCHITECTURE.md
- Templates: ../../TEMPLATES.md
- Sub-agents: ../../../agents/README.md