Agent skill · affaan-m

laravel-patterns

Laravel architecture patterns, routing/controllers, Eloquent ORM, service layers, queues, events, caching, and API resources for production apps. Use when building or reviewing Laravel apps — controllers, Eloquent, service layers, queues, or API resources.

What it needs

About 4k tokens when loaded.

What this skill does

Laravel Development Patterns Production-grade Laravel architecture patterns for scalable, maintainable applications. When to Use Building Laravel web applications or APIs Structuring controllers, services, and domain logic Working with Eloquent models and relationships Designing APIs with resources and pagination Adding queues, events, caching, and background jobs How It Works Structure the app around clear boundaries (controllers -> services/actions -> models). Use explicit bindings and scoped bindings to keep routing predictable; still enforce authorization for access control. Favor typed models, casts, and scopes to keep domain logic consistent. Keep IO-heavy work in queues and cache expensive reads. Centralize config in config/ and keep environments explicit. Examples Project Structure Use a conventional Laravel layout with clear layer boundaries (HTTP, services/actions, models). Recommended Layout Controllers -> Services -> Actions Keep controllers thin. Put orchestration in services and single-purpose logic in actions. Routing and Controllers Prefer route-model binding and resource controllers for clarity. Route Model Binding (Scoped) Use scoped bindings to prevent cross-tenant access. Nested Routes and Binding Names Keep prefixes and paths consistent to avoid double nesting (e.g., conversation vs conversations). Use a single parameter name that matches the bound model (e.g., {conversation} for Conversation). Prefer scoped bindings when nesting to enforce parent-child relationships. If you want a parameter to resolve to a different model class, define explicit binding. For custom binding logic, use Route::bind() or implement resolveRouteBinding() on the model. Service Container Bindings Bind interfaces to implementations in a service provider for clear dependency wiring. Eloquent Model Patterns Model Configuration Custom Casts and Value Objects Use enums or value objects for strict typing. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills affaan-m/laravel-patterns--4afd36

View the source on GitHub

Browse the @skills marketplace