guillemroca/agent-skills-android/android-architecture
Claude Code and agent skill by guillemroca/agent-skills-android
- community
Checking that the SKILL.md file is still in the repository.
Use when designing module structure, choosing architecture patterns (MVVM/MVI), setting up dependency injection, or defining layer boundaries in an Android project.
Install
npx vskill@latest install guillemroca/agent-skills-android/android-architectureSKILL.md
The same SKILL.md was published earlier as guillemroca/agent-skills-android/android-architecture.
Android Architecture
Overview
Good architecture makes Android apps testable, maintainable, and scalable. This skill guides architectural decisions: module structure, layer separation (UI → Domain → Data), dependency injection with Hilt, state management with Coroutines and Flow, and patterns that survive configuration changes and process death.
When to Use
- Starting a new Android project or module
- Adding a feature module to an existing multi-module project
- Choosing between MVVM and MVI for a screen
- Setting up or refactoring dependency injection
- Defining boundaries between layers
- Debugging lifecycle or state management issues
Skip when: Making a small change within an already-architected feature.
Core Process
Step 1: Module Structure
- Organize by layer and feature:
- Dependency rules:
:feature:*depends on:core:domain,:core:ui,:core:common:core:datadepends on:core:domain,:core:database,:core:network:core:domaindepends on nothing (pure Kotlin module):appdepends on all:feature:*and:core:data(for DI wiring)- Never: feature → feature, core → feature, domain → data
Step 2: Layer Separation
- Three layers, strict boundaries:
| Layer | Contains | Depends On | |
|---|---|---|---|
| UI | Composables, ViewModels, UiState | Domain | |
| Domain | Use cases, domain models, repository interfaces | Nothing | |
| Data | Repository implementations, data sources, mappers | Domain (interfaces) |
- Data flows one direction: UI ← Domain ← Data
Step 3: ViewModel and State Management
- MVVM with UiState pattern:
- MVI for complex screens (multiple user actions, side effects):
Step 4: Dependency Injection with Hilt
- Module setup:
- Hilt rules:
- Use
@Inject constructor(not field injection) - Scope to the narrowest lifecycle:
@Singletononly for truly app-wide instances - Use
@Bindsfor interface→implementation,@Providesfor third-party classes - Test with
@UninstallModules+@BindValueor Hilt test rules
Step 5: Coroutines and Flow
- Structured concurrency:
- Error handling:
Common Rationalizations
| Shortcut | Why It Fails | |
|---|---|---|
| "We don't need modules, it's a small app" | Modularization pays off at ~10 screens. Build times and code coupling grow fast. | |
| "Use cases are unnecessary boilerplate" | Use cases make ViewModels testable without mocking repositories. They also compose. | |
| "I'll put the logic in the ViewModel" | Fat ViewModels become untestable. Domain logic belongs in use cases. | |
| "Hilt is too complex, I'll use manual DI" | Manual DI doesn't survive multi-module projects. Hilt scales; manual DI doesn't. | |
| "GlobalScope is fine for fire-and-forget" | GlobalScope survives activity destruction, leaking resources. Use structured concurrency. |
Red Flags
- Feature module depends on another feature module
- Domain layer imports Android framework classes
- ViewModel directly accesses Room DAOs or Retrofit services
GlobalScope.launchanywhere in production code- Field injection (
@Inject lateinit var) instead of constructor injection - Mutable state exposed from ViewModel (
MutableStateFlowmade public) - Business logic in Composables
Verification
- [ ] Module dependency graph follows layer rules (no upward dependencies)
- [ ] Domain layer has zero Android dependencies
- [ ] ViewModels expose
StateFlow, notMutableStateFloworLiveData - [ ] All dependencies provided via Hilt constructor injection
- [ ] No
GlobalScopeusage in production code - [ ] Repositories return
Flowfor observable data - [ ] Use cases are independently testable
- [ ]
./gradlew buildsucceeds with no circular dependency errors
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/android-architecture/SKILL.md
Popularity
- Repository stars
- 2
- 7-day trend score
- 5
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/guillemroca/agent-skills-android/android-architecture)