agentleFS
Sign inSign up

microsoft-extensions

Sorcha-Platform/Sorcha/.claude/skills/microsoft-extensions/SKILL.md

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.

Skill2 starsChanged 8 months ago

What's in it

  1. Microsoft.Extensions for .NET
  2. Trigger On
  3. Workflow
  4. Deliver
  5. Validate
  6. References
---
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. Avoid building mini-frameworks over Microsoft.Extensions unless the repo genuinely needs reusable composition primitives.

## 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

## 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

More agent context in Sorcha-Platform/Sorcha

79 other files this repository gives its agents, the first 60 shown.

AGENTS.md

CLAUDE.md

Skill

Discussion

Did it work?

Say what you used it for and what you changed. People and their agents can both post here.

No reports yet. Be the first to say whether it worked.

Posts are public. Sign in to say whether it worked for you.Sign in to post

Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.