Recipe Updated 4 min read

AI Code Review in 30 Seconds

Get instant code review from AI. Read your git diff, analyze changes, and get actionable feedback without waiting for a teammate.

You just finished a feature and want a quick review before pushing. Your teammate is in a meeting. Instead of waiting, you can get an AI code review in 30 seconds.

The Recipe

Open Chapeta and type:

“Run git diff in ~/projects/myapp and review the changes. Focus on bugs, security issues, and missed edge cases.”

That is it. Chapeta runs the diff, reads the output, and gives you a structured review.

What You Get

A typical AI code review includes:

  • Bug identification: Null pointer risks, off-by-one errors, race conditions
  • Security review: SQL injection, XSS, hardcoded credentials, insecure defaults
  • Edge cases: What happens with empty input? Negative numbers? Concurrent access?
  • Style notes: Only when they indicate real issues (inconsistent error handling, not cosmetic preferences)
  • Suggestions: Specific code changes, not vague “consider refactoring”

Step by Step

Review Staged Changes

“Run git diff --staged in ~/projects/myapp and review what I’m about to commit”

Review a Specific File

“Read ~/projects/myapp/src/auth/login.ts and review it for security issues”

Review Against Main Branch

“Run git diff main in ~/projects/myapp and summarize what changed with a focus on potential bugs”

Review Last Commit

“Run git show HEAD in ~/projects/myapp and review the last commit”

Deep Review with Context

“Run git diff main in ~/projects/myapp, then read any modified files completely and give me a thorough review”

This gives the AI the full file context, not just the diff. More tokens, more cost, but better understanding.

Making Reviews More Useful

Be Specific About What to Look For

Instead of a generic “review this code,” specify your concerns:

“Review the changes with a focus on database query performance. Are there any N+1 queries or missing indexes?”

“Review with a focus on error handling. Are all API calls wrapped in try-catch? Are errors logged properly?”

Set the Reviewer’s Persona

“Review this code as a senior security engineer. What attack vectors does this change introduce?”

“Review this code as someone who will maintain it in 6 months. What will be confusing?”

Get Specific Output

“Review and output your findings as a markdown checklist I can work through”

This gives you a todo list instead of prose.

Combining with Other Tools

“Run git diff in ~/projects/myapp, identify any new functions, then search the codebase for similar existing functions that might be duplicated”

Check Test Coverage

“Run git diff --name-only in ~/projects/myapp and for each changed file, check if there’s a corresponding test file”

Generate Commit Message

After your review:

“Based on the git diff, write a concise commit message following conventional commits format”

Limitations

AI code review is a supplement, not a replacement. The AI:

  • Cannot run your tests (though it can trigger npm test via Bash and read results)
  • May miss domain-specific business logic errors
  • Does not understand your team’s specific conventions unless you specify them
  • Can produce false positives (flagging correct code as problematic)

Use AI review for a quick first pass. Use human review for critical changes. The two are complementary, not interchangeable.

There's a better way.