Find bugs, security vulnerabilities, and code quality issues in branch changes. Use when reviewing code for bugs, security issues, or quality problems. Thorough but concise reporting.
Reviews branch changes for security vulnerabilities, bugs, and code quality issues. Triggers when reviewing code changes to identify SQL injection, XSS, authentication flaws, and other critical issues before merging.
/plugin marketplace add sontek/sontek-skills/plugin install agent-skills@agent-skills-localThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Review branch changes for bugs, security vulnerabilities, and code quality issues.
For each changed file:
This prevents false positives and focuses on real risks.
# Get the full diff
git diff main...HEAD
# If truncated, list changed files
git diff main...HEAD --name-only
# Get all commits
git log main..HEAD --oneline
Review every changed file completely:
For each changed file, identify:
User Input Points:
Data Operations:
Security Controls:
Sensitive Operations:
Check each category for every changed file:
For each potential issue:
Confirm it's real:
Don't report if:
Be concise and accurate. Don't invent issues.
For each real issue found:
### [Severity] File:Line - Brief description
**Problem:** Clear explanation of the vulnerability or bug
**Evidence:** Why this is a real issue (not already fixed, no test coverage, etc.)
**Impact:** What could happen (data breach, crash, etc.)
**Fix:** Specific, actionable suggestion
**Reference:** OWASP link or standard if applicable
Severity levels:
If nothing significant found:
No security vulnerabilities or bugs found in the changes.
Reviewed files:
- src/api/user.py
- src/models/profile.py
- tests/test_user.py
All inputs are validated, queries are parameterized, and auth checks are present.
### [Critical] src/api/users.py:45 - SQL injection in user search
**Problem:** User search query concatenates unsanitized input directly into SQL
**Evidence:**
- Line 45: `query = f"SELECT * FROM users WHERE name = '{search_term}'"`
- No parameterization or escaping
- search_term comes directly from request.args
- No test coverage for SQL injection attempts
**Impact:** Attacker can execute arbitrary SQL, dump database, or delete data
**Fix:** Use parameterized query:
```python
query = "SELECT * FROM users WHERE name = %s"
cursor.execute(query, [search_term])
Reference: OWASP SQL Injection - https://owasp.org/www-community/attacks/SQL_Injection
### Example 2: Authorization Issue
Problem: updateProfile() checks authentication but not authorization
Evidence:
Impact: Users can modify other users' profiles (IDOR vulnerability)
Fix: Add ownership check:
if profile.user_id != current_user.id and not current_user.is_admin:
raise PermissionDenied()
Reference: OWASP A01:2021 - Broken Access Control
### Example 3: No Issues Found
No security vulnerabilities or bugs found.
Files reviewed:
All user inputs are validated at API boundary, database queries use parameterization, and test coverage is comprehensive.
## Common Bug Patterns
| Language | Pattern | Issue |
| ---------- | ------------------------------- | ------------------------------ |
| Python | Mutable default args | Shared state across calls |
| JavaScript | Missing `await` | Returns Promise not value |
| Go | Goroutine without WaitGroup | Resource leaks |
| All | TOCTOU (check-then-act) | Race conditions |
| All | Unclosed resources | File/connection leaks |
## Tool Usage
- **Use `git diff main...HEAD`** to get all changes
- **Use Read tool** to examine complete files for context
- **Use Grep tool** to search for dangerous patterns (eval, exec, etc.)
- **Use Task tool with Explore agent** to understand codebase architecture
- **Use LSP tool** to trace function calls and data flow
## Search Patterns for Common Issues
```bash
# SQL injection patterns
grep -r "execute.*format\|execute.*%.*%" .
grep -r "query.*+.*request\|query.*f\"" .
# Command injection
grep -r "os\.system\|subprocess\.*shell=True" .
grep -r "exec\|eval" .
# Hardcoded secrets
grep -ri "password.*=.*['\"][^'\"]\|api_key.*=.*['\"]" .
Before finalizing, verify:
Don't:
Do:
Remember: