resources/boost/skills/actions/SKILL.md
Single-purpose business logic classes that encapsulate one well-defined business operation. Actions are the primary location for business logic in Laravel applications, invoked from controllers, commands, or jobs.
npx skillsauth add codebar-ag/coding-guidelines actionsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
app/Actions/ classes with execute().app/Actions/ directory exists (or will be created) and is autoloaded by Composer.app/Actions/.CreateInvoice, SendPasswordResetEmail, ArchiveExpiredSubscriptions.InvoiceAction, UserHandler, DataProcessor.execute() method that represents the operation.execute() with the full business operation:
Request, Response, redirects) inside the Action.$this->authorize().execute() with validated data or models.execute().namespace App\Actions;
use App\Models\Invoice;
use App\Models\Order;
use App\Notifications\InvoiceCreatedNotification;
class CreateInvoice
{
public function __construct(
private readonly GenerateInvoicePdf $generatePdf,
) {}
public function execute(Order $order): Invoice
{
$invoice = Invoice::create([
'order_id' => $order->id,
'amount' => $order->total,
'due_date' => now()->addDays(30),
]);
$this->generatePdf->execute($invoice);
$order->user->notify(new InvoiceCreatedNotification($invoice));
return $invoice;
}
}
// Controller usage
class InvoiceController extends Controller
{
public function store(StoreInvoiceRequest $request, CreateInvoice $action): JsonResponse
{
$order = Order::findOrFail($request->validated('order_id'));
$invoice = $action->execute($order);
return new JsonResponse(new InvoiceResource($invoice), 201);
}
}
// Command usage
class GenerateInvoicesCommand extends Command
{
public function handle(CreateInvoice $action): int
{
Order::pending()->each(fn ($order) => $action->execute($order));
return self::SUCCESS;
}
}
app/Actions/ with a clear verb–noun name.execute() method for the operation.Request, Response, redirects) inside an Action.InvoiceAction, UserHandler, DataProcessor.execute() methods or extra public methods beyond the single operation.execute().// Anti-pattern: Action doing orchestration + HTTP concerns
class ProcessInvoiceAction
{
public function execute(Request $request): RedirectResponse
{
// Mixed responsibilities: validation, orchestration, and HTTP response
// Move validation/response to controller, orchestration to Service.
}
}
Services/SKILL.md — for multi-domain orchestrationJobs/SKILL.md — for deferring actions to the queueControllers/SKILL.md — for how controllers delegate to actionstesting
Translation and localization conventions for Laravel. Use when adding user-facing strings, creating translation files, or working with lang/ directory.
tools
Reusable behaviour shared across multiple unrelated classes. Traits provide shared Eloquent scopes, accessors, lifecycle hooks, and small stateless helper methods.
development
Tailwind CSS v4 styling conventions. Use when working with CSS, Tailwind utilities, or customizing the theme in Laravel projects.
development
Orchestration classes that coordinate multiple Actions, external APIs, or domain operations into a cohesive workflow. Services own transaction boundaries and third-party API integrations.