shiny-di

Automate .NET dependency injection registration with attribute-driven source generators.

4|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/shinyorg/skills --skill shiny-di
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shiny-di
Source: https://github.com/shinyorg/skills/tree/main/skills/shiny-di
Command: npx skills add https://github.com/shinyorg/skills --skill shiny-di

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill simplifies and automates the process of registering dependency injection services in .NET applications, reducing boilerplate code and improving maintainability through attribute-driven configuration and source generation.

Core Features & Use Cases

  • Attribute-Driven Registration: Define service lifetimes (Singleton, Scoped, Transient) and registration options directly on your service classes using attributes.
  • Source Generation: Automatically generates DI registration code, eliminating manual setup and potential errors.
  • Advanced Configuration: Supports keyed services, categories for conditional registration, and multi-interface registration.
  • Use Case: Quickly set up a complex service architecture in a new .NET project by marking services with attributes and letting the source generator handle the IServiceCollection configuration.

Quick Start

Configure your .NET application to use Shiny DI by adding the AddShinyServiceRegistry() method to your service collection setup.

Frequently Asked Questions about shiny-di

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate .NET dependency injection service registration to reduce boilerplate?

You can automate .NET dependency injection registration by using attribute-driven source generators that automatically generate the IServiceCollection configuration code, eliminating manual setup. This approach reduces boilerplate by placing attributes directly on service classes.

What is attribute-driven dependency injection and how does source generation handle service lifetimes?

Attribute-driven dependency injection allows you to define service lifetimes like Singleton, Scoped, or Transient directly on classes. Source generation then automatically produces the registration code based on these attributes.

How do I configure keyed services and multi-interface registration in .NET dependency injection?

Keyed services and multi-interface registration are configured by applying specific DI attributes to your service classes. The source generator processes these attributes to automatically generate the necessary multi-interface and keyed service registrations.

Do I need the Shiny Extensions package to use source generators for .NET dependency injection?

Yes, you need the Shiny.Extensions.DependencyInjection package. You must also call the AddShinyServiceRegistry method in your service collection setup to activate and apply the generated dependency injection registrations.

Can I use categories for conditional service registration in my .NET project?

Yes, categories are supported for conditional service registration. By assigning categories through attributes on your service classes, the source generator applies conditional logic during the dependency injection setup process.

What is the best way to set up a complex service architecture in a new .NET project without manual DI errors?

The best way is to mark services with attributes for lifetime and configuration, letting the source generator handle the IServiceCollection setup automatically. This eliminates manual registration errors and significantly reduces boilerplate code.