{"id":"6adee3bf-1daf-4597-81c0-d1c231334673","shortId":"tyn4Gc","kind":"skill","title":"dishka","tagline":"Auto-activate for dishka imports. Dishka dependency injection framework: Provider, Scope, Container, FromDishka, Inject. Use when: setting up DI containers, defining providers/scopes, or integrating dependency injection with Litestar or FastAPI. Produces Dishka DI container confi","description":"# Dishka Dependency Injection Skill\n\n## Overview\n\nDishka is a Python dependency injection framework built around Providers, Scopes, and typed containers. It supports async/sync workflows and integrates with web frameworks (Litestar, FastAPI) and CLI tools (Click).\n\n---\n\n<workflow>\n\n## References Index\n\nFor detailed guides and configuration examples, refer to the following documents in `references/`:\n\n- **[Providers, Scopes & Factory Functions](references/providers.md)**\n  - Core concepts, scope hierarchy, container creation, provider patterns, clean naming, and best practices.\n- **[Litestar Integration](references/litestar.md)**\n  - Setup, controller injection, router integration, and manual resolution from connection.\n- **[FastAPI Integration](references/fastapi.md)**\n  - Setup and route-level injection with FromDishka.\n- **[CLI Integration](references/cli.md)**\n  - Click with async_inject decorator for Dishka-powered CLI commands.\n- **[Testing Patterns](references/testing.md)**\n  - Test containers, mock providers, and override strategies.\n\n</workflow>\n\n<example>\n\n## Example: Provider and Container Setup\n\n```python\nfrom dishka import Provider, Scope, make_async_container, provide\n\nclass AppProvider(Provider):\n    scope = Scope.APP\n\n    @provide\n    async def get_db_engine(self) -> AsyncEngine:\n        return create_async_engine(\"postgresql+asyncpg://...\")\n\nclass RequestProvider(Provider):\n    scope = Scope.REQUEST\n\n    @provide\n    async def get_session(self, engine: AsyncEngine) -> AsyncSession:\n        return AsyncSession(engine)\n\ncontainer = make_async_container(AppProvider(), RequestProvider())\n```\n\n</example>\n\n---\n\n## Official References\n\n- <https://dishka.readthedocs.io/en/stable/>\n- <https://dishka.readthedocs.io/en/stable/integrations/litestar.html>\n- <https://dishka.readthedocs.io/en/stable/integrations/fastapi.html>\n- <https://dishka.readthedocs.io/en/stable/integrations/click.html>\n- <https://github.com/reagento/dishka/releases>\n- <https://pypi.org/project/dishka/>\n\n## Shared Styleguide Baseline\n\n- Use shared styleguides for generic language/framework rules to reduce duplication in this skill.\n- [General Principles](https://github.com/cofin/flow/blob/main/templates/styleguides/general.md)\n- [Dishka](https://github.com/cofin/flow/blob/main/templates/styleguides/frameworks/dishka.md)\n- [Python](https://github.com/cofin/flow/blob/main/templates/styleguides/languages/python.md)\n- Keep this skill focused on tool-specific workflows, edge cases, and integration details.\n\n<guardrails>\n## Guardrails\n\n- **Explicitly manage Scopes (APP, REQUEST)** -- Always use the appropriate scope to avoid resource leaks or unnecessary object creation. Objects in `Scope.APP` live as long as the container; `Scope.REQUEST` lives only for the duration of a request.\n- **Avoid global container access** -- Always use dependency injection to provide dependencies; never resolve objects from a global container instance in application logic.\n- **Ensure Providers are stateless** -- Providers should only contain factory methods; any state should be managed within the injected objects themselves.\n- **Check scope hierarchy** -- Objects in a wider scope (APP) cannot depend on objects in a narrower scope (REQUEST).\n- **Use typed providers** -- Always use type hints for provider return values to ensure the container can correctly resolve and validate dependencies.\n</guardrails>\n\n<validation>\n## Validation Checkpoint\n\n- [ ] Providers are assigned the correct `Scope` (APP, REQUEST)\n- [ ] No objects are resolved manually from a global container\n- [ ] All factory methods in providers are correctly annotated with `@provide`\n- [ ] Scope hierarchy is valid (no narrow-to-wide scope dependencies)\n- [ ] Provider return types match the types expected by the consumers\n- [ ] Async/sync providers are used consistently with the target framework\n</validation>","tags":["dishka","flow","cofin","agent-skills","ai-agents","beads","claude-code","codex","cursor","developer-tools","gemini-cli","opencode"],"capabilities":["skill","source-cofin","skill-dishka","topic-agent-skills","topic-ai-agents","topic-beads","topic-claude-code","topic-codex","topic-cursor","topic-developer-tools","topic-gemini-cli","topic-opencode","topic-plugin","topic-slash-commands","topic-spec-driven-development"],"categories":["flow"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/cofin/flow/dishka","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add cofin/flow","source_repo":"https://github.com/cofin/flow","install_from":"skills.sh"}},"qualityScore":"0.455","qualityRationale":"deterministic score 0.46 from registry signals: · indexed on github topic:agent-skills · 11 github stars · SKILL.md body (3,884 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-04-24T01:03:26.090Z","embedding":null,"createdAt":"2026-04-23T13:03:58.844Z","updatedAt":"2026-04-24T01:03:26.090Z","lastSeenAt":"2026-04-24T01:03:26.090Z","tsv":"'/cofin/flow/blob/main/templates/styleguides/frameworks/dishka.md)':253 '/cofin/flow/blob/main/templates/styleguides/general.md)':249 '/cofin/flow/blob/main/templates/styleguides/languages/python.md)':257 '/en/stable/':213 '/en/stable/integrations/click.html':222 '/en/stable/integrations/fastapi.html':219 '/en/stable/integrations/litestar.html':216 '/project/dishka/':228 '/reagento/dishka/releases':225 'access':312 'activ':4 'alway':278,313,372 'annot':416 'app':276,359,398 'applic':329 'appprovid':169,207 'appropri':281 'around':51 'assign':394 'async':134,165,174,183,192,205 'async/sync':59,440 'asyncengin':180,198 'asyncsess':199,201 'auto':3 'auto-activ':2 'avoid':284,309 'baselin':231 'best':103 'built':50 'cannot':360 'case':268 'check':351 'checkpoint':391 'class':168,186 'clean':100 'cli':69,129,141 'click':71,132 'command':142 'concept':93 'confi':37 'configur':78 'connect':117 'consist':444 'consum':439 'contain':14,22,36,56,96,147,156,166,203,206,299,311,326,338,383,408 'control':109 'core':92 'correct':385,396,415 'creat':182 'creation':97,290 'db':177 'decor':136 'def':175,193 'defin':23 'depend':9,27,39,47,315,319,361,389,429 'detail':75,271 'di':21,35 'dishka':1,6,8,34,38,43,139,160,250 'dishka-pow':138 'dishka.readthedocs.io':212,215,218,221 'dishka.readthedocs.io/en/stable/':211 'dishka.readthedocs.io/en/stable/integrations/click.html':220 'dishka.readthedocs.io/en/stable/integrations/fastapi.html':217 'dishka.readthedocs.io/en/stable/integrations/litestar.html':214 'document':84 'duplic':241 'durat':305 'edg':267 'engin':178,184,197,202 'ensur':331,381 'exampl':79,153 'expect':436 'explicit':273 'factori':89,339,410 'fastapi':32,67,118 'focus':261 'follow':83 'framework':11,49,65,448 'fromdishka':15,128 'function':90 'general':245 'generic':236 'get':176,194 'github.com':224,248,252,256 'github.com/cofin/flow/blob/main/templates/styleguides/frameworks/dishka.md)':251 'github.com/cofin/flow/blob/main/templates/styleguides/general.md)':247 'github.com/cofin/flow/blob/main/templates/styleguides/languages/python.md)':255 'github.com/reagento/dishka/releases':223 'global':310,325,407 'guardrail':272 'guid':76 'hierarchi':95,353,420 'hint':375 'import':7,161 'index':73 'inject':10,16,28,40,48,110,126,135,316,348 'instanc':327 'integr':26,62,106,112,119,130,270 'keep':258 'language/framework':237 'leak':286 'level':125 'litestar':30,66,105 'live':294,301 'logic':330 'long':296 'make':164,204 'manag':274,345 'manual':114,404 'match':433 'method':340,411 'mock':148 'name':101 'narrow':366,425 'narrow-to-wid':424 'never':320 'object':289,291,322,349,354,363,401 'offici':209 'overrid':151 'overview':42 'pattern':99,144 'postgresql':185 'power':140 'practic':104 'principl':246 'produc':33 'provid':12,52,87,98,149,154,162,167,170,173,188,191,318,332,335,371,377,392,413,418,430,441 'providers/scopes':24 'pypi.org':227 'pypi.org/project/dishka/':226 'python':46,158,254 'reduc':240 'refer':72,80,86,210 'references/cli.md':131 'references/fastapi.md':120 'references/litestar.md':107 'references/providers.md':91 'references/testing.md':145 'request':277,308,368,399 'requestprovid':187,208 'resolut':115 'resolv':321,386,403 'resourc':285 'return':181,200,378,431 'rout':124 'route-level':123 'router':111 'rule':238 'scope':13,53,88,94,163,171,189,275,282,352,358,367,397,419,428 'scope.app':172,293 'scope.request':190,300 'self':179,196 'session':195 'set':19 'setup':108,121,157 'share':229,233 'skill':41,244,260 'skill-dishka' 'source-cofin' 'specif':265 'state':342 'stateless':334 'strategi':152 'styleguid':230,234 'support':58 'target':447 'test':143,146 'tool':70,264 'tool-specif':263 'topic-agent-skills' 'topic-ai-agents' 'topic-beads' 'topic-claude-code' 'topic-codex' 'topic-cursor' 'topic-developer-tools' 'topic-gemini-cli' 'topic-opencode' 'topic-plugin' 'topic-slash-commands' 'topic-spec-driven-development' 'type':55,370,374,432,435 'unnecessari':288 'use':17,232,279,314,369,373,443 'valid':388,390,422 'valu':379 'web':64 'wide':427 'wider':357 'within':346 'workflow':60,266","prices":[{"id":"a565edc7-9afc-4d0a-93fe-166196b44961","listingId":"6adee3bf-1daf-4597-81c0-d1c231334673","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"cofin","category":"flow","install_from":"skills.sh"},"createdAt":"2026-04-23T13:03:58.844Z"}],"sources":[{"listingId":"6adee3bf-1daf-4597-81c0-d1c231334673","source":"github","sourceId":"cofin/flow/dishka","sourceUrl":"https://github.com/cofin/flow/tree/main/skills/dishka","isPrimary":false,"firstSeenAt":"2026-04-23T13:03:58.844Z","lastSeenAt":"2026-04-24T01:03:26.090Z"}],"details":{"listingId":"6adee3bf-1daf-4597-81c0-d1c231334673","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"cofin","slug":"dishka","github":{"repo":"cofin/flow","stars":11,"topics":["agent-skills","ai-agents","beads","claude-code","codex","context-driven-development","cursor","developer-tools","gemini-cli","opencode","plugin","slash-commands","spec-driven-development","subagents","tdd","workflow"],"license":"apache-2.0","html_url":"https://github.com/cofin/flow","pushed_at":"2026-04-19T23:22:27Z","description":"Context-Driven Development toolkit for AI agents — spec-first planning, TDD workflow, and Beads integration.","skill_md_sha":"94eebf60c36b290bd34ef7ee55784d7eac4c6729","skill_md_path":"skills/dishka/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/cofin/flow/tree/main/skills/dishka"},"layout":"multi","source":"github","category":"flow","frontmatter":{"name":"dishka","description":"Auto-activate for dishka imports. Dishka dependency injection framework: Provider, Scope, Container, FromDishka, Inject. Use when: setting up DI containers, defining providers/scopes, or integrating dependency injection with Litestar or FastAPI. Produces Dishka DI container configurations with providers, scopes, and framework integrations. Not for manual dependency injection or other DI frameworks."},"skills_sh_url":"https://skills.sh/cofin/flow/dishka"},"updatedAt":"2026-04-24T01:03:26.090Z"}}