Skip to main content

/code-review Command

Comprehensive security and quality review of uncommitted changes before committing.

What This Command Does

  1. Get changed files: git diff --name-only HEAD
  2. Check each file for security issues, code quality, and best practices
  3. Generate report with severity levels and suggested fixes
  4. Block commit if CRITICAL or HIGH issues found

Review Categories

Security Issues (CRITICAL)

  • Hardcoded credentials, API keys, tokens
  • SQL injection vulnerabilities
  • XSS vulnerabilities
  • Missing input validation
  • Insecure dependencies
  • Path traversal risks

Code Quality (HIGH)

  • Functions > 50 lines
  • Files > 800 lines
  • Nesting depth > 4 levels
  • Missing error handling
  • console.log statements
  • TODO/FIXME comments
  • Missing JSDoc for public APIs

Best Practices (MEDIUM)

  • Mutation patterns (use immutable instead)
  • Emoji usage in code/comments
  • Missing tests for new code
  • Accessibility issues (a11y)

Command Syntax

No arguments required - automatically reviews all uncommitted changes.

Example Output

After:
[HIGH] Missing Error Handling File: src/api/users.ts:42 Issue: Network call without try/catch Suggestion: Wrap in try/catch Before:
After:

Summary

  • CRITICAL: 1
  • HIGH: 1
  • MEDIUM: 0
Recommendation: ❌ Block commit until CRITICAL issue is fixed