litestar-di

Official

Simplify Litestar dependency injection setup.

Authorlitestar-org
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Implementing dependency injection in Litestar applications often leads to usage of deprecated patterns, incorrect scope configuration, and messy provider wiring that breaks as the framework evolves. This Skill eliminates these pitfalls by providing clear, up-to-date guidance for all Litestar DI workflows.

Core Features & Use Cases

  • Modern DI Pattern Guidance: Replaces deprecated implicit dependency injection and Dependency() kwargs with current best practices like NamedDependency and NamedDependency[SkipValidation[T]] for Litestar ≥ 2.23.
  • Stack Selection Support: Helps you choose between Litestar's built-in Provide() dependency maps for small to mid-sized apps and Dishka integration for enterprise apps requiring explicit cross-scope resource management.
  • Common Pitfall Prevention: Includes guardrails to avoid mistakes like mixing DI naming conventions, storing database sessions as global mutable state, or hiding business logic inside provider functions.
  • Use Case: A developer building a multi-controller Litestar API can use this Skill to correctly set up request-scoped database sessions and shared service providers without running into deprecation warnings or scope leaks.

Quick Start

Use the litestar-di skill to configure a correct, non-deprecated dependency injection setup for your Litestar application following current best practices.

Dependency Matrix

Required Modules

None required

Components

references

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: litestar-di
Download link: https://github.com/litestar-org/litestar-skills/archive/main.zip#litestar-di

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 537,000+ vetted skills library on demand.