validators

Standardize FluentValidation validators with SetValidator and Include composition patterns.

Updated Apr 9, 2026
One-click install
npx skills add https://github.com/SergeuMatyasov/dotnet-shared-skills --skill validators-sergeumatyasov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: validators
Source: https://github.com/SergeuMatyasov/dotnet-shared-skills/tree/main/validators
Command: npx skills add https://github.com/SergeuMatyasov/dotnet-shared-skills --skill validators-sergeumatyasov

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

FluentValidation validators often diverge across projects, leading to inconsistent rules, duplicated logic, and harder maintenance. This Skill standardizes validator design to promote predictable behavior, reusability, and clear testing boundaries.

Core Features & Use Cases

  • Enforces the single responsibility principle by keeping validators focused on input validation only.
  • Encourages reuse through composition patterns like SetValidator and Include to avoid rule duplication.
  • Provides best practices and anti-pattern guidance to improve readability, testability, and maintainability across teams.
  • Use Case: Create a base validator for common fields, then compose project-specific validators with SetValidator.

Quick Start

Review existing validators and apply the shared patterns to create or refactor a FluentValidation validator.

Frequently Asked Questions about validators

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize FluentValidation validators across multiple .NET projects?

To standardize FluentValidation validators across .NET projects, apply reusable validator components using SetValidator and Include to compose complex rules. This enforces consistent validation behavior, eliminates rule duplication, and maintains clear testing boundaries.

Can I reuse FluentValidation rules for common fields in different commands?

Yes, you can reuse FluentValidation rules for common fields by creating a base validator and composing project-specific validators with SetValidator. This approach prevents rule duplication and ensures consistent validation logic across different commands.

How does MustAsync handle CancellationToken in FluentValidation?

MustAsync handles CancellationToken in FluentValidation by passing the token to asynchronous validation methods to support proper async cancellation. This ensures that long-running validation checks respect operation cancellation requests and avoid unnecessary resource consumption.

Why should FluentValidation validators contain zero business logic?

FluentValidation validators should contain zero business logic to enforce the single responsibility principle and keep validators focused solely on input validation. This separation improves readability, testability, and maintainability by preventing complex business rules from obscuring validation checks.

What is the best way to enforce English validation messages in FluentValidation?

The best way to enforce English validation messages in FluentValidation is to standardize validator design patterns across all projects. Applying consistent message templates ensures predictable validation behavior and avoids localized message divergence during team development.