android-clean-architecture
What it does
This skill helps organize the code for Android apps and other platforms. It defines how different parts of the program should communicate, ensuring the code is easier to understand and maintain.
When to use it
- βWhen starting a new Android project.
- βWhen organizing different parts of an existing app.
- βWhen the app's code is becoming confusing.
Skill link
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/android-clean-architecture/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βHow can I structure my Android code using Clean Architecture?β
5 new skills a week. 1 minute to read.
How it works
It divides code into logical layers, like 'domain' (business rules) and 'data' (where information is stored). Rules ensure the domain layer never depends on others, keeping it pure.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Android Clean Architecture
Clean Architecture patterns for Android and KMP projects. Covers module boundaries, dependency inversion, UseCase/Repository patterns, and data layer design with Room, SQLDelight, and Ktor.
When to Activate
- Structuring Android or KMP project modules
- Implementing UseCases, Repositories, or DataSources
- Designing data flow between layers (domain, data, presentation)
- Setting up dependency injection with Koin or Hilt
- Working with Room, SQLDelight, or Ktor in a layered architecture
Module Structure
Recommended Layout
project/
βββ app/ # Android entry point, DI wiring, Application class
βββ core/ # Shared utilities, base classes, error types
βββ domain/ # UseCases, domain models, repository interfaces (pure Kotlin)
βββ data/ # Repository implementations, DataSources, DB, network
βββ presentation/ # Screens, ViewModels, UI models, navigation
βββ design-system/ # Reusable Compose components, theme, typography
βββ feature/ # Feature modules (optional, for larger projects)
βββ auth/
βββ settings/
βββ profile/
Dependency Rules
app β presentation, domain, data, core
presentation β domain, design-system, core
data β domain, core
domain β core (or no dependencies)
core β (nothing)
Critical: domain must NEVER depend on data, presentation, or any framework. It contains pure Kotlin only.
Domain Layer
UseCase Pattern
Each UseCase represents one business operation. Use operator fun invoke for clean call sites:
class GetItemsByCategoryUseCase(
private val repository: ItemRepository
) {
suspend operator fun invoke(category: String): Result<List<Item>> {
return repository.getItemsByCategory(category)
}
}
// Flow-based UseCase for reactive streams
class ObserveUserProgressUseCase(
private val repository: UserRepository
) {
operator fun invoke(userId: String): Flow<UserProgress> {
return repository.observeProgress(userId)
}
}
Domain Models
Domain models are plain Kotlin data classes β no framework annotations:
data class Item(
val id: String,
val title: String,
val description: String,
val tags: List<String>,
val status: Status,
val category: String
)
enum class Status { DRAFT, ACTIVE, ARCHIVED }
Repository Interfaces
Defined in domain, implemented in data:
interface ItemRepository {
suspend fun getItemsByCategory(category: String): Result<List<Item>>
suspend fun saveItem(item: Item): Result<Unit>
fun observeItems(): Flow<List<Item>>
}
Data Layer
Repository Implementation
Coordinates between local and remote data sources:
class ItemRepositoryImpl(
private val localDataSource: ItemLocalDataSource,
private val remoteDataSource: ItemRemoteDataSource
) : ItemRepository {
override suspend fun getItemsByCategory(category: String): Result<List<Item>> {
return runCatching {
val remote = remoteDataSource.fetchItems(category)
localDataSource.insertItems(remote.map { it.toEntity() })
localDataSource.getItemsByCategory(category).map { it.toDomain() }
}
}
override suspend fun saveItem(item: Item): Result<Unit> {
return runCatching {
localDataSource.insertItems(listOf(item.toEntity()))
}
}
override fun observeItems(): Flow<List<Item>> {
return localDataSource.observeAll().map { entities ->
entities.map { it.toDomain() }
}
}
}
Mapper Pattern
Keep mappers as extension functions near the data models:
// In data layer
fun ItemEntity.toDomain() = Item(
id = id,
title = title,
description = description,
tags = tags.split("|"),
status = Status.valueOf(status),
category = category
)
fun ItemDto.toEntity() = ItemEntity(
id = id,
title = title,
description = description,
tags = tags.joinToString("|"),
status = status,
category = category
)
Room Database (Android)
@Entity(tableName = "items")
data class ItemEntity(
@PrimaryKey val id: String,
val title: String,
val description: String,
val tags: String,
val status: String,
val category: String
)
@Dao
interface ItemDao {
@Query("SELECT * FROM items WHERE category = :category")
β¦
FAQ
What is 'domain'?
It's the part of the code containing your app's core rules, without worrying about technical details like where data is saved.
What is a 'Use Case'?
It's a specific action the app can perform, like 'fetch items' or 'save user'.
Why can't 'domain' depend on 'data'?
So that business rules can be used in different contexts (like Android, web, etc.) without needing changes, and to keep the code more organized and testable.
Details
Original description by the author
Clean Architecture patterns for Android and Kotlin Multiplatform projects β module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.
repo: affaan-m/ECC
Popularity
- GitHub stars
- 280k
- Ranking position
- #135
- License
- MIT
- Updated
- 10/15/2026
Comments
- β¦
More skills from this repository
accessibility
280kHelps your agent create interfaces that everyone can use. Ensures websites and apps work well for people with disabilities, like those who are blind or have reduced mobility.
agent-architecture-audit
280kMakes your agent check if everything is working correctly. It finds and fixes problems in AI systems, ensuring they perform as expected.
agent-eval
280kHelps your agent compare different AI coding tools. It measures which one is faster, cheaper, and more reliable for specific tasks.
agent-harness-construction
280kMakes your agent better understand how to perform tasks. It optimizes the tools and instructions the agent uses to increase its chances of success.
Similar skills
flutter-animating-apps
101kLets your agent add animated effects and transitions in Flutter apps. It's useful for creating motion and visual design in iOS and Android apps.
agent-spec-mobile-react-native
81kHelps your agent build mobile apps for iPhone and Android with React Native, including screens, navigation and native modules.
orientation
75kHelps your agent make sure your site works in both portrait and landscape, removing orientation locks and rotate-device messages that block people from content.