action-pattern
Action Pattern
Overview
The Action pattern encapsulates business logic into reusable, composable, single-responsibility classes. Actions replace traditional "Service" classes and provide a clean, testable way to organize application behavior.
Core Principles
1. Single Responsibility Principle (SRP)
Each action should have one reason to change. If a class is doing multiple things, it should be split into multiple actions, not multiple methods within the same class.
Key Question: Does this action have more than one responsibility? If yes, split it into separate actions.
Note: This same principle applies to tasks in the task list. See single-task-responsibility skill for guidance on recognizing when task implementation violates SRP and requires stopping to consult the user.
2. The execute() Method
Every action must have a public execute() method. This is the convention and must not be flexible.