Guides composing .NET application hosts using IHostApplicationBuilder extensions for feature registration, startup, and lifecycle management.
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.
Compose a host from small, named feature extensions on IHostApplicationBuilder, each adding one capability and returning the builder for chaining.
Program.cs or a shared defaults project.Configure…/Add… extension that adds a capability to every host.Write a generic extension over IHostApplicationBuilder; the same extension applies to any host (worker, web, CLI).
Return the builder.
public static TBuilder AddServiceDefaults<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
{
builder.ConfigureTelemetry();
builder.ConfigureSerialization();
builder.ConfigureHttpClients();
return builder;
}
Write Program.cs as a readable list of capability calls, and put the configuration code inside each extension.
var builder = Host.CreateApplicationBuilder(args);
builder.AddServiceDefaults();
builder.AddFeatureFlags();
builder.Services.AddEmailSenders();
var host = builder.Build();
await host.RunAsync();
Read builder.Configuration and branch on builder.Environment inside the capability's extension, and place its options binding and service registrations in the same extension when they always change together.
Register continuous or startup-bound work with AddHostedService; never run it inline during composition.
Create a scope inside a hosted operation before resolving scoped dependencies, and make any loop observe the stopping token.
Build the host through its normal entry point and confirm it starts, resolves the changed capability, honors host shutdown, and stops cleanly.
Program.cs reads as a list of capability calls, not inline configuration code.| Pitfall | Correct approach |
|---|---|
Configuring a capability inline in Program.cs | Move it into a Configure…/Add… builder extension. |
| Running startup work during composition | Register an IHostedService/BackgroundService. |
| Resolving a scoped service directly in a hosted service | Create a scope with IServiceScopeFactory first. |
Extension returns void, breaking the chain | Return the builder (or IServiceCollection). |
What SKILL.md sets; muted values are Claude Code's defaults
/dotnet-advanced:configuring-dotnet-hostingfrom dotnet-advanced
npx claudepluginhub nice3point/revit-skills --plugin dotnet-advanced5 skills in this plugin
/binding-and-validating-optionsBind a configuration section to a typed options class and validate it at startup with the .NET options pattern. USE FOR: adding an options type, binding it from configuration, applying DataAnnotations or custom validation, and failing fast on invalid configuration with ValidateOnStart. DO NOT USE FOR: general host composition and the order of builder extensions (use configuring-dotnet-hosting).
/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).
/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).
Other plugins' skills for the same job