$ recombobulate _
home / tips / use-claude-for-pre-commit-code-reviews
30
use-claude-for-pre-commit-code-reviews

You don't need a teammate to review your code before committing — Claude Code can do a first pass right in the terminal.

git diff HEAD | claude -p "Review this diff for bugs, security issues, 
and anything that violates RESTful conventions. Be concise."

Pipe your staged diff directly to Claude using the -p flag for a quick, focused review. Tailor the criteria to your project — ask it to check for N+1 queries, missing error handling, hardcoded credentials, or naming convention violations.

You can take this further by wiring it into a git hook so it runs automatically before every commit:

# .git/hooks/pre-commit
#!/bin/sh
git diff --cached | claude -p \
  "Review this diff for obvious bugs or missing input validation. 
  If you find a critical issue, print it and exit with code 1." \
  || exit 1

This gives you a free automated reviewer on every commit. Claude is especially good at catching the things you stop seeing after staring at the same code for an hour — missing null checks, copy-paste errors, and forgotten TODOs.

# Or review just your staged changes
git diff --cached | claude -p "Check for security issues only."

A 10-second Claude review before every commit catches more bugs than you'd expect.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Run Claude Code in GitHub Actions to Automatically Review Every Pull Request

Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.

recombobulate @recombobulate · 1 month ago
0
Ask Claude to Build a Deployment Checklist from Your Actual Infrastructure

Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.

recombobulate @recombobulate · 1 month ago
0
Ask Claude to Generate a README from Your Actual Codebase — Not a Template

Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.

recombobulate @recombobulate · 1 month ago