agentleFS
GDvegaGDvega/super-android-kotlin-firebase-skill/skills/dependency-injection/SKILL.md

dependency-injection

Skill2 starsChanged 5 months agoMITView on GitHub

Use for Hilt, Koin, DI modules, scopes, ViewModel injection, repository bindings and testing with dependency injection.

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 10 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Add the smallest binding/module needed.

    line 27
  2. Distinctive:

    Add test fakes or replacement modules.

    line 30
  3. Distinctive:

    Do not mix Hilt and Koin without strong reason.

    line 34
  4. Distinctive:

    Avoid hidden service locators.

    line 35
  5. Distinctive:

    Do not inject Context unless needed.

    line 36
  6. Distinctive:

    Keep singletons immutable or thread-safe.

    line 37
  7. Distinctive:

    Do not break Compose previews.

    line 38
  8. Distinctive:

    Do not assume these companion skills are installed.

    line 51
  9. Distinctive:

    Use $super-android-kotlin-firebase to add Hilt for repositories and ViewModels.

    line 88
  10. Distinctive:

    Use $super-android-kotlin-firebase to fix this DI binding error.

    line 89

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Purpose

Make dependencies explicit and replaceable without adding unnecessary framework weight.

When to use

  • Adding Hilt or Koin.
  • Injecting ViewModels, repositories or data sources.
  • Fixing scope or binding problems.
  • Replacing dependencies in tests.

Inputs to inspect

  • Existing DI framework or manual DI.
  • Object lifetimes and scopes.
  • ViewModel and repository constructors.
  • Test replacement needs.

Required workflow

  1. Detect current DI pattern.
  2. Add the smallest binding/module needed.
  3. Use scopes intentionally.
  4. Wire ViewModel and repository dependencies.
  5. Add test fakes or replacement modules.

Rules

  • Do not mix Hilt and Koin without strong reason.
  • Avoid hidden service locators.
  • Do not inject Context unless needed.
  • Keep singletons immutable or thread-safe.
  • Do not break Compose previews.

Related existing skills

Local skills to invoke

  • android-architecture
  • kotlin-core
  • testing
  • room-datastore

External companion skills to use when installed

Do not assume these companion skills are installed. Prefer the local skills above first, then consult Companion Skills for install and verification commands.

  • android/skills — use for official Android workflow alignment when a first-party companion skill exists for the task.

Files commonly touched

  • di modules
  • Application class
  • ViewModels
  • repositories
  • test modules

Commands to validate

./gradlew test
./gradlew assembleDebug
./gradlew lint

Common mistakes to avoid

  • Injecting everything by default.
  • Creating circular dependencies.
  • Using singletons for mutable state.
  • Forgetting test replacements.

Checklist

  • Bindings minimal.
  • Scopes correct.
  • Tests can replace dependencies.
  • Previews still work.
  • Build passes.

Example prompts

  • Use $super-android-kotlin-firebase to add Hilt for repositories and ViewModels.
  • Use $super-android-kotlin-firebase to fix this DI binding error.

Expected response style

Respond with: brief diagnosis, change plan, affected files, code or diff summary, validation commands, tests added or recommended, risks, and next step. For review tasks, lead with findings ordered by severity.

References

  • ../../docs/audits/FUENTES_LOCALES.md
  • references/di-scopes-and-tests.md
  • templates/hilt-module-template.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.