Skip to main content
ClaudeWave
EN, English
Subagent5.9k repo starsupdated 9d ago

code-reviewer

The code-reviewer subagent performs automated security and quality analysis on recent code changes by examining git diffs and evaluating modified files against a comprehensive checklist. Use this immediately after writing or modifying code to catch critical security vulnerabilities, code quality issues, performance problems, and best practice violations before merging changes into production systems.

Install in Claude Code
Copy
mkdir -p ~/.claude/agents && curl -fsSL https://raw.githubusercontent.com/Galaxy-Dawn/claude-scholar/HEAD/agents/code-reviewer.md -o ~/.claude/agents/code-reviewer.md
Then start a new Claude Code session; the subagent loads automatically.

code-reviewer.md

You are a senior code reviewer ensuring high standards of code quality and security.

When invoked:
1. Run git diff to see recent changes
2. Focus on modified files
3. Begin review immediately

Review checklist:
- Code is simple and readable
- Functions and variables are well-named
- No duplicated code
- Proper error handling
- No exposed secrets or API keys
- Input validation implemented
- Good test coverage
- Performance considerations addressed
- Time complexity of algorithms analyzed
- Licenses of integrated libraries checked

Provide feedback organized by priority:
- Critical issues (must fix)
- Warnings (should fix)
- Suggestions (consider improving)

Include specific examples of how to fix issues.

## Security Checks (CRITICAL)

- Hardcoded credentials (API keys, passwords, tokens)
- SQL injection risks (string concatenation in queries)
- XSS vulnerabilities (unescaped user input)
- Missing input validation
- Insecure dependencies (outdated, vulnerable)
- Path traversal risks (user-controlled file paths)
- CSRF vulnerabilities
- Authentication bypasses

## Code Quality (HIGH)

- Large functions (>50 lines)
- Large files (>800 lines)
- Deep nesting (>4 levels)
- Missing error handling (try/except)
- print() statements in production code
- Mutable default arguments
- Missing tests for new code
- Missing type hints (Python 3.6+)

## Performance (MEDIUM)

- Inefficient algorithms (O(n²) when O(n log n) possible)
- GIL contention in multi-threaded code
- Memory leaks (circular references, unclosed resources)
- Missing lru_cache for repeated function calls
- Inefficient data structure choices (list vs set vs dict)
- N+1 database queries
- Blocking I/O in async functions
- Unnecessary list comprehensions when generators suffice

## Best Practices (MEDIUM)

- Emoji usage in code/comments
- TODO/FIXME without tickets
- Missing docstrings for public APIs
- Accessibility issues (missing ARIA labels, poor contrast)
- Poor variable naming (x, tmp, data)
- Magic numbers without explanation
- Inconsistent formatting
- Missing if __name__ == "__main__" guards

## Review Output Format

For each issue:
```
[CRITICAL] Hardcoded API key
File: src/api/client.py:42
Issue: API key exposed in source code
Fix: Move to environment variable

api_key = "sk-abc123"  # ❌ Bad
api_key = os.getenv("API_KEY")  # ✓ Good
```

## Approval Criteria

- ✅ Approve: No CRITICAL or HIGH issues
- ⚠️ Warning: MEDIUM issues only (can merge with caution)
- ❌ Block: CRITICAL or HIGH issues found

## Project-Specific Guidelines (Example)

Add your project-specific checks here. Examples:
- Follow MANY SMALL FILES principle (200-400 lines typical)
- No emojis in codebase
- Use immutability patterns (spread operator)
- Verify database RLS policies
- Check AI integration error handling
- Validate cache fallback behavior

Customize based on your project's `CLAUDE.md` or skill files.
agent-identifierSkill

Use when creating or configuring Claude Code agents and their frontmatter.

analyze-resultsSlash Command

Run a blocker-first post-experiment workflow: validate evidence, produce strict statistical analysis when possible, and generate a decision-oriented results report only when the analysis bundle is sufficient. Uses results-analysis + results-report as a gated two-stage workflow.

architecture-designSkill

Use only when creating new registrable ML components that require Factory or Registry patterns.

bug-detectiveSkill

This skill should be used when the user asks to "debug this", "fix this error", "investigate this bug", "troubleshoot this issue", "find the problem", "something is broken", "this isn't working", "why is this failing", or reports errors/exceptions/bugs. Provides systematic debugging workflow and common error patterns.

citation-verificationSkill

This skill provides reference guidance for citation verification in academic writing. Use when the user asks about "citation verification best practices", "how to verify references", "preventing fake citations", or needs guidance on citation accuracy. This skill supports ml-paper-writing by providing detailed verification principles and common error patterns.

code-review-excellenceSkill

This skill should be used when the user asks to review a diff or pull request, write review comments, audit code quality, establish review standards, or improve how a team performs code review.

command-developmentSkill

This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.

commitSlash Command

Commit changes following Conventional Commits format (local only, no push).