Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+23 more

    Laravel Architecture

    by Andrey Shelamkoff

    1

    Build, refactor, and audit Laravel applications using idiomatic patterns and optimized Eloquent queries.

    $5.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Laravel Architecture

    Laravel Architecture

    Example session with this skill installed

    Refactor the StoreOrder logic in OrderController to use a dedicated Action class. Ensure it handles database transactions and dispatches the OrderCreated event.

    • Read your context and instructions
    • Compiled the laravel architecture

    I have refactored the order creation logic. The process now uses a dedicated Action class to ensure a clear transaction boundary, moving logic out of the controller and into a reusable domain component.

    Refactored Order Architecture

    // app/Actions/StoreOrderAction.php
    namespace App\Actions;
    
    use App\Models\Order;
    use App\Events\OrderCreated;
    use Illuminate\Support\Facades\DB;
    use App\Http\Requests\StoreOrderRequest;
    
    class StoreOrderAction
    {
        public function execute(StoreOrderRequest $request): Order
        {
            return DB::transaction(function () use ($request) {
                $order = Order::create($request->validated());
    
                if ($request->has('items')) {
                    $order->items()->createMany($request->input('items'));
                }
    
                OrderCreated::dispatch($order);
    
                return $order;
            });
        }
    }
    
    // app/Http/Controllers/OrderController.php
    namespace App\Http\Controllers;
    
    use App\Actions\StoreOrderAction;
    use App\Http\Requests\StoreOrderRequest;
    use App\Http\Resources\OrderResource;
    
    class OrderController extends Controller
    {
        public function store(StoreOrderRequest $request, StoreOrderAction $storeOrder)
        {
            $order = $storeOrder->execute($request);
            return new OrderResource($order);
        }
    }
    

    Next steps

    • Update OrderActionTest.php to verify the transaction rolls back on item creation failure.
    • Register the OrderCreated listener in your EventServiceProvider if not using discovery.
    • Verify that StoreOrderRequest includes all necessary validation rules for the nested items array.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Laravel development moves fast, but architectural technical debt accumulates even faster. This skill handles everything from resolving N+1 query bottlenecks to designing complex event-driven systems while maintaining idiomatic Laravel patterns. It ensures your application stays maintainable by choosing the simplest design that works, rather than forcing unnecessary abstractions like repositories or DDD where a simple Controller and Eloquent model suffice.

    What it does

    • Architectural design suggests idiomatic patterns from simple CRUD to CQRS or event sourcing based on specific business needs.
    • Query optimization identifies and fixes N+1 issues, implements caching, and optimizes Eloquent relationships and migrations.
    • Reliable background processing configures queues, jobs, and events with atomic handoffs and idempotent processing logic.
    • Security enforcement implements robust authorization via Policies, validates input with Form Requests, and secures trust boundaries.
    • Modern frontend integration builds delivery layers using Blade, Livewire, Inertia.js, or dedicated API resources.

    How it works

    1. Discovery scans composer.json and project files to identify Laravel versions, installed packages, and existing architectural patterns.
    2. Analysis traces affected entry points, data flows, and business rules to define success and failure states.
    3. Implementation writes the smallest coherent change, prioritizing native framework features and type safety.
    4. Verification runs focused tests using production-family drivers to prove guarantees for locking, isolation, and delivery.

    Frameworks & tools

    Specifically built for the Laravel ecosystem, including Eloquent ORM, Blade, Livewire, Inertia.js, Sanctum, Passport, Horizon, and Octane. It supports testing via Pest or PHPUnit and static analysis integration.

    Why this beats prompting it yourself

    Generic AI often hallucinates outdated APIs or forces generic PHP patterns onto Laravel. This skill verifies APIs against your specific version and understands the trade-offs between facades, dependency injection, and service providers in a real-world application.

    Use cases

    • Refactor a bloated Controller into dedicated Action classes and Form Requests.
    • Troubleshoot a race condition in a high-concurrency job using atomic locks.
    • Design a multi-tenant isolation strategy for a new SaaS feature.
    • Audit an existing codebase for N+1 queries and missing database indexes.

    Known limitations

    Does not support standalone PHP libraries without a Laravel integration boundary. Destructive operations and live deployments require explicit manual authorization.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.

    Not for standalone PHP libraries. Destructive operations or live deployments require manual authorization. Scope limited to Laravel-integrated codebases.

    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.

    Trust & safety

    Security scan

    Security scan passed 2 days ago

    Software
    Git

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Network Access
    Listed2 days ago
    Updated1 day ago

    What's inside

    Frequently Asked Questions

    This skill is designed for the official Laravel framework ecosystem (v8.x through v11.x+) and integrates with tools like Livewire, Inertia.js, and Eloquent; it does not support standalone PHP projects or other frameworks like Symfony or Slim.

    Unlike generic prompts, this skill performs a 'Discovery' phase to scan your specific composer.json and directory structure, ensuring it suggests idiomatic patterns that match your existing codebase rather than hallucinating outdated APIs.

    The skill identifies N+1 bottlenecks, suggests missing database indexes, and refactors complex Eloquent relationships into optimized queries, often replacing heavy collections with efficient database-level operations.

    For safety, the skill follows a 'Verification' step where it writes focused Pest or PHPUnit tests for all changes, and it requires manual authorization before performing any destructive operations like database migrations.

    Yes, it includes specialized logic for modern Laravel stacks, including state management for Livewire components and creating clean API resources for Inertia.js frontends.

    New in APIs & Backend