Guides choosing the right .NET type for new behavior — static class, extension method, service, hosted service, record, or interface — based on dependency and lifecycle needs.
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.
Pick the type from its dependency and lifecycle needs, not from habit.
record and an options type.Use a static class only for stateless behavior with no injected dependency, configuration, logging, I/O, clock, cache, or mutable state. Make a static method deterministic for the same input unless its name says otherwise.
Use an extension method for a small operation centered on its receiver type, free of injected dependencies, I/O, hidden mutation, and expensive enumeration. Use an ordinary service when the operation needs configuration, logging, another collaborator, or a lifetime.
Use an injected service when behavior depends on configuration, logging, I/O, a client, a clock, a cache, or another injectable collaborator.
Use IHostedService or BackgroundService for work that starts with the host, stops with the host, or continuously consumes an independent source.
Implement request handling and one-shot operations in ordinary services.
Use a record for immutable data crossing a method, process, or configuration boundary.
Use a dedicated options type for a cohesive configuration section; never store mutable configuration on a service.
| Pitfall | Correct approach |
|---|---|
| Static helper that quietly reads a file or clock | Make it a service with the dependency injected. |
Extension method taking a DbContext or HttpClient | Use a service; extensions are for receiver-centric operations. |
| Interface added for every DI-registered class | Register the concrete type; add an interface only for a real boundary. |
| Mutable "settings" service storing configuration | Bind an options type (use binding-and-validating-options). |
What SKILL.md sets; muted values are Claude Code's defaults
/dotnet-advanced:designing-dotnet-typesfrom 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).
/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).
/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