wshaddix avatar

Microsoft Extensions Configuration

This handles configuration setup in .NET apps using Microsoft.Extensions.Configuration, with a strong focus on validation at startup instead of runtime failures. You get patterns for binding appsettings.json to strongly-typed classes, using Data Annotations for simple rules, and implementing IValidateOptions for complex cross-property checks. The core idea is fail fast: if your SMTP host is missing or your production database points to localhost, you want the app to crash on startup with a clear message, not 10 minutes into a user session. Also covers the differences between IOptions, IOptionsSnapshot, and IOptionsMonitor, plus how to inject dependencies into validators when you need environment-specific logic.

skills.sh installs
528
GitHub stars
90
last updated
Aug 21, 2026

Install

$ npx -y skills add wshaddix/dotnet-skills --skill microsoft-extensions-configuration --agent claude-code

Installs into .claude/skills of the current project.

Files

Microsoft.Extensions Configuration Patterns

When to Use This Skill

Use this skill when:

  • Binding configuration from appsettings.json to strongly-typed classes
  • Validating configuration at application startup (fail fast)
  • Implementing complex validation logic for settings
  • Designing configuration classes that are testable and maintainable
  • Understanding IOptions, IOptionsSnapshot, and IOptionsMonitor

Why Configuration Validation Matters

The Problem: Applications often fail at runtime due to misconfiguration - missing connection strings, invalid URLs, out-of-range values. These failures happen deep in business logic, far from where configuration is loaded, making debugging difficult.

The Solution: Validate configuration at startup. If configuration is invalid, the application fails immediately with a clear error message. This is the "fail fast" principle.

Sponsors

Details

Repository
github.com/wshaddix/dotnet-skills
Category
.NET & C#
First seen
Jun 3, 2026

More from wshaddix/dotnet-skills

All 13

Recommended

More .NET & C#
1aaronontheweb avatarsnapshot-testingaaronontheweb/dotnet-skillsUse Verify for snapshot testing in .NET. Approve API surfaces, HTTP responses, rendered emails, and serialized outputs. Detect unintended changes through human-484skills.sh installs
2aaronontheweb avatarmailpit-integrationaaronontheweb/dotnet-skillsTest email sending locally using Mailpit with .NET Aspire. Captures all outgoing emails without sending them. View rendered HTML, inspect headers, and verify de443skills.sh installs
3aaronontheweb avatarOpenTelemetry-NET-Instrumentationaaronontheweb/dotnet-skillsProvides guidance for implementing OpenTelemetry instrumentation in .NET codebases, covering tracing (Activities/Spans), metrics, logs, naming conventions, erro431skills.sh installs
4aaronontheweb avatarakka-net-aspire-configurationaaronontheweb/dotnet-skillsConfigure Akka.NET with .NET Aspire for local development and production deployments. Covers actor system setup, clustering, persistence, Akka.Management integr415skills.sh installs
5dotnet avatarexp-mock-usage-analysisdotnet/skillsAudits .NET test mock usage by tracing each mock setup through the production code's execution path to find dead, unreachable, redundant, or replaceable mocks. 0skills.sh installs
6dotnet avatarexp-simd-vectorizationdotnet/skillsOptimizes hot-path scalar loops in .NET 8+ with cross-platform Vector128/Vector256/Vector512 SIMD intrinsics, or replaces manual math loops with single TensorPr0skills.sh installs