configuration

Configure .NET 10 applications with validated Options pattern bindings.

224|87|Updated Dec 15, 2018
One-click install
npx skills add https://github.com/Resgrid/Core --skill configuration-resgrid
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: configuration
Source: https://github.com/Resgrid/Core/tree/main/.opencode/skills/configuration
Command: npx skills add https://github.com/Resgrid/Core --skill configuration-resgrid

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you avoid misconfiguration and fragile “stringly-typed” setup by showing how to structure .NET configuration using strongly-typed options with validation and correct layering.

Core Features & Use Cases

  • Options pattern with validation: Bind configuration sections to validated option classes using data annotations and fail fast at startup with ValidateOnStart.
  • Correct configuration source layering: Apply appsettings.json, environment-specific appsettings, environment variables, and user secrets in the right override order.
  • Secure secrets handling: Keep secrets out of source control by using user secrets in development and Azure Key Vault or environment variables in production.
  • Choosing the right options lifetime: Use IOptions for immutable startup values, IOptionsSnapshot for scoped reload scenarios, and IOptionsMonitor for actively changing values.

Quick Start

Load the configuration skill and ask for an example of binding a section from appsettings to a validated Options class, then wiring it into a service using IOptions<T> or IOptionsSnapshot<T> as appropriate for your environment.

Frequently Asked Questions about configuration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I bind .NET configuration sections to strongly-typed options with validation?

You can bind configuration sections to strongly-typed options in .NET using data annotations and the Options pattern. Applying ValidateOnStart ensures your configuration fails fast during startup if the settings are invalid.

What is the correct layering order for .NET configuration sources?

The correct layered configuration ordering applies appsettings.json, environment-specific appsettings, environment variables, and user secrets in a deliberate override sequence. This structure ensures reliable settings while preventing direct IConfiguration reads.

When should I use IOptions vs IOptionsSnapshot vs IOptionsMonitor in .NET?

Use IOptions for immutable startup values, IOptionsSnapshot for scoped reload scenarios, and IOptionsMonitor for actively changing values. Selecting the correct options lifetime ensures your .NET application handles configuration updates appropriately.

How do I keep secrets out of source control in .NET production applications?

To keep secrets out of source control, use user secrets during development and Azure Key Vault or environment variables in production. This secure secrets handling approach prevents secret leakage into your repository.

How do I validate .NET options on startup to prevent misconfiguration?

You can validate .NET options on startup by binding configuration sections to validated option classes using data annotations and enabling ValidateOnStart. This fail-fast mechanism prevents application misconfiguration before the app runs.

Does the .NET Options pattern work with Azure Key Vault for secrets management?

Yes, the .NET Options pattern integrates with Azure Key Vault for production secrets management. This combination allows you to bind secure configuration values into strongly-typed options while keeping secrets out of source control.