DEV Community

brian austin
brian austin

Posted on

How I use Claude as a code reviewer that never gets tired (with real examples)

How I use Claude as a code reviewer that never gets tired

Every developer has been there: it's 11pm, you've been staring at the same function for 3 hours, and you need a second pair of eyes before you push.

Your teammates are asleep. The PR can't wait until morning.

I built a solution: a $2/month Claude API endpoint I can hit from anywhere, any time, with any code.

The setup

First, get your API key from SimplyLouie — it's a Claude API proxy at $2/month that works with the same parameters as the official Anthropic API.

Then build a tiny bash function:

#!/bin/bash
# review.sh — paste any function, get a code review in seconds

review() {
  local code=$(cat "$1")
  curl -s https://api.simplylouie.com/v1/messages \
    -H "Content-Type: application/json" \
    -H "x-api-key: $LOUIE_API_KEY" \
    -d "{
      \"model\": \"claude-sonnet-4-5\",
      \"max_tokens\": 1024,
      \"messages\": [{
        \"role\": \"user\",
        \"content\": \"Review this code for bugs, edge cases, and style issues. Be direct and specific.\\n\\n$code\"
      }]
    }" | jq -r '.content[0].text'
}

# Usage: review myfile.py
Enter fullscreen mode Exit fullscreen mode

Add it to your .bashrc and you have an always-on code reviewer.

Real example: catching a subtle bug

I ran this Python function through it last week:

def get_user_balance(user_id, use_cache=True):
    if use_cache:
        cached = redis.get(f'balance:{user_id}')
        if cached:
            return float(cached)

    balance = db.query('SELECT balance FROM accounts WHERE id = ?', user_id)
    redis.setex(f'balance:{user_id}', 300, balance)  # 5 min TTL
    return balance
Enter fullscreen mode Exit fullscreen mode

Claude's response:

Bug (high severity): You're caching the raw DB result object, not a float. When you call redis.setex(), you're serializing whatever db.query() returns — if that's a Row object or tuple, Redis will store its string representation like (Decimal('1234.56'),). Then float(cached) on line 4 will throw ValueError: could not convert string to float: "(Decimal('1234.56'),)".

Fix: Cache float(balance[0]) or str(balance[0]) explicitly.

Edge case: What if user_id doesn't exist? balance will be None, and redis.setex() will cache 'None'. Next request returns float('None') → ValueError.

This is a real bug. The code had been in production for 4 months. Two human code reviewers had approved it.

The CLAUDE.md trick for consistent reviews

If you use Claude Code, add a reviewer persona to your .claude/CLAUDE.md:

## Code Review Style
When asked to review code:
1. Check for bugs first, style second
2. Flag SQL injection, XSS, and auth issues as CRITICAL
3. Rate each issue: CRITICAL / HIGH / MEDIUM / LOW
4. Always check edge cases: null inputs, empty lists, concurrency
5. Suggest specific fixes with code examples, not vague advice
Enter fullscreen mode Exit fullscreen mode

Now every review follows the same format. Your whole team gets consistent feedback.

Building a pre-commit hook

Take it further: auto-review before every commit.

#!/bin/bash
# .git/hooks/pre-commit

# Get staged Python files
STAGED=$(git diff --cached --name-only --diff-filter=ACM | grep '\.py$')

if [ -z "$STAGED" ]; then
  exit 0
fi

echo "🔍 Running AI code review..."

for file in $STAGED; do
  result=$(curl -s https://api.simplylouie.com/v1/messages \
    -H "Content-Type: application/json" \
    -H "x-api-key: $LOUIE_API_KEY" \
    -d "{
      \"model\": \"claude-sonnet-4-5\",
      \"max_tokens\": 512,
      \"messages\": [{
        \"role\": \"user\",
        \"content\": \"Quick security review — any CRITICAL issues in this code?\\n\\n$(cat $file)\"
      }]
    }" | jq -r '.content[0].text')

  if echo "$result" | grep -q 'CRITICAL'; then
    echo "⚠️  CRITICAL issue found in $file:"
    echo "$result"
    echo "\nCommit blocked. Fix the issue or use git commit --no-verify"
    exit 1
  fi
done

echo "✅ No critical issues found"
Enter fullscreen mode Exit fullscreen mode

Make it executable: chmod +x .git/hooks/pre-commit

Now every commit gets a fast security scan. CRITICAL issues block the commit.

Why $2/month instead of the official API

The Anthropic API charges per-token. For a solo developer doing occasional code reviews, usage-based pricing means unpredictable bills.

SimplyLouie gives you a flat $2/month cap — use it as much as you want for code reviews, documentation, debugging, whatever. One API key, one endpoint, same Claude models.

The base URL is https://api.simplylouie.com/v1 — drop it into any existing Anthropic SDK integration:

import anthropic

client = anthropic.Anthropic(
    api_key="your-louie-key",
    base_url="https://api.simplylouie.com/v1"
)
Enter fullscreen mode Exit fullscreen mode

The late-night workflow

Here's my actual flow when I'm coding after midnight:

  1. Write the function
  2. review myfile.py in terminal
  3. Fix what Claude flags
  4. Commit

No waiting for morning. No incomplete PRs sitting in draft. No shipping bugs because you were too tired to catch them.

The code reviewer that never sleeps costs less than a cup of coffee per month.


SimplyLouie is a $2/month Claude API with a 7-day free trial. 50% of revenue goes to animal rescue. Start reviewing: simplylouie.com

Top comments (0)