code-review
Review code changes between commits for security, logic, performance, and style issues
What this skill does
# code-review **Category**: Development ## Usage ```bash /code-review [<commit>] [--from <commit>] [--to <commit>] ``` ## Arguments | Argument | Default | Description | |----------|---------|-------------| | `<commit>` | - | Single commit to review | | `--from` | merge-base with main | Starting commit reference | | `--to` | HEAD | Ending commit reference | ## Examples ```bash # Review all changes in current branch (from merge-base to HEAD) /code-review # Review a specific commit /code-review abc1234 # Review a range of commits /code-review --from abc1234 --to def5678 # Review changes since a specific commit /code-review --from HEAD~5 # Review changes up to a specific commit /code-review --to feature-branch ``` ## Execution Method This command delegates to the `code-review-expert` agent (Haiku model) for fast, cost-effective execution. **Delegation**: Use the Task tool with: - `subagent_type`: `"git-workflow:code-review-expert"` - `model`: `"haiku"` - `prompt`: Include the commit range and current working directory Example: ``` Task(subagent_type="git-workflow:code-review-expert", model="haiku", prompt="Review changes from abc1234 to HEAD in /path/to/repo") ``` --- ## Execution Instructions for Claude Code When this command is run, Claude Code should: ### 1. Parse Arguments ``` SINGLE_COMMIT = first positional argument (if provided) FROM = --from value or merge-base with main/master TO = --to value or HEAD ``` If a single commit is provided: - Review just that commit: `FROM = <commit>^`, `TO = <commit>` If no arguments: - FROM = merge-base with main (or master) - TO = HEAD ### 2. Validate Commit References ```bash # Verify commits exist git rev-parse --verify "$FROM" 2>/dev/null git rev-parse --verify "$TO" 2>/dev/null ``` If invalid, show error with suggestions. ### 3. Gather Change Information ```bash # Get overview git diff --stat $FROM..$TO # Get commit history git log --oneline $FROM..$TO # Get full diff for analysis git diff $FROM..$TO ``` ### 4. Analyze Changes Review each file's changes for: **Critical Issues (must fix)** - Security vulnerabilities (injection, XSS, auth bypass) - Hardcoded secrets or credentials - Data exposure risks **High Priority (should fix)** - Logic bugs and incorrect behavior - Missing error handling - Null reference issues - Race conditions **Medium Priority (consider fixing)** - Performance issues (N+1 queries, inefficient loops) - Code smells and maintainability issues - Missing input validation **Low Priority (optional)** - Style inconsistencies - Minor code improvements - Documentation gaps **Test Coverage** - New code without corresponding tests - Changed behavior without updated tests ### 5. Present Findings Format output as: ``` Code Review: <from>..<to> ========================= Files Changed: N (+X, -Y) Commits: M ## Critical Issues - [SECURITY] path/file.py:42 - SQL injection via unsanitized input ## High Priority - [LOGIC] path/file.py:78 - Missing null check on user.profile ## Medium Priority - [PERFORMANCE] path/file.py:120 - Queries in loop, consider batch fetch ## Low Priority - [STYLE] path/file.py:15 - Inconsistent naming: userID vs user_id ## Test Coverage - Missing tests for: new_feature() in path/file.py ## Suggestions - Consider adding retry logic for external API calls --- Overall: NEEDS_CHANGES | APPROVED_WITH_COMMENTS | APPROVED ``` ### 6. Overall Assessment - **NEEDS_CHANGES**: Critical or multiple high-priority issues found - **APPROVED_WITH_COMMENTS**: Only medium/low issues, suggestions provided - **APPROVED**: No significant issues found ## What to Review | Category | Look For | |----------|----------| | Security | Injection, auth, secrets, data exposure | | Logic | Bugs, error handling, edge cases | | Performance | N+1 queries, inefficient algorithms | | Style | Naming, consistency, complexity | | Tests | Coverage, quality, edge cases | ## What NOT to Flag - Subjective style preferences (unless inconsistent) - Theoretical issues that can't happen in context - Over-engineering suggestions - Minor naming bikeshedding ## Error Handling ``` No changes to review The commits $FROM and $TO are identical. Invalid commit reference Could not find commit: abc1234 Try: git log --oneline -20 Not a git repository Navigate to a git repository first. ``` ## Related Commands | Command | Purpose | |---------|---------| | `/commit` | Create commits with conventional format | | `/rebase` | Rebase local changes on remote |
Related in Security
mac-ops
IncludedComprehensive macOS workstation operations — diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.