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
- maxrave-dev/SimpMusictheir own version, first seen Oct 8, 2026
- GuillemRoca/agent-skills-androidtheir own version, first seen Oct 3, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- maxrave-dev/SimpMusic★ 13ksame name
- 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.
- android-patternsSkill
- android-testingSkill
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
- Distinctive: line 9
Use this skill to keep Android projects consistent, scalable, and easy to navigate.
- Distinctive: line 13
Follow Clean Architecture inspired layering:
- Distinctive: line 31
Keep business rules out of UI and Android framework classes.
- Distinctive: line 35
Prefer a feature-first layout with shared infrastructure only where it truly belongs.
- Distinctive: line 75
Keep each feature self-contained.
- Distinctive: line 76
Place shared abstractions in the lowest common layer possible.
- Distinctive: line 77
Avoid large folders full of unrelated classes.
- Very specific: line 78
Avoid creating utils or helpers folders as a dumping ground.
- Distinctive: line 142
Use explicit and consistent names.
- Distinctive: line 171
Prefer names that reveal responsibility immediately.
- Very specific: line 172
Do not use vague names such as Manager, Helper, Processor, or Utils.
- Very specific: line 173
Use internal by default for implementation classes.
- Distinctive: line 174
Keep file names aligned with class names.
- Distinctive: line 178
Use the narrowest visibility that still works.
- Very specific: line 190
Use cases should usually be internal.
- Distinctive: line 197
Use Hilt with constructor injection.
- Distinctive: line 210
Prefer constructor injection everywhere.
- Very specific: line 211
Use @Binds for interface to implementation bindings.
- Very specific: line 212
Use @Provides for objects that need construction logic.
- Very specific: line 213
Keep all modules in di/.
- Distinctive: line 243
no fragments for new work unless a specific legacy constraint requires them
- Distinctive: line 247
When adding a new feature:
- Distinctive: line 252
Add presentation state and logic.
- Very specific: line 261
keep rendering in ui
- Distinctive: line 284
Use this skill when deciding where code belongs.
- Distinctive: line 292
When uncertain, choose the lowest layer that can own the logic without leaking framework concerns upward.
≈ “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.
Files
Android Architecture
Use this skill to keep Android projects consistent, scalable, and easy to navigate.
1. Core architecture rules
Follow Clean Architecture inspired layering:
domainis the business core.datahandles remote, local, and other external data sources.presentationcoordinates state and mapping for the UI.uicontains Compose screens, reusable components, and theme.dicontains dependency injection modules.
Dependency flow always points inward:
ui -> presentation -> domain <- data
Rules:
domainmust not depend on Android, Compose, Retrofit, database, or DI APIs.presentationmust not depend on Retrofit, Room, or DTOs.datamay depend ondomain, not the other way around.uimust 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
utilsorhelpersfolders 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]Mapperor[Target]Mapper - Parser:
[Type]Parser - Provider:
[Name]Provider - DTO:
[Entity]Dto
Examples:
ObserveRateForCurrenciesUseCaseExchangeViewModelExchangeScreenUiStateExchangeRepositoryImplCurrencyMapperAmountParser
Rules:
- Prefer names that reveal responsibility immediately.
- Do not use vague names such as
Manager,Helper,Processor, orUtils. - Use
internalby default for implementation classes. - Keep file names aligned with class names.
5. Visibility rules
Use the narrowest visibility that still works.
Default rules:
internalfor most app implementation classes- package-private or public only when needed for module boundaries
publiconly for intended shared APIsprivatefor 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
internalorprivateif 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
@Bindsfor interface to implementation bindings. - Use
@Providesfor 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:
Applicationannotated with@HiltAndroidApp- single
MainActivityannotated 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:
- Define the feature boundary first.
- Create domain contracts.
- Add data implementations.
- Add presentation state and logic.
- Add UI composables.
- 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.
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
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.

