Binds a configuration section to a typed options class and validates it at startup using the .NET options pattern. Use for adding options types, binding from configuration, applying DataAnnotations or custom validation, and failing fast on invalid config.
Ships in dotnet-advanced. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Represent a cohesive configuration section as an immutable options type, bound once and validated at startup. A misconfigured process fails at startup, not at first use.
IConfiguration["Section:Key"] lookups scattered across services.IConfiguration read is fine; do not model an options type for it.configuring-dotnet-hosting.Use a record with init properties and DataAnnotations describing the constraints.
One type per configuration section.
public sealed record DatabaseOptions
{
[Required]
public required string ConnectionString { get; init; }
[Range(1, 100)]
public int MinPoolSize { get; init; }
[Range(1, 100)]
public int MaxPoolSize { get; init; }
}
Bind from the named section, validate DataAnnotations, and add ValidateOnStart when the process cannot operate without valid values.
builder.Services.AddOptions<DatabaseOptions>()
.Bind(builder.Configuration.GetSection("Database"))
.ValidateDataAnnotations()
.ValidateOnStart();
When one field constrains another, add a Validate predicate or an IValidateOptions<T> implementation; do not encode the rule in a consumer.
.Validate(options => options.MinPoolSize <= options.MaxPoolSize, "MinPoolSize must not exceed MaxPoolSize");
Inject IOptions<T> for singleton configuration fixed at startup, IOptionsSnapshot<T> for per-scope reads, or IOptionsMonitor<T> when values can change at runtime.
Read .Value; never store mutable config on a service.
Start the host with a missing or out-of-range required value and confirm startup fails with a clear message; start it with valid values and confirm the service reads them.
init/required), with DataAnnotations for constraints.ValidateOnStart to fail fast.IOptions*<T>, not raw IConfiguration.| Pitfall | Correct approach |
|---|---|
Reading IConfiguration["Database:ConnectionString"] in a service | Bind a DatabaseOptions type and inject IOptions<DatabaseOptions>. |
| Invalid config discovered at first request | Add ValidateDataAnnotations().ValidateOnStart(). |
| Cross-field rule checked inside a consumer | Add .Validate(...) or an IValidateOptions<T>. |
| Mutating an options instance after binding | Declare it immutable; use IOptionsMonitor<T> for runtime changes. |
ValidateDataAnnotations not found | The Microsoft.Extensions.Options.DataAnnotations package is not referenced. |
What SKILL.md sets; muted values are Claude Code's defaults
/dotnet-advanced:binding-and-validating-optionsfrom dotnet-advanced
npx claudepluginhub nice3point/revit-skills --plugin dotnet-advanced5 skills in this plugin
/configuring-dotnet-dependency-injectionRegister and review .NET dependency-injection services and lifetimes on IServiceCollection. USE FOR: adding a registration, choosing singleton/scoped/transient, grouping registrations behind a feature extension, assembly scanning with Scrutor, or validating a service graph. DO NOT USE FOR: choosing which kind of type to declare (use designing-dotnet-types), or configuring the host builder and its lifecycle (use configuring-dotnet-hosting).
/configuring-dotnet-hostingConfigure a .NET application host and its feature-registration extensions on IHostApplicationBuilder. USE FOR: composing HostApplicationBuilder/WebApplicationBuilder, writing IHostApplicationBuilder extension methods, registering shared service defaults, and host startup and lifecycle. DO NOT USE FOR: choosing a service lifetime or a single registration (use configuring-dotnet-dependency-injection), or binding and validating an options section (use binding-and-validating-options).
/designing-dotnet-typesChoose the right kind of .NET type for new behavior — static class, extension method, injected service, hosted service, options type, record, or interface. USE FOR: deciding how to shape a new unit of behavior or data before writing it, or reviewing that an existing type has the right shape for its dependencies and lifecycle. DO NOT USE FOR: registering a type or choosing its DI lifetime (use configuring-dotnet-dependency-injection).
/dotnet-source-generated-loggingWrite .NET logs with the LoggerMessage source generator for ILogger calls. USE FOR: adding or reviewing log statements built from [LoggerMessage] partial methods — message templates, log levels, event ids, exception logging, and logging scopes.
Other plugins' skills for the same job