Code review

From gittower/git-flow-next · View interactive version

Code review is an AI agent skill from the GitHub repository gittower/git-flow-next. Review changes or PRs against project guidelines

How to use this skill

Skill file

Code Review

Review local changes or pull requests against project guidelines. All output is written locally — never posted to GitHub.

Arguments

/code-review [target] [--output path]

Target (optional)

Specifies what to review. Can be:

Output (optional)

--output path or -o path - where to write the review:

Examples

# Auto-detect new commits vs main (writes to .ai/)
/code-review

# Auto-detect, specify output folder
/code-review --output issue-59-add-no-verify-option
/code-review -o .ai/my-feature

# Review specific commits (outputs to conversation)
/code-review HEAD~3..HEAD
/code-review abc123
/code-review main..feature/foo

# Review commits and save to file
/code-review HEAD~5..HEAD --output code-audit

# Review a pull request (auto-saves to .ai/)
/code-review #123
/code-review 123

Instructions

  1. Parse Arguments
  1. Gather Context

For auto-detect mode (no target specified):

For explicit mode (commit/range target specified):

For PR mode (PR number specified):

```bash

gh pr view <number> --json title,author,baseRefName,headRefName,headRefOid,number

```

  1. Detect and Get Changes

For auto-detect mode:

For explicit mode:

For PR mode:

For all modes:

  1. Review Against Guidelines

Review the code against REVIEW_CRITERIA.md, which covers:

  1. Code Quality Checks (auto-detect mode only)

Skip this step for explicit mode (reviewing historical commits) and PR mode.

For auto-detect mode, run:

```bash

# Format check

go fmt ./...

# Vet check

go vet ./...

```

  1. Determine Output Location

Filename includes revision(s) being reviewed:

```bash

# For auto-detect mode: use HEAD short SHA

HEAD_SHA=$(git rev-parse --short HEAD)

FILENAME="review-${HEAD_SHA}.md"

# For commit range (abc123..def456): use both endpoints

START_SHA=$(git rev-parse --short abc123)

END_SHA=$(git rev-parse --short def456)

FILENAME="review-${START_SHA}-${END_SHA}.md"

# For single commit: use that commit's short SHA

COMMIT_SHA=$(git rev-parse --short abc123)

FILENAME="review-${COMMIT_SHA}.md"

# For PR mode: use PR number and head SHA

HEAD_SHA=$(gh pr view <number> --json headRefOid --jq '.headRefOid' | cut -c1-7)

FILENAME="review-pr<number>-${HEAD_SHA}.md"

```

If --output / -o was provided:

If no --output and auto-detect mode:

If no --output and PR mode:

If no --output and explicit mode:

Examples:

  1. Generate Review Report

Write the review to file OR output directly to conversation based on step 6.

Use this format:

```markdown

# Code Review: <branch-name, commit-range, or PR #number>

## Summary

```

For PR mode, add PR metadata to the summary:

```markdown

```

Then continue with:

```markdown

## Checklist Results

### Passed

### Must Fix

### Should Fix

## Quality Checks (auto-detect mode only)

## Recommendations

1. <recommendation>

2. <recommendation>

## Ready for PR? (auto-detect mode only)

<YES/NO - explain if NO>

```

For explicit and PR modes, omit "Quality Checks" and "Ready for PR?" sections.

  1. Report Findings

Issue Categories

Categorize findings using the severity levels defined in REVIEW_CRITERIA.md (Must fix, Should fix, Nit).

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.