Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Laravel Performance Audit and Optimization

    by Saizul Amin

    1

    Audit Laravel projects and PHP-FPM configurations to fix high TTFB, cache issues, and server bottlenecks.

    $10

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Laravel Performance Audit and Optimization

    Laravel Performance Audit and Optimization

    Example session with this skill installed

    Run the Laravel Performance Audit and Optimization skill on my project and give me a prioritised list of what to fix, with exact changes.

    • Read your context and instructions
    • Compiled the laravel performance audit

    Here is what the Laravel Performance Audit and Optimization skill produced.

    Demo: real, unedited output of the skill's bundled script on a sample input from its test suite.

    Output

    performance audit (production): 4 high, 1 medium, 4 low, 0 info
    HIGH   app/Http/Controllers/ReportController.php:15  [env-outside-config] env('STRIPE_KEY') outside config/: returns null after config:cache
           fix: Add it to a config file ('x' => env('STRIPE_KEY')) and read config('file.x').
    HIGH   app/Services/Feature.php:9  [env-outside-config] env('FEATURE_X') outside config/: returns null after config:cache
           fix: Add it to a config file ('x' => env('FEATURE_X')) and read config('file.x').
    HIGH   resources/views/footer.blade.php:1  [env-outside-config] env('APP_NAME') outside config/: returns null after config:cache
           fix: Add it to a config file ('x' => env('APP_NAME')) and read config('file.x').
    HIGH   routes/web.php:3  [env-outside-config] env('APP_NAME') outside config/: returns null after config:cache
           fix: Add it to a config file ('x' => env('APP_NAME')) and read config('file.x').
    MEDIUM composer.json  [dev-packages] barryvdh/laravel-debugbar is in require (installed in production)
           fix: composer remove barryvdh/laravel-debugbar && composer require --dev barryvdh/laravel-debugbar
    LOW    composer.json  [autoloader] optimize-autoloader is not set
           fix: Set config.optimize-autoloader=true, or deploy with composer install --no-dev --optimize-autoloader.
    LOW    app/Http/Controllers/ReportController.php:11  [query-patterns] Order::all() loads the whole table
           fix: Paginate, select columns, filter with where(), or chunkById() for batch work.
    LOW    app/Http/Controllers/ReportController.php:12  [query-patterns] ->get()->count() fetches every row first
           fix: Use ->count() on the query builder.
    LOW    app/Http/Controllers/ReportController.php:13  [query-patterns] ->get()->isEmpty() fetches every row first
           fix: Use ->doesntExist() on the query builder.
    

    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

    Laravel applications often suffer from high TTFB and sluggish response times due to misconfigured caches, suboptimal PHP settings, or improper environment variable usage. This skill audits your project and server configuration to identify the high-impact bottlenecks that slow down your production environment.

    What it does

    • Config & Route Audit identifies missing config:cache and route:cache triggers in deployment scripts.
    • Environment Leak Detection finds env() calls outside of configuration files that break when Laravel's config is cached.
    • PHP Engine Tuning analyzes php.ini or php -i output to optimize OPcache settings, realpath cache, and JIT.
    • Production Hygiene flags APP_DEBUG=true, active Xdebug sessions, or development packages installed on production servers.
    • Code Pattern Analysis detects expensive database patterns like Model::all() or ->get()->count() that waste memory.
    • Driver Validation checks if session, cache, and queue drivers are set to high-performance options like Redis.

    How it works

    1. Initialize Audit by providing the project root and the PHP-FPM configuration output using php-fpm -i.
    2. Execute Audit via the perf_audit.py script to scan codebase and server settings for performance regressions.
    3. Prioritize Fixes based on the generated report, starting with high-impact server settings and cache commands.
    4. Benchmarking involves measuring TTFB and total response time using curl before and after applying optimizations.

    Frameworks & tools

    Laravel 9 through 12, PHP 8.1+, PHP-FPM, Redis, Composer, and Laravel Octane (Swoole, RoadRunner, or FrankenPHP).

    Why this beats prompting it yourself

    Generic prompts often miss the critical interaction between env() calls and config:cache, which can lead to null values in production. This skill uses a dedicated Python auditor to scan the entire vendor-to-file ratio and specifically calculate max_accelerated_files based on your actual file count.

    Use cases

    • Pre-launch Check to ensure a new Laravel deployment is fully optimized for production traffic.
    • Server Migration to tune a new PHP-FPM pool and OPcache settings on fresh infrastructure.
    • Traffic Spike Prep to identify bottlenecks before an expected surge in users.
    • Cost Reduction by lowering CPU and memory usage through better caching and autoloader optimization.

    Known limitations

    Does not audit front-end assets, image compression, or Nginx/Apache specific configurations. Requires manual extraction of PHP-FPM info if not running on the server directly.


    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 LLM Ops.

    Does not audit front-end assets or Nginx/Apache configs. Requires PHP-FPM info via php -i for server tuning. Focuses on Laravel 9-12 and PHP 8.1+.

    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 identifies high Time to First Byte (TTFB), misconfigured OPcache settings, improper environment variable usage that breaks caching, and inefficient database query patterns that cause memory spikes.

    It is compatible with Laravel versions 9 through 12 and PHP 8.1 or higher, including specialized environments like Laravel Octane (Swoole, RoadRunner, or FrankenPHP).

    You will receive the core logic for the performance auditor, the `perf_audit.py` execution script, and a guided workflow for benchmarking results and prioritizing server-level fixes.

    No, this skill focuses strictly on backend performance; it does not audit front-end assets, CSS/JS minification, or web server configurations like Nginx or Apache.

    Yes, it is designed to analyze your PHP-FPM configuration output (via `php -i`) to provide tailored recommendations for settings like realpath cache and JIT.

    Standard LLM prompts often fail to detect how `env()` calls behave once `config:cache` is enabled, whereas this skill uses a dedicated auditor to scan the entire codebase for these specific production-breaking patterns.

    New in LLM Ops