Implement Mobile Feature
Step-by-step implementation guidance for Android and iOS projects.
When to Use
- Implementing a new feature or PBI in a mobile app
- Fixing a bug with code changes
- Adding a new screen with navigation
- Modifying existing business logic
- Creating or updating API integrations
Prerequisites
- Investigation report or clear PBI requirements
- Understanding of affected features/modules
Workflow
Step 1: Detect Platform & Analyze Patterns
Detect whether this is Android, iOS, or KMP:
- Android:
build.gradle.kts, AndroidManifest.xml, Kotlin source files
- iOS:
*.xcodeproj, Package.swift, Swift source files
- KMP:
shared/ module with commonMain
Then analyze existing patterns:
- Architecture pattern (MVVM, MVI, Clean Architecture)
- DI framework (Hilt, Koin, manual injection, Swinject)
- Navigation approach (Compose Navigation, Coordinator, Router)
- State management (StateFlow, LiveData, @Observable, Combine)
- Networking (Retrofit, Ktor, URLSession, Alamofire)
- Local storage (Room, DataStore, CoreData, SwiftData)
- Testing approach (JUnit/MockK, XCTest/Swift Testing)
Step 2: Plan Implementation
Identify all files to create/modify per layer:
Android:
- DTOs (
data/remote/dto/)
- Room Entity + DAO (
data/local/)
- API Service interface (
data/remote/)
- Repository implementation (
data/repository/)
- Domain model (
domain/model/)
- Repository interface (
domain/repository/)
- Use Case (
domain/usecase/)
- UI State sealed interface (
presentation/)
- ViewModel (
presentation/)
- Composable screens (
presentation/)
- Navigation route (
navigation/)
- Hilt Module (
di/)
iOS:
- DTOs (
Data/DTOs/)
- SwiftData/CoreData model (
Data/)
- API Service (
Data/)
- Repository implementation (
Data/)
- Domain model (
Domain/)
- Repository protocol (
Domain/)
- Use Case (
Domain/)
- ViewState enum (
Presentation/)
- ViewModel (
Presentation/)
- SwiftUI Views (
Presentation/)
- Navigation route (
Navigation/)
Step 3: Implement (bottom-up)
Order of implementation: Data Layer → Domain Layer → Presentation Layer → Navigation → DI
Data Layer
- Create DTOs matching API response
- Create local entities (Room @Entity / @Model)
- Create DAO/data access interface
- Create API service interface
- Implement repository (offline-first pattern)
Domain Layer
- Create domain models (clean, platform-independent)
- Define repository interface/protocol
- Create use cases for each business operation
Presentation Layer
- Define UI State (sealed interface/enum)
- Create ViewModel with StateFlow/@Observable
- Create screens/views (stateless composables/views)
- Create stateful container connecting ViewModel
Navigation & DI
- Add navigation routes
- Register dependencies in DI module
Step 4: Write Tests
For each new/modified class:
- Create fake repositories for ViewModel tests
- Create test builders for domain models and DTOs
- Test all UI states (Loading, Content, Error, Empty)
- Test all business logic branches in use cases
- Test error handling and edge cases
Step 5: Verify
Android:
./gradlew assembleDebug # compilation check
./gradlew testDebugUnitTest # unit tests
./gradlew lint # lint checks
iOS:
xcodebuild test -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 16'
swift build # SPM compilation check
Validation Checklist
Source: vndkubi/code-graph — distributed by TomeVault.
1---2name: implement-mobile-feature3description: Guided mobile feature implementation across all layers of Android (Kotlin/Jetpack Compose) and iOS (Swift/SwiftUI) applications. Creates or modifies screens, ViewModels, use cases, repositories, data sources, DTOs, navigation routes, and DI modules following MVVM + Clean Architecture patterns. Use when asked to implement a feature, fix a bug, add a screen, or make code changes in mobile projects. Use when this capability is needed.4---56# Implement Mobile Feature78Step-by-step implementation guidance for Android and iOS projects.910## When to Use1112- Implementing a new feature or PBI in a mobile app13- Fixing a bug with code changes14- Adding a new screen with navigation15- Modifying existing business logic16- Creating or updating API integrations1718## Prerequisites1920- Investigation report or clear PBI requirements21- Understanding of affected features/modules2223## Workflow2425### Step 1: Detect Platform & Analyze Patterns2627Detect whether this is Android, iOS, or KMP:28- **Android**: `build.gradle.kts`, `AndroidManifest.xml`, Kotlin source files29- **iOS**: `*.xcodeproj`, `Package.swift`, Swift source files30- **KMP**: `shared/` module with `commonMain`3132Then analyze existing patterns:33- Architecture pattern (MVVM, MVI, Clean Architecture)34- DI framework (Hilt, Koin, manual injection, Swinject)35- Navigation approach (Compose Navigation, Coordinator, Router)36- State management (StateFlow, LiveData, @Observable, Combine)37- Networking (Retrofit, Ktor, URLSession, Alamofire)38- Local storage (Room, DataStore, CoreData, SwiftData)39- Testing approach (JUnit/MockK, XCTest/Swift Testing)4041### Step 2: Plan Implementation4243Identify all files to create/modify per layer:4445**Android:**461. DTOs (`data/remote/dto/`)472. Room Entity + DAO (`data/local/`)483. API Service interface (`data/remote/`)494. Repository implementation (`data/repository/`)505. Domain model (`domain/model/`)516. Repository interface (`domain/repository/`)527. Use Case (`domain/usecase/`)538. UI State sealed interface (`presentation/`)549. ViewModel (`presentation/`)5510. Composable screens (`presentation/`)5611. Navigation route (`navigation/`)5712. Hilt Module (`di/`)5859**iOS:**601. DTOs (`Data/DTOs/`)612. SwiftData/CoreData model (`Data/`)623. API Service (`Data/`)634. Repository implementation (`Data/`)645. Domain model (`Domain/`)656. Repository protocol (`Domain/`)667. Use Case (`Domain/`)678. ViewState enum (`Presentation/`)689. ViewModel (`Presentation/`)6910. SwiftUI Views (`Presentation/`)7011. Navigation route (`Navigation/`)7172### Step 3: Implement (bottom-up)7374**Order of implementation:** Data Layer → Domain Layer → Presentation Layer → Navigation → DI7576#### Data Layer77- Create DTOs matching API response78- Create local entities (Room @Entity / @Model)79- Create DAO/data access interface80- Create API service interface81- Implement repository (offline-first pattern)8283#### Domain Layer84- Create domain models (clean, platform-independent)85- Define repository interface/protocol86- Create use cases for each business operation8788#### Presentation Layer89- Define UI State (sealed interface/enum)90- Create ViewModel with StateFlow/@Observable91- Create screens/views (stateless composables/views)92- Create stateful container connecting ViewModel9394#### Navigation & DI95- Add navigation routes96- Register dependencies in DI module9798### Step 4: Write Tests99100For each new/modified class:101- Create fake repositories for ViewModel tests102- Create test builders for domain models and DTOs103- Test all UI states (Loading, Content, Error, Empty)104- Test all business logic branches in use cases105- Test error handling and edge cases106107### Step 5: Verify108109**Android:**110```bash111./gradlew assembleDebug # compilation check112./gradlew testDebugUnitTest # unit tests113./gradlew lint # lint checks114```115116**iOS:**117```bash118xcodebuild test -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 16'119swift build # SPM compilation check120```121122## Validation Checklist123124- [ ] All layers follow existing codebase patterns125- [ ] UI State handles Loading, Content, Error, and Empty states126- [ ] ViewModel uses StateFlow (Android) or @Observable (iOS)127- [ ] Repository has interface/protocol for testability128- [ ] DI is properly configured129- [ ] Navigation is integrated130- [ ] Unit tests cover all business logic branches131- [ ] Accessibility attributes added (contentDescription / accessibilityLabel)132- [ ] Strings are localized (strings.xml / Localizable.strings)133- [ ] No compilation errors or warnings134135---136> Source: [vndkubi/code-graph](https://github.com/vndkubi/code-graph) — distributed by [TomeVault](https://tomevault.io).137<!-- tomevault:4.0:skill_md:2026-06-26 -->