phpstan-runner
Run PHPStan static analysis and fix errors using intelligent agent delegation. Use when user requests to:- Run static analysis- Fix PHPStan errors- Check code quality- Analyze type errorsDelegates to runner agent (haiku) for execution and fixer agent (sonnet) for fixes.Automatically cycles between run and fix until analysis passes or human intervention needed.
When & Why to Use This Skill
The PHPStan Runner skill automates PHP static analysis and error remediation through an intelligent multi-agent delegation system. It streamlines the development workflow by identifying type errors and code quality issues using PHPStan, then automatically applying fixes via specialized AI agents. By iterating between analysis and repair, it ensures high-quality, type-safe PHP codebases with minimal manual intervention.
Use Cases
- Automated Code Quality Audits: Run comprehensive static analysis on PHP projects to detect hidden bugs, type mismatches, and deprecated code patterns automatically.
- Intelligent Error Remediation: Leverage specialized 'fixer' agents to automatically resolve complex PHPStan errors and improve code health without manual refactoring.
- Continuous Maintenance Cycles: Maintain a clean codebase by allowing the agent to iteratively run checks and apply fixes until the analysis passes or requires human architectural decisions.
- Legacy Code Modernization: Use the runner-fixer workflow to systematically identify and fix type-related issues when upgrading older PHP applications to stricter standards.
| name | phpstan-runner |
|---|---|
| description | | |
| allowed-tools | Task |
PHPStan Runner Skill
This skill provides intelligent PHPStan static analysis and fixing through specialized agent delegation.
Agent Delegation Strategy
This skill delegates to specialized agents via the Task tool:
- php-qa-ci_phpstan-runner agent (haiku model) - Runs analysis and parses results
- php-qa-ci_phpstan-fixer agent (sonnet model) - Analyzes and fixes errors
- Escalation - Uses opus model or asks human for stubborn issues
Workflow
When User Says: "Run PHPStan"
Launch runner agent:
Use Task tool: description: "Run PHPStan analysis" subagent_type: "php-qa-ci_phpstan-runner" prompt: "Run PHPStan static analysis and provide summary"Receive runner output with log location
If errors detected:
- Launch fixer agent:
Use Task tool: description: "Fix PHPStan errors" subagent_type: "php-qa-ci_phpstan-fixer" prompt: "Fix errors in log: {log_path}"
- Launch fixer agent:
After fixes applied, re-run via runner agent
Repeat cycle until:
- Analysis passes → Success
- Same errors persist 2+ times → Escalate to opus or human
- User intervention needed → Ask user
When User Says: "Fix the PHPStan errors"
Check if recent log exists in var/qa/phpstan_logs/
If log found:
- Launch fixer agent directly with log path
If no log:
- Launch runner agent first to generate log
- Then launch fixer agent
Escalation Triggers
Launch opus model or ask human when:
- Fixer agent reports "cannot fix" for same error 2+ times
- Architecture questions arise (design patterns, type hierarchies)
- User explicitly requests explanation of errors
Runner Agent Reference
The phpstan-runner agent (haiku model) handles:
- PHPStan execution with proper configuration
- Log parsing for error patterns
- Concise summary generation
See .claude/agents/php-qa-ci_phpstan-runner.md for agent implementation details.
Fixer Agent Reference
The phpstan-fixer agent (sonnet model) handles:
- Log file discovery and parsing
- Error grouping by pattern
- Fix implementation for common PHPStan issues
- Verification that fixes resolve issues
See .claude/agents/php-qa-ci_phpstan-fixer.md for agent implementation details.