
Microsoft Extensions Dependency Injection
Shows you how to organize Microsoft.Extensions.DependencyInjection registrations so your Program.cs doesn't turn into a 200-line mess. The pattern is simple: group related services into extension methods like AddUserServices() or AddEmailServices(), keep them near the code they register, and compose them at startup. The real win is testing. When your production config is a set of composable methods, your WebApplicationFactory tests can call the same AddOrderServices() that production uses and only swap out the email sender or payment processor. Covers naming conventions, file organization, and handling configuration binding. If you've ever had merge conflicts in Startup.cs or copied service registrations into test fixtures, this solves that.
- skills.sh installs
- 552
- GitHub stars
- 90
- last updated
- Aug 21, 2026
Install
$ npx -y skills add wshaddix/dotnet-skills --skill microsoft-extensions-dependency-injection --agent claude-codeInstalls into .claude/skills of the current project.
Files
Dependency Injection Patterns
When to Use This Skill
Use this skill when:
- Organizing service registrations in ASP.NET Core applications
- Avoiding massive Program.cs/Startup.cs files with hundreds of registrations
- Making service configuration reusable between production and tests
- Designing libraries that integrate with Microsoft.Extensions.DependencyInjection
The Problem
Without organization, Program.cs becomes unmanageable:
// BAD: 200+ lines of unorganized registrations
var builder = WebApplication.CreateBuilder(args);
Sponsors
Details
- Repository
- github.com/wshaddix/dotnet-skills
- Category
- .NET & C#
- First seen
- Jun 3, 2026