{"id":"6adee3bf-1daf-4597-81c0-d1c231334673","shortId":"tyn4Gc","kind":"skill","title":"dishka","tagline":"Use when editing Dishka dependency injection code, Provider, Scope, Container, FromDishka, Inject, DI scopes, providers, testing containers, or Litestar/FastAPI Dishka integrations.","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-05-18T19:07:36.256Z","embedding":null,"createdAt":"2026-04-23T13:03:58.844Z","updatedAt":"2026-05-18T19:07:36.256Z","lastSeenAt":"2026-05-18T19:07:36.256Z","tsv":"'/cofin/flow/blob/main/templates/styleguides/frameworks/dishka.md)':238 '/cofin/flow/blob/main/templates/styleguides/general.md)':234 '/cofin/flow/blob/main/templates/styleguides/languages/python.md)':242 '/en/stable/':198 '/en/stable/integrations/click.html':207 '/en/stable/integrations/fastapi.html':204 '/en/stable/integrations/litestar.html':201 '/project/dishka/':213 '/reagento/dishka/releases':210 'access':297 'alway':263,298,357 'annot':401 'app':261,344,383 'applic':314 'appprovid':154,192 'appropri':266 'around':36 'assign':379 'async':119,150,159,168,177,190 'async/sync':44,425 'asyncengin':165,183 'asyncsess':184,186 'avoid':269,294 'baselin':216 'best':88 'built':35 'cannot':345 'case':253 'check':336 'checkpoint':376 'class':153,171 'clean':85 'cli':54,114,126 'click':56,117 'code':8 'command':127 'concept':78 'configur':63 'connect':102 'consist':429 'consum':424 'contain':11,18,41,81,132,141,151,188,191,284,296,311,323,368,393 'control':94 'core':77 'correct':370,381,400 'creat':167 'creation':82,275 'db':162 'decor':121 'def':160,178 'depend':6,24,32,300,304,346,374,414 'detail':60,256 'di':14 'dishka':1,5,21,23,28,124,145,235 'dishka-pow':123 'dishka.readthedocs.io':197,200,203,206 'dishka.readthedocs.io/en/stable/':196 'dishka.readthedocs.io/en/stable/integrations/click.html':205 'dishka.readthedocs.io/en/stable/integrations/fastapi.html':202 'dishka.readthedocs.io/en/stable/integrations/litestar.html':199 'document':69 'duplic':226 'durat':290 'edg':252 'edit':4 'engin':163,169,182,187 'ensur':316,366 'exampl':64,138 'expect':421 'explicit':258 'factori':74,324,395 'fastapi':52,103 'focus':246 'follow':68 'framework':34,50,433 'fromdishka':12,113 'function':75 'general':230 'generic':221 'get':161,179 'github.com':209,233,237,241 'github.com/cofin/flow/blob/main/templates/styleguides/frameworks/dishka.md)':236 'github.com/cofin/flow/blob/main/templates/styleguides/general.md)':232 'github.com/cofin/flow/blob/main/templates/styleguides/languages/python.md)':240 'github.com/reagento/dishka/releases':208 'global':295,310,392 'guardrail':257 'guid':61 'hierarchi':80,338,405 'hint':360 'import':146 'index':58 'inject':7,13,25,33,95,111,120,301,333 'instanc':312 'integr':22,47,91,97,104,115,255 'keep':243 'language/framework':222 'leak':271 'level':110 'litestar':51,90 'litestar/fastapi':20 'live':279,286 'logic':315 'long':281 'make':149,189 'manag':259,330 'manual':99,389 'match':418 'method':325,396 'mock':133 'name':86 'narrow':351,410 'narrow-to-wid':409 'never':305 'object':274,276,307,334,339,348,386 'offici':194 'overrid':136 'overview':27 'pattern':84,129 'postgresql':170 'power':125 'practic':89 'principl':231 'provid':9,16,37,72,83,134,139,147,152,155,158,173,176,303,317,320,356,362,377,398,403,415,426 'pypi.org':212 'pypi.org/project/dishka/':211 'python':31,143,239 'reduc':225 'refer':57,65,71,195 'references/cli.md':116 'references/fastapi.md':105 'references/litestar.md':92 'references/providers.md':76 'references/testing.md':130 'request':262,293,353,384 'requestprovid':172,193 'resolut':100 'resolv':306,371,388 'resourc':270 'return':166,185,363,416 'rout':109 'route-level':108 'router':96 'rule':223 'scope':10,15,38,73,79,148,156,174,260,267,337,343,352,382,404,413 'scope.app':157,278 'scope.request':175,285 'self':164,181 'session':180 'setup':93,106,142 'share':214,218 'skill':26,229,245 'skill-dishka' 'source-cofin' 'specif':250 'state':327 'stateless':319 'strategi':137 'styleguid':215,219 'support':43 'target':432 'test':17,128,131 'tool':55,249 'tool-specif':248 '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':40,355,359,417,420 'unnecessari':273 'use':2,217,264,299,354,358,428 'valid':373,375,407 'valu':364 'web':49 'wide':412 'wider':342 'within':331 'workflow':45,251","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-05-18T19:07:36.256Z"}],"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-27T19:07:26Z","description":"Context-Driven Development toolkit for AI agents — spec-first planning, TDD workflow, and Beads integration.","skill_md_sha":"2a19d24f30be95333c7fc51c986c733f7dd1bc23","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":"Use when editing Dishka dependency injection code, Provider, Scope, Container, FromDishka, Inject, DI scopes, providers, testing containers, or Litestar/FastAPI Dishka integrations."},"skills_sh_url":"https://skills.sh/cofin/flow/dishka"},"updatedAt":"2026-05-18T19:07:36.256Z"}}