dotnet-source-gen-options-validation

Installation
SKILL.md

Convert options validation to use the compile-time source generator, enabling AOT-compatible, reflection-free validation at startup.

When to Use

  • Preparing application for Native AOT compilation
  • Eliminating reflection-based validation overhead
  • Ensuring validation errors surface at compile time rather than runtime
  • Migrating from ValidateDataAnnotations() to source-generated validation

Steps

  1. Find options classes with data annotations:

    • Search for classes using [Required], [Range], [RegularExpression], [MaxLength], [MinLength], [Length]
    • These are typically in files matching *Options.cs or *Settings.cs
  2. Check existing validation setup:

    • If class already has a corresponding [OptionsValidator] partial class, skip it
    • Note any existing ValidateDataAnnotations() calls for removal later
Installs
2
Repository
im5tu/claude
GitHub Stars
1
First Seen
May 20, 2026
dotnet-source-gen-options-validation — im5tu/claude