Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Validator Conventions?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/makigjuro-validator-conventions)
---
name: validator-conventions
description: FluentValidation conventions — AbstractValidator structure, registration, and rule conventions. Apply whenever writing or editing a validator class.
user-invocable: false
paths:
- "src/**/*Validator*.cs"
---
# Validator Rules (FluentValidation)
## Structure
- Inherit from `AbstractValidator<TCommand>` or `AbstractValidator<TRequest>`
- Rules defined in constructor
- One validator per command/request
## Registration
- Register all validators from assembly: `services.AddValidatorsFromAssemblyContaining<TValidator>()`
- Validators injected into handlers or run via middleware
## Conventions
- Use `.NotEmpty()`, `.MaximumLength()`, `.Must()` for rules
- Provide `.WithMessage()` for user-facing messages
- Provide `.WithErrorCode()` using SCREAMING_SNAKE_CASE codes matching domain error codes
- Validate at application boundary (commands/requests), not deep in domain
## Example
```csharp
public class CreateOrderValidator : AbstractValidator<CreateOrderCommand>
{
public CreateOrderValidator()
{
RuleFor(x => x.TenantId).NotEmpty().WithErrorCode("TENANT_ID_REQUIRED");
RuleFor(x => x.Description).NotEmpty().MaximumLength(500).WithErrorCode("INVALID_DESCRIPTION");
}
}
```