Agent skill

Android Dependency Injection (Hilt)

Standards for Hilt Setup, Scoping, and Modules

Stars 163
Forks 31

Install this agent skill to your Project

npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/di

Metadata

Additional technical details for this skill

labels
android di hilt dagger
triggers
{
    "files": [
        "**/*Module.kt",
        "**/*Component.kt"
    ],
    "keywords": [
        "@HiltAndroidApp",
        "@Inject",
        "@Provides",
        "@Binds"
    ]
}

SKILL.md

Android Dependency Injection (Hilt)

Priority: P0

Implementation Guidelines

Setup

  • App: Must annotate Application class with @HiltAndroidApp.
  • Entries: Annotate Activities/Fragments with @AndroidEntryPoint.

Modules

  • Binding: Use @Binds (abstract class) over @Provides when possible (smaller generated code).
  • InstallIn: Be explicit (SingletonComponent, ViewModelComponent).

Construction

  • Constructor Injection: Prefer over Field Injection (@Inject constructor(...)).
  • Assisted Injection: Use for runtime parameters (@AssistedInject).

Anti-Patterns

  • Component Manual Creation: **No Manual Dagger**: Use Hilt Standard.
  • Field Inject in Logic: **No Field Inject**: Only in Android Components.

References

  • Module Templates

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results