- Home
- Skills
- Code Quality & Review
- PHP Static Analysis with PHPStan and Psalm
Works with the AI Agents you already use
PHP Static Analysis with PHPStan and Psalm
by Saizul Amin
Implement PHPStan and Larastan with automated error grouping, baseline management, and CI integration.
$5
PHP Static Analysis with PHPStan and Psalm
Example session with this skill installed
Run the PHP Static Analysis with PHPStan and Psalm skill on my project and give me a prioritised list of what to fix, with exact changes.
- Read your context and instructions
- Compiled the php static analysis
Here is what the PHP Static Analysis with PHPStan and Psalm skill produced.
Demo: real, unedited output of the skill's bundled script on a sample input from its test suite.
Output
PHPStan: 3 error(s) in 2 file(s), 1 general error(s)
(no error identifiers in this report; grouped by message pattern. PHPStan 1.11+ adds them)
By rule:
2 Call to an undefined method Class::method(). (1 file(s))
e.g. src/Foo.php:3 Call to an undefined method App\Foo::bar().
1 Undefined variable: $var (1 file(s))
e.g. src/Bar.php:4 Undefined variable: $x
By file:
2 src/Foo.php
1 src/Bar.php
GENERAL: Ignored error pattern #^Foo$# was not matched in reported errors.
What you do next
- Fix the highest-severity items first.
- Ask your agent to apply the fixes it suggests, then run the skill again to confirm.
- Keep the skill installed and re-run it whenever the project changes.
Connects securely to your tools. The creator never sees your data.
About this skill
Legacy PHP codebases often suffer from hidden type errors and "magic" Eloquent properties that break at runtime. This skill provides a structured path to implement PHPStan and Larastan without being overwhelmed by a thousand-error backlog.
What it does
- Automated setup Configures
phpstan.neonand Larastan extensions based on your PHP and Laravel versions. - Error grouping Summarizes raw JSON reports by error identifier, file, and message pattern to find the root cause of bulk errors.
- Baseline management Generates and analyzes baselines to allow CI to pass while blocking new regressions.
- Eloquent support Fixes "undefined property" errors on models by configuring Larastan or suggesting correct
@propertyannotations. - Progress tracking Compares two analysis runs to report exactly which errors were fixed and which are new.
How it works
- Analyze environment Checks
composer.jsonfor existing static analysis tools and identifies PHP/Laravel versions. - Install and Configure Generates a tailored
phpstan.neonconfig using appropriate strictness levels. - Generate Summary Runs a Python-based analysis script on PHPStan's JSON output to group errors by rule and "hot" files.
- Execute Strategy Guides the developer through fixing high-impact rules first before baselining the noise.
Frameworks & tools
This tool integrates PHPStan and Larastan into PHP and Laravel projects. It includes a Python 3.8+ script for report processing and works with PHP 7.4 through PHP 8.4 environments.
Why this beats prompting it yourself
Generic prompts often struggle with Larastan's specific configuration requirements for Eloquent magic. This skill provides specialized logic to summarize thousands of errors into actionable groups, preventing "context window" saturation when dealing with large reports.
Use cases
- Adding strict static analysis to a legacy Laravel application.
- Resolving widespread Eloquent model property and method "undefined" errors.
- Setting up CI gates that only fail when new type errors are introduced.
- Paying down technical debt by targeting specific PHPStan rules across the codebase.
Known limitations
Does not handle code style enforcement (Pint/PHP-CS-Fixer) or automated refactoring (Rector). Analysis script requires a Python 3.8+ runtime.
Open source: saizul/laravel-php-skills on GitHub (MIT licence, by Saizul Amin).
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.
Requires Python 3.8+ for summary scripts. Focuses on PHPStan/Larastan; does not support Psalm-specific configurations. Does not perform automated refactoring or style fixes.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 day ago
- Software
Python 3.8+