litestar-dependency-injection

Installation
SKILL.md

Dependency Injection

Execution Workflow

  1. Choose the contract to inject first: settings object, service, repository, session, current user, or request-derived value.
  2. Pick the narrowest scope that should own it: app, router, controller, or handler.
  3. Implement the provider as a callable wrapped in Provide, choosing async, sync, or generator form based on lifecycle needs.
  4. Keep the dependency key identical to the injected parameter name.
  5. Use overrides intentionally at lower scopes and in tests.
  6. Mark special cases with Dependency(...) when validation, defaults, or OpenAPI behavior need to be explicit.
  7. Verify cleanup behavior for generator dependencies and startup-time failure for missing explicit dependencies.

Core Rules

Installs
36
GitHub Stars
7
First Seen
Mar 2, 2026
litestar-dependency-injection — alti3/litestar-skills