Fresh-eyes code review for local Git branches and pull requests, powered by the Claude CLI.
- Python 3.10+
- PyYAML (
pip install pyyaml) - Claude CLI installed and on
PATH - Git
- GitHub CLI (
gh) — required for PR reviews
git clone <repo-url> ~/.local-code-review
cd ~/.local-code-review && bash install.sh1. Clone the repo
git clone <repo-url> ~/.local-code-review2. Install Python dependency
pip install pyyaml3. Install Claude Code skills
The tool uses a custom Claude Code skill (/local-review) that must be copied to your Claude commands directory:
mkdir -p ~/.claude/commands
cp ~/.local-code-review/skills/local-review.md ~/.claude/commands/Optionally, install the critical-code-review skill for the --critical-review-skill flag (see Credits).
4. Create the lcr command
ln -s ~/.local-code-review/local_code_review.py /usr/local/bin/lcrOr add an alias to your shell profile:
echo 'alias lcr="python3 ~/.local-code-review/local_code_review.py"' >> ~/.zshrcRun from any Git repository on a feature branch:
# Review current branch against main/master (auto-detected)
lcr review
# Review against a specific base branch
lcr review --base develop
# Use the deep /local-review skill instead of inline prompt
lcr review --skill
# Focus the review on a specific area
lcr review --skill --focus "error handling"
# Save review to a specific file
lcr review --output ./my-review.mdReview a pull request with full PR context (description, comments, linked issues):
# Review PR #123 (auto-checks out the branch, uses /local-review skill)
lcr review --pr 123
# Review without checking out the branch (already on it)
lcr review --pr 123 --no-checkout
# Review with a specific focus area
lcr review --pr 123 --focus "security implications"
# Save PR review to a specific file
lcr review --pr 123 --output ./pr-review.mdPR reviews automatically:
- Fetch PR metadata (title, description, comments, reviews, labels)
- Check out the PR branch (unless
--no-checkout) - Fetch the PR diff
- Follow
Fixes #N/Closes #Nreferences to fetch linked issues - Use the
/local-reviewskill for deep, structured review
# Apply fixes from the latest review
lcr improve
# Apply fixes interactively (opens Claude Code session)
lcr improve --interactive
# Run review→improve loop until approved (max 3 passes)
lcr loop
# Override model or max passes
lcr --model sonnet loop --max-passes 5The /local-review skill can also be used directly inside Claude Code:
/local-review PR #123
/local-review security audit of auth module
/local-review src/api/
| Command | Description |
|---|---|
review |
Run a code review of a branch or PR. Outputs a verdict: APPROVE, REQUEST_CHANGES, or NEEDS_DISCUSSION. |
improve |
Read the latest review and apply fixes for blocking/important issues. |
loop |
Iterate review→improve→review until approved or max passes reached. |
| Flag | Description |
|---|---|
--pr <N> |
PR number or URL to review |
--no-checkout |
Skip gh pr checkout (use when already on the PR branch) |
--focus <area> |
Focus the review on a specific area |
--output <path> |
Save review to a specific file instead of the review directory |
--skill |
Use the /local-review skill (default when --pr is used) |
--base <branch> |
Base branch to diff against (branch review only) |
--pass-number <N> |
Override the review pass number (branch review only) |
--critical-review-skill |
Use the /critical-code-review skill for an adversarial review |
- APPROVE — Code is ready to merge.
- REQUEST_CHANGES — Blocking or important issues found;
improvecan auto-fix these. - NEEDS_DISCUSSION — Architectural or design concerns that need human input.
Edit ~/.local-code-review/config.yaml:
model: claude-opus-4-6 # Claude model to use
base_branch_candidates: [main, master] # Auto-detect base branch
loop:
max_passes: 3 # Max review-improve iterations
stop_on: APPROVE # Stop loop on this verdict
review_dir: .claude/reviews # Where reviews are saved (relative to repo root)
timeout: 600 # Claude CLI timeout in seconds
pr:
auto_checkout: true # Checkout PR branch automatically
max_diff_chars: 100000 # Truncate diffs beyond this
fetch_linked_issues: true # Follow Fixes #N referencesAll fields have sensible defaults — the config file is optional.
Reviews are saved as timestamped Markdown files in <repo>/.claude/reviews/. Consider adding this directory to your .gitignore.
Branch reviews are saved as YYYYMMDD_HHMMSS_passN.md. PR reviews are saved as YYYYMMDD_HHMMSS_prN.md.
The optional /critical-code-review skill is by Garrick Aden-Buie (@gadenbuie) from the posit-dev/skills repository, licensed under the MIT License. To install it:
curl -o ~/.claude/commands/critical-code-review.md \
https://raw.githubusercontent.com/posit-dev/skills/main/posit-dev/critical-code-reviewer/SKILL.md