Skip to main content
Build an agent that reviews open PRs and flags issues.

What you’ll build

An automated PR reviewer that:
  1. Fetches open PRs from GitHub
  2. Analyzes diffs for bugs, security issues, and style problems
  3. Posts review comments

Prerequisites

  • Airstore installed and authenticated
  • GitHub connected (airstore connect github)
  • Claude Code installed

Step 1: Create a smart folder for PRs

airstore create sources/github/prs-to-review \
  --query "open PRs in acme/api with full diffs"
This creates a folder with PR diffs:
~/airstore/sources/github/prs-to-review/
├── 142-add-rate-limiting.diff
├── 143-fix-auth-bug.diff
└── 147-update-dependencies.diff

Step 2: Mount the filesystem

airstore mount ~/airstore

Step 3: Run Claude Code

cd ~/airstore/sources/github/prs-to-review
claude "Review these PRs. For each one:
1. Summarize the changes
2. Flag any security issues
3. Note any bugs or logic errors
4. Suggest improvements
Format as a review I can post."

Example output

## PR #142: Add rate limiting

**Summary**: Adds rate limiting middleware to the API endpoints.

**Security**: ✅ No issues found. Rate limiting is properly implemented.

**Bugs**: 
- Line 45: The rate limit counter resets on server restart. Consider using Redis for persistence.

**Suggestions**:
- Add unit tests for the rate limiting logic
- Consider making the limit configurable via environment variable

---

## PR #143: Fix auth bug

**Summary**: Fixes a bug where expired tokens weren't being rejected.

**Security**: ⚠️ Line 23: The token expiry check uses `<=` instead of `<`. This allows tokens to be used for 1 extra second after expiry.

**Bugs**: None found.

**Suggestions**:
- Add a test case for tokens at exact expiry time

Automating with a script

Create a script to run reviews on a schedule:
#!/bin/bash
# review-prs.sh

# Sync latest PRs
airstore sync sources/github/prs-to-review

# Run review
cd ~/airstore/sources/github/prs-to-review

REVIEW=$(claude "Review these PRs. Flag security issues and bugs." --print)

# Post to Slack
echo "$REVIEW" | ~/airstore/tools/slack post \
  --channel="#code-review" \
  --stdin
Run daily with cron:
0 9 * * * /path/to/review-prs.sh

Posting comments to GitHub

Use the GitHub tool to post review comments:
#!/bin/bash

cd ~/airstore/sources/github/prs-to-review

for diff in *.diff; do
  PR_NUMBER=$(echo "$diff" | grep -oE '^[0-9]+')
  
  REVIEW=$(cat "$diff" | claude "Review this PR diff. Be concise." --print)
  
  ~/airstore/tools/github comment \
    --repo=acme/api \
    --number="$PR_NUMBER" \
    --body="$REVIEW"
done

Multi-repo review

Review PRs across multiple repositories:
# Create smart folders for each repo
airstore create sources/github/api-prs \
  --query "open PRs in acme/api"

airstore create sources/github/web-prs \
  --query "open PRs in acme/web"

airstore create sources/github/mobile-prs \
  --query "open PRs in acme/mobile"

# Review all
cd ~/airstore/sources/github
claude "Review all open PRs across these repos. Prioritize by risk."

Adding context from Linear

Include related issues for better reviews:
# Connect Linear
airstore connect linear

# Create a folder for related issues
airstore create sources/linear/pr-context \
  --query "issues mentioned in open PRs"

# Review with context
cd ~/airstore
claude "Review the PRs in sources/github/prs-to-review. 
Check sources/linear/pr-context for related issues and requirements."

Next steps