agentsclimarketplace

Laravel architecture

Skill ComeOnOliver/skillshub/skills/HoangNguyen0403/agent-skills-standard/laravel-architecture

🧠 The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.

Install
npx -y skills add ComeOnOliver/skillshub --skill laravel-architecture

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Core architectural standards for scalable Laravel applications. Use when structuring service layers, repositories, or scalable architecture in Laravel. (triggers: app/Http/Controllers/**/*.php, routes/*.php, controller, service, action, request, container)

SKILL.md

2.4 KB, 444 tokens by cl100k_base, as published. Nobody here has run it

Laravel Architecture

Priority: P0 (CRITICAL)

Structure

app/
β”œβ”€β”€ Http/
β”‚   β”œβ”€β”€ Controllers/    # Slim (Request/Response only)
β”‚   └── Requests/       # Validation logic
β”œβ”€β”€ Services/           # Business logic (Optional)
└── Actions/            # Single-purpose classes (Preferred)

Implementation Guidelines

Controller Responsibilities

  • Skinny Controllers: Controller delegates to Action or Service classes; keep controllers focused on mapping requests/responses.
  • Dependency Injection: Use constructor DI to inject services or actions. Laravel resolves these via the Service Container.
  • No Logic in Routes: Always delegate route closures to controllers; don't use raw Closures for logic.

Business Logic Placement

  • Actions: Create app/Actions/CreatePost.php (or similar) β€” one action per use case β€” with a single handle() method. This keeps controllers slim and Create Action class logic focused.
  • Service Classes: Create app/Services/PaymentService.php for multi-step logic across domains. type-hint interface in controller constructor for clean DI.
  • Binding: Bind interfaces in AppServiceProvider using $this->app->bind(Interface::class, Implementation::class).
  • Service Isolation: No Eloquent queries directly in controllers; handle database access within services or actions.

Validation & Requests

  • Form Requests: Use php artisan make:request StoreUserRequest for Form Requests for validation.
  • Usage: call $request->validated() in the controller or action for mass assignment.
  • Validation Methods: Implement authorize() and rules(); never use $request->validate() inline.

Anti-Patterns

  • No logic in Controllers: Move to Services or Action classes.
  • No manual instantiation: Use Service Container via DI.
  • No inline $request->validate(): Favor Form Request classes.
  • No excessive global helpers: Use class-based logic instead.

References

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 327,069. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.