make-controller
Skill4 starsChanged 2 months agoMITView on GitHub
Use when creating a controller or an HTTP endpoint in a Symfony project.
In this repository24 other files it gives its agents.
- AGENTS.mdAGENTS.md
- cli-conventionsSkill
- componentsSkill
- configurationSkill
- discoverSkill
- make-ciSkill
- make-commandSkill
- make-crudSkill
- make-decoratorSkill
- make-entitySkill
- make-formSkill
- make-listenerSkill
- make-migrationSkill
- make-registration-formSkill
- make-reset-passwordSkill
- make-security-customSkill
- make-security-form-loginSkill
- make-testSkill
- make-twig-extensionSkill
- make-userSkill
- make-voterSkill
- make-webhookSkill
- servicesSkill
- templatesSkill
The file
Files
Controller
symfony console make:controller ProductController
symfony console make:controller ProductController --no-template # API, no Twig
symfony console make:controller HealthController --invokable # single actionThe maker takes the class name as an argument and asks nothing further. Install it first if
it is missing: symfony composer require --dev symfony/maker-bundle.
What to keep
Extend AbstractController — always. It provides render(), redirectToRoute(),
isGranted() and the form helpers, and a controller is thin enough that the coupling costs
nothing.
Route metadata goes in attributes, never YAML: #[Route] on the class as a prefix and on
each action, with snake_case route names prefixed by the entity (product_index,
product_show).
What the framework already does for you
#[MapRequestPayload]and#[MapQueryString]on an action argument wire up the Serializer and the Validator. Hand-writtenjson_decode()plus manual checks is the thing to avoid. Both needsymfony/serializerandsymfony/validator— require them rather than falling back to parsing by hand.- A failed validation on those attributes already answers 422 with the violations. An
exception listener written to produce that response duplicates what the attribute does.
validationFailedStatusCodechanges the code when 422 is wrong for the endpoint. - A route parameter type-hinted as an entity is resolved and 404s on its own. Query the repository yourself only when the lookup is genuinely more complex.
#[IsGranted]and#[Cache]express authorisation and caching declaratively.
Business logic belongs in a service. A controller that grew past orchestration has taken on someone else's job.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

