Skip to content
Back to skills

Controller Cleanup

ASecurity

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

  • 147 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added June 6, 2026
testingphptesting

Security analysis

A100/100

Scanned June 6, 2026

npx -y skills add jpcaparas/superpowers-laravel --skill controller-cleanup --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Controller Cleanup?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Controller Cleanup
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jpcaparas-controller-cleanup/badge)](https://www.skillsdirectory.com/skills/jpcaparas-controller-cleanup)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: laravel:controller-cleanup
description: Reduce controller bloat using Form Requests for auth/validation, small Actions/Services with DTOs, and resource/single-action controllers
---

# 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

```php
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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.