AN

android-di-hilt

A guide for implementing and testing Android dependency injection using Hilt.

Install

mkdir -p .claude/skills/android-di-hilt && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/12301" && unzip -o skill.zip -d .claude/skills/android-di-hilt && rm skill.zip

Installs to .claude/skills/android-di-hilt

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Wire Android dependency injection with Hilt, scopes, testing overrides, and module ownership boundaries.
104 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Set up Hilt for dependency injection in Android projects
  • Define component and scope alignment for dependencies
  • Implement constructor injection, `@Binds`, `@Provides`, and qualifiers
  • Manage lifetime of dependencies with explicit scopes
  • Verify replacement strategies for tests using Hilt test modules

How it works

The skill configures Hilt-based dependency injection in Android projects by identifying injection boundaries, defining bindings, matching lifetimes to scopes, and verifying test replacement strategies. It focuses on component ownership and graph correctness.

Inputs & outputs

You give it
Android project requiring dependency injection setup or modification
You get back
Configured Hilt dependency injection graph with appropriate scopes, bindings, and test overrides

When to use android-di-hilt

  • Set up Hilt in Android project
  • Scope repository in ViewModel
  • Override dependencies for testing
  • Define Hilt modules

About this skill

Android DI Hilt

When To Use

  • Use this skill when the request is about: android hilt setup, inject viewmodel repository hilt, scope dependency in android.
  • Primary outcome: Wire Android dependency injection with Hilt, scopes, testing overrides, and module ownership boundaries.
  • 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.
  • Handoff skills when the scope expands:
  • android-testing-unit
  • android-networking-retrofit-okhttp

Workflow

  1. Identify the injection boundary first: app-wide singleton, activity-retained, ViewModel, worker, service, or entry point from unsupported framework code.
  2. Decide what should be bound: constructor injection, @Binds, @Provides, qualifiers, multibindings, or assisted injection.
  3. Match lifetime to scope explicitly so dependencies do not outlive their owner or rebuild too often.
  4. Verify replacement strategy for tests with Hilt test modules, uninstall modules, or fakes at the right component boundary.
  5. Hand off API-specific or architectural questions only after the DI graph ownership is correct.

Guardrails

  • Prefer constructor injection for app code you own.
  • Use qualifiers and scope annotations deliberately; ambiguous bindings are a graph smell, not a convenience.
  • Keep Hilt modules close to the ownership boundary they configure.
  • Treat test replacement as part of the design, not an afterthought.

Anti-Patterns

  • Making everything @Singleton to silence scope questions.
  • Hiding business construction logic inside giant @Provides methods when constructor injection would suffice.
  • Using Hilt modules as a dumping ground for unrelated bindings across modules.
  • Confusing DI graph ownership with app architecture ownership.

Review Focus

  • Component and scope alignment.
  • Binding style and qualifier clarity.
  • Unsupported-entry-point bridges and test replacement strategy.
  • Module ownership boundaries across features and core code.

Examples

Happy path

  • Scenario: Inject OrbitTasks repositories and dispatchers with clear Hilt scopes.
  • Command: cd examples/orbittasks-compose && ./gradlew :app:testDebugUnitTest

Edge case

  • Scenario: Swap fake dependencies in the XML fixture for deterministic tests.
  • Command: cd examples/orbittasks-xml && ./gradlew :app:testDebugUnitTest

Failure recovery

  • Scenario: Catch DI-specific prompts before they drift into architecture-clean or networking.
  • Command: python3 scripts/eval_triggers.py --skill android-di-hilt

Done Checklist

  • Component lifetime matches dependency lifetime.
  • Binding style is explicit and testable.
  • Test overrides or fakes are planned at the right graph boundary.
  • Non-DI work is handed off instead of buried in modules.

Official References

When not to use it

  • When the request is only about networking APIs or reducer design
  • When the user needs to upgrade Gradle wrapper or collect flows in Compose
  • When the user is not working with Android dependency injection using Hilt

Limitations

  • Focuses on Hilt for Android, not other DI frameworks
  • Does not cover general networking APIs or reducer design
  • Requires explicit scope annotations and deliberate use of qualifiers

How it compares

This skill provides specialized guidance for Hilt in Android, focusing on complex aspects like scope alignment, component ownership, and testability, which goes beyond basic dependency injection setup.

Compared to similar skills

android-di-hilt side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
android-di-hilt (this skill)02moReviewIntermediate
mqtt-kmp03moReviewAdvanced
android-kotlin-development2685moReviewAdvanced
kotlin-multiplatform323moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

mqtt-kmp

meshtastic

MQTTastic Client KMP — Kotlin Multiplatform MQTT 5.0 client library project knowledge

00

android-kotlin-development

aj-geddes

Develop native Android apps with Kotlin. Covers MVVM with Jetpack, Compose for modern UI, Retrofit for API calls, Room for local storage, and navigation architecture.

268679

kotlin-multiplatform

vitorpamplona

Platform abstraction decision-making for Amethyst KMP project. Guides when to abstract vs keep platform-specific, source set placement (commonMain, jvmAndroid, platform-specific), expect/actual patterns. Covers primary targets (Android, JVM/Desktop, iOS) with web/wasm future considerations. Integrates with gradle-expert for dependency issues. Triggers on: abstraction decisions ("should I share this?"), source set placement questions, expect/actual creation, build.gradle.kts work, incorrect placement detection, KMP dependency suggestions.

32156

survey-sdk-audit

PostHog

Audit PostHog survey SDK features and version requirements

336

android-kotlin

alinaqi

Android Kotlin development with Coroutines, Jetpack Compose, Hilt, and MockK testing

729

kotlin-expert

vitorpamplona

Advanced Kotlin patterns for AmethystMultiplatform. Flow state management (StateFlow/SharedFlow), sealed hierarchies (classes vs interfaces), immutability (@Immutable, data classes), DSL builders (type-safe fluent APIs), inline functions (reified generics, performance). Use when working with: (1) State management patterns (StateFlow/SharedFlow/MutableStateFlow), (2) Sealed classes or sealed interfaces, (3) @Immutable annotations for Compose, (4) DSL builders with lambda receivers, (5) inline/reified functions, (6) Kotlin performance optimization. Complements kotlin-coroutines agent (async patterns) - this skill focuses on Amethyst-specific Kotlin idioms.

526

Search skills

Search the agent skills registry