validation
Skill1 starsChanged 6 days agoMITView on GitHub
How request validation works with FluentValidation and the ValidationBehaviour pipeline, including message wording and the shared paging rules. Use when adding or changing a validator, or when a request needs a new rule.
20 other projects use a version of this.
Adopted by
Most recently taken up by
- thistleknot/skillstheir own version, first seen Nov 8, 2026
- GoogleCloudPlatform/cloud-solutionstheir own version, first seen Nov 8, 2026
- AnyOrgName/php-skillstheir own version, first seen Nov 8, 2026
- ruujOnChain/HedgeFund-Skillstheir own version, first seen Nov 8, 2026
- honeydew-ai/honeydew-ai-coding-agents-pluginstheir own version, first seen Nov 1, 2026
- aibtcdev/skillstheir own version, first seen Oct 26, 2026
Used with
Projects with it also use testing.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
NVIDIASkilltesting
Run Python and Rust tests for physicsnemo-curator using uv + pytest with coverage reporting via pytest-cov, and cargo-nextest for Rust tests. Includes benchmark workflows with pytest-benchmark and criterion.
Also in 3 projects that use this
Other versions20 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 20
- openai/codex-security★ 11ksame name
- openai/plugins★ 7.8ksame name
- GoogleCloudPlatform/cloud-solutions★ 139same name
- richard-kim-79/archora-skills★ 49same name
- honeydew-ai/honeydew-ai-coding-agents-plugins★ 43same name
- wolverin0/claude-skills★ 41same name
- loocor/mcpmate★ 35same name
- ruujOnChain/HedgeFund-Skills★ 17same name
- aibtcdev/skills★ 11same name
- AnyOrgName/php-skills★ 4same name
10 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository40 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-a-use-caseSkill
- api-conventionsSkill
- branches-and-pull-requestsSkill
- cancellationSkill
- ci-for-your-solutionSkill
- ci-pipelineSkill
- clean-architecture-layersSkill
- configuration-and-environmentsSkill
- coverageSkill
- csharp-house-styleSkill
- data-access-ef-coreSkill
- database-migrationsSkill
- docker-and-composeSkill
- docs-and-voiceSkill
- errors-and-exceptionsSkill
- expose-a-use-caseSkill
- family-syncSkill
- health-checksSkill
- integration-testsSkill
- json-serializationSkill
- mapping-with-mapperlySkill
- mcp-inspectorSkill
- mediatorSkill
- optional-token-authSkill
- packages-and-dependenciesSkill
- pagingSkill
- presentation-integration-testsSkill
- releasesSkill
- sample-dataSkill
- security-findingsSkill
- serilogSkill
- telemetrySkill
- template-authoringSkill
- test-designSkill
- time-providerSkill
- unit-testsSkill
- writing-a-skillSkill
- xml-docs-and-openapiSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 2 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 20 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
Create <UseCase>Validator.cs beside the request: public class XValidator : AbstractValidator<XRequest>.
- Very specific: line 21
Add one RuleFor per property, each discarded with _ = and qualified with this..
- Distinctive: line 22
Write the message for a person reading an API error: what's wrong and what's allowed.
- Very specific: line 24
Test every rule (unit-tests, test-design): one valid case, one failing case per rule, and both sides of every boundary in a [Theory].
- Very specific: line 52
Use data annotations ([Required], [Range]) on requests.
- Very specific: line 53
Check existence in a validator (does this movie exist?).
- Distinctive: line 56
Write messages like "Invalid input" or "'Stars' must be between 1 and 5." (the FluentValidation default).
“Common” is measured: kept by at least 6 in 10 of the 20 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Validation
The rule
All input rules live in one place: a FluentValidation validator next to the request in Application. ValidationBehaviour runs every validator for a request before its handler and throws FluentValidation.ValidationException with all failures. Each presentation layer turns that into its own "bad request" shape. Nothing else validates input.
Validators check the shape of a request: ids present, values in range, text the right length. Handlers check anything that needs storage, such as whether a movie exists. So validators are synchronous, take no dependencies and never call a repository.
Validators are found by AddValidatorsFromAssembly in src/Application/DependencyInjection.cs, so a new one needs no registration.
Steps
- Create
<UseCase>Validator.csbeside the request:public class XValidator : AbstractValidator<XRequest>. - Add one
RuleForper property, each discarded with_ =and qualified withthis.. - Write the message for a person reading an API error: what's wrong and what's allowed. End with a full stop.
- Paged queries use the shared extensions in
src/Application/Common/Paging/PagingValidatorExtensions.cs:ValidOffset(),ValidLimit(),ValidSearchTerm(). - Test every rule (
unit-tests,test-design): one valid case, one failing case per rule, and both sides of every boundary in a[Theory].
Example
// src/Application/Reviews/Commands/CreateReview/CreateReviewValidator.cs
public class CreateReviewValidator : AbstractValidator<CreateReviewCommand>
{
public CreateReviewValidator()
{
_ = this.RuleFor(r => r.AuthorId).NotEqual(Guid.Empty).WithMessage("An author id was not supplied to create the review.");
_ = this.RuleFor(r => r.MovieId).NotEqual(Guid.Empty).WithMessage("A movie id was not supplied to create the review.");
_ = this.RuleFor(r => r.Stars).InclusiveBetween(1, 5).WithMessage("A star rating must be between 1 and 5.");
}
}// src/Application/Movies/Queries/GetMovies/GetMoviesValidator.cs
_ = this.RuleFor(r => r.Query).ValidSearchTerm();
_ = this.RuleFor(r => r.Offset).ValidOffset();
_ = this.RuleFor(r => r.Limit).ValidLimit();A rule shared by several requests becomes an extension method on IRuleBuilder<T, TProperty> returning IRuleBuilderOptions<T, TProperty>, with its message inside, like the paging ones.
Don't
- Use data annotations (
[Required],[Range]) on requests. - Check existence in a validator (does this movie exist?). That needs storage, so it's the handler's job and throws
NotFoundException(errors-and-exceptions). - Inject a repository or use
MustAsyncin a validator. - Throw your own
ValidationException. Let the behaviour do it. - Write messages like "Invalid input" or "'Stars' must be between 1 and 5." (the FluentValidation default). Say it in a sentence.
Check
dotnet test tests/Application.Tests.Unit --filter "FullyQualifiedName~ValidatorTests"Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

