android-hilt

Configure Hilt dependency injection for Android apps with Gradle and annotations.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill android-hilt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-hilt
Source: https://github.com/soygabimoreno/Los-ANDROIDES/tree/main/.agents/skills/android-hilt
Command: npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill android-hilt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Hilt dependency injection reduces boilerplate and wiring errors by making your Android component graph explicit and validated at compile time.

Core Features & Use Cases

  • Project setup and Gradle configuration: Add Hilt with KSP or kapt, and wire the required plugins and dependencies for Android.
  • Module definitions and bindings: Use @Module with @InstallIn plus @Binds for interface-to-implementation wiring and @Provides for factory methods.
  • Correct scoping and component hierarchy: Apply @Singleton, @ActivityRetainedScoped, @ViewModelScoped, and @ActivityScoped so dependencies live as long as they should.
  • ViewModel injection and entry points: Inject dependencies into @HiltViewModel and connect Activities/Fragments via @AndroidEntryPoint; support Compose via hiltViewModel().
  • Testing support: Use @HiltAndroidTest, HiltAndroidRule, and test-time module replacement to validate behavior with fakes.

Quick Start

Use the android-hilt skill to help you add Hilt to your Android project and correctly inject a ViewModel into a Compose screen.

Frequently Asked Questions about android-hilt

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

FAQPage Schema
How do I set up Hilt dependency injection in an Android project?

To set up Hilt dependency injection, configure Gradle with KSP or kapt, apply the required plugins, annotate your application class with @HiltAndroidApp, and use @AndroidEntryPoint for Activities and Fragments.

How do I inject a ViewModel into a Compose screen using Hilt?

Inject a ViewModel into Compose by annotating it with @HiltViewModel and constructor @Inject, then retrieve it within your composable using the hiltViewModel() function.

When do I use @Binds vs @Provides for Hilt module bindings?

Use @Binds for interface-to-implementation wiring within a @Module, and use @Provides for factory methods when you need to construct or configure dependency instances manually.

Can I use Hilt for dependency injection in an MVVM Clean Architecture Android app?

Hilt fits Android-only MVVM and Clean Architecture projects by providing compile-time validated dependency graphs for Activities, Fragments, and ViewModels.

How do I test ViewModels and replace modules in Hilt?

Test Hilt components by annotating tests with @HiltAndroidTest, using HiltAndroidRule, and replacing specific modules at test-time to validate behavior with fakes.

Why do Hilt dependencies have incorrect lifecycles in my Android app?

Correct Hilt dependency lifecycles by applying proper scoping annotations like @Singleton, @ActivityRetainedScoped, @ViewModelScoped, and @ActivityScoped to match component hierarchy semantics.