This skill reviews uncommitted changes against requirements and design, validates quality, and runs tests to ensure safe commits.
npx playbooks add skill tsaol/awesome-claude --skill git-review
This skill performs a thorough code review by:
Trigger /git-review when:
/git-commit to ensure quality/git-review # Review all uncommitted changes
/git-review <issue-url> # Review changes against a GitHub issue
/git-review <pr-url> # Review an existing PR
/git-review --design-only # Skip tests, only check design alignment
/git-review --test-only # Only run tests
--design-only: Run Phase 1 (context) → Phase 2 (requirements) → Phase 3 (design) → Phase 4 (code quality) → Phase 6 (report). Skip Phase 5 (tests).--test-only: Run Phase 1 (context) → Phase 5 (tests) → Phase 6 (report). Skip Phase 2-4.Code Changes Ready
|
/git-review
|
+----------------------------------+
| Phase 1: Gather Context |
| - Collect uncommitted changes |
| - Read requirements source |
| - Read design docs |
+----------------------------------+
|
+----------------------------------+
| Phase 2: Requirements Check |
| - Map changes to requirements |
| - Flag missing implementations |
| - Flag scope creep |
+----------------------------------+
|
+----------------------------------+
| Phase 3: Design Alignment |
| - Check architecture fit |
| - Validate patterns & naming |
| - Review data model changes |
+----------------------------------+
|
+----------------------------------+
| Phase 4: Code Quality |
| - Logic correctness |
| - Error handling |
| - Security considerations |
| - Edge cases |
+----------------------------------+
|
+----------------------------------+
| Phase 5: Run Tests |
| - Detect test framework |
| - Run existing tests |
| - Report failures |
+----------------------------------+
|
+----------------------------------+
| Phase 6: Review Report |
| - Summary with verdict |
| - Issues & recommendations |
| - Suggested fixes |
+----------------------------------+
Collect all information needed for the review.
1a. Collect code changes:
# Uncommitted changes (staged + unstaged)
git diff HEAD
# If no uncommitted changes, review last commit only
git show HEAD --stat
git diff HEAD~1 HEAD
# List changed files
git diff HEAD --name-only
1b. Identify requirements source:
Requirements can come from:
gh issue view <number>gh pr view <number># If a GitHub issue/PR URL is provided
gh issue view <number> --json title,body,labels
gh pr view <number> --json title,body,commits,files
# Recent commit messages for context
git log --oneline -10
1c. Find design documents:
# Look for design docs in the project
find . -maxdepth 3 \( \
-name "DESIGN.md" -o \
-name "ARCHITECTURE.md" -o \
-name "*.design.md" -o \
-name "design*.md" -o \
-name "SPEC.md" -o \
-name "spec*.md" -o \
-name "RFC*.md" -o \
-name "ADR*.md" \
\) -not -path "*/node_modules/*" -not -path "*/.git/*"
# Also check for inline design comments in changed files
Compare the code changes against stated requirements.
Checklist:
How to check:
Verify changes respect the project's existing architecture and design.
Checklist:
How to check:
Review the actual code for correctness and quality.
Checklist:
Severity levels:
Detect and run the project's test suite.
Test framework detection:
# Python
[ -f pytest.ini ] && echo "pytest"
[ -f setup.cfg ] && grep -q "\[tool:pytest\]" setup.cfg && echo "pytest"
[ -f pyproject.toml ] && grep -q "\[tool.pytest" pyproject.toml && echo "pytest"
[ -d tests ] || [ -d test ] && echo "pytest (test dir found)"
[ -f tox.ini ] && echo "tox"
# JavaScript/TypeScript
grep -q '"test"' package.json 2>/dev/null && echo "npm test"
grep -q '"vitest"' package.json 2>/dev/null && echo "vitest"
grep -q '"jest"' package.json 2>/dev/null && echo "jest"
# Go
[ -f go.mod ] && echo "go test"
# Rust
[ -f Cargo.toml ] && echo "cargo test"
# Java/Kotlin
[ -f pom.xml ] && echo "maven"
[ -f build.gradle ] || [ -f build.gradle.kts ] && echo "gradle"
# Generic
[ -f Makefile ] && grep -q "test" Makefile && echo "make test"
Run tests:
# Run with appropriate framework (examples)
pytest -v --tb=short 2>&1 | tail -50
npm test 2>&1 | tail -50
go test ./... 2>&1 | tail -50
cargo test 2>&1 | tail -50
If no tests exist:
Generate a structured review report.
## Git Review Report
### Requirements: [Issue/PR title or description]
### Verdict: PASS / PASS WITH WARNINGS / FAIL
---
### 1. Requirements Coverage
| Requirement | Status | Code Location |
|------------|--------|---------------|
| Feature A | DONE | src/foo.py:42 |
| Feature B | MISSING | - |
**Missing implementations:**
- [ ] Feature B: not found in changed files
**Scope creep:**
- (none, or list unrelated changes)
---
### 2. Design Alignment
| Check | Status | Notes |
|-------|--------|-------|
| Architecture fit | PASS | Follows existing module structure |
| Naming conventions | PASS | Consistent with project style |
| API compatibility | WARNING | Endpoint X changed signature |
**Issues:**
- WARNING: `GET /api/users` now requires `page` param (breaking change)
---
### 3. Code Quality
| File | Line | Severity | Issue |
|------|------|----------|-------|
| src/handler.py | 55 | CRITICAL | SQL injection via string formatting |
| src/utils.py | 12 | WARNING | Exception silently caught |
| src/model.py | 30 | SUGGESTION | Could use dataclass |
---
### 4. Test Results
**Framework**: pytest
**Result**: 42 passed, 1 failed, 0 errors
**Failures:**
- `test_user_creation`: AssertionError - expected 201, got 400
**Missing test coverage:**
- [ ] No tests for new endpoint `POST /api/orders`
---
### 5. Summary & Recommendations
**Must fix before commit:**
1. Fix SQL injection in src/handler.py:55
2. Add missing implementation for Feature B
**Should fix:**
1. Handle breaking API change (add versioning or migration)
2. Fix failing test `test_user_creation`
**Nice to have:**
1. Add tests for new endpoint
Typical workflow:
1. Write code
2. /git-review # Check everything
3. Fix issues (if any)
4. /git-review # Re-check
5. /git-commit # Commit when review passes
## Git Review Report
### Requirements: Add user avatar upload (Issue #42)
### Verdict: PASS WITH WARNINGS
---
### 1. Requirements Coverage
| Requirement | Status | Code Location |
|------------|--------|---------------|
| Upload avatar image | DONE | src/api/avatar.py:15 |
| Validate file type (jpg/png) | DONE | src/api/avatar.py:28 |
| Resize to 200x200 | DONE | src/services/image.py:10 |
| Store in S3 | DONE | src/services/storage.py:45 |
| Update user profile | DONE | src/models/user.py:62 |
### 2. Design Alignment
| Check | Status |
|-------|--------|
| Architecture fit | PASS |
| Naming conventions | PASS |
| API compatibility | PASS |
### 3. Code Quality
| File | Line | Severity | Issue |
|------|------|----------|-------|
| src/api/avatar.py | 32 | WARNING | Max file size not enforced |
### 4. Test Results
**Framework**: pytest
**Result**: 58 passed, 0 failed
**Missing test coverage:**
- [ ] No test for oversized file upload
### 5. Summary
**Should fix:**
1. Add max file size validation (recommend 5MB)
**Nice to have:**
1. Add test for oversized file rejectionWeekly roundup of top Claude Code skills, MCP servers, and AI coding tips.