{"id":"0ecedb3c-49c4-4593-b1e1-0ad2403c9469","shortId":"qb3BPx","kind":"skill","title":"android-di-hilt","tagline":"Wire Android dependency injection with Hilt, scopes, testing overrides, and module ownership boundaries.","description":"# Android DI Hilt\n\n## When To Use\n- Use this skill when the request is about: android hilt setup, inject viewmodel repository hilt, scope dependency in android.\n- Primary outcome: Wire Android dependency injection with Hilt, scopes, testing overrides, and module ownership boundaries.\n- Reach for this skill when the hard part is component ownership, bindings, scopes, entry points, or test replacement. If the request is only about networking APIs or reducer design, use the neighboring skill instead.\n- Handoff skills when the scope expands:\n- `android-testing-unit`\n- `android-networking-retrofit-okhttp`\n\n## Workflow\n1. Identify the injection boundary first: app-wide singleton, activity-retained, ViewModel, worker, service, or entry point from unsupported framework code.\n2. Decide what should be bound: constructor injection, `@Binds`, `@Provides`, qualifiers, multibindings, or assisted injection.\n3. Match lifetime to scope explicitly so dependencies do not outlive their owner or rebuild too often.\n4. Verify replacement strategy for tests with Hilt test modules, uninstall modules, or fakes at the right component boundary.\n5. Hand off API-specific or architectural questions only after the DI graph ownership is correct.\n\n## Guardrails\n- Prefer constructor injection for app code you own.\n- Use qualifiers and scope annotations deliberately; ambiguous bindings are a graph smell, not a convenience.\n- Keep Hilt modules close to the ownership boundary they configure.\n- Treat test replacement as part of the design, not an afterthought.\n\n## Anti-Patterns\n- Making everything `@Singleton` to silence scope questions.\n- Hiding business construction logic inside giant `@Provides` methods when constructor injection would suffice.\n- Using Hilt modules as a dumping ground for unrelated bindings across modules.\n- Confusing DI graph ownership with app architecture ownership.\n\n## Review Focus\n- Component and scope alignment.\n- Binding style and qualifier clarity.\n- Unsupported-entry-point bridges and test replacement strategy.\n- Module ownership boundaries across features and core code.\n\n## Examples\n### Happy path\n- Scenario: Inject OrbitTasks repositories and dispatchers with clear Hilt scopes.\n- Command: `cd examples/orbittasks-compose && ./gradlew :app:testDebugUnitTest`\n\n### Edge case\n- Scenario: Swap fake dependencies in the XML fixture for deterministic tests.\n- Command: `cd examples/orbittasks-xml && ./gradlew :app:testDebugUnitTest`\n\n### Failure recovery\n- Scenario: Catch DI-specific prompts before they drift into architecture-clean or networking.\n- Command: `python3 scripts/eval_triggers.py --skill android-di-hilt`\n\n## Done Checklist\n- Component lifetime matches dependency lifetime.\n- Binding style is explicit and testable.\n- Test overrides or fakes are planned at the right graph boundary.\n- Non-DI work is handed off instead of buried in modules.\n\n## Official References\n- [https://developer.android.com/training/dependency-injection/hilt-android](https://developer.android.com/training/dependency-injection/hilt-android)\n- [https://developer.android.com/training/dependency-injection/hilt-testing](https://developer.android.com/training/dependency-injection/hilt-testing)\n- [https://developer.android.com/training/dependency-injection/hilt-multi-module](https://developer.android.com/training/dependency-injection/hilt-multi-module)\n- [https://developer.android.com/topic/libraries/architecture/viewmodel](https://developer.android.com/topic/libraries/architecture/viewmodel)\n- [https://developer.android.com/training/dependency-injection/manual](https://developer.android.com/training/dependency-injection/manual)","tags":["android","hilt","agent","skills","krutikjain","agent-skills","android-development","android-skills","androidx","claude-code","codex","cursor"],"capabilities":["skill","source-krutikjain","skill-android-di-hilt","topic-agent-skills","topic-android","topic-android-development","topic-android-skills","topic-androidx","topic-claude-code","topic-codex","topic-cursor","topic-jetpack-compose","topic-kotlin","topic-skills"],"categories":["android-agent-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/krutikJain/android-agent-skills/android-di-hilt","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add krutikJain/android-agent-skills","source_repo":"https://github.com/krutikJain/android-agent-skills","install_from":"skills.sh"}},"qualityScore":"0.454","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 8 github stars · SKILL.md body (3,650 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:27.217Z","embedding":null,"createdAt":"2026-05-18T13:20:49.485Z","updatedAt":"2026-05-18T19:13:27.217Z","lastSeenAt":"2026-05-18T19:13:27.217Z","tsv":"'/gradlew':331,350 '/topic/libraries/architecture/viewmodel](https://developer.android.com/topic/libraries/architecture/viewmodel)':427 '/training/dependency-injection/hilt-android](https://developer.android.com/training/dependency-injection/hilt-android)':418 '/training/dependency-injection/hilt-multi-module](https://developer.android.com/training/dependency-injection/hilt-multi-module)':424 '/training/dependency-injection/hilt-testing](https://developer.android.com/training/dependency-injection/hilt-testing)':421 '/training/dependency-injection/manual](https://developer.android.com/training/dependency-injection/manual)':430 '1':108 '2':131 '3':146 '4':163 '5':182 'across':277,310 'activ':119 'activity-retain':118 'afterthought':243 'align':292 'ambigu':214 'android':2,6,18,32,42,46,99,103,375 'android-di-hilt':1,374 'android-networking-retrofit-okhttp':102 'android-testing-unit':98 'annot':212 'anti':245 'anti-pattern':244 'api':83,186 'api-specif':185 'app':115,204,284,332,351 'app-wid':114 'architectur':189,285,366 'architecture-clean':365 'assist':144 'bind':69,139,215,276,293,385 'bound':136 'boundari':17,57,112,181,230,309,401 'bridg':302 'buri':411 'busi':255 'case':335 'catch':356 'cd':329,348 'checklist':379 'clariti':297 'clean':367 'clear':325 'close':226 'code':130,205,314 'command':328,347,370 'compon':67,180,289,380 'configur':232 'confus':279 'construct':256 'constructor':137,201,263 'conveni':222 'core':313 'correct':198 'decid':132 'deliber':213 'depend':7,40,47,153,339,383 'design':86,240 'determinist':345 'developer.android.com':417,420,423,426,429 'developer.android.com/topic/libraries/architecture/viewmodel](https://developer.android.com/topic/libraries/architecture/viewmodel)':425 'developer.android.com/training/dependency-injection/hilt-android](https://developer.android.com/training/dependency-injection/hilt-android)':416 'developer.android.com/training/dependency-injection/hilt-multi-module](https://developer.android.com/training/dependency-injection/hilt-multi-module)':422 'developer.android.com/training/dependency-injection/hilt-testing](https://developer.android.com/training/dependency-injection/hilt-testing)':419 'developer.android.com/training/dependency-injection/manual](https://developer.android.com/training/dependency-injection/manual)':428 'di':3,19,194,280,358,376,404 'di-specif':357 'dispatch':323 'done':378 'drift':363 'dump':272 'edg':334 'entri':71,125,300 'everyth':248 'exampl':315 'examples/orbittasks-compose':330 'examples/orbittasks-xml':349 'expand':97 'explicit':151,388 'failur':353 'fake':176,338,394 'featur':311 'first':113 'fixtur':343 'focus':288 'framework':129 'giant':259 'graph':195,218,281,400 'ground':273 'guardrail':199 'hand':183,407 'handoff':92 'happi':316 'hard':64 'hide':254 'hilt':4,10,20,33,38,50,170,224,268,326,377 'identifi':109 'inject':8,35,48,111,138,145,202,264,319 'insid':258 'instead':91,409 'keep':223 'lifetim':148,381,384 'logic':257 'make':247 'match':147,382 'method':261 'modul':15,55,172,174,225,269,278,307,413 'multibind':142 'neighbor':89 'network':82,104,369 'non':403 'non-di':402 'offici':414 'often':162 'okhttp':106 'orbittask':320 'outcom':44 'outliv':156 'overrid':13,53,392 'owner':158 'ownership':16,56,68,196,229,282,286,308 'part':65,237 'path':317 'pattern':246 'plan':396 'point':72,126,301 'prefer':200 'primari':43 'prompt':360 'provid':140,260 'python3':371 'qualifi':141,209,296 'question':190,253 'reach':58 'rebuild':160 'recoveri':354 'reduc':85 'refer':415 'replac':75,165,235,305 'repositori':37,321 'request':29,78 'retain':120 'retrofit':105 'review':287 'right':179,399 'scenario':318,336,355 'scope':11,39,51,70,96,150,211,252,291,327 'scripts/eval_triggers.py':372 'servic':123 'setup':34 'silenc':251 'singleton':117,249 'skill':26,61,90,93,373 'skill-android-di-hilt' 'smell':219 'source-krutikjain' 'specif':187,359 'strategi':166,306 'style':294,386 'suffic':266 'swap':337 'test':12,52,74,100,168,171,234,304,346,391 'testabl':390 'testdebugunittest':333,352 'topic-agent-skills' 'topic-android' 'topic-android-development' 'topic-android-skills' 'topic-androidx' 'topic-claude-code' 'topic-codex' 'topic-cursor' 'topic-jetpack-compose' 'topic-kotlin' 'topic-skills' 'treat':233 'uninstal':173 'unit':101 'unrel':275 'unsupport':128,299 'unsupported-entry-point':298 'use':23,24,87,208,267 'verifi':164 'viewmodel':36,121 'wide':116 'wire':5,45 'work':405 'worker':122 'workflow':107 'would':265 'xml':342","prices":[{"id":"797af8b3-b9e8-4d82-aed9-5ccc91e33c83","listingId":"0ecedb3c-49c4-4593-b1e1-0ad2403c9469","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"krutikJain","category":"android-agent-skills","install_from":"skills.sh"},"createdAt":"2026-05-18T13:20:49.485Z"}],"sources":[{"listingId":"0ecedb3c-49c4-4593-b1e1-0ad2403c9469","source":"github","sourceId":"krutikJain/android-agent-skills/android-di-hilt","sourceUrl":"https://github.com/krutikJain/android-agent-skills/tree/main/skills/android-di-hilt","isPrimary":false,"firstSeenAt":"2026-05-18T13:20:49.485Z","lastSeenAt":"2026-05-18T19:13:27.217Z"}],"details":{"listingId":"0ecedb3c-49c4-4593-b1e1-0ad2403c9469","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"krutikJain","slug":"android-di-hilt","github":{"repo":"krutikJain/android-agent-skills","stars":8,"topics":["agent-skills","android","android-development","android-skills","androidx","claude-code","codex","cursor","jetpack-compose","kotlin","skills"],"license":"mit","html_url":"https://github.com/krutikJain/android-agent-skills","pushed_at":"2026-03-25T05:47:20Z","description":"Android skills repository for Kotlin, Compose, XML, testing, CI, release work, and legacy upgrades","skill_md_sha":"39d876beb1db4346bef3b3d2ef960127202fb568","skill_md_path":"skills/android-di-hilt/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/krutikJain/android-agent-skills/tree/main/skills/android-di-hilt"},"layout":"multi","source":"github","category":"android-agent-skills","frontmatter":{"name":"android-di-hilt","description":"Wire Android dependency injection with Hilt, scopes, testing overrides, and module ownership boundaries."},"skills_sh_url":"https://skills.sh/krutikJain/android-agent-skills/android-di-hilt"},"updatedAt":"2026-05-18T19:13:27.217Z"}}