Skip to content
Development
Skill

/controller-cleanup

Refactor fat controllers into lean ones by extracting business logic to services, handlers, and invokable commands

From plugin
superpowers-symfony
22744 skills14 agents13 commands1 hook

Claude Code

$ npx -y skills add dev-toolings/superpowers-symfony --skill controller-cleanup --agent claude-code

SKILL.md

controller-cleanup.SKILL.md
name: controller-cleanup
description: Refactor fat controllers into lean ones by extracting business logic to services, handlers, and invokable commands
capabilities: [read, search]
tags: [architecture]
# projected by `bun run build` — do not edit by hand
allowed-tools:
  - Read
  - Glob
  - Grep

Controller Cleanup (Symfony)

Use when

  • A controller action holds business logic, queries, or more than a handful of lines.
  • Input parsing, validation, authorization and persistence are mixed in one action.
  • A console command does the real work itself instead of delegating it.

Default workflow

1. List what the action does: input, validation, authorization, business logic, persistence, side effects. 2. Cover the current HTTP behavior with a functional test before moving anything. 3. Map input to a DTO with `#[MapRequestPayload]` or `#[MapQueryString]` and let the validator reject it. 4. Move business logic into a service or a command handler, authorization into a voter, side effects into events or messages. 5. Leave the action to resolve, authorize, delegate and respond, in five to ten lines.

Guardrails

  • Type-hint services as arguments or constructor parameters; never pull them from the container.
  • Keep the HTTP behavior identical: same status codes, same payloads.
  • Do not move the logic into a "manager" that is the old controller under a new name.
  • Write console entry points as invokable `#[AsCommand]` classes (Symfony 7.3+) that delegate to the same services.

Progressive disclosure

  • Use this file for execution posture and risk controls.
  • Open references when deep implementation details are needed.

Output contract

  • Lean actions that delegate.
  • The extracted DTOs, services, voters or handlers, one responsibility each.
  • Functional tests showing the HTTP behavior is unchanged.

References

  • `reference.md`
Read more
@dev-toolings
Ships withsuperpowers-symfony

Superpowers Symfony gives coding agents deep, version-accurate Symfony expertise: from Doctrine schema design and API Platform REST/GraphQL APIs to test-driven development, async Messenger workflows, caching, rate limiting, and clean architecture.

22744 skills14 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
227
Star history of dev-toolings/superpowers-symfony on GitHub, a chart by star-history.com

Other skills on superpowers-symfony.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills11d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react2d252k
@facebook@facebookInstall Skill

Questions about controller-cleanup.

Which coding agents can use controller-cleanup?
controller-cleanup installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.