symfony:controller-cleanup

Refactor Symfony controllers by extracting business logic into services and DTOs.

187|17|Updated Dec 17, 2025
One-click install
npx skills add https://github.com/MakFly/superpowers-symfony --skill symfony-controller-cleanup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: symfony:controller-cleanup
Source: https://github.com/MakFly/superpowers-symfony/tree/main/skills/controller-cleanup
Command: npx skills add https://github.com/MakFly/superpowers-symfony --skill symfony-controller-cleanup

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the common issue of "fat controllers" in Symfony applications, which can lead to code that is difficult to maintain, test, and scale. It guides users in refactoring controllers to be leaner and more focused.

Core Features & Use Cases

  • Service Extraction: Guides the process of moving business logic from controllers into dedicated services.
  • DTO Usage: Promotes the use of Data Transfer Objects (DTOs) for cleaner request handling and validation.
  • Attribute-Based Routing & Security: Encourages the use of Symfony's attribute system for common tasks like routing and authorization.
  • Use Case: Refactor a complex controller action that handles order creation, including validation, business logic, and email sending, into a lean controller that delegates these responsibilities to services and uses DTOs for input.

Quick Start

Use the symfony:controller-cleanup skill to refactor the controller logic for creating a new user.

Frequently Asked Questions about symfony:controller-cleanup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor a fat Symfony controller to be production-ready?

Refactor Symfony controllers by extracting business logic into dedicated services, implementing DTOs for input validation, and using attributes for routing and security to ensure modular, testable code.

What is the best way to extract business logic from Symfony controllers?

The best way to extract business logic from Symfony controllers is moving it into dedicated services, ensuring lean controller actions that delegate responsibilities like validation and notifications to separate components.

How do I use DTOs for request validation in Symfony controllers?

Use Data Transfer Objects (DTOs) in Symfony controllers to handle request data and validation cleanly, separating input validation concerns from the controller's execution workflow and business logic.

Can I use Symfony attributes for routing and security in refactored controllers?

Yes, refactored Symfony controllers can employ the attribute system for common tasks like routing and authorization, replacing older configuration methods to streamline execution workflows.

Why does my Symfony controller have validation and email sending logic mixed together?

Mixing validation, business logic, and notifications in a Symfony controller creates a fat controller, which you resolve by refactoring to delegate these responsibilities to services and DTOs.

Does the symfony:controller-cleanup skill support service extraction for order creation workflows?

Yes, the symfony:controller-cleanup skill specifically guides refactoring complex workflows like order creation by extracting validation, business logic, and email sending into separate services and DTOs.