{"id":"86b7f620-2e42-4b07-b1d3-ef4b3f7d2433","shortId":"fagGZE","kind":"skill","title":"litestar-di","tagline":"Auto-activate for Provide, dependencies=, dependency maps, litestar.di, scoped providers, Dishka FromDishka, Inject, provider modules, or request/session/app scope wiring. Use when wiring Litestar dependencies, service factories, app state dependencies, or external DI integration","description":"# Litestar Dependency Injection\n\nUse this skill for `Provide`, dependency maps, provider factories, request-scoped resources, and Dishka integration.\n\n## Code Style Rules\n\n- Use Litestar dependency maps for simple and medium apps.\n- Use Dishka when the project needs explicit scopes and provider modules.\n- Keep provider names stable and descriptive.\n- Do not open request-scoped resources at import time.\n\n## Quick Reference\n\n- DI patterns: [di.md](references/di.md)\n- Pair with [litestar-data-services](../litestar-data-services/SKILL.md) for service providers.\n- Pair with [litestar-settings](../litestar-settings/SKILL.md) for settings injection.\n\n<workflow>\n\n## Workflow\n\n1. Identify whether the dependency is app, request, transaction, or function scoped.\n2. Choose built-in dependency maps or the existing DI framework.\n3. Register providers at the narrowest useful scope.\n4. Inject dependencies by name or type according to the chosen stack.\n\n</workflow>\n\n<guardrails>\n\n## Guardrails\n\n- Do not introduce Dishka for one or two simple providers.\n- Do not mix dependency naming conventions in one app.\n- Do not keep database sessions or clients as global mutable state.\n- Do not hide business logic inside providers.\n\n</guardrails>\n\n<validation>\n\n## Validation Checkpoint\n\n- [ ] Dependency scope is explicit.\n- [ ] Providers are async when they manage async resources.\n- [ ] Tests can override providers cleanly.\n- [ ] Provider wiring matches the app's existing DI style.\n\n</validation>\n\n<example>\n\n## Example\n\n```python\nfrom litestar.di import Provide\n\nasync def provide_user_service(db_session: AsyncSession) -> UserService:\n    return UserService(session=db_session)\n\ndependencies = {\"users_service\": Provide(provide_user_service)}\n```\n\n</example>\n\n## References Index\n\n- [di.md](references/di.md)\n\n## Official References\n\n- <https://docs.litestar.dev/> - Litestar documentation\n- <https://docs.litestar.dev/latest/reference/> - Litestar API reference\n\n## Shared Styleguide Baseline\n\n- [General](../litestar-styleguide/references/general.md)\n- [Python](../litestar-styleguide/references/python.md)\n- [Litestar](../litestar-styleguide/references/litestar.md)","tags":["litestar","skills","litestar-org","advanced-alchemy","agent-skills","agentskills","ai-agents","claude-code-plugin","claude-code-skills","gemini-cli-extension","htmx","inertia"],"capabilities":["skill","source-litestar-org","skill-litestar-di","topic-advanced-alchemy","topic-agent-skills","topic-agentskills","topic-ai-agents","topic-claude-code-plugin","topic-claude-code-skills","topic-gemini-cli-extension","topic-htmx","topic-inertia","topic-litestar","topic-mcp","topic-python"],"categories":["litestar-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/litestar-org/litestar-skills/litestar-di","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add litestar-org/litestar-skills","source_repo":"https://github.com/litestar-org/litestar-skills","install_from":"skills.sh"}},"qualityScore":"0.453","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 7 github stars · SKILL.md body (2,165 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:13:53.620Z","embedding":null,"createdAt":"2026-05-18T13:20:56.917Z","updatedAt":"2026-05-18T19:13:53.620Z","lastSeenAt":"2026-05-18T19:13:53.620Z","tsv":"'/latest/reference/':270 '/litestar-data-services/skill.md':108 '/litestar-settings/skill.md':117 '/litestar-styleguide/references/general.md':278 '/litestar-styleguide/references/litestar.md':282 '/litestar-styleguide/references/python.md':280 '1':122 '2':134 '3':146 '4':154 'accord':161 'activ':6 'api':272 'app':31,68,128,185,227 'async':212,216,238 'asyncsess':245 'auto':5 'auto-activ':4 'baselin':276 'built':137 'built-in':136 'busi':200 'checkpoint':205 'choos':135 'chosen':164 'clean':222 'client':192 'code':57 'convent':182 'data':106 'databas':189 'db':243,250 'def':239 'depend':9,10,28,33,39,46,62,126,139,156,180,206,252 'descript':85 'di':3,36,98,144,230 'di.md':100,261 'dishka':15,55,70,170 'docs.litestar.dev':265,269 'docs.litestar.dev/latest/reference/':268 'document':267 'exampl':232 'exist':143,229 'explicit':75,209 'extern':35 'factori':30,49 'framework':145 'fromdishka':16 'function':132 'general':277 'global':194 'guardrail':166 'hide':199 'identifi':123 'import':94,236 'index':260 'inject':17,40,120,155 'insid':202 'integr':37,56 'introduc':169 'keep':80,188 'litestar':2,27,38,61,105,115,266,271,281 'litestar-data-servic':104 'litestar-di':1 'litestar-set':114 'litestar.di':12,235 'logic':201 'manag':215 'map':11,47,63,140 'match':225 'medium':67 'mix':179 'modul':19,79 'mutabl':195 'name':82,158,181 'narrowest':151 'need':74 'offici':263 'one':172,184 'open':88 'overrid':220 'pair':102,112 'pattern':99 'project':73 'provid':8,14,18,45,48,78,81,111,148,176,203,210,221,223,237,240,255,256 'python':233,279 'quick':96 'refer':97,259,264,273 'references/di.md':101,262 'regist':147 'request':51,90,129 'request-scop':50,89 'request/session/app':21 'resourc':53,92,217 'return':247 'rule':59 'scope':13,22,52,76,91,133,153,207 'servic':29,107,110,242,254,258 'session':190,244,249,251 'set':116,119 'share':274 'simpl':65,175 'skill':43 'skill-litestar-di' 'source-litestar-org' 'stabl':83 'stack':165 'state':32,196 'style':58,231 'styleguid':275 'test':218 'time':95 'topic-advanced-alchemy' 'topic-agent-skills' 'topic-agentskills' 'topic-ai-agents' 'topic-claude-code-plugin' 'topic-claude-code-skills' 'topic-gemini-cli-extension' 'topic-htmx' 'topic-inertia' 'topic-litestar' 'topic-mcp' 'topic-python' 'transact':130 'two':174 'type':160 'use':24,41,60,69,152 'user':241,253,257 'userservic':246,248 'valid':204 'whether':124 'wire':23,26,224 'workflow':121","prices":[{"id":"fc4b416e-676b-4bf7-af1e-f9e072d2eb35","listingId":"86b7f620-2e42-4b07-b1d3-ef4b3f7d2433","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"litestar-org","category":"litestar-skills","install_from":"skills.sh"},"createdAt":"2026-05-18T13:20:56.917Z"}],"sources":[{"listingId":"86b7f620-2e42-4b07-b1d3-ef4b3f7d2433","source":"github","sourceId":"litestar-org/litestar-skills/litestar-di","sourceUrl":"https://github.com/litestar-org/litestar-skills/tree/main/skills/litestar-di","isPrimary":false,"firstSeenAt":"2026-05-18T13:20:56.917Z","lastSeenAt":"2026-05-18T19:13:53.620Z"}],"details":{"listingId":"86b7f620-2e42-4b07-b1d3-ef4b3f7d2433","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"litestar-org","slug":"litestar-di","github":{"repo":"litestar-org/litestar-skills","stars":7,"topics":["advanced-alchemy","agent-skills","agentskills","ai-agents","claude-code-plugin","claude-code-skills","gemini-cli-extension","htmx","inertia","litestar","mcp","python","sqlspec"],"license":"mit","html_url":"https://github.com/litestar-org/litestar-skills","pushed_at":"2026-05-13T16:04:09Z","description":"Opinionated first-party agent skills, plugins, subagents, slash commands, and MCP servers for the Litestar framework ecosystem — publishable to Claude Code, Gemini CLI, Codex CLI, Cursor, OpenCode, and VS Code/Copilot from a single repo.","skill_md_sha":"bce7ed6d50894e9198c83dc658e448fe1aee92ba","skill_md_path":"skills/litestar-di/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/litestar-org/litestar-skills/tree/main/skills/litestar-di"},"layout":"multi","source":"github","category":"litestar-skills","frontmatter":{"name":"litestar-di","description":"Auto-activate for Provide, dependencies=, dependency maps, litestar.di, scoped providers, Dishka FromDishka, Inject, provider modules, or request/session/app scope wiring. Use when wiring Litestar dependencies, service factories, app state dependencies, or external DI integration. Not for plain function parameters or unrelated IoC containers."},"skills_sh_url":"https://skills.sh/litestar-org/litestar-skills/litestar-di"},"updatedAt":"2026-05-18T19:13:53.620Z"}}