agentleFS
lennonpetricklennonpetrick/android-engineering-skills/android-architecture/SKILL.md

android-architecture

Skill40 starsChanged 27 days agoMITView on GitHub

Defines project structure, package layout, layer boundaries, naming conventions, and dependency injection setup for Android projects. Use this skill whenever creating a new Android project, adding a new feature module, scaffolding a new screen or flow, setting up DI bindings, naming any class or file, or deciding which layer a piece of code belongs in. Also use it when reviewing or refactoring existing code to ensure it follows the established architecture.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. maxrave-dev/SimpMusic★ 13ksame name
    2. GuillemRoca/agent-skills-android★ 2same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository2 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

26 rules. About 0 are common, 18 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈18

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill to keep Android projects consistent, scalable, and easy to navigate.

    line 9
  2. Distinctive:

    Follow Clean Architecture inspired layering:

    line 13
  3. Distinctive:

    Keep business rules out of UI and Android framework classes.

    line 31
  4. Distinctive:

    Prefer a feature-first layout with shared infrastructure only where it truly belongs.

    line 35
  5. Distinctive:

    Keep each feature self-contained.

    line 75
  6. Distinctive:

    Place shared abstractions in the lowest common layer possible.

    line 76
  7. Distinctive:

    Avoid large folders full of unrelated classes.

    line 77
  8. Very specific:

    Avoid creating utils or helpers folders as a dumping ground.

    line 78
  9. Distinctive:

    Use explicit and consistent names.

    line 142
  10. Distinctive:

    Prefer names that reveal responsibility immediately.

    line 171
  11. Very specific:

    Do not use vague names such as Manager, Helper, Processor, or Utils.

    line 172
  12. Very specific:

    Use internal by default for implementation classes.

    line 173
  13. Distinctive:

    Keep file names aligned with class names.

    line 174
  14. Distinctive:

    Use the narrowest visibility that still works.

    line 178
  15. Very specific:

    Use cases should usually be internal.

    line 190
  16. Distinctive:

    Use Hilt with constructor injection.

    line 197
  17. Distinctive:

    Prefer constructor injection everywhere.

    line 210
  18. Very specific:

    Use @Binds for interface to implementation bindings.

    line 211
  19. Very specific:

    Use @Provides for objects that need construction logic.

    line 212
  20. Very specific:

    Keep all modules in di/.

    line 213
  21. Distinctive:

    no fragments for new work unless a specific legacy constraint requires them

    line 243
  22. Distinctive:

    When adding a new feature:

    line 247
  23. Distinctive:

    Add presentation state and logic.

    line 252
  24. Very specific:

    keep rendering in ui

    line 261
  25. Distinctive:

    Use this skill when deciding where code belongs.

    line 284
  26. Distinctive:

    When uncertain, choose the lowest layer that can own the logic without leaking framework concerns upward.

    line 292

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Android Architecture

Use this skill to keep Android projects consistent, scalable, and easy to navigate.

1. Core architecture rules

Follow Clean Architecture inspired layering:

  • domain is the business core.
  • data handles remote, local, and other external data sources.
  • presentation coordinates state and mapping for the UI.
  • ui contains Compose screens, reusable components, and theme.
  • di contains dependency injection modules.

Dependency flow always points inward:

ui -> presentation -> domain <- data

Rules:

  • domain must not depend on Android, Compose, Retrofit, database, or DI APIs.
  • presentation must not depend on Retrofit, Room, or DTOs.
  • data may depend on domain, not the other way around.
  • ui must stay focused on rendering and user interaction.
  • Keep business rules out of UI and Android framework classes.

2. Recommended project structure

Prefer a feature-first layout with shared infrastructure only where it truly belongs.

com.company.app/
├── AppApplication.kt
├── MainActivity.kt
│
├── di/
│   ├── NetworkModule.kt
│   ├── DatabaseModule.kt
│   ├── RepositoryModule.kt
│   └── DispatcherModule.kt
│
├── domain/
│   ├── model/
│   ├── repository/
│   └── usecase/
│
├── data/
│   ├── api/
│   │   └── model/
│   ├── datasource/
│   ├── mapper/
│   └── repository/
│
├── presentation/
│   ├── <feature>/
│   │   ├── <Feature>ViewModel.kt
│   │   ├── model/
│   │   ├── mapper/
│
└── ui/
    ├── <feature>/
    │   ├── <Feature>Screen.kt
    │   ├── components/
    └── theme/

Rules:

  • Keep each feature self-contained.
  • Place shared abstractions in the lowest common layer possible.
  • Avoid large folders full of unrelated classes.
  • Avoid creating utils or helpers folders as a dumping ground.

3. Layer responsibilities

domain

Contains only pure Kotlin code.

Typical contents:

  • entities and value objects
  • repository interfaces
  • use cases
  • domain errors
  • domain calculators when the logic is reusable and not UI-specific

data

Handles anything outside the app process or outside the pure domain model.

Typical contents:

  • Retrofit APIs
  • DTOs and network models
  • local datasource implementations
  • mappers between external models and domain models
  • repository implementations
  • caching, persistence, synchronization logic

presentation

Owns screen behavior and state orchestration.

Typical contents:

  • ViewModels
  • screen UiState, UiAction, UiEvent
  • input state and internal state models
  • pure calculators, parsers, and mappers used only by the screen flow

ui

Owns rendering.

Typical contents:

  • Screen composables
  • stateless content composables
  • reusable UI components
  • theme, typography, colors, shapes, previews

di

Owns object graph wiring only.

Typical contents:

  • bindings
  • providers
  • qualifiers
  • module objects and abstract modules

4. Naming conventions

Use explicit and consistent names.

Common patterns

  • ViewModel: [Feature]ViewModel
  • Screen: [Feature]Screen
  • Screen state: [Feature]ScreenUiState
  • Content state: [Feature]UiState
  • Actions: [Feature]UiAction
  • Events: [Feature]UiEvent
  • Repository interface: [Feature]Repository
  • Repository implementation: [Feature]RepositoryImpl
  • Use case: [Verb][Subject]UseCase
  • Mapper: [Source]Mapper or [Target]Mapper
  • Parser: [Type]Parser
  • Provider: [Name]Provider
  • DTO: [Entity]Dto

Examples:

  • ObserveRateForCurrenciesUseCase
  • ExchangeViewModel
  • ExchangeScreenUiState
  • ExchangeRepositoryImpl
  • CurrencyMapper
  • AmountParser

Rules:

  • Prefer names that reveal responsibility immediately.
  • Do not use vague names such as Manager, Helper, Processor, or Utils.
  • Use internal by default for implementation classes.
  • Keep file names aligned with class names.

5. Visibility rules

Use the narrowest visibility that still works.

Default rules:

  • internal for most app implementation classes
  • package-private or public only when needed for module boundaries
  • public only for intended shared APIs
  • private for local helpers and implementation details

Practical guidance:

  • ViewModels should usually be internal.
  • Use cases should usually be internal.
  • repository implementations should usually be internal.
  • Compose screen and content functions should usually be internal or private if only used locally.
  • Expose only the minimum needed surface area.

6. Dependency injection

Use Hilt with constructor injection.

Preferred pattern:

@HiltViewModel
internal class ExampleViewModel @Inject constructor(
    private val repository: ExampleRepository,
) : ViewModel()

Rules:

  • Prefer constructor injection everywhere.
  • Use @Binds for interface to implementation bindings.
  • Use @Provides for objects that need construction logic.
  • Keep all modules in di/.
  • Separate modules by concern.
  • Use javax.inject.Inject.

Common module types:

  • repository bindings
  • network setup
  • database setup
  • dispatcher providers
  • feature specific object providers

Do not use:

  • service locators
  • manual singleton containers
  • global mutable dependency access
  • jakarta.inject.Inject

7. Android entry points

Recommended app entry points:

  • Application annotated with @HiltAndroidApp
  • single MainActivity annotated with @AndroidEntryPoint

Prefer:

  • one activity architecture
  • Compose Navigation for routing
  • no fragments for new work unless a specific legacy constraint requires them

8. Module and package boundaries

When adding a new feature:

  1. Define the feature boundary first.
  2. Create domain contracts.
  3. Add data implementations.
  4. Add presentation state and logic.
  5. Add UI composables.
  6. Wire everything in di.

When moving code:

  • move pure business rules down to domain
  • move external data handling to data
  • move screen orchestration to presentation
  • keep rendering in ui

9. Code review checklist

A piece of code belongs in the correct place only if:

  • its dependencies point in the right direction
  • its responsibility is clear
  • the layer contains only concerns allowed by that layer
  • its name matches its role
  • the code can be tested in isolation
  • the implementation does not leak framework details into lower layers

Refactor when:

  • a ViewModel contains parsing or formatting logic that belongs elsewhere
  • a repository returns DTOs instead of domain models
  • UI code performs business calculations
  • a module mixes unrelated responsibilities
  • naming does not make the feature easy to understand

10. Practical decision rules

Use this skill when deciding where code belongs.

  • Business rule with no UI dependency: domain
  • Network or persistence logic: data
  • Screen orchestration or state transformation: presentation
  • Compose rendering: ui
  • Dependency wiring: di

When uncertain, choose the lowest layer that can own the logic without leaking framework concerns upward.

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.