hilt-di

Configure Hilt DI bindings, scoping, and Android component wiring.

14|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/piyushverma0/android-agent-skills --skill hilt-di-piyushverma0
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hilt-di
Source: https://github.com/piyushverma0/android-agent-skills/tree/main/skills/hilt-di
Command: npx skills add https://github.com/piyushverma0/android-agent-skills --skill hilt-di-piyushverma0

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Hilt DI setup and best practices for Android apps, helping agents correctly configure dependencies and avoid common DI pitfalls.

Core Features & Use Cases

  • Guidance on binding strategies (@Binds vs @Provides), scoping rules, and component lifecycles.
  • Examples for @HiltViewModel, @AndroidEntryPoint, @EntryPoint, @AssistedInject, and @HiltWorker, plus testing with HiltAndroidTest.
  • Practical anti-patterns and fixes to reduce compile-time errors and runtime issues.

Quick Start

Annotate Application with @HiltAndroidApp, mark Android components with @AndroidEntryPoint, and define bindings in Modules using @Binds or @Provides to enable Hilt DI.

Frequently Asked Questions about hilt-di

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure Hilt dependency injection for an Android ViewModel?

To configure Hilt dependency injection for an Android ViewModel, annotate your Application class with @HiltAndroidApp, mark the ViewModel with @HiltViewModel, and define bindings in Modules using @Binds or @Provides to enable proper injection.

What is the difference between @Binds and @Provides in Hilt modules?

The difference between @Binds and @Provides in Hilt modules is that @Binds maps an interface to its implementation with minimal boilerplate, while @Provides contains logic to construct and return dependency instances when instantiation requires explicit setup.

Does Hilt dependency injection work with WorkManager integration and testing?

Yes, Hilt dependency injection works with WorkManager integration and testing by using @HiltWorker for worker classes and @HiltAndroidTest to configure automated testing environments, ensuring correct component wiring and scoping.

Why does my Android component fail to inject dependencies with Hilt?

Your Android component fails to inject dependencies with Hilt typically because the component lacks the @AndroidEntryPoint annotation, or because component lifecycles and scoping rules are mismatched, leading to common compile-time and runtime injection errors.

Can I use Hilt dependency injection without modifying the base Android Application class?

You cannot use Hilt dependency injection without modifying the base Application class, because annotating it with @HiltAndroidApp is strictly required to initialize the Hilt component hierarchy and generate the underlying Dagger dependency graph.