Skip to content

mzikherman/local-code-review

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lcr — Local Code Review

Fresh-eyes code review for local Git branches and pull requests, powered by the Claude CLI.

Requirements

Installation

Quick setup

git clone <repo-url> ~/.local-code-review
cd ~/.local-code-review && bash install.sh

Manual setup

1. Clone the repo

git clone <repo-url> ~/.local-code-review

2. Install Python dependency

pip install pyyaml

3. 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/lcr

Or add an alias to your shell profile:

echo 'alias lcr="python3 ~/.local-code-review/local_code_review.py"' >> ~/.zshrc

Usage

Branch Review

Run 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.md

PR Review

Review 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.md

PR 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 #N references to fetch linked issues
  • Use the /local-review skill for deep, structured review

Improve & Loop

# 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 5

Claude Code Skill

The /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/

Commands

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.

Review Flags

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

Verdicts

  • APPROVE — Code is ready to merge.
  • REQUEST_CHANGES — Blocking or important issues found; improve can auto-fix these.
  • NEEDS_DISCUSSION — Architectural or design concerns that need human input.

Configuration

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 references

All fields have sensible defaults — the config file is optional.

Reviews

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.

Credits

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

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors