Agent Guidelines — init-android-apps
- Project:
init-android-apps(Google-standard single-module Android starter template) - Module / Namespace:
:app(io.github.amirisback.androidapp) + included composite buildbuild-logic/convention(io.github.amirisback.androidapp.convention) - Toolchain & Stack: AGP
9.5.1(built-in Kotlin), Kotlin2.4.21, KSP2.3.14, Gradle9.9.1, JVM17,minSdk 24/compileSdk 37/targetSdk 37 - Core Libraries: Jetpack Compose M3 (BOM
2026.09.00), Hilt2.60.1, Room2.8.5, DataStore Preferences1.3.0, Google Mobile Ads25.5.0, Retrofit + OkHttp + Gson, Coil3.6.3, Chucker4.4.0, Frogo SDK4.0.0, JUnit4.13.2,kotlinx-coroutines-test1.10.2
Mandatory First Step: Read
ARCHITECTURE.mdbefore creating, moving, or refactoring any source file.
Layer Dependency & Import Guardrails
| Layer | Allowed Dependencies | Forbidden Dependencies |
|---|---|---|
domain/ |
Kotlin stdlib, kotlinx.coroutines, javax.inject, core/common/Resource |
android.*, androidx.*, retrofit2.*, com.google.gson.*, okhttp3.*, data/, feature/, core/game/ |
data/ |
domain/, core/common/, core/di/ qualifiers (@IoDispatcher), Room, Retrofit, Gson, OkHttp, Hilt |
feature/, Compose UI |
feature/ |
domain/, core/ui/, core/game/, core/common/, Compose M3, Lifecycle, Hilt |
data/ (no DAO, Entity, DTO, API service, or *RepositoryImpl) |
core/game/ |
Kotlin stdlib, kotlinx.coroutines, core/di/ (@IoDispatcher), Compose, Lifecycle, DataStore, Google Mobile Ads, Android media/window APIs, Hilt |
data/, feature/ |
core/di/ |
Wires data/ & core/game/ implementations to domain/ & core/game/ interfaces via Hilt |
feature/ |
core/ui/ |
Compose M3, Coil 3, domain/model/ (shared display components such as MealCard) |
data/, feature ViewModels |
Dual-Purpose Starter (Standard App + Opt-In 2D Game Core)
Both tracks are strictly decoupled and share only ProjectApplication.kt, core/common/, core/di/DispatcherModule.kt, core/ui/theme/, and build-logic/convention/. Choose one of three modes when cloning this template:
- Default / Hybrid Mode:
feature/main/MainActivityis the default launcher (Meal sample intact);core/game/andfeature/game/stay opt-in with zero startup overhead (MobileAdsInitProvideris removed viatools:node="remove"). - Mode A — Standard App Only (Prune Game Track):
- Delete
app/src/main/java/.../core/game/,feature/game/, andcore/di/GameModule.kt. - Delete
app/src/test/java/.../core/game/,feature/game/,testutil/FakeGame*.kt, andtestutil/FakeRewardedAdController.kt. - Remove
.feature.game.GameActivity(andMobileAdsInitProviderremoval if dropping AdMob) fromAndroidManifest.xml, plusgame_*entries inres/values/strings.xml. - Optionally remove
google.play.services.ads(andandroidx.datastore.preferencesif unused) fromapp/build.gradle.kts.
- Delete
- Mode B — 2D Casual / Puzzle / Board Game Only (Prune Meal App Track):
- Delete
app/src/main/java/.../data/,domain/,feature/main/,feature/detail/,feature/favorite/,feature/about/,core/ui/component/MealCard.kt, andcore/di/{Database,Network,Repository,UseCase}Module.kt(keepDispatcherModule.ktandGameModule.kt). - Delete
app/src/test/java/.../data/,feature/{main,detail,favorite}/, andtestutil/FakeMeal*.kt. - In
AndroidManifest.xml, removeMainActivity,DetailActivity,AboutUsActivity, and promote.feature.game.GameActivitytoandroid:exported="true"withMAIN/LAUNCHERintent-filter. - If offline-only, optionally remove
androidapp.android.room,chucker,coil, andapp/schemas/fromapp/build.gradle.kts. - Unity 2D REA rewrite mapping:
FixedUpdate->FixedTimestepClock/onFixedUpdate,Time.timeScale = 0->GameLoopController,PlayerPrefs->GameSaveStore,AudioSource->GameAudioController, AdMob Rewarded ->RewardedAdController, fullscreen/wake ->ImmersiveModeEffect.
- Delete
Non-Negotiable Coding Rules
- Maintain a strict 1:1 match between physical directories and Kotlin
packagedeclarations inapp/src/main/javaandapp/src/test/java. - Follow Unidirectional Data Flow (UDF) in all stateful features:
ViewModelexposes a singleStateFlow<*UiState>(never rawResource<T>) collected viacollectAsStateWithLifecycle()in<Feature>Route, delegating to a stateless, previewable<Feature>Screen(uiState, onEvent). - Zero warning suppression: Never introduce
@Suppressor@SuppressWarningsinapp/src/orbuild-logic/. Always migrate deprecated APIs to official modern replacements. - Build logic & version catalog: Keep reusable Gradle build configuration and app metadata (
ProjectSetting.kt,ProjectAds.kt) inside thebuild-logic/conventioncomposite build, sourcing all versions strictly from rootgradle/libs.versions.toml. Never applyorg.jetbrains.kotlin.android(AGP 9.5.1 uses built-in Kotlin). - Never hardcode
Dispatchers.IOinside data sources; inject@IoDispatcherfromcore/di/DispatcherModule.ktand always rethrowCancellationException. - Keep Activities inheriting directly from
FrogoComposeActivity(withenableEdgeToEdge()) and ViewModels fromandroidx.lifecycle.ViewModel. Do not reintroduce empty base wrappers, XML layouts, or wrong-project copyright banners. - Every new mapper, repository, or ViewModel must include JVM unit tests under
app/src/test/using hand-written fakes andkotlinx-coroutines-test.
Verification Commands
Run all three verification tasks before completing any code change:
./gradlew assembleDebug testDebugUnitTest lintDebug
Static checks to confirm on every change:
- Zero forbidden imports (
android.*,androidx.*,retrofit2.*,com.google.gson.*,okhttp3.*,data.*,feature.*,core.game.*) insidedomain/. - Zero
@Suppressor@SuppressWarningsannotations underapp/src/andbuild-logic/. - Exported Room schema JSON matches
app/schemas/io.github.amirisback.androidapp.data.local.database.AppDatabase/<version>.json.
Relevant Android Skills
Consult the matching Android skill (SKILL.md) before working in its domain:
frogo-sdk:FrogoComposeActivity, Frogo SDK v4.0.0 utilities and conventions.edge-to-edge:enableEdgeToEdge(),ScaffoldinnerPadding, and window inset handling.jetpack-compose-m3: Material Design 3 components, typography, color roles, and@Previewhygiene.kotlin-coroutines-expert: Structured concurrency,StateFlow,CancellationException, and dispatcher injection.android-cli: Device deployment, emulator control, and environment diagnostics.r8-analyzer: ProGuard/R8 shrinking rules (e.g., Gson DTO preservation).