validation-patterns — Claude Code skill for ASP.NET Core validation
A skill that tells your agent how to validate data in ASP.NET Core, from attributes to FluentValidation and startup option checks.
npx skills add wshaddix/dotnet-skills --skill validation-patterns -a claude-codeWhat validation-patterns does
The skill lays out five validation layers: client side, model binding, business rules, configuration and database constraints. A decision tree inside helps pick an approach by complexity. Simple property constraints go to DataAnnotations with [Required], [Range] and [StringLength]. Rules that span several properties go to IValidatableObject or a custom ValidationAttribute.
There are separate sections on IValidateOptions<T> for checking options classes at startup and on FluentValidation for async validators that hit a database. Code samples cover a request model with attributes, a FutureDateAttribute, a class-level DateRangeAttribute comparing two dates, and a Validate() implementation in CreateOrderRequest that checks the ship-by date and order total.
The patterns target ASP.NET Core projects. On another stack the samples do not carry over. Some attributes — [AllowedValues], [DeniedValues], [Length], [Base64String] — are marked as .NET 8 and later, so they will not compile on an older runtime. Worth checking your target framework before pasting the code.
What it helps with
- pick between DataAnnotations and FluentValidation for a model
- express a rule that depends on two properties at once
- validate an options class when the app starts
- write a reusable attribute for a domain rule
- add an async check that queries the database
Example prompts for the agent
- Add validation to CreateProductRequest using the validation-patterns skill
- Write a cross-field check for the ship-by date in CreateOrderRequest
- Set up IValidateOptions for my options class and validate it at startup
How to install validation-patterns
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill validation-patterns -a claude-code2Manually: put the files in place
~/.claude/skills/validation-patterns/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/validation-patterns/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill validation-patterns -a codex2Manually: put the files in place
.agents/skills/validation-patterns/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill validation-patterns -a cursor2Manually: put the files in place
.cursor/skills/validation-patterns/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install wshaddix/dotnet-skills validation-patterns2Manually: put the files in place
.github/skills/validation-patterns/SKILL.md1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill validation-patterns -a gemini-cli2Platform CLI
gemini skills install https://github.com/wshaddix/dotnet-skills --path skills/validation-patternsManually: put the files in place
.devin/skills/validation-patterns/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill validation-patterns -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
From the same set5
Similar
Nearby in Backend and APIs
Everything for Backend and APIs →Questions about validation-patterns
How do I install validation-patterns in Claude?
Run npx skills add wshaddix/dotnet-skills --skill validation-patterns -a claude-code. The skill file then lands at ~/.claude/skills/validation-patterns/SKILL.md.
What does validation-patterns do?
It collects validation patterns for ASP.NET Core: DataAnnotations, custom ValidationAttribute classes, IValidatableObject, IValidateOptions<T>, FluentValidation and client-side checks. The agent reaches for them when you ask to add or rework validation.
Which projects does this skill fit?
ASP.NET Core applications. The samples rely on C# and the System.ComponentModel.DataAnnotations namespace, and some attributes need .NET 8 or later.