android-clean-architecture

Implements Clean Architecture module structure, UseCases, and Repositories for Android and Kotlin Multiplatform projects.

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/Femad-6/my-skills --skill android-clean-architecture-femad-6
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-clean-architecture
Source: https://github.com/Femad-6/my-skills/tree/main/.github/skills/android-clean-architecture
Command: npx skills add https://github.com/Femad-6/my-skills --skill android-clean-architecture-femad-6

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Structuring Android and Kotlin Multiplatform projects without clear layer boundaries leads to tangled dependencies, untestable business logic, and framework leakage into domain code. This Skill provides concrete patterns for module separation, dependency rules, and data flow so your codebase stays maintainable as it grows. ## Core Features & Use Cases - Module Structure & Dependency Rules: Defines a layered layout (app, core, domain, data, presentation) with strict dependency direction, keeping the domain layer pure Kotlin. - UseCase and Repository Patterns: Provides ready-to-adapt templates for UseCases with operator invoke, repository interfaces in domain, and implementations coordinating local and remote DataSources. - Data Layer Integrations: Includes working examples for Room, SQLDelight, Ktor clients, mapper extensions, and DI setup with Koin or Hilt. - Use Case: When starting a new KMP feature, apply the patterns to create a domain module with a GetItemsByCategoryUseCase, a Room-backed repository implementation, and a Koin module wiring it into a ViewModel. ## Quick Start Ask the assistant to structure a new Android or KMP feature module using Clean Architecture with a UseCase, Repository, and Room data source.

Frequently Asked Questions about android-clean-architecture

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

FAQPage Schema
How do I structure an Android project with Clean Architecture?

Split the project into app, core, domain, data, and presentation modules. Domain holds pure-Kotlin UseCases, models, and repository interfaces; data implements repositories with Room or Ktor; presentation contains ViewModels and UI. Dependencies must always point inward toward domain.

How to implement a UseCase in Kotlin with Clean Architecture?

Define a class with a single operator fun invoke that calls a repository interface, returning Result or Flow. Inject the repository via constructor, then call the UseCase from a ViewModel like a function, keeping business logic out of the UI layer.

Koin vs Hilt for dependency injection in KMP projects?

Koin works in Kotlin Multiplatform shared code using module DSL with factory and single declarations. Hilt is Android-only, using @Module, @Binds, and @HiltViewModel annotations. Choose Koin for shared KMP modules and Hilt for Android-only apps.

Can the domain layer depend on Android framework classes?

No. The domain layer must remain pure Kotlin with no Android, Room, or network framework imports. It contains only data classes, enums, UseCases, and repository interfaces, which keeps business logic testable and portable across platforms.

Should Room entities be exposed to the UI layer?

No. Map entities and DTOs to domain models using extension functions like toDomain() inside the data layer. Exposing database entities to the UI couples presentation to storage details and breaks layer isolation.

When is Clean Architecture overkill for an Android app?

For small single-feature apps or prototypes, full module separation adds build complexity without payoff. The pattern pays off in larger projects with multiple features, KMP targets, or teams needing clear boundaries and testable domain logic.