
Validation Patterns
This walks through the validation layer cake in ASP.NET Core, from DataAnnotations up through FluentValidation and options validation at startup. You get decision trees for picking the right approach (simple attributes vs IValidatableObject vs custom ValidationAttribute), tables of built-in attributes including the .NET 8 additions like AllowedValues and Base64String, and working examples of cross-property validation and MediatR pipeline behaviors. The IValidateOptions pattern for catching bad configuration at startup is especially worth having around. It's comprehensive enough that you'll reference it when setting up validation in a new project or when you need to remember the syntax for custom validators that need database access.
- skills.sh installs
- 542
- GitHub stars
- 90
- last updated
- Aug 21, 2026
Install
$ npx -y skills add wshaddix/dotnet-skills --skill validation-patterns --agent claude-codeInstalls into .claude/skills of the current project.
Files
Validation Patterns in ASP.NET Core
Rationale
Validation is critical for both security and user experience. Poor validation leads to invalid data, security vulnerabilities, and confusing error messages. These patterns provide a comprehensive approach to validation at multiple layers.
Validation Strategy
| Layer | Purpose | Technology |
|---|---|---|
| Client-Side | Immediate feedback, reduce server load | jQuery Validation, HTML5 |
| Model Binding | Data type/format validation | Model Binders |
| Application | Business rule validation | FluentValidation, DataAnnotations |
| Configuration | Startup validation | IValidateOptions |
| Database | Constraint enforcement | EF Core Configurations |
Validation Approach Decision Tree
Choose the validation approach based on complexity:
Sponsors
Details
- Repository
- github.com/wshaddix/dotnet-skills
- Categories
- DevOps & CI/CD, Automation & Workflows, Sales & Marketing, .NET & C#
- First seen
- Jun 3, 2026