gza-code-review-full
Comprehensive pre-release code review assessing test coverage, code duplication, and component interactions
mhawthorne · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add mhawthorne/gza --skill gza-code-review-full技能说明
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
Full Codebase Code Review
Perform a comprehensive code review of the gza codebase, suitable for pre-release assessment. This review covers:
- Unit test coverage
- Functional test coverage
- Code duplication
- Component interaction patterns
- Error handling consistency
- API/interface consistency
- Configuration and hardcoding audit
- Logging and observability
- Resource management
- Type safety
When to Use
- Before a release to assess codebase health
- When you want a comprehensive quality check
- To identify areas needing more tests or refactoring
Output
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.
Process
Step 1: Inventory the codebase
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.py- etc.
-
Identify untested modules - source files with no corresponding test file
Step 2: Assess unit test coverage
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:
- Functions/methods that ARE tested
- Functions/methods that are NOT tested
- Edge cases that aren't covered (error paths, boundary conditions)
-
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 integration
Step 3: Assess functional test coverage
Functional tests verify end-to-end workflows. Check for:
-
Core workflows that should have integration tests:
- Creating a task → running it → verifying completion
- Task dependencies (task B waits for task A)
- PR creation workflow
- Review workflow
- Improve workflow
-
Read
tests_integration/(if exists) to see what's covered -
Identify missing functional tests - workflows documented in AGENTS.md that aren't tested
Step 4: Analyze code duplication
Look for patterns of duplicated code:
-
Search for similar code blocks:
- Similar function signatures doing similar things
- Copy-pasted error handling
- Repeated patterns that could be extracted
-
Check specific areas prone to duplication:
- CLI command handlers (do they share common patterns that could be unified?)
- Database queries (repeated query patterns)
- Git operations (similar git command sequences)
-
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
Step 5: Check error handling consistency
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:
- Are errors handled uniformly? (always raise vs sometimes return None)
- Are custom exceptions used where appropriate vs generic
Exception? - Do error messages provide actionable information?
- Are exceptions caught too broadly? (
except Exceptionvs specific types)
-
Look for problematic patterns:
- Silent failures (bare
except:orexcept: pass) - Swallowed exceptions without logging
- Inconsistent error return values (None vs empty list vs raise)
- Missing error handling on I/O operations
- Silent failures (bare
-
Document findings:
- List any inconsistencies in error handling approach
- Note functions that should raise but return None (or vice versa)
- Identify error messages that aren't helpful for debugging
Step 6: Check API/interface consistency
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:
- Similar operations with different names (
get_taskvsfetch_taskvsretrieve_task) - Parameter ordering inconsistencies (does
dbcome first or last?) - Return type inconsistencies (objects vs dicts vs tuples)
- Similar operations with different names (
-
Check function signatures:
- Do similar functions have similar signatures?
- Are there functions with too many parameters (>5)?
- Are boolean parameters used where enums would be clearer?
-
Review public interfaces:
- Are module
__all__exports defined? - Is it clear what's public vs private? (underscore prefix convention)
- Are there functions that
- Are module