add-validation-constraint

add-validation-constraint is a skill for Claude Code, Codex from tarlepp/symfony-flex-backend. It costs 31 tokens per session (1,142 once invoked), scanned A, original, MIT.

A workflow for adding or changing a Symfony Validator constraint, which is a project-specific rule that checks whether input is acceptable. It covers the rule's meaning, dependencies, error codes, and tests.

In plain words
What is it for?
Use it when creating or updating a validation rule under `src/Validator/Constraints/`, including its validator class and integration tests.
Why use it?
It helps prevent validation rules from being added with unclear handling for blank values, input types, validation groups, or error messages. It also keeps the rule consistent with the repository's existing Symfony code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when creating or updating a validation rule under src/Validator/Constraints/, including its validator class and integration tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tarlepp/symfony-flex-backend/add-validation-constraint
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tarlepp/symfony-flex-backend --skill add-validation-constraint
Clone the repo
git clone --depth 1 https://github.com/tarlepp/symfony-flex-backend

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for add-validation-constraint

README.md
[![agentmods](https://agentmods.dev/badge/skills/tarlepp/symfony-flex-backend/add-validation-constraint/github.svg)](https://agentmods.dev/skills/tarlepp/symfony-flex-backend/add-validation-constraint)
Your own site
<a href="https://agentmods.dev/skills/tarlepp/symfony-flex-backend/add-validation-constraint"><img src="https://agentmods.dev/badge/skills/tarlepp/symfony-flex-backend/add-validation-constraint/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for add-validation-constraint

Your own site · 80×15
<a href="https://agentmods.dev/skills/tarlepp/symfony-flex-backend/add-validation-constraint"><img src="https://agentmods.dev/badge/skills/tarlepp/symfony-flex-backend/add-validation-constraint.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,142 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00031 $0.01142
Opus 5.5 $0.00012 $0.00457
Sonnet 5.5 $0.00006 $0.00228
Haiku 4.5 $0.00003 $0.00114

Measured 11d ago against content hash 0bbb01c6ffa4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

add-validation-constraint scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/skills/add-validation-constraint/SKILL.md · 102 lines

How it starts

The opening of the file, as written. The whole thing — 102 lines — stays where its author put it; the contents beside it link to each section on GitHub.

What is this?

Use this skill when adding or changing a project-specific Symfony validation rule under src/Validator/Constraints/. For using constraints on API DTOs, also follow add-api-dto-mapping; a custom constraint does not require changing a DTO if its validation scope is elsewhere.

Follow the shared skill guidance, including repository instructions and AI rules.

Table of Contents ᐞ

Workflow ᐞ

  1. Inspect the relevant DTO or domain object, existing constraint and validator pairs under src/Validator/Constraints/, and nearby tests under tests/Integration/Validator/Constraints/. Examples include Locale/LocaleValidator, Timezone/TimezoneValidator, and UniqueUsername/UniqueUsernameValidator. Check their current behavior and the installed Symfony Validator APIs before applying a pattern.
  2. Define the rule's scope and contract: property or class level, supported input types, null/blank behavior, groups, violation message and parameters, error code, and any service or repository lookup. Ask before choosing unspecified validation semantics that change accepted input or API errors.
  3. Implement the constraint as a Constraint subclass in App\Validator\Constraints. Declare its PHP attribute target to match the intended scope. For class-level validation, implement getTargets() as needed. Define stable message and error-code constants and map the code in ERROR_NAMES, following current local conventions. If the constraint has options, use a typed constructor compatible with Symfony's base constructor; preserve options, groups, and payload behavior.
  4. Implement the matching *Validator as a ConstraintValidator in the same namespace. Inject required collaborators through the constructor and use the existing App\ autowiring/autoconfiguration rather than manual instantiation or redundant service tags. Verify Symfony's validator discovery and naming behavior when using a non-default validator class.
  5. Keep validation focused on the rule. Define deliberately how null or blank values are handled; optionality and requiredness usually belong to separate constraints such as NotBlank. Validate supported value types explicitly: throw Symfony's UnexpectedTypeException for the wrong constraint and UnexpectedValueException for incompatible values when that is the intended contract. Do not silently cast, normalize, or accept malformed input unless the rule explicitly defines that behavior.
  6. Add violations through the validator context using the declared message, parameters, and error code. Avoid leaking secrets or unnecessary personal or persisted data through violation messages, logs, or parameters. Surface collaborator failures according to the repository's error-handling conventions; do not convert infrastructure failures into a valid result or a misleading validation violation.
  7. Add tests for valid and invalid values, null/blank and unsupported types where relevant, and the exact violation message/code/parameters. If the validator uses a repository or service, test the rule's observable behavior with controlled collaborator responses. Also verify the constraint through Symfony's configured Validator service when service discovery, constraint mapping, or dependency injection matters; direct calls to validateInContext alone do not prove framework wiring.
  8. For DTO usage, place the constraint on the correct field or class and preserve operation-specific validation groups and create/update/patch behavior. Follow add-api-dto-mapping for request mapping, DTO validation, and HTTP-boundary coverage when the API contract changes. Keep entity validation separate from request DTO validation unless the existing domain behavior requires both.
  9. Update API error documentation or other existing documentation when the externally observable validation contract changes. Do not add a migration unless persisted entity structure changes; follow the entity skill when it does.

Read the full file on GitHub · 102 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago Changed · -1 lines 0bbb01c6ffa4
  2. 16d ago Changed · -1 lines 5478ccff60b8
  3. 1mo ago First seen · 104 lines · 31 tokens per session scan A 8e850e1039b2

Subscribe to this mod's changes

add-validation-constraint is a skill published in the GitHub repository tarlepp/symfony-flex-backend (286 stars, last pushed yesterday), licensed MIT. It adds 31 tokens to every session and 1,142 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-25.

Related

add-validation-constraint compared with skills from other repositories

add-validation-constraint next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
add-validation-constrainttarlepp/symfony-flex-backendSkill286yesterdayMITA31Claude Code, Codex
api-integration-architectsickn33/agentic-awesome-skillsSkill51kyesterdayMITA33Claude Code
dmrwemake-services/django-modern-restSkill1.6kyesterdayMITA80Claude Code, Codex
api-connector-builderericrisco/rsc-harnessSkill695yesterdayMITA80Claude Code, Codex
dmr-openapi-skeletonwemake-services/django-modern-restSkill1.6kyesterdayMITA97Claude Code, Codex
dmr-from-dj-rest-authwemake-services/django-modern-restSkill1.6kyesterdayMITA67Claude Code, Codex
dmr-from-drfwemake-services/django-modern-restSkill1.6kyesterdayMITA69Claude Code, Codex