Review your code before you open a PR. Get a structured, AI-powered code review (design, security, performance, tests) as a single markdown report—no GitHub, no API keys, no PR required. Works on any git repo, offline. Use it with any AI agent that supports skills (Cursor, Claude Code, Windsurf, Gemini, etc.).
Most code-review tools assume you already have a pull request. This skill is for the step before that: you want feedback on your branch, your staged changes, or your local edits so you can fix issues and polish the diff before raising a PR. No GitHub dependency, no external services—just your repo and your AI agent.
Use it when you:
- Want a review of your branch vs
main(or any base) before opening a PR - Want to double-check what you're about to commit (
--staged) - Want feedback on all uncommitted work (
--local)
You get one markdown file with Critical, High, Medium, and Positive notes, plus suggested code snippets in the doc only—your source files stay untouched unless you choose to apply changes.
| This skill | Typical PR review tools | |
|---|---|---|
| When | Before you open a PR | After you open a PR |
| Needs GitHub? | No | Yes (PR number, gh CLI, etc.) |
| Needs API keys? | No | Often (GitHub token, service account) |
| Works offline? | Yes | Usually no |
| Modes | Branch vs branch, staged only, all local | PR-only |
| Output | One markdown report (git-ignored) | Inline comments on the PR |
So: review first, PR when you're ready.
review-before-pr/
├── README.md
├── SKILL.md
├── references/
│ └── REVIEW_CHECKLIST.md
└── scripts/
└── generate_diff.sh
Clone this repo directly into your AI agent's skills directory. From your project root (the repo you want to review), run the command for your agent.
| Agent | Skills directory | Install command |
|---|---|---|
| Cursor | .cursor/skills/review-before-pr |
git clone https://github.com/amanblog/review-before-pr.git .cursor/skills/review-before-pr |
| Claude Code | .claude/skills/review-before-pr |
git clone https://github.com/amanblog/review-before-pr.git .claude/skills/review-before-pr |
| Windsurf | .windsurf/skills/review-before-pr |
git clone https://github.com/amanblog/review-before-pr.git .windsurf/skills/review-before-pr |
| Continue | .continue/skills/review-before-pr |
git clone https://github.com/amanblog/review-before-pr.git .continue/skills/review-before-pr |
| Other | Check your agent's docs for "skills" path | Clone into that path as review-before-pr. |
Ensure your repo has **.review/** in .gitignore so diff and review output aren't committed. The script will add it automatically if missing.
You can use the skill in three ways. How you invoke it depends on your AI agent (see How agents invoke skills below).
In chat, ask the agent to review your current branch against a base branch (e.g. main or develop) using this skill. The agent will run the diff script and then produce the review.
Example prompts:
- "Review my current branch against
mainusing the review-before-pr skill" - "Review my branch against
developusing review-before-pr" - "Review my staged changes using the review-before-pr skill"
- "Review my local (uncommitted) changes using review-before-pr"
The agent runs the script, writes the diff to .review/diff.txt, analyzes it, and writes the report to e.g. .review/review-<branch>.md.
In Cursor: type **/** in Agent chat, then choose review-before-pr from the list (or type the skill name). When prompted, say which base branch to compare against (e.g. main, develop) or that you want staged/local changes.
In Claude Code: type **/review-before-pr. In Windsurf: type **@review-before-pr in Cascade. See the table below for other agents.
Generate the diff from the CLI (use the path where you installed the skill, e.g. .cursor/skills/review-before-pr), then ask the agent to review .review/:
# From project root — <SKILL_DIR> = where you installed the skill (e.g. .cursor/skills/review-before-pr)
<SKILL_DIR>/scripts/generate_diff.sh main my-feature-branch
# Or: --staged for staged only, --local for all local changesExamples:
- Cursor:
.cursor/skills/review-before-pr/scripts/generate_diff.sh main my-branch - Claude Code:
.claude/skills/review-before-pr/scripts/generate_diff.sh main my-branch
Then in chat: "Review the diff in .review/diff.txt using the review-before-pr skill". The agent will read the diff and write the report under .review/.
| Agent | How to invoke this skill |
|---|---|
| Cursor | Type **/** in Agent chat, then select review-before-pr. You can also type the skill name. Cursor skills docs |
| Claude Code | Type **/review-before-pr**. Claude Code skills |
| Windsurf | Type **@review-before-pr** in Cascade. Windsurf Cascade skills |
| Continue | Use natural language in Agent mode, e.g. "Review my current branch against main using the review-before-pr skill". |
| Other | Check your agent's docs; invoke by name or via the UI. |
The review document is organized into Critical, High priority, Medium / good-to-have, and Positive notes, with suggested fixes as code blocks in the doc. For very large diffs (e.g. 5,000+ lines), the agent summarizes by file/module.
Example: See examples/sample-review.md for a complete review output.
Automatically excludes noise files (lock files, SVGs, build artifacts) to keep reviews focused on actual code. Saves AI tokens and improves review quality.
Scans for hardcoded secrets (API keys, tokens, passwords) before generating diffs. Prevents accidental exposure to AI APIs.
Works on Mac, Linux, and Windows. Python version available for full Windows compatibility.
Customize ignore patterns, secret detection, and review focus areas with .reviewrc file. See docs/CONFIGURATION.md.
AI proactively searches your codebase for related code, reducing false positives and improving accuracy.
Track code quality trends over time with automatic metrics logging.
Create a .reviewrc file in your project root to customize behavior:
{
"baseBranch": "develop",
"ignorePatterns": ["*.generated.ts", "migrations/*"],
"review": {
"categories": ["security", "performance"],
"contextGathering": true
}
}Full documentation: docs/CONFIGURATION.md
After reviewing, apply suggested fixes safely via patch files:
# Generate patch for Critical fixes
python scripts/apply_fixes.py --priority critical --preview
# Review the patch, then apply
python scripts/apply_fixes.py --priority critical --apply
# Rollback if needed
git apply -R .review/patches/critical-fixes.patchView your code quality trends:
python scripts/analyze_metrics.pyAutomatically review staged changes before committing. See docs/PRECOMMIT_SETUP.md.
Solution 1: Install Git Bash (comes with Git for Windows)
winget install Git.GitSolution 2: Use Python version (works on all platforms)
python .cursor/skills/review-before-pr/scripts/generate_diff.py --stagedIf you need to review code containing test API keys:
# Temporarily disable secret detection
./scripts/generate_diff.sh --allow-secrets main featureFor diffs >5000 lines, the AI will summarize. To review specific parts:
# Split into smaller reviews by directory
./scripts/generate_diff.sh main feature .review/frontend.txt -- src/frontend/
./scripts/generate_diff.sh main feature .review/backend.txt -- src/backend/Full troubleshooting guide: docs/TROUBLESHOOTING.md
| Feature | review-before-pr | CodeRabbit | Qodo | GitHub Copilot | SonarQube |
|---|---|---|---|---|---|
| Pre-PR reviews | ✅ Core focus | ❌ PR-only | |||
| Local execution | ✅ Yes | ❌ No | ❌ No | ✅ Yes | |
| No API keys needed | ✅ Yes | ❌ Requires account | ❌ Requires account | ❌ Requires license | ✅ Yes |
| Works offline | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |
| AI-powered | ✅ Yes (your agent) | ✅ Yes | ✅ Yes | ✅ Yes | |
| Context-aware | ✅ Yes (v2.0) | ✅ Yes | ✅ Yes | ✅ Yes | |
| Secret detection | ✅ Yes (v2.0) | ✅ Yes | ❌ No | ✅ Yes | |
| Metrics tracking | ✅ Yes (v2.0) | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes |
| Cost | Free | $12-48/user/mo | $19-39/user/mo | $10-39/user/mo | Free (OSS) |
- A git repository
- An AI agent that supports skills (Cursor, Claude Code, Windsurf, Continue, etc.)
- Python 3.7+ (for cross-platform support and secret detection)
- Configuration Guide - Customize for your project
- Troubleshooting - Common issues and solutions
- Pre-commit Setup - Automatic reviews before commits
- Sample Review Output - See what you'll get
Contributions welcome! See CONTRIBUTING.md for guidelines.
MIT