agentleFS
yanzyuyuyanzyuyu/min-tok/skills/laravel-architect/SKILL.md

laravel-architect

Skill1 starsChanged 50 days agoApache-2.0View on GitHub

Enterprise Laravel & PHP Modern Architecture (Laravel 11/12+). Enforces the modern streamlined application structure (bootstrap/app.php, zero legacy kernels), strict Eloquent ORM patterns, Form Requests, Pest/PHPUnit testing, and zero-trust backend security.

  • Reads credentials

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 1 is distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Always enable strict model evaluation in AppServiceProvider::boot():

    line 56
  2. Very specific:

    Always use eager loading (with(['relation'])) when retrieving lists of models.

    line 64
  3. Very specific:

    Use $fillable with explicit whitelisted attributes.

    line 66
  4. Very specific:

    All core business entities must utilize the SoftDeletes trait and deleted_at timestamp.

    line 68
  5. Very specific:

    Every migration must define both up() and down() methods, with proper foreign key cascade rules and database indexes.

    line 70
  6. Very specific:

    Never validate inline using $request->validate([...]) inside controller methods.

    line 79
  7. Very specific:

    Never return raw Eloquent models directly to API clients.

    line 89
  8. Distinctive:

    Write declarative tests covering authentication, authorization gates (Policies), and validation boundaries.

    line 95
  9. Very specific:

    Ensure all tests run cleanly via php artisan test before declaring completion.

    line 96

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Modern Laravel Architecture (Laravel 11/12+ Standards)

This skill guides the agent to design and build Laravel applications conforming strictly to modern upstream standards, eliminating obsolete legacy directory conventions (Laravel 8-10 patterns).


1. Streamlined Application Structure (Modern Laravel Standards)

A. The Banned Legacy Patterns:

  • ❌ DO NOT CREATE app/Http/Kernel.php: HTTP Middleware is NO LONGER registered in Kernel.php.
  • ❌ DO NOT CREATE app/Console/Kernel.php: Console commands and schedules are NO LONGER registered in a console kernel.
  • ❌ DO NOT CREATE bloated config files by default: Laravel 11+ ships with a lean /config folder. Everything cascades from .env.

B. The Modern Standard (bootstrap/app.php):

Routing, middleware, exceptions, and schedules are configured centrally in bootstrap/app.php:

<?php

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        api: __DIR__.'/../routes/api.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->web(append: [
            // Custom web middleware
        ]);
        $middleware->api(prepend: [
            // Custom API middleware
        ]);
    })
    ->withExceptions(function (Exceptions $exceptions) {
        // Custom API exception rendering
    })->create();

2. Eloquent ORM & Database Discipline

  1. Strict Models in Development: Always enable strict model evaluation in AppServiceProvider::boot():
    public function boot(): void
    {
        Model::shouldBeStrict(! $this->app->isProduction());
    }
  2. Anti-N+1 Query Prevention: Always use eager loading (with(['relation'])) when retrieving lists of models.
  3. Mass Assignment Protection: Use $fillable with explicit whitelisted attributes. Never pass $request->all() into model creation.
  4. Soft Deletes by Default: All core business entities must utilize the SoftDeletes trait and deleted_at timestamp.
  5. Robust Migrations: Every migration must define both up() and down() methods, with proper foreign key cascade rules and database indexes.

3. Controllers & Request Validation

  1. Skinny Controllers, Zero Business Bloat: Controllers must only handle HTTP coordination: receive validated request, invoke service/action, return response/resource.
  2. Mandatory Form Requests: Never validate inline using $request->validate([...]) inside controller methods. Always generate dedicated Form Request classes:
    public function store(StoreOrderRequest $request): JsonResponse
    {
        $validated = $request->validated();
        $order = $this->orderService->create($request->user(), $validated);
        return response()->json(new OrderResource($order), 201);
    }
  3. API Resource Transformers: Never return raw Eloquent models directly to API clients. Always transform responses using JsonResource to prevent leaking internal database schemas or sensitive columns.

4. Modern Testing & Verification (Pest / PHPUnit)

  • Write declarative tests covering authentication, authorization gates (Policies), and validation boundaries.
  • Ensure all tests run cleanly via php artisan test before declaring completion.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.