跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
开发与测试

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:

  1. Unit test coverage
  2. Functional test coverage
  3. Code duplication
  4. Component interaction patterns
  5. Error handling consistency
  6. API/interface consistency
  7. Configuration and hardcoding audit
  8. Logging and observability
  9. Resource management
  10. 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:

  1. List all source modules:

    ls -la src/gza/*.py
    ls -la src/gza/providers/*.py
    
  2. List all test files:

    ls -la tests/*.py
    ls -la tests_integration/*.py 2>/dev/null || echo "No integration tests dir"
    
  3. Create a mapping of source file → test file(s):

    • db.py → test_db.py
    • cli.py → test_cli.py
    • etc.
  4. Identify untested modules - source files with no corresponding test file

Step 2: Assess unit test coverage

For each source module:

  1. Read the source file to understand its public interface (functions, classes, methods)

  2. Read the corresponding test file (if exists)

  3. 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)
  4. Run the tests to verify they pass:

    uv run pytest tests/ -v --tb=short
    

Focus especially on:

  • db.py - Core task storage, critical for correctness
  • cli.py - User-facing commands, all subcommands should have tests
  • runner.py - Task execution logic
  • git.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:

  1. 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
  2. Read tests_integration/ (if exists) to see what's covered

  3. Identify missing functional tests - workflows documented in AGENTS.md that aren't tested

Step 4: Analyze code duplication

Look for patterns of duplicated code:

  1. Search for similar code blocks:

    • Similar function signatures doing similar things
    • Copy-pasted error handling
    • Repeated patterns that could be extracted
  2. 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)
  3. 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
    
  4. 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:

  1. 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/
    
  2. 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 Exception vs specific types)
  3. Look for problematic patterns:

    • Silent failures (bare except: or except: pass)
    • Swallowed exceptions without logging
    • Inconsistent error return values (None vs empty list vs raise)
    • Missing error handling on I/O operations
  4. 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:

  1. Check naming consistency:

    # Find all public function definitions
    grep -n "^def " src/gza/*.py
    grep -n "    def " src/gza/*.py | grep -v "__"
    
  2. Look for inconsistencies:

    • Similar operations with different names (get_task vs fetch_task vs retrieve_task)
    • Parameter ordering inconsistencies (does db come first or last?)
    • Return type inconsistencies (objects vs dicts vs tuples)
  3. 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?
  4. Review public interfaces:

    • Are module __all__ exports defined?
    • Is it clear what's public vs private? (underscore prefix convention)
    • Are there functions that
阅读完整来源 ↗