laravel-patterns

Define Laravel architecture patterns for thin controllers and organized services.

70|42|Updated Mar 27, 2026
One-click install
npx skills add https://github.com/tranhieutt/software_development_department --skill laravel-patterns-tranhieutt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-patterns
Source: https://github.com/tranhieutt/software_development_department/tree/main/.claude/skills/laravel-patterns
Command: npx skills add https://github.com/tranhieutt/software_development_department --skill laravel-patterns-tranhieutt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill captures production-ready Laravel architecture patterns so developers avoid bloated controllers, mixed responsibilities, and fragile event, queue, and cache handling while keeping the application structure predictable.

Core Features & Use Cases

  • Layered structure: Keep controllers thin by routing through services and single-purpose actions, then return Api resources that match your DTO contracts.
  • Routing clarity: Prefer resource controllers with scoped route-model bindings, nested routes that match parent-child relationships, and explicit bindings to prevent cross-tenant leaks.
  • Model discipline: Apply typed casts, enums, query objects, scopes, and transactions alongside soft deletes or global scopes to keep Eloquent logic consistent and efficient.
  • Operational hardening: Register service container bindings, centralize configuration, use form requests for validation, design migrations with timestamps and anonymous classes, and emit cached events plus queued jobs for IO-heavy work.

Quick Start

Ask the laravel-patterns skill to review your Laravel project structure and recommend controller, service, Eloquent, routing, caching, and queue conventions for production workloads.

Frequently Asked Questions about laravel-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I keep Laravel controllers thin and organize service layers?

To keep Laravel controllers thin, route logic through single-purpose service classes and return API resources matching your DTO contracts. This layered structure prevents mixed responsibilities and keeps application behavior predictable.

What's the best way to prevent cross-tenant leaks with Laravel route model binding?

Preventing cross-tenant leaks in Laravel requires using scoped route model bindings and explicit bindings. Nested routes should match parent-child relationships to enforce data isolation securely.

How do I use DTOs for validation in Laravel form requests?

DTO-driven validation in Laravel uses form requests to centralize configuration and enforce explicit data contracts. API resources then match these DTO contracts to ensure consistent validation responses.

How should I structure Eloquent models for production Laravel applications?

Structure Eloquent models by applying typed casts, enums, query objects, and scopes. Use transactions alongside soft deletes or global scopes to maintain consistent and efficient database logic.

When should I use queued jobs and cached events in Laravel?

Use queued jobs and cached events in Laravel for IO-heavy work to achieve operational hardening. Register service container bindings and centralize configuration to keep background processing resilient.