Skip to content

[Enhancement] Update code-reviewer agent with function decomposition patterns from #560 #568

Description

@mrveiss

Summary

Update the code-reviewer agent to enforce the function decomposition patterns and thresholds defined in issue #560.

Related Issues

Changes Required

Add the following to .claude/agents/code-reviewer.md:

1. Function Length Rules

  • 50-line threshold: Functions exceeding 50 lines should be flagged for decomposition
  • 100-line critical threshold: Functions over 100 lines are HIGH PRIORITY and must be refactored
  • 70-99 lines: Medium priority - should be decomposed when touched

2. Decomposition Patterns to Enforce

  1. Extract Helper Functions - Break validation, processing, formatting, response into separate functions
  2. Extract Strategy Classes - For functions with many conditionals
  3. Extract Data Builders - For MCP tool definitions (consider YAML/JSON externalization)

3. Code Review Checks

When reviewing code, the agent should:

Acceptance Criteria

  • Code-reviewer agent updated with function length thresholds
  • Decomposition patterns documented in agent config
  • Agent can identify and flag long functions during review

🤖 Generated with Claude Code

Activity

  1. mrveiss commented on Dec 23, 2025

    @mrveiss
    OwnerAuthor

    Completed ✅

    Changes Made:

    • Added Function Length Thresholds table with priority levels:

      • 🔴 CRITICAL (100+ lines): Block PR if not addressed
      • 🟡 MEDIUM (70-99 lines): Decompose when file is touched
      • 🟢 LOW (50-69 lines): Flag for future refactoring
      • ✅ OK (<50 lines): Acceptable
    • Added 3 Decomposition Patterns with code examples:

      1. Extract Helper Functions (most common)
      2. Extract Strategy Classes (for many conditionals)
      3. Extract Data Builders (for MCP tool definitions)
    • Added Review Checklist for function length enforcement

    Acceptance Criteria Verified:

    • Code-reviewer agent updated with function length thresholds - ✅ Table added
    • Decomposition patterns documented in agent config - ✅ 3 patterns with examples
    • Agent can identify and flag long functions during review - ✅ Checklist added

    Commits:


    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions