laravel:controller-cleanup

SkillDev tools

Reduce controller bloat using Form Requests for auth/validation, small Actions/Services with DTOs, and resource/single-action controllers

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the laravel:controller-cleanup skill

What this skill tells your AI

The instructions your AI receives, as published by jpcaparas/superpowers-laravel in skills/controller-cleanup/SKILL.md and read by ahel’s review.

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

Signals

GitHub stars
153
Forks
2
Last commit
Jul 2026
Advanced
Catalog kind
skill
Gateway key
laravel-controller-cleanup
Source
github.com/jpcaparas/superpowers-laravel