Symfony validation
Skill aligundogdu/symfony-hexagonal-skill/skills/symfony-validation
Claude Code plugin that enforces hexagonal architecture (ports & adapters) in Symfony projects — with 10 auto-triggered skills, 2 review agents, and progressive refactoring support for existing codebases.
npx -y skills add aligundogdu/symfony-hexagonal-skill --skill symfony-validationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its author says it does
Copied from the file, not written here
Symfony validation — 3-layer validation strategy, constraints, DTO validation, domain invariants, validation groups, custom validators. Triggers on: validation, validator, constraint, DTO validation, input validation, invariant, assert, validation group
SKILL.md
2.8 KB, 569 tokens by cl100k_base, as published. Nobody here has run it
Symfony Validation
You are an expert in multi-layer validation within Symfony hexagonal architecture.
When to Activate
- User needs input validation
- User asks about validation strategies
- User needs custom constraints
- User mentions DTO validation or domain invariants
3-Layer Validation Strategy
Layer 1: Presentation (Input Validation)
Where: Controllers, request listeners What: Format validation — is the input well-formed? How: Symfony Validator on request DTOs
// Request DTO with constraints
final readonly class CreateUserRequest
{
public function __construct(
#[Assert\NotBlank]
#[Assert\Email]
public string $email,
#[Assert\NotBlank]
#[Assert\Length(min: 2, max: 100)]
public string $name,
#[Assert\NotBlank]
#[Assert\Length(min: 8)]
#[Assert\Regex(pattern: '/[A-Z]/', message: 'Must contain uppercase')]
#[Assert\Regex(pattern: '/[0-9]/', message: 'Must contain a number')]
public string $password,
) {
}
}
Layer 2: Application (DTO/Command Validation)
Where: Command/Query classes, validated by Messenger middleware What: Business rule pre-checks — are the values acceptable? How: Symfony Validator constraints on command properties
final readonly class RegisterUser
{
public function __construct(
#[Assert\NotBlank]
#[Assert\Email]
public string $email,
#[Assert\NotBlank]
public string $name,
#[Assert\NotBlank]
public string $password,
) {
}
}
The validation middleware on the bus auto-validates before handler execution.
Layer 3: Domain (Invariants)
Where: Entity constructors, value objects, business methods What: Business invariants — is the operation valid in domain context? How: Pure PHP validation, throw domain exceptions
// Value object self-validates
final readonly class Email
{
public function __construct(public string $value)
{
if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
throw InvalidEmailException::forValue($value);
}
}
}
// Entity protects invariants
final class Order
{
public function cancel(string $reason): void
{
if ($this->status === OrderStatus::DELIVERED) {
throw CannotCancelDeliveredException::forOrder($this->id);
}
// ...
}
}
References
See references/ for detailed guides:
validation-layers.md— Full examples for each layer, custom constraints, groups
Gives 0 of the 12 instructions most quality gates skills give in 569 tokens
Counted across 1,195 of the 2,094 authors here whose files we hold, read 2026-08-06
- read the output and check the exit codein 55 of 1195, across 14 files
- verify requirements using a line-by-line checklistin 53 of 1195, across 12 files
- identify the verification command proving the claimin 53 of 1195, across 12 files
- run the full verification commandin 51 of 1195, across 11 files
- verify output confirms the claimin 49 of 1195, across 10 files
- check version control diff after agent delegationin 45 of 1195, across 5 files
- state claim with evidencein 43 of 1195, across 3 files
- run the test suitein 32 of 1195, across 24 files
- keep state in memory by defaultin 27 of 1195, across 6 files
- make prototype runnable with one commandin 26 of 1195, across 5 files
- detect the package manager from lockfilesin 24 of 1195, across 5 files
- produce a verification reportin 23 of 1195, across 12 files
Said here and by no other author read
- validate request format using Symfony Validator on DTOs
- validate business rule pre-checks on command properties
- enforce business invariants in entity constructors
- protect domain invariants inside business methods
- throw domain exceptions for invalid operations
- use value objects to self-validate
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.