android-architecture

Guide Android app architecture with Clean Architecture and Hilt.

915|88|Updated Feb 6, 2024
One-click install
npx skills add https://github.com/new-silvermoon/awesome-android-agent-skills --skill android-architecture-new-silvermoon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-architecture
Source: https://github.com/new-silvermoon/awesome-android-agent-skills/tree/main/.github/skills/android-architecture
Command: npx skills add https://github.com/new-silvermoon/awesome-android-agent-skills --skill android-architecture-new-silvermoon

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides expert guidance on designing and maintaining a modern Android app architecture using Clean Architecture and Hilt. It helps teams structure projects for scalable UI, Domain, and Data layers, and to apply modularization and dependency-injection best practices.

Core Features & Use Cases

  • Clear three-layer architecture with strict inward dependencies between UI, Domain, and Data layers.
  • Guidance on modularization strategies including :app, :core:model, :core:data, :core:domain, :core:ui, and feature modules to improve build times and separation of concerns.
  • Hilt-based dependency injection guidance (e.g., @HiltAndroidApp, @AndroidEntryPoint, @HiltViewModel) and module bindings to promote testability and clean wiring.

Quick Start

Initialize a multi-module Android project following Clean Architecture and Hilt conventions: create core modules (:core:model, :core:data, :core:domain, :core:ui), add an :app module, then implement a sample feature with its own UI and ViewModel. Gradually migrate existing code to the new structure and verify dependency directions.

Frequently Asked Questions about android-architecture

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

FAQPage Schema
How do I structure an Android app using clean architecture and Hilt?

To structure an Android app using clean architecture and Hilt, separate your project into UI, Domain, and Data layers with strict inward dependencies, then wire them together using Hilt annotations like @HiltAndroidApp and @HiltViewModel to promote testability and clean wiring.

What is the best way to modularize an Android project for scalable architecture?

The best way to modularize an Android project involves creating distinct core modules like :core:model, :core:data, :core:domain, and :core:ui, alongside an :app module and specific feature modules, which improves build times and enforces strict separation of concerns across the codebase.

When do I need a domain layer in my Android app architecture?

You need a domain layer in your Android app architecture when you want to enforce separation of concerns and maintain strict inward dependencies, isolating business logic from the UI and Data layers to ensure scalable and maintainable code across simple to complex applications.

Does Hilt dependency injection work with multi-module Android apps?

Hilt dependency injection works seamlessly with multi-module Android apps by utilizing module bindings and entry points like @AndroidEntryPoint, allowing you to cleanly wire UI components and ViewModels across feature and core modules while maintaining strict architectural boundaries.

How to migrate existing Android code to a clean architecture structure?

To migrate existing Android code to clean architecture, first establish core modules like :core:model and :core:domain, then gradually move your code into the new structure while verifying dependency directions, ensuring that UI and Data layers strictly depend on Domain and never the reverse.