Skip to content
Back to skills

Validator Conventions

ASecurity

FluentValidation conventions — AbstractValidator structure, registration, and rule conventions. Apply whenever writing or editing a validator class.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 11, 2026
development

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add makigjuro/cloud-app-blueprint --skill validator-conventions --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Validator Conventions?

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

Security grade badge for Validator Conventions
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/makigjuro-validator-conventions/badge)](https://www.skillsdirectory.com/skills/makigjuro-validator-conventions)

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: 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");
    }
}
```

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.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.