Skip to content
Back to skills

Form Types Validation

ASecurity

Build Symfony forms with custom Form Types, validation constraints, HTTP 422 handling, and multi-step flows

  • 221 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added August 31, 2026
developmentshellbashreactrailssecurity

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned October 6, 2026

npx -y skills add dev-toolings/superpowers-symfony --skill form-types-validation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Form Types Validation?

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

Security grade badge for Form Types Validation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dev-toolings-form-types-validation/badge)](https://www.skillsdirectory.com/skills/dev-toolings-form-types-validation)

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: form-types-validation
description: Build Symfony forms with custom Form Types, validation constraints, HTTP 422 handling, and multi-step flows
capabilities: [read, search, edit, shell]
tags: [security]
# projected by `bun run build` — do not edit by hand
allowed-tools:
  - Read
  - Glob
  - Grep
  - Write
  - Edit
  - Bash
---

# Form Types Validation (Symfony)

## Use when
- Building or changing a Symfony form type.
- Adding validation constraints on an entity, a DTO, or a form field.
- Different rules per context (registration vs profile) through validation groups.
- Converting values with a data transformer or reacting with form events.
- Writing a custom constraint, or a form spread across several steps.

## Default workflow
1. Put business constraints on the entity or DTO; keep form-level constraints for UI-only rules such as uploads.
2. Build the form type with explicit field types and options.
3. Split rules into validation groups when contexts differ.
4. Add data transformers or `PRE_SET_DATA`/`PRE_SUBMIT` listeners only where the model and the view disagree.
5. In the controller, check `isSubmitted() && isValid()` and pass the form itself to `render()`.

## Guardrails
- Pass the form, not `createView()`, to `render()` so an invalid submit answers 422.
- A transformer that cannot convert throws `TransformationFailedException`, it never returns garbage.
- Do not duplicate the same constraint on the form and on the entity.
- Multi-step flows and the custom violation mapper are recent: verify the installed Symfony version first.

## Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.

## Output contract
- Form types and the constraints they rely on, with their groups.
- Transformers, listeners or custom constraints, each with a reason.
- Tests for a valid submit, an invalid submit (422), and each custom constraint.

## References
- `reference.md`

Files in this skill

  • SKILL.md1.1 KB
  • reference.md11.7 KB

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…