microsoft-extensions-dependency-injection — Claude Code skill
A skill that tames service registrations in .NET: splits Program.cs into extension methods and helps you pick the right service lifetime.
npx skills add wshaddix/dotnet-skills --skill microsoft-extensions-dependency-injection -a claude-codeWhat microsoft-extensions-dependency-injection does
The skill covers registration patterns in Microsoft.Extensions.DependencyInjection built around extension methods on IServiceCollection. Instead of one long Program.cs you get a chain like AddUserServices().AddOrderServices().AddEmailServices(), each method owning one slice of the container. Singleton, Scoped and Transient lifetimes get the same treatment, along with decorators and service interception.
It also sets conventions: naming such as Add{Feature}Services(), Configure{Feature}() and Use{Feature}() for middleware, plus file placement — {Feature}ServiceCollectionExtensions.cs sits next to that feature's services. A testing section shows how to reuse production configuration inside WebApplicationFactory and override only what differs, like the email sender or the payment processor.
The payoff shows up on a team: fewer merge conflicts, visible boundaries between subsystems. Ordering is on you, though. When one module depends on another, calling AddEmailServices() before AddOrderServices() is the caller's job — the skill just says so plainly.
What it helps with
- split a bloated Program.cs into readable registration blocks
- choose between Singleton, Scoped and Transient without guessing
- reuse production DI configuration in integration tests
- hide a library's internal dependencies behind one Add* method
- agree on naming and file layout for registrations across a team
Example prompts for the agent
- Refactor the service registrations in Program.cs into Add*Services() extension methods
- Check the lifetimes of these services and flag any captive dependency
- Help me swap IEmailSender for a test double in WebApplicationFactory
How to install microsoft-extensions-dependency-injection
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill microsoft-extensions-dependency-injection -a claude-code2Manually: put the files in place
~/.claude/skills/microsoft-extensions-dependency-injection/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/microsoft-extensions-dependency-injection/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill microsoft-extensions-dependency-injection -a codex2Manually: put the files in place
.agents/skills/microsoft-extensions-dependency-injection/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill microsoft-extensions-dependency-injection -a cursor2Manually: put the files in place
.cursor/skills/microsoft-extensions-dependency-injection/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install wshaddix/dotnet-skills microsoft-extensions-dependency-injection2Manually: put the files in place
.github/skills/microsoft-extensions-dependency-injection/SKILL.md1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill microsoft-extensions-dependency-injection -a gemini-cli2Platform CLI
gemini skills install https://github.com/wshaddix/dotnet-skills --path skills/microsoft-extensions-dependency-injectionManually: put the files in place
.devin/skills/microsoft-extensions-dependency-injection/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill microsoft-extensions-dependency-injection -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about microsoft-extensions-dependency-injection
How do I install microsoft-extensions-dependency-injection in Claude?
Run npx skills add wshaddix/dotnet-skills --skill microsoft-extensions-dependency-injection -a claude-code. The skill file then lives at ~/.claude/skills/microsoft-extensions-dependency-injection/SKILL.md.
What does microsoft-extensions-dependency-injection do?
It walks through organizing .NET service registrations with IServiceCollection extension methods, and covers service lifetimes, decorators and interception.
Which platforms can install it?
Besides Claude, there are install commands for Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode, each with its own path to the skill file.