controller-cleanup — скилл для Claude Code
Скилл controller-cleanup переносит бизнес-логику из толстых контроллеров Symfony в сервисы, обработчики и команды. Оставляет в действии только делегирование и ответ.
MIT ★ 234 обновлён 2026-10-05
npx skills add dev-toolings/superpowers-symfony --skill controller-cleanup -a claude-codeЧто делает controller-cleanup
Скилл читает контроллер, составляет список операций — валидация, авторизация, логика, сохранение — и выносит каждую в свой слой. Перед переносом покрывает действие функциональным тестом, чтобы HTTP-поведение осталось прежним: те же коды, те же ответы. Входные данные привязывает к DTO через #[MapRequestPayload] или #[MapQueryString], авторизацию переносит в voter, побочные эффекты — в события или сообщения.
Сервисы внедряются через аргументы конструктора или метода, прямые обращения к контейнеру запрещены. Логика не перемещается в «manager», который остаётся старым контроллером под новым именем. Консольные команды пишутся как invokable-классы с #[AsCommand] (Symfony 7.3+) и используют те же сервисы.
Выход — действие в пять-десять строк, извлечённые DTO, сервисы, voter или обработчики с одной ответственностью у каждого, тесты, подтверждающие, что HTTP-поведение не изменилось.
Какие задачи решает
- вынести бизнес-логику из контроллера в сервисы и обработчики
- покрыть действие функциональным тестом перед рефакторингом
- привязать входные данные к DTO через
#[MapRequestPayload] - переместить авторизацию в voter, побочные эффекты в события
- написать консольную команду как invokable-класс с
#[AsCommand]
Примеры запросов агенту
- Разбери контроллер
UserController::registerна сервисы — валидацию, создание пользователя и отправку письма - Покрой действие
POST /ordersфункциональным тестом, потом вынеси логику вCreateOrderHandler - Перепиши
app:import-productsкак invokable-команду, которая делегируетProductImporter
Как установить controller-cleanup
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill controller-cleanup -a claude-code2Вручную: положить файлы
~/.claude/skills/controller-cleanup/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/controller-cleanup/
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill controller-cleanup -a codex2Вручную: положить файлы
.agents/skills/controller-cleanup/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill controller-cleanup -a cursor2Вручную: положить файлы
.cursor/skills/controller-cleanup/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install dev-toolings/superpowers-symfony content/skills/controller-cleanup2Вручную: положить файлы
.github/skills/controller-cleanup/SKILL.md1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill controller-cleanup -a gemini-cli2Командой платформы
gemini skills install https://github.com/dev-toolings/superpowers-symfony --path content/skills/controller-cleanupВручную: положить файлы
.devin/skills/controller-cleanup/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Claude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о controller-cleanup
Как установить controller-cleanup в Claude Code?
Выполни npx skills add dev-toolings/superpowers-symfony --skill controller-cleanup -a claude-code, путь к скиллу — ~/.claude/skills/controller-cleanup/SKILL.md.
Что делает скилл controller-cleanup?
Переносит бизнес-логику, валидацию и авторизацию из контроллеров Symfony в сервисы, DTO, voter и обработчики. Действие остаётся коротким — только делегирование и ответ.
Как controller-cleanup сохраняет HTTP-поведение?
Перед рефакторингом скилл покрывает действие функциональным тестом, чтобы коды ответов и тела остались прежними. После переноса логики тест подтверждает, что ничего не сломалось.
Исходный текст
SKILL.md · MIT
--- 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`
© dev-toolings · MIT · dev-toolings/superpowers-symfony