laravel-actions-service-pattern

Implement Actions and Service pattern to decouple Laravel controller business logic.

Updated May 11, 2026
One-click install
npx skills add https://github.com/irizqi/agent-skills --skill laravel-actions-service-pattern
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-actions-service-pattern
Source: https://github.com/irizqi/agent-skills/tree/main/skills/laravel-actions-service-pattern
Command: npx skills add https://github.com/irizqi/agent-skills --skill laravel-actions-service-pattern

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the common issue of bloated controllers and fragmented business logic by providing a structured, modular approach to organizing code in Laravel applications.

Core Features & Use Cases

  • Atomic Actions: Encapsulates single business operations into reusable, testable classes.
  • Service Orchestration: Coordinates multiple actions and repositories to handle complex workflows cleanly.
  • Use Case: When building a complex module like an invoicing system, use this pattern to separate the logic of creating a request from the orchestration of sending that request to a client.

Quick Start

Use the laravel-actions-service-pattern skill to refactor the current controller method into a dedicated service and action class structure.

Frequently Asked Questions about laravel-actions-service-pattern

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

FAQPage Schema
How do I decouple business logic from Laravel controllers?

To decouple business logic from Laravel controllers, you can implement the Actions and Service pattern to encapsulate operations in atomic action classes and use orchestrating service classes for complex workflows, ensuring thin controller architecture.

What is the best way to organize bloated Laravel controllers for scale?

The best way to organize bloated Laravel controllers for scale is adopting the Actions and Service pattern, which standardizes business logic into modular, testable action classes and coordinating services to maintain a clean, decoupled architecture.

How do I refactor a Laravel controller into actions and services?

You refactor a Laravel controller into actions and services by extracting single business operations into atomic action classes and moving complex workflow orchestration into dedicated service classes that coordinate those actions.

When do I need to use service classes in Laravel backend development?

You need to use service classes in Laravel backend development when handling complex workflows that coordinate multiple actions and repositories, such as separating the creation of an invoicing request from the orchestration of sending it to a client.

Does the Laravel Actions and Service pattern support dependency injection?

Yes, the Laravel Actions and Service pattern supports dependency injection, ensuring that action classes and orchestrating services adhere to dependency injection principles for modular and testable application development.

Why should I use atomic action classes in PHP backend applications?

You should use atomic action classes in PHP backend applications to encapsulate single business operations into reusable, testable components, which prevents fragmented business logic and ensures scalable application development.