gza-code-review-full
Comprehensive pre-release code review assessing test coverage, code duplication, and component interactions
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Comprehensive pre-release code review assessing test coverage, code duplication, and component interactions
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Review changes on current branch and output a structured review. Optionally post to PR with --pr flag, or apply non-blocking follow-ups inline with --apply-followups.
Run an interactive code-only review for a gza task's implementation branch and produce structured review output compatible with gza-task-improve
Check the implementation against the behavior specs in specs/behavior/. Reports where the code diverges from intended behavior — each divergence is either a code bug or a spec gap. The behavior spec is the source of truth; this skill never edits code or the spec.
Check the behavior spec set for coherence, ownership boundaries, and plain-language discipline without editing the spec or the code
Turn the recurring `watch` stuck-task pile into (1) a diagnosis of why each class is stuck, (2) the existing stuck rows actually cleared now, and (3) systemic prevention so it does not recur. Snapshots watch/incomplete/queue, buckets stuck tasks by failure class, dedups against already-tracked `system` work, unsticks each row by its clearing action (drop moot/dead/stale, spawn follow-up, hand review-loop rows to /gza-task-fix), then ranks and files `system`-tagged prevention fixes by blast radius (cascade-preventer first). Never merges, retries, resumes, deletes branches, or edits code.
Triage `gza incomplete` rows — classify each unresolved merge-unit lineage and recommend the right corrective action (drop moot leaves, escalate to fix, surface manual-resolve rebases, etc.). Never merges, retries, resumes, or deletes branches; never edits code.
| name | gza-code-review-full |
| description | Comprehensive pre-release code review assessing test coverage, code duplication, and component interactions |
| allowed-tools | Read, Glob, Grep, Bash(uv run pytest:*), Bash(uv run python:*), Bash(uv run mypy:*), Bash(ls:*), Bash(wc:*) |
| version | 1.0.0 |
| public | false |
Perform a comprehensive code review of the gza codebase, suitable for pre-release assessment. This review covers:
Write findings to reviews/<timestamp>-code-review-full-<model>.md in the project root, where <timestamp> is the current date/time in YYYYmmddHHMMSS format and <model> is a short identifier for the model performing the review (e.g., reviews/20260305114139-code-review-full-opus-4-6.md). Use your own model name/ID to derive the short identifier.
Map out the source modules and test files:
List all source modules:
ls -la src/gza/*.py
ls -la src/gza/providers/*.py
List all test files:
ls -la tests/*.py
ls -la tests_integration/*.py 2>/dev/null || echo "No integration tests dir"
Create a mapping of source file → test file(s):
db.py → test_db.pycli.py → test_cli.pyIdentify untested modules - source files with no corresponding test file
For each source module:
Read the source file to understand its public interface (functions, classes, methods)
Read the corresponding test file (if exists)
Check coverage by listing:
Run the tests to verify they pass:
uv run pytest tests/ -v --tb=short
Focus especially on:
db.py - Core task storage, critical for correctnesscli.py - User-facing commands, all subcommands should have testsrunner.py - Task execution logicgit.py - Git operations (mocked tests preferred)github.py - GitHub integrationFunctional tests verify end-to-end workflows. Check for:
Core workflows that should have integration tests:
Read tests_integration/ (if exists) to see what's covered
Identify missing functional tests - workflows documented in AGENTS.md that aren't tested
Look for patterns of duplicated code:
Search for similar code blocks:
Check specific areas prone to duplication:
Use grep to find suspicious patterns:
# Find similar function definitions
grep -n "def.*task" src/gza/*.py
# Find repeated patterns
grep -n "subprocess.run" src/gza/*.py
grep -n "click.echo" src/gza/cli.py
Read AGENTS.md section on "Single code path principle" and verify it's followed
Review how errors are handled across the codebase:
Identify error handling patterns:
# Find exception raising
grep -n "raise " src/gza/*.py
# Find try/except blocks
grep -n "except " src/gza/*.py
# Find custom exceptions
grep -rn "class.*Exception" src/gza/
grep -rn "class.*Error" src/gza/
Check for consistency:
Exception?except Exception vs specific types)Look for problematic patterns:
except: or except: pass)Document findings:
Review function signatures and naming conventions:
Check naming consistency:
# Find all public function definitions
grep -n "^def " src/gza/*.py
grep -n " def " src/gza/*.py | grep -v "__"
Look for inconsistencies:
get_task vs fetch_task vs retrieve_task)db come first or last?)Check function signatures:
Review public interfaces:
__all__ exports defined?Look for magic values that should be configurable:
Find hardcoded values:
# Find numeric literals (potential magic numbers)
grep -En "[^a-zA-Z_][0-9]{2,}[^0-9]" src/gza/*.py
# Find string literals that might be paths or config
grep -n '"/.*"' src/gza/*.py
grep -n "'/.*'" src/gza/*.py
Check for:
Review path handling:
pathlib?dir + "/" + file)Check configuration loading:
config.py the single source for configuration?Assess the ability to debug and monitor the system:
Check logging usage:
# Find logging calls
grep -n "logging\." src/gza/*.py
grep -n "logger\." src/gza/*.py
grep -n "log\." src/gza/*.py
# Find print statements (should these be logs?)
grep -n "print(" src/gza/*.py
Assess logging quality:
Check for sensitive data exposure:
# Look for potential credential logging
grep -in "api.key\|token\|password\|secret\|credential" src/gza/*.py
repr() or str() methods that might expose secrets?Review error logging:
Look for resource leaks and cleanup issues:
Check file handling:
# Find file operations
grep -n "open(" src/gza/*.py
grep -n "with open" src/gza/*.py
with)?open() calls without corresponding close()?Check database connections:
grep -n "connect(" src/gza/*.py
grep -n "cursor" src/gza/*.py
Check subprocess management:
grep -n "subprocess" src/gza/*.py
grep -n "Popen" src/gza/*.py
Check for memory issues:
Check temp file cleanup:
grep -n "tempfile\|mktemp\|NamedTemporaryFile" src/gza/*.py
Review type hints and type correctness:
Check type hint coverage:
# Find functions without return type hints
grep -n "def.*):$" src/gza/*.py
# Find functions with type hints
grep -n "def.*) ->" src/gza/*.py
Run mypy (if configured):
uv run mypy src/gza/ --ignore-missing-imports 2>&1 | head -100
Look for type safety issues:
Any types that could be more specificOptional types without proper None checksstr | None but callers don't check)Check for common type issues:
# Find potential None issues
grep -n "\.get(" src/gza/*.py # dict.get returns Optional
grep -n "or None" src/gza/*.py
grep -n "if.*is None" src/gza/*.py
Understand how modules interact and assess the clarity of these interactions:
Map the import graph:
grep -h "^from gza" src/gza/*.py | sort | uniq -c | sort -rn
grep -h "^import gza" src/gza/*.py | sort | uniq -c | sort -rn
Identify the layering:
Check separation of concerns:
cli.py only handle CLI concerns, delegating to other modules?db.py only handle database concerns?runner.py only handle execution concerns?Look for unclear interfaces:
Document the interaction patterns:
cli.py → db.py (task CRUD)
cli.py → runner.py (task execution)
runner.py → providers/* (AI execution)
runner.py → git.py (git operations)
etc.
Create a structured report at reviews/code-review-full.md:
# Gza Code Review - Pre-Release Assessment
Date: YYYY-MM-DD
Reviewer: Claude
## Executive Summary
[2-3 sentence overview of codebase health]
## Test Coverage
### Unit Tests
| Module | Test File | Coverage Assessment |
|--------|-----------|---------------------|
| db.py | test_db.py | Good - covers CRUD, queries |
| cli.py | test_cli.py | Partial - missing `gza pr` tests |
| ... | ... | ... |
#### Well-Tested Areas
- [List modules/features with good coverage]
#### Under-Tested Areas
- [List modules/features needing more tests]
- [Specific functions that lack tests]
### Functional Tests
| Workflow | Test Status | Notes |
|----------|-------------|-------|
| Task creation → execution | ✓ Tested | integration test exists |
| PR creation | ✗ Not tested | needs integration test |
| ... | ... | ... |
## Code Duplication
### Issues Found
1. **[Description]** - [location]
- Suggestion: [how to fix]
2. **[Description]** - [location]
- Suggestion: [how to fix]
### Single Code Path Violations
- [Any violations of the principle from AGENTS.md]
## Error Handling
### Consistency Assessment
- [Are errors handled uniformly?]
- [Custom exceptions defined and used appropriately?]
### Issues Found
| Location | Issue | Suggestion |
|----------|-------|------------|
| file.py:123 | Bare except clause | Catch specific exception |
## API/Interface Consistency
### Naming Conventions
- [Assessment of naming consistency]
### Signature Consistency
- [Assessment of parameter ordering, return types]
### Issues Found
- [List any inconsistencies]
## Configuration & Hardcoding
### Magic Values Found
| Value | Location | Suggestion |
|-------|----------|------------|
| 30 | runner.py:45 | Move to config as DEFAULT_TIMEOUT |
### Path Handling
- [Assessment of pathlib usage vs string concatenation]
## Logging & Observability
### Coverage Assessment
- [Can operations be traced through logs?]
- [Are log levels appropriate?]
### Sensitive Data
- [Any exposure risks found?]
### Issues Found
- [Silent failures, missing logging, etc.]
## Resource Management
### File Handling
- [Context manager usage assessment]
### Database Connections
- [Connection lifecycle assessment]
### Subprocess Management
- [Cleanup assessment]
### Issues Found
| Resource Type | Location | Issue |
|---------------|----------|-------|
| file | path/to/file.py:89 | open() without context manager |
## Type Safety
### Type Hint Coverage
- [Percentage/assessment of coverage]
### Mypy Results
- [Summary of mypy findings]
### Issues Found
- [Any types, missing None checks, etc.]
## Component Interactions
### Module Dependency Graph
[ASCII diagram or description]
### Clear Patterns
- [What's done well]
### Areas for Improvement
- [Unclear interfaces, tight coupling, etc.]
## Recommendations
### High Priority
1. [Most important fix]
2. [Second most important]
### Medium Priority
1. [...]
### Low Priority
1. [...]
## Appendix: Detailed Findings
[Any detailed notes, specific code snippets, etc.]
Use these criteria when assessing test coverage: