git-review

Original🇨🇳 Chinese
Translated

Local code review tool for self-inspection before git push. Triggered when users request phrases like "review my code", "check code changes", "review this commit", "review this", "code review", "git review", "help me check my code". Supports reviewing unstaged, staged uncommitted, and committed unpushed changes, and outputs a Markdown review report with scores.

2installs
Added on

NPX Install

npx skill4agent add ashwinyue/aswin-skills git-review

SKILL.md Content (Chinese)

View Translation Comparison →

Git Review - Local Code Review

Code self-inspection tool before pushing, outputs professional review reports.

Workflow

1. Determine Review Scope (Auto-selection)

Auto-selection logic (by priority):
  1. Check for committed but unpushed changes → Select this scope if exists
  2. Check for staged but uncommitted changes → Select this scope if exists
  3. Check for unstaged changes → Select this scope if exists
  4. Prompt user if no changes exist
Users can also manually specify the scope:
ScopeGit CommandScenario
Unstaged
git diff
Check workspace modifications
Staged but Uncommitted
git diff --cached
Check before commit
Committed but Unpushed
git diff origin/$(git branch --show-current)
Check before push

2. Determine Review Style (Auto-selection)

Default style: professional (rigorous and professional)
Users can also manually specify:
  • professional: Rigorous and professional, uses standard engineering terminology
  • sarcastic: Sarcastic style, with accurate technical corrections
  • gentle: Gentle style, uses "suggestion", "may consider" frequently
  • humorous: Humorous style, uses appropriate Emojis

3. Obtain Change Content

bash
# Get diff
git diff <scope>

# Get recent commit information (as context)
git log --oneline -5

4. Execute Review

使用以下 System Prompt 进行审查:
You are a senior software development engineer, focusing on code standardization, functionality, security, and stability.

### Code Review Objectives:
1. Correctness and robustness of function implementation (40 points): Ensure code logic is correct and can handle various boundary cases and abnormal inputs.
2. Security and potential risks (30 points): Check if the code has security vulnerabilities (such as SQL injection, XSS attacks, etc.) and evaluate its potential risks.
3. Compliance with best practices (20 points): Evaluate whether the code follows industry best practices, including code structure, naming conventions, comment clarity, etc.
4. Performance and resource utilization efficiency (5 points): Analyze the performance of the code and evaluate whether there is resource waste or performance bottlenecks.
5. Clarity and accuracy of commit information (5 points): Check if the commit information is clear and accurate, and whether it facilitates subsequent maintenance and collaboration.

### Output Format:
Please output the code review report in Markdown format, including:
1. Problem descriptions and optimization suggestions (if any): List the problems in the code, briefly explain their impacts, and provide optimization suggestions
2. Score details: Provide specific scores for each scoring criterion
3. Total score: Format as "Total Score: XX points" (e.g.: Total Score: 80 points), ensuring it can be parsed by the regular expression r"Total Score:\s*(\d+) points?"

### Special Notes:
The entire review should maintain the {style} style

5. Output Report

Output to two locations simultaneously:
  1. Display in conversation - Directly output the review result in the conversation
  2. Save to file - Save to the
    docs/reviews/
    directory
File naming format:
docs/reviews/YYYY-MM-DD_HH-MM_branch-name_score.md
Example:
docs/reviews/2026-02-27_11-30_feature-login_85.md
File content template:
markdown
# Code Review Report

**Date**: 2026-02-27 11:30
**Branch**: feature-login
**Review Scope**: Committed but Unpushed
**Reviewer**: AI Code Reviewer

---

## 📋 Review Summary
...

## 🔍 Issues and Suggestions
...

## 📊 Score Details
- Correctness and robustness of function implementation: 35/40
- Security and potential risks: 25/30
- Best practices: 18/20
- Performance and resource utilization: 4/5
- Clarity of commit information: 3/5

**Total Score: 85 points**

---

## Reviewed Code Changes

<details>
<summary>Click to view diff</summary>

```diff
... diff content ...
</details> ```

Review Criteria

See references/review-criteria.md.

Notes

  • Truncate to the first 10000 tokens when diff content is too long (>10000 tokens)
  • Skip automatically generated changes such as configuration files and lock files
  • Scoring should be objective and fair, specific reasons are required for deducting points
  • Locate problems to specific files and line numbers