Fluent validation custom validation

From IntentArchitect/Intent.Modules.NET · View interactive version

Fluent validation custom validation is an AI agent skill from the GitHub repository IntentArchitect/Intent.Modules.NET. Implements custom and async FluentValidation rules. MUST load before creating or editing any validator e.g. *Validator.cs.

How to use this skill

Skill file

Fluent Validation Custom Async Method

Implement custom async validation method logic inside an existing validator file. Keep validators aligned with the modeled domain and existing validation patterns while protecting architectural boundaries.

Core rules

Workflow

  1. Inspect the existing validator, command/DTO, custom validation method, repository interfaces, and related domain types, such as enums.
  2. Search for code usages of:
  1. Gather explicit evidence from sources: XML docs, comments, domain entities, tests, and value objects.
  2. Only implement if every single line of code is traceable to an explicit requirement; otherwise, ask targeted questions.
  3. Implement the method body using existing patterns first.
  4. If the validator needs missing DAL capabilities, extend the relevant repository abstraction in an allowed layer instead of pulling infrastructure into the validator.
  5. Add focused private helper methods when validation logic becomes easier to read or test.
  6. Ensure cancellation tokens are threaded through async calls where applicable.
  7. Verify the final code preserves layer boundaries and avoids infrastructure leakage.

Validation-specific guidance

Custom async validation methods usually check business rules that require external data access. Prefer patterns like these when supported by the surrounding codebase:

Repository and abstraction extension guidance

When a needed validation capability is missing:

Requirement gathering

Before implementing any custom validation method, ensure you have found explicit evidence. If no explicit requirement is found in these sources, ask the user:

If you find no such evidence, ask:

Output expectations

Produce a concrete code update that:

You must never write any line of code whose logic is not traceable to an explicit requirement in the codebase. "Invented logic" means any statement, condition, check, or failure message that you derived from reasoning, intuition, naming, or general domain knowledge rather than from an explicit source

Explicit no-ops are forbidden unless the user has explicitly written something like _"implement a no-op"_ or _"no validation logic is needed"

Disguised no-ops - code with the appearance of logic but no real outcome. These are equally forbidden

When you lack sufficient information, asking is the correct and only acceptable output. A no-op — explicit or disguised — is never a valid substitute for asking

Review checklist

Before finishing, check that:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.