Maintain and improve code quality using PHPInsights without decreasing quality thresholds. Use when PHPInsights fails, cyclomatic complexity is too high, code quality drops, or when refactoring for better maintainability. Always maintains 94% complexity and 100% quality/architecture/style scores.
make phpinsights returns errors)Maintain exceptional code quality standards using PHPInsights while preserving hexagonal architecture, DDD patterns, and CQRS design.
Success Criteria:
make phpinsights passes without errorsCRITICAL: These thresholds in phpinsights.php must NEVER be lowered:
'requirements' => [
'min-quality' => 100, // Code quality
'min-complexity' => 94, // Cyclomatic complexity
'min-architecture' => 100, // Architecture compliance
'min-style' => 100, // Coding style
],
Policy: If PHPInsights fails, fix the code - NEVER lower these thresholds.
╔═══════════════════════════════════════════════════════════════╗
║ When PHPInsights fails, you MUST FIX THE CODE. ║
║ NEVER lower thresholds in phpinsights.php. ║
║ ║
║ ❌ FORBIDDEN: Changing config to pass checks ║
║ ✅ REQUIRED: Refactoring code to meet standards ║
╚═══════════════════════════════════════════════════════════════╝
# Find top 20 most complex classes
make analyze-complexity
# Find top 10 classes
make analyze-complexity N=10
# Export as JSON for tracking
make analyze-complexity-json N=20 > complexity-report.json
Output shows:
See: reference/analysis-tools.md
make phpinsights
❌ [COMPLEXITY] 93.5 pts (target: 94%)
✗ Method `CustomerCommandHandler::handle` has cyclomatic complexity of 12
See: refactoring-strategies.md for proven patterns:
make phpinsights
Repeat until all scores meet thresholds.
Problem: Method has too many decision points (if/else/switch/loops)
Identify hotspots:
make analyze-complexity N=10
Solutions:
See: refactoring-strategies.md for DDD/CQRS-specific patterns
Problem: Layer dependencies violated (e.g., Domain depending on Infrastructure)
Solutions:
See: deptrac-fixer skill for fixing architectural violations
Problem: Code doesn't meet PSR-12 or Symfony coding standards
Solution:
# Auto-fix most style issues
make phpcsfixer
# Re-run PHPInsights to verify
make phpinsights
Problem: Lines exceed configured limit
Solutions:
See: reference/project-configuration.md
phpinsights.phpphpinsights-tests.phpmake phpinsights after refactoringmake analyze-complexity to find hotspotsmake ci before committing[CODE] 100.0 pts ✅ Target: 100%
[COMPLEXITY] 94.0 pts ✅ Target: 94%
[ARCHITECTURE] 100 pts ✅ Target: 100%
[STYLE] 100.0 pts ✅ Target: 100%
✅ CI checks successfully passed!
After refactoring:
make phpinsights passes without errorsmake deptrac passes)make all-tests)# Find complex classes
make analyze-complexity N=10
# Run PHPInsights
make phpinsights
# Find complex methods with PHPMD
make phpmd
# Auto-fix style issues
make phpcsfixer
# Validate architecture
make deptrac
# Run all tests
make all-tests
# Full CI check
make ci
For detailed patterns, strategies, and troubleshooting:
When facing multiple issues:
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer