Skip to content
Skills Library
Programming · Building & coding

microsoft-extensions

/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 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.

Licence
MIT
Last repository change
26.10.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
4
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 26.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

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.

Original author 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.

How it works

  1. Trigger On
  2. Workflow
  3. Current Upstream Notes
  4. Deliver
  5. Validate
  6. References
Original SKILL.md headings · 44 lines, 386 words
SKILL.md preview
---
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
Files in this package (4)
  • SKILL.md 4 KB
  • manifest.json 1 KB
  • references/anti-patterns.md 16 KB
  • references/patterns.md 13 KB

Versions

The database has no other skills named microsoft-extensions.

Database snapshot: 13.11.2026 · package version 12e48f62d401 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100microsoft-extensions-ai
    Build provider-agnostic .NET AI integrations with `Microsoft.Extensions.AI`, `IChatClient`, embeddings, middleware, structured output, vector search, and evaluation. USE FOR: building or reviewing .NET code that uses Microsoft.Extensions.AI, Microsoft.Extensions.AI.Abstractions,…
  • 100worker-services
    Build long-running .NET background services with `BackgroundService`, Generic Host, graceful shutdown, configuration, logging, and deployment patterns suited to workers and daemons. USE FOR: background services; scheduled workers; hosted services; worker extraction; graceful…
  • 100devexpress-wpf-dependency-injection
    Adds dependency injection (Microsoft.Extensions.DependencyInjection, optionally the .NET Generic Host) to an existing DevExpress WPF application and moves its view models and services onto the container — composition root, registrations and lifetimes, {dxmvvm:Ioc} in XAML,…
  • 100configuring-dotnet-hosting
    Configure 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…
  • 100extensions-logging
    Guidance for Microsoft.Extensions.Logging and LoggerMessage source generators. USE FOR: ILogger abstraction, LoggerMessage source-generated logging, structured logging with event IDs, log filtering and configuration, high-performance logging patterns. DO NOT USE FOR:…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.