Skip to content
Development
Skill

/microsoft-extensions

Use the Microsoft.Extensions stack correctly across Generic Host, dependency injection, configuration, logging, options, HttpClientFactory, and other shared infrastructure patterns. USE FOR: wiring dependency injection, configuration, logging, or options; introducing Generic

From plugin
managedcode-dotnet-skills
483184 skills17 agents
Install
$ npx -y skills add managedcode/dotnet-skills --skill microsoft-extensions --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/microsoft-extensions

Context preview

The summary Claude sees to decide when to auto-load this skill.

Use the Microsoft.Extensions stack correctly across Generic Host, dependency injection, configuration, logging, options, HttpClientFactory, and other shared infrastructure patterns. USE FOR: wiring dependency injection, configuration, logging, or options; introducing Generic

SKILL.md

microsoft-extensions.SKILL.md
name: microsoft-extensions
description: "Use the Microsoft.Extensions stack correctly across Generic Host, dependency injection, configuration, logging, options, HttpClientFactory, and other shared infrastructure patterns. USE FOR: wiring dependency injection, configuration, logging, or options; introducing Generic Host patterns into non-web .NET apps; cleaning up service registration, typed HTTP. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made."
compatibility: "Relevant to console apps, workers, ASP.NET Core apps, functions, and reusable libraries."

Microsoft.Extensions for .NET

Trigger On

  • wiring dependency injection, configuration, logging, or options
  • introducing Generic Host patterns into non-web .NET apps
  • cleaning up service registration, typed HTTP clients, or shared infrastructure code

Workflow

1. Prefer the Generic Host for apps that need configuration, DI, logging, hosted services, or coordinated startup. 2. Keep service registration predictable: composition at the edge, concrete implementations hidden behind interfaces only where that abstraction buys flexibility. 3. Use options binding for structured configuration and validate configuration at startup when bad settings would fail later at runtime. 4. Prefer `IHttpClientFactory` and typed or named clients for outbound HTTP instead of ad-hoc singleton or per-call `HttpClient` usage. 5. Use logging categories and config-driven log levels rather than scattered ad-hoc logging behavior. 6. For Kubernetes-hosted services, prefer the stable `Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes` package from the 10.7+ line when CPU/memory request and limit metrics should come from pod resource quotas. 7. Avoid building mini-frameworks over Microsoft.Extensions unless the repo genuinely needs reusable composition primitives.

Current Upstream Notes

  • `dotnet/extensions` `v10.9.0` adds experimental AI routing and failover clients and includes HTTP diagnostics/source-logging fixes. Generic Host, dependency injection, configuration, logging, options, and `IHttpClientFactory` patterns remain unchanged; route AI-specific architecture to `microsoft-extensions-ai`.
  • The MCP server project template moved out of `dotnet/extensions` and into the ASP.NET Core/.NET SDK distribution. Update scaffolding automation to use the SDK-provided template instead of pinning the removed extensions template package.
  • If repository automation creates AI templates from the prior `v10.8.4` change, pass `--provider azureopenai`, `--provider ollama`, or `--provider openai` explicitly and validate the selected provider's secrets and local-development path.
  • Keep Microsoft.Extensions package versions aligned within the repo's selected servicing line, then rerun host startup and options-validation tests after upgrading.

Deliver

  • clean host wiring and service registration
  • configuration and logging that are observable and testable
  • infrastructure code that fits naturally with the .NET stack

Validate

  • service lifetimes are correct
  • configuration is strongly typed where it matters
  • host setup remains easy to debug and reason about
  • Kubernetes resource monitoring uses the stable quota-provider APIs when pod request/limit dimensions matter

References

  • [patterns.md](references/patterns.md) - DI patterns, Configuration patterns, Options pattern, Logging patterns, HttpClientFactory patterns, Hosted Service patterns
  • [anti-patterns.md](references/anti-patterns.md) - Common mistakes with DI, configuration, options, logging, HttpClient, and hosted services
Read more
Ships withmanagedcode-dotnet-skills

Stop explaining .NET to your AI. Start building. We've all been there: asking Claude to use Entity Framework, only to get EF6 patterns in a .NET 8 project. Explaining to Copilot that Blazor Server and Blazor WebAssembly aren't the same thing.

Get the whole plugin

Other skills on managedcode-dotnet-skills.