Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    PHP Static Analysis with PHPStan and Psalm

    by Saizul Amin

    1

    Implement PHPStan and Larastan with automated error grouping, baseline management, and CI integration.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    PHP Static Analysis with PHPStan and Psalm

    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

    1. Fix the highest-severity items first.
    2. Ask your agent to apply the fixes it suggests, then run the skill again to confirm.
    3. 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.neon and 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 @property annotations.
    • Progress tracking Compares two analysis runs to report exactly which errors were fixed and which are new.

    How it works

    1. Analyze environment Checks composer.json for existing static analysis tools and identifies PHP/Laravel versions.
    2. Install and Configure Generates a tailored phpstan.neon config using appropriate strictness levels.
    3. Generate Summary Runs a Python-based analysis script on PHPStan's JSON output to group errors by rule and "hot" files.
    4. 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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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.

    Frequently Asked Questions

    This skill automates the configuration of PHPStan and Larastan, specifically addressing 'magic' Eloquent properties that generic AI prompts often miss. It includes a custom processing script to group thousands of errors into actionable reports, preventing your AI's context window from becoming overwhelmed.

    The skill supports PHP versions 7.4 through 8.4 and is compatible with both standard PHP projects and Laravel applications. It requires a environment with Python 3.8+ to run the advanced error-grouping and reporting scripts.

    You receive the complete configuration logic for PHPStan/Larastan, the automated baseline management workflow, and a specialized Python script for processing and summarizing JSON analysis reports. It also includes the integration steps for your CI/CD pipeline.

    Unlike a standard prompt, this skill provides a structured path to 'zero errors' by generating a baseline for existing debt while blocking new regressions. It intelligently identifies which rules should be fixed immediately versus which ones should be suppressed to keep your build green.

    Yes, the skill is designed to work with any AI agent that has file-system access and the ability to execute terminal commands. It provides the necessary logic to guide the agent through environment analysis, installation, and iterative error fixing.

    This skill focuses exclusively on type safety and static analysis using PHPStan and Larastan. It does not handle linting (like Laravel Pint) or automated refactoring (like Rector), though it provides the perfect foundation for those tools.

    New in Code Quality & Review