laravel-patterns

Standardize Laravel architecture with separated controllers, services, and domain models.

Updated Jul 8, 2026
One-click install
npx skills add https://github.com/nazrulsoftwaredev/NIT_CRM_2 --skill laravel-patterns-nazrulsoftwaredev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-patterns
Source: https://github.com/nazrulsoftwaredev/NIT_CRM_2/tree/main/.agents/skills/laravel-patterns
Command: npx skills add https://github.com/nazrulsoftwaredev/NIT_CRM_2 --skill laravel-patterns-nazrulsoftwaredev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the challenge of maintaining clean, scalable, and testable codebases in Laravel by providing standardized architectural patterns that prevent "fat controller" syndrome and spaghetti logic.

Core Features & Use Cases

  • Layered Architecture: Implements a clear separation of concerns using Controllers, Services, and Actions.
  • Domain Logic Encapsulation: Provides patterns for Eloquent models, custom casts, and query objects to keep domain logic consistent.
  • API & Routing Best Practices: Offers guidance on scoped route-model binding, API resources, and efficient eager loading to optimize performance.

Quick Start

Ask the laravel-patterns skill to generate a service class and a corresponding action class for a new user registration feature following the recommended directory structure.

Frequently Asked Questions about laravel-patterns

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

FAQPage Schema
How do I prevent fat controllers in my Laravel backend architecture?

Separate concerns by moving domain logic out of HTTP controllers into dedicated service layers and action classes. This architectural pattern keeps Laravel controllers thin, routing clean, and business logic encapsulated for better maintainability.

What is the best way to structure a scalable Laravel API with Eloquent?

Structure scalable Laravel APIs by implementing API resources, scoped route-model binding, and Eloquent query objects. This pattern separates HTTP layers from domain logic while optimizing eager loading to prevent performance bottlenecks.

How do I set up service classes and action classes for a Laravel feature?

Generate service classes and action classes following a recommended directory structure that separates HTTP routing from domain operations. This pattern encapsulates business logic into dedicated services and actions, ensuring robust dependency injection and testability.

When do I need form requests and query objects in Laravel?

Use form requests to encapsulate validation rules and query objects to encapsulate Eloquent data retrieval logic. These patterns are needed when separating HTTP concerns from domain models to maintain scalable, testable Laravel codebases.

Does layered architecture work with Laravel background job processing?

Layered architecture supports Laravel background job processing by isolating domain logic in service and action classes. Background jobs can invoke these services without duplicating business logic, ensuring robust dependency injection and maintainability.