Skip to content
TheBushidoCollective avatar

session-code-review

Pre-commit review gate that checks changes against REVIEW.md before commits and session completion.

CCM score
48 of 100
GitHub stars
201
View on GitHub

Own this plugin? Claim it

What it does

  • Adds a code-review skill for manual review of the current branch against REVIEW.md guidelines
  • Runs a Stop hook that sends unresolved issues back to Claude so it fixes them before finishing
  • Adds a PreToolUse hook that blocks git commit and git push when staged or branch changes fail review
  • Designed for teams that want project-specific review rules applied earlier than CI-based pull request review

Backpressure code review that validates changes against REVIEW.md before commits and session completion.

Add marketplace

/plugin marketplace add TheBushidoCollective/han

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install session-code-review@han

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

Code Review

Name

session-code-review:code-review - Review session changes against REVIEW.md and CLAUDE.md guidelines

Synopsis

/code-review [--branch <base>]

Description

Performs a thorough code review of all changes on the current branch compared to the base branch (defaults to main or master). Reviews against REVIEW.md and CLAUDE.md guidelines in the repository.

This is a local-only review — no PR or GitHub integration required. It examines your uncommitted changes, staged changes, and all commits on the current branch.

Implementation

Follow these steps exactly:

1. Determine the base branch

If --branch was provided, use that. Otherwise, detect the default branch:

git remote show origin | grep 'HEAD branch' | sed 's/.*: //'

2. Gather review guidelines

Read the following files if they exist:

  • REVIEW.md at the repo root
  • CLAUDE.md at the repo root
  • Any CLAUDE.md files in directories containing changed files

These define the review criteria. If no REVIEW.md or CLAUDE.md exists, use general best practices (security, correctness, logic errors).

3. Get the full diff

# Uncommitted changes
git diff

# Staged changes
git diff --cached

# All commits on this branch vs base
git diff <base-branch>...HEAD

4. Review the changes

For each changed file, check against the guidelines from step 2. Focus on:

  • REVIEW.md violations: Explicit rules the team has defined
  • CLAUDE.md violations: Project conventions and requirements
  • Bugs: Logic errors, off-by-one errors, null pointer issues
  • Security: Injection, auth bypass, exposed secrets, OWASP top 10
  • Correctness: Code that will produce wrong results

Do NOT flag:

  • Style preferences (unless in REVIEW.md)
  • Issues a linter catches
  • Subjective improvements
  • Pre-existing issues not in the diff

5. Report findings

For each issue found, report:

  • File and line number (link format: file_path:line_number)
  • Severity: critical / warning
  • Description: What's wrong and why
  • Suggestion: How to fix it

If no issues are found, report: "No issues found. Changes comply with REVIEW.md and CLAUDE.md guidelines."

6. Offer to fix

If issues were found, ask the user if they'd like you to fix them.

Example Interaction

User: /code-review

Claude: Reviewing changes on branch `feature/auth-flow` against `main`...

Found REVIEW.md with 3 rules:
1. All API routes must validate auth tokens
2. Database queries must use parameterized statements
3. Error responses must not leak internal details

Reviewing 4 changed files...

## Code Review Results

### 1. Missing auth validation (critical)
`src/routes/users.ts:45` — New GET `/users/:id` endpoint does not validate the auth token. REVIEW.md rule: "All API routes must validate auth tokens."

**Fix**: Add `validateToken(req)` middleware before the handler.

### 2. SQL injection risk (critical)
`src/db/queries.ts:23` — String interpolation in SQL query: `` `SELECT * FROM users WHERE id = ${id}` ``. REVIEW.md rule: "Database queries must use parameterized statements."

**Fix**: Use `db.query('SELECT * FROM users WHERE id = ?', [id])`.

---

Found 2 issues (2 critical). Would you like me to fix them?

Readme

Session Code Review

Backpressure code review plugin that validates changes against REVIEW.md before commits and session completion.

How It Works

This plugin uses Claude Code's agent-based hooks to provide automatic code review at two critical points:

Stop Hook — Session Review

When Claude finishes responding, an agent reviewer examines all uncommitted and staged changes against your REVIEW.md and CLAUDE.md guidelines. If issues are found, Claude continues working to fix them instead of stopping.

PreToolUse Hook — Commit/Push Gate

Before any git commit or git push command executes, an agent reviewer checks the staged or branch changes. If issues are found, the commit/push is blocked and Claude is told what to fix.

REVIEW.md

Create a REVIEW.md file at your repository root to define review rules. The plugin auto-discovers this file — no configuration needed.

Example REVIEW.md:

# Review Guidelines

## Required

- All API routes must validate authentication tokens
- Database queries must use parameterized statements
- Error responses must not leak internal implementation details
- All new public functions must have JSDoc comments

## Do Not Flag

- Formatting issues (handled by Biome)
- Test file naming conventions
- Import ordering

The plugin also respects CLAUDE.md files for project-specific conventions.

Installation

claude plugin install session-code-review@han

Recommended scope: project (since review rules are project-specific):

han plugin install session-code-review --scope project

On-Demand Review

Use the /code-review skill to manually trigger a review of your current branch:

/code-review
/code-review --branch develop

Design Philosophy

  • High signal only — Only flags issues with high confidence. False positives erode trust.
  • REVIEW.md driven — Your team's rules, not generic suggestions.
  • Backpressure, not gatekeeping — Issues are fixed in-session, not posted as comments to review later.
  • Complements Anthropic's Code Review — Anthropic's review runs on PRs in CI. This plugin catches issues earlier, before code is even committed.

Details

Marketplace
TheBushidoCollective/han
Source
plugins/validation/session-code-review
Category
Validation
Keywords
code-review, review, backpressure, quality, validation, review.md
Listed since
Apr 7, 2026

More from TheBushidoCollective/han

All 340

Similar to session-code-review

More Code Review & Quality