laravel:controller-cleanup

Keep controllers small and focused on orchestration.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "laravel:controller-cleanup" with this command: npx skills add jpcaparas/superpowers-laravel/jpcaparas-superpowers-laravel-laravel-controller-cleanup

Controller Cleanup

Keep controllers small and focused on orchestration.

Move auth/validation to Form Requests

  • Create a Request class (e.g., StoreUserRequest ) and use authorize()
  • rules()
  • Type-hint the Request in your controller method; Laravel runs it before the action

php artisan make:request StoreUserRequest

Extract business logic to Actions/Services

  • Create a small Action (one thing well) or a Service for larger workflows

  • Pass a DTO from the Request to the Action to avoid leaking framework concerns

final class CreateUserAction { public function __invoke(CreateUserDTO $dto): User { /* ... */ } }

Prefer Resource or Single-Action Controllers

  • Use resource controllers for standard CRUD

  • For one-off endpoints, use invokable (single-action) controllers

Testing

  • Write feature tests for the controller route

  • Unit test Actions/Services independently with DTOs

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

laravel:routes-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review
General

laravel:blade-components-and-layouts

No summary provided by upstream source.

Repository SourceNeeds Review
General

laravel:queues-and-horizon

No summary provided by upstream source.

Repository SourceNeeds Review
General

laravel:quality-checks

No summary provided by upstream source.

Repository SourceNeeds Review