Review

/laravel-agent:analyze:codebase

Full codebase health report

Overview

Generate a comprehensive health report analyzing code quality, architecture, security, performance, and maintainability of your Laravel codebase.

Usage

/laravel-agent:analyze:codebase [path] [--focus=area]

Examples

/laravel-agent:analyze:codebase                      # Full codebase analysis
/laravel-agent:analyze:codebase app/                 # Analyze app directory only
/laravel-agent:analyze:codebase --focus=security     # Security-focused analysis
/laravel-agent:analyze:codebase --focus=performance  # Performance analysis
/laravel-agent:analyze:codebase --output=json        # JSON output for CI

Analysis Areas

Area Description
all Complete analysis (default)
architecture Project structure, patterns, dependencies
quality Code quality, SOLID, DRY, complexity
security OWASP vulnerabilities, auth, encryption
performance N+1, caching, indexing, queries
testing Coverage, quality, missing tests
dependencies Package health, updates, conflicts
laravel Laravel best practices compliance

Report Output

The report includes:

  • Overall Health Score - 0-100 with letter grade
  • Area Scores - Individual scores per category
  • Top Priorities - Critical issues to address first
  • Detailed Findings - File-level issues with fixes
  • Recommendations - Short-term and long-term improvements

Quality Metrics

Metric Threshold
Method Lines ≤ 20 lines
Class Lines ≤ 200 lines
Cyclomatic Complexity ≤ 10 per method
Dependencies ≤ 5 constructor params
Test Coverage ≥ 80%
DRY Violations 0 (3+ duplicates)

CI/CD Integration

# .github/workflows/health-check.yml
name: Codebase Health
on: [push, pull_request]

jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run Analysis
        run: /analyze:codebase --output=json > report.json
      - name: Check Score
        run: |
          SCORE=$(/analyze:codebase --score-only)
          if [ $SCORE -lt 70 ]; then
            echo "Health score $SCORE is below threshold"
            exit 1
          fi

See Also