CO

coreex-validator

Use this to create or update CoreEx validation rules for C# application contracts and requests.

Install

mkdir -p .claude/skills/coreex-validator && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/17872" && unzip -o skill.zip -d .claude/skills/coreex-validator && rm skill.zip

Installs to .claude/skills/coreex-validator

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Create or modify a CoreEx validator in the Application layer. USE FOR: new Validator<T,TSelf> (no injection), new Validator<T> with constructor injection, AbstractValidator<T,TSelf> (FluentValidation-style), adding rules to an existing validator, nested entity/collection/dictionary validators. DO NOT USE FOR: domain invariants in aggregates, FluentValidation NuGet package, Infrastructure-layer checks.
404 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • Create a new CoreEx validator for a contract or request type.
  • Modify an existing CoreEx validator by adding property rules or async checks.
  • Implement nested validators for sub-properties, collections, or dictionaries.
  • Switch to FluentValidation-compatible `AbstractValidator` syntax.
  • Determine the appropriate base class for a validator based on injection needs.

How it works

This skill guides the creation and modification of CoreEx validators, covering declarative rules, ref-data validation, and async database checks. It helps determine the correct base class and syntax style, and emphasizes generating matching unit tests.

Inputs & outputs

You give it
Optional: contract type, validator name, properties to validate, async/database checks.
You get back
A new or modified CoreEx validator in the Application layer, with corresponding unit tests.

When to use coreex-validator

  • Create a new validator for a request contract
  • Add an asynchronous database check to a validator
  • Configure nested validation for a dictionary or collection

About this skill

<!-- AI workflow asset — dual-audience notice: - In the Avanade/CoreEx repository: this file is the authored source. Edit it here. - In a consumer repository: this file was generated by `dotnet new coreex-ai` (or refreshed via `dotnet new coreex-ai --force` / the `/coreex-docs-sync` skill). Do not hand-edit it directly — propose the change upstream in Avanade/CoreEx instead, then refresh once it is released. -->

CoreEx: Validator

Guides you through creating or modifying a CoreEx validator (Application/Validators/) for a contract or request type. Covers declarative rules, ref-data validation, async database checks, collection and dictionary validators.

When to Use

  • New validator for a contract or request type (no database calls needed)
  • New validator that requires a repository or other Application-layer dependency
  • Adding property rules or an async check to an existing validator
  • Nested validator for a sub-property (.Entity()), a collection, or a dictionary
  • Switching to FluentValidation-compatible AbstractValidator syntax

When Not to Use

  • Domain invariants (aggregates, entities, value objects) — those belong in the Domain layer
  • Infrastructure-level data checks that are not accessed via an Application-layer interface
  • FluentValidation NuGet package — AbstractValidator here is CoreEx.Validation.AbstractValidator

Quick Reference

Clarifying questions to ask before writing any code:

  1. Does the validator need a constructor-injected dependency (e.g. a repository)? (determines base class)
  2. Which properties need validation? (list upfront — batch type resolution, don't interrupt per-property)
  3. Are any ref-data properties required? Optional? (.Mandatory().IsValid() vs .IsValid())
  4. Are any checks async (e.g. confirming an entity exists in the database)?
  5. Does the user prefer FluentValidation-style RuleFor(x => ...) syntax?

Base class decision:

SituationBase classNotes
No injection neededValidator<T, TSelf>Exposes Default singleton; invoke via .Default.ValidateAndThrowAsync(...)
Constructor injection neededValidator<T>No Default; instantiate at the call site with already-injected dependencies: new {Name}Validator(_dep).ValidateAndThrowAsync(...)
FluentValidation-style preferredAbstractValidator<T, TSelf>RuleFor(x => ...) / NotEmpty() / IsValid() — still CoreEx; has Default

Key rules at a glance:

  • Ref-data: .IsValid() on the navigation property (Gender), never on *Code string
  • Mandatory() on a non-nullable value type errors on default (0, MinValue) — use a range rule if 0 is valid
  • Runtime-computed thresholds: use delegate overloads (.LessThanOrEqualTo(_ => ...)) — prefer over OnValidateAsync imperative logic
  • context.HasErrors guard before async I/O; context.HasError(x => x.Prop) for per-property guards
  • context.AddError(x => x.Prop, ...) — member-access expression, never nameof(...)
  • Message text argument is a {2} suffix substitution — not a full sentence; use .Error("...") to override the whole message
  • Always generate or update the matching {Validator}Tests in *.Test.Unit/Validators/ — cover conditional/business rules and cross-field logic thoroughly, plus a representative error/success pair for simple rules; skip dedicated boundary tests for framework-guaranteed constraints like length rules (MaximumLength/MinimumLength/Length/String)

For full workflow, rule reference, and code examples see references/workflow.md.

Key References

When not to use it

  • When defining domain invariants for aggregates, entities, or value objects.
  • When performing infrastructure-level data checks not accessed via an Application-layer interface.
  • When using the `FluentValidation` NuGet package instead of `CoreEx.Validation.AbstractValidator`.

Limitations

  • Does not apply to domain invariants.
  • Does not apply to infrastructure-level data checks.
  • Requires generating or updating matching `{Validator}Tests`.

How it compares

This skill provides specific guidance for CoreEx validators, including base class selection based on dependency injection and a preference for `CoreEx.Validation.AbstractValidator` over the `FluentValidation` NuGet package, unlike general v

Compared to similar skills

coreex-validator side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
coreex-validator (this skill)020dNo flagsIntermediate
dotnet-backend-patterns74moNo flagsAdvanced
azure-resource-manager-postgresql-dotnet12moReviewIntermediate
azure-resource-manager-sql-dotnet12moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

dotnet-backend-patterns

wshobson

Master C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.

722

azure-resource-manager-postgresql-dotnet

microsoft

Azure PostgreSQL Flexible Server SDK for .NET. Database management for PostgreSQL Flexible Server deployments. Use for creating servers, databases, firewall rules, configurations, backups, and high availability. Triggers: "PostgreSQL", "PostgreSqlFlexibleServer", "PostgreSQL Flexible Server", "Azure Database for PostgreSQL", "PostgreSQL database management", "PostgreSQL firewall", "PostgreSQL backup", "Postgres".

13

azure-resource-manager-sql-dotnet

microsoft

Azure Resource Manager SDK for Azure SQL in .NET. Use for MANAGEMENT PLANE operations: creating/managing SQL servers, databases, elastic pools, firewall rules, and failover groups via Azure Resource Manager. NOT for data plane operations (executing queries) - use Microsoft.Data.SqlClient for that. Triggers: "SQL server", "create SQL database", "manage SQL resources", "ARM SQL", "SqlServerResource", "provision Azure SQL", "elastic pool", "firewall rule".

13

appsettings

punk-link

Rules for modifying ASP.NET Core configuration files (appsettings*.json) in the Warp project. Use when: adding, removing, or changing any configuration key in appsettings files; creating new Options classes that bind to configuration; the user mentions 'appsettings', 'configuration', 'options', 'con

00

dotnet-backend-patterns

brunolimaff-jpg

Master C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuratio...

00

efcore-migrations

thecaaz

**WORKFLOW SKILL** — EF Core migrations workflow for backend model changes: generate, review, and apply EF Core migrations using the repository's README guidance. Agents MUST NOT hand-edit migration code — migrations must be generated with the `dotnet ef migrations add` tool.

00

Search skills

Search the agent skills registry