android-sdd 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/dist/index.js +143 -0
  2. package/package.json +27 -0
  3. package/skills/Android Ecosystem/Baseline Profile Generator/SKILL.md +277 -0
  4. package/skills/Android Ecosystem/Glance/SKILL.md +315 -0
  5. package/skills/Android Platform/Configuration/SKILL.md +201 -0
  6. package/skills/Android Platform/Filesystem/SKILL.md +216 -0
  7. package/skills/Android Platform/Lifecycle/SKILL.md +233 -0
  8. package/skills/Android Platform/Manifest/SKILL.md +226 -0
  9. package/skills/Android Platform/Process Death Recovery/SKILL.md +214 -0
  10. package/skills/Android Platform/Resources/SKILL.md +234 -0
  11. package/skills/Android Platform/SavedStateHandle/SKILL.md +217 -0
  12. package/skills/Android Platform/State Restoration/SKILL.md +210 -0
  13. package/skills/Architecture/Bounded Context/SKILL.md +207 -0
  14. package/skills/Architecture/Clean Architecture/SKILL.md +229 -0
  15. package/skills/Architecture/Domain Modeling/SKILL.md +236 -0
  16. package/skills/Architecture/Entity Design/SKILL.md +243 -0
  17. package/skills/Architecture/Feature Isolation/SKILL.md +216 -0
  18. package/skills/Architecture/MVI/SKILL.md +224 -0
  19. package/skills/Architecture/MVVM/SKILL.md +198 -0
  20. package/skills/Architecture/Modularization/SKILL.md +194 -0
  21. package/skills/Architecture/Offline First/SKILL.md +249 -0
  22. package/skills/Architecture/Repository Pattern/SKILL.md +216 -0
  23. package/skills/Architecture/Side Effect Management/SKILL.md +278 -0
  24. package/skills/Architecture/State Management/SKILL.md +229 -0
  25. package/skills/Architecture/Unidirectional Data Flow/SKILL.md +196 -0
  26. package/skills/Architecture/Use Case Design/SKILL.md +244 -0
  27. package/skills/Architecture/Value Object/SKILL.md +226 -0
  28. package/skills/Build Infrastructure/Build Orchestration/SKILL.md +257 -0
  29. package/skills/Build Infrastructure/Dependency Compatibility Resolver/SKILL.md +259 -0
  30. package/skills/Build Infrastructure/Environment Validator/SKILL.md +311 -0
  31. package/skills/Build System/Build Cache/SKILL.md +233 -0
  32. package/skills/Build System/Build Flavor Strategy/SKILL.md +171 -0
  33. package/skills/Build System/Build Variant/SKILL.md +215 -0
  34. package/skills/Build System/Convention Plugin/SKILL.md +288 -0
  35. package/skills/Build System/Dependency Management/SKILL.md +261 -0
  36. package/skills/Build System/Gradle/SKILL.md +284 -0
  37. package/skills/Build System/Incremental Build/SKILL.md +199 -0
  38. package/skills/Build System/KAPT/SKILL.md +198 -0
  39. package/skills/Build System/KSP/SKILL.md +263 -0
  40. package/skills/Build System/Module Dependency Graph Validation/SKILL.md +223 -0
  41. package/skills/Build System/Specialized/C++/SKILL.md +308 -0
  42. package/skills/Build System/Specialized/JNI/SKILL.md +306 -0
  43. package/skills/Build System/Specialized/NDK/SKILL.md +264 -0
  44. package/skills/Build System/Version Catalog/SKILL.md +304 -0
  45. package/skills/Concurrency/Background Processing/SKILL.md +185 -0
  46. package/skills/Concurrency/Channel/SKILL.md +207 -0
  47. package/skills/Concurrency/Coroutine/SKILL.md +200 -0
  48. package/skills/Concurrency/Flow/SKILL.md +179 -0
  49. package/skills/Concurrency/Mutex Strategy/SKILL.md +185 -0
  50. package/skills/Concurrency/SharedFlow/SKILL.md +171 -0
  51. package/skills/Concurrency/StateFlow/SKILL.md +175 -0
  52. package/skills/Concurrency/Structured Concurrency/SKILL.md +197 -0
  53. package/skills/Concurrency/Synchronization Policy/SKILL.md +192 -0
  54. package/skills/Core Language/Annotation Processing/SKILL.md +224 -0
  55. package/skills/Core Language/DSL/SKILL.md +186 -0
  56. package/skills/Core Language/Extension Functions Design/SKILL.md +191 -0
  57. package/skills/Core Language/Immutability/SKILL.md +156 -0
  58. package/skills/Core Language/KMP/SKILL.md +182 -0
  59. package/skills/Core Language/Kotlin/SKILL.md +187 -0
  60. package/skills/Core Language/Reactive State Management/SKILL.md +228 -0
  61. package/skills/Core Language/Reactive Streams/SKILL.md +235 -0
  62. package/skills/Core Language/Serialization/SKILL.md +191 -0
  63. package/skills/Data Layer/Cache Strategy/SKILL.md +261 -0
  64. package/skills/Data Layer/Conflict Resolution/SKILL.md +248 -0
  65. package/skills/Data Layer/DAO/SKILL.md +225 -0
  66. package/skills/Data Layer/DTO Mapping/SKILL.md +269 -0
  67. package/skills/Data Layer/DataStore/SKILL.md +264 -0
  68. package/skills/Data Layer/Database Versioning Strategy/SKILL.md +215 -0
  69. package/skills/Data Layer/Encrypted Database/SKILL.md +212 -0
  70. package/skills/Data Layer/File Storage/SKILL.md +247 -0
  71. package/skills/Data Layer/Indexing/SKILL.md +184 -0
  72. package/skills/Data Layer/Key-Value Store Strategy/SKILL.md +185 -0
  73. package/skills/Data Layer/Merge Strategy/SKILL.md +240 -0
  74. package/skills/Data Layer/Migration/SKILL.md +243 -0
  75. package/skills/Data Layer/Paging/SKILL.md +264 -0
  76. package/skills/Data Layer/Proto DataStore/SKILL.md +250 -0
  77. package/skills/Data Layer/Room/SKILL.md +244 -0
  78. package/skills/Data Layer/SQLite/SKILL.md +255 -0
  79. package/skills/Data Layer/Sync Engine/SKILL.md +268 -0
  80. package/skills/Dependency Injection/Dagger/SKILL.md +283 -0
  81. package/skills/Dependency Injection/Hilt/SKILL.md +345 -0
  82. package/skills/Dependency Injection/Koin/SKILL.md +282 -0
  83. package/skills/Developer Experience/Detekt/SKILL.md +272 -0
  84. package/skills/Developer Experience/Lint Rule/SKILL.md +281 -0
  85. package/skills/Google Ecosystem/Analytics/SKILL.md +281 -0
  86. package/skills/Google Ecosystem/Crashlytics/SKILL.md +234 -0
  87. package/skills/Google Ecosystem/Firebase/SKILL.md +200 -0
  88. package/skills/Google Ecosystem/Firebase Messaging/SKILL.md +266 -0
  89. package/skills/Media/Audio/SKILL.md +257 -0
  90. package/skills/Media/Camera/SKILL.md +229 -0
  91. package/skills/Media/CameraX/SKILL.md +295 -0
  92. package/skills/Media/ExoPlayer/SKILL.md +258 -0
  93. package/skills/Media/Video/SKILL.md +228 -0
  94. package/skills/Meta Skills/Domain Error Model/SKILL.md +238 -0
  95. package/skills/Meta Skills/Error Handling/SKILL.md +255 -0
  96. package/skills/Meta Skills/Error Mapping/SKILL.md +232 -0
  97. package/skills/Meta Skills/Failure Strategy/SKILL.md +294 -0
  98. package/skills/Meta Skills/Migration Strategy/SKILL.md +305 -0
  99. package/skills/Meta Skills/User Friendly Errors/SKILL.md +334 -0
  100. package/skills/Navigation/Deep Navigation/SKILL.md +209 -0
  101. package/skills/Navigation/Navigation/SKILL.md +215 -0
  102. package/skills/Navigation/Nested Navigation/SKILL.md +214 -0
  103. package/skills/Networking/API Contract/SKILL.md +220 -0
  104. package/skills/Networking/Authentication/SKILL.md +210 -0
  105. package/skills/Networking/Certificate Pinning/SKILL.md +167 -0
  106. package/skills/Networking/Fallback Strategy/SKILL.md +182 -0
  107. package/skills/Networking/Ktor/SKILL.md +219 -0
  108. package/skills/Networking/Multipart Upload/SKILL.md +213 -0
  109. package/skills/Networking/OkHttp/SKILL.md +193 -0
  110. package/skills/Networking/REST/SKILL.md +178 -0
  111. package/skills/Networking/Rate Limiting/SKILL.md +170 -0
  112. package/skills/Networking/Retrofit/SKILL.md +241 -0
  113. package/skills/Networking/Retry-Backoff/SKILL.md +181 -0
  114. package/skills/Networking/Server-Sent Events (SSE)/SKILL.md +196 -0
  115. package/skills/Networking/WebSocket/SKILL.md +224 -0
  116. package/skills/Observability/Crash Reporting/SKILL.md +219 -0
  117. package/skills/Observability/Logging/SKILL.md +168 -0
  118. package/skills/Observability/Metrics/SKILL.md +227 -0
  119. package/skills/Observability/Structured Logging/SKILL.md +234 -0
  120. package/skills/Performance/ANR Prevention/SKILL.md +192 -0
  121. package/skills/Performance/Allocation Optimization/SKILL.md +179 -0
  122. package/skills/Performance/App Startup/SKILL.md +183 -0
  123. package/skills/Performance/Baseline Profile/SKILL.md +205 -0
  124. package/skills/Performance/Battery Optimization/SKILL.md +192 -0
  125. package/skills/Performance/Benchmark/SKILL.md +182 -0
  126. package/skills/Performance/Bitmap Optimization/SKILL.md +178 -0
  127. package/skills/Performance/Compose Optimization/SKILL.md +187 -0
  128. package/skills/Performance/Heap Management/SKILL.md +184 -0
  129. package/skills/Performance/Macrobenchmark/SKILL.md +214 -0
  130. package/skills/Performance/Memory Leak Prevention/SKILL.md +218 -0
  131. package/skills/Performance/Rendering Performance/SKILL.md +205 -0
  132. package/skills/Performance/Startup Optimization/SKILL.md +219 -0
  133. package/skills/Security/Biometric/SKILL.md +224 -0
  134. package/skills/Security/Certificate Transparency/SKILL.md +158 -0
  135. package/skills/Security/Cryptography/SKILL.md +244 -0
  136. package/skills/Security/Encrypted Storage/SKILL.md +273 -0
  137. package/skills/Security/Frida Detection/SKILL.md +230 -0
  138. package/skills/Security/Hook Detection/SKILL.md +197 -0
  139. package/skills/Security/Keystore/SKILL.md +272 -0
  140. package/skills/Security/Network Security Config/SKILL.md +186 -0
  141. package/skills/Security/Obfuscation/SKILL.md +226 -0
  142. package/skills/Security/Proguard/SKILL.md +202 -0
  143. package/skills/Security/R8/SKILL.md +234 -0
  144. package/skills/Security/Reverse Engineering Resistance/SKILL.md +267 -0
  145. package/skills/Security/Root Detection/SKILL.md +220 -0
  146. package/skills/Security/Secure Networking/SKILL.md +220 -0
  147. package/skills/System Integration/AlarmManager/SKILL.md +182 -0
  148. package/skills/System Integration/App Widget/SKILL.md +182 -0
  149. package/skills/System Integration/Deep Link/SKILL.md +187 -0
  150. package/skills/System Integration/Foreground Service/SKILL.md +212 -0
  151. package/skills/System Integration/Notification/SKILL.md +237 -0
  152. package/skills/System Integration/WorkManager/SKILL.md +256 -0
  153. package/skills/System Integration/clipboard/SKILL.md +155 -0
  154. package/skills/System Integration/share-intent/SKILL.md +182 -0
  155. package/skills/Testing/Compose Testing/SKILL.md +296 -0
  156. package/skills/Testing/Espresso/SKILL.md +292 -0
  157. package/skills/Testing/Fake Data/SKILL.md +245 -0
  158. package/skills/Testing/Integration Testing/SKILL.md +288 -0
  159. package/skills/Testing/Mocking/SKILL.md +229 -0
  160. package/skills/Testing/Snapshot Testing/SKILL.md +259 -0
  161. package/skills/Testing/UI Testing/SKILL.md +293 -0
  162. package/skills/Testing/Unit Testing/SKILL.md +309 -0
  163. package/skills/UI System/Bottom Sheet Patterns/SKILL.md +279 -0
  164. package/skills/UI System/Compose/SKILL.md +296 -0
  165. package/skills/UI System/Compose Animation/SKILL.md +281 -0
  166. package/skills/UI System/Compose Multiplatform/SKILL.md +261 -0
  167. package/skills/UI System/Compose Navigation/SKILL.md +255 -0
  168. package/skills/UI System/Compose Performance/SKILL.md +274 -0
  169. package/skills/UI System/Design System/SKILL.md +217 -0
  170. package/skills/UI System/Empty State Strategy/SKILL.md +208 -0
  171. package/skills/UI System/Keyboard Navigation/SKILL.md +214 -0
  172. package/skills/UI System/Loading Strategy/SKILL.md +254 -0
  173. package/skills/UI System/Material 3/SKILL.md +279 -0
  174. package/skills/UI System/RTL/SKILL.md +179 -0
  175. package/src/index.ts +182 -0
  176. package/tsconfig.json +19 -0
@@ -0,0 +1,261 @@
1
+ ---
2
+ name: dependency-management
3
+ description: >
4
+ Gradle dependency management — conflict resolution, dependency configurations,
5
+ transitive dependencies, and keeping dependencies up to date.
6
+ Load this skill when resolving version conflicts, understanding dependency
7
+ graphs, or managing third-party library upgrades.
8
+ ---
9
+
10
+ # Dependency Management
11
+
12
+ ## Overview
13
+ Dependency management covers how Gradle resolves, configures, and maintains third-party libraries. Conflicts arise when multiple libraries require different versions of the same transitive dependency. Understanding configurations (`implementation`, `api`, `compileOnly`) and resolution strategies prevents runtime crashes and build issues.
14
+
15
+ ---
16
+
17
+ ## Core Principles
18
+
19
+ - Use `implementation` by default — expose via `api` only when the type is part of your public API
20
+ - Let Version Catalog be the **single source of truth** for all versions
21
+ - Resolve conflicts **explicitly** — never rely on Gradle's default resolution silently winning
22
+ - Keep dependencies **up to date** — stale deps accumulate security vulnerabilities
23
+ - Audit the **dependency tree** regularly — transitive deps can surprise you
24
+
25
+ ---
26
+
27
+ ## Dependency Configurations
28
+
29
+ ```kotlin
30
+ dependencies {
31
+ // ✅ implementation — compile + runtime, NOT exposed to consumers
32
+ implementation(libs.retrofit)
33
+
34
+ // ✅ api — compile + runtime, EXPOSED to consumers (module's public API)
35
+ api(libs.kotlinx.coroutines.core) // use when consumers need this type
36
+
37
+ // ✅ compileOnly — compile time only, not in runtime classpath
38
+ compileOnly(libs.javax.annotation)
39
+
40
+ // ✅ runtimeOnly — runtime only, not available at compile time
41
+ runtimeOnly(libs.room.runtime)
42
+
43
+ // ✅ testImplementation — test compile + runtime only
44
+ testImplementation(libs.junit)
45
+
46
+ // ✅ androidTestImplementation — instrumented test only
47
+ androidTestImplementation(libs.espresso.core)
48
+
49
+ // ✅ debugImplementation — debug build type only
50
+ debugImplementation(libs.leakcanary)
51
+
52
+ // ✅ ksp — annotation processor (KSP)
53
+ ksp(libs.hilt.compiler)
54
+ }
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Viewing the Dependency Tree
60
+
61
+ ```bash
62
+ # ✅ Full dependency tree for a configuration
63
+ ./gradlew :app:dependencies --configuration debugRuntimeClasspath
64
+
65
+ # ✅ Find who brings a specific dependency
66
+ ./gradlew :app:dependencyInsight \
67
+ --configuration debugRuntimeClasspath \
68
+ --dependency okhttp
69
+
70
+ # ✅ Per-module dependency tree
71
+ ./gradlew :core:network:dependencies
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Resolving Version Conflicts
77
+
78
+ ```kotlin
79
+ // ✅ Force a specific version globally
80
+ configurations.all {
81
+ resolutionStrategy {
82
+ force("com.squareup.okhttp3:okhttp:4.12.0")
83
+ force("org.jetbrains.kotlin:kotlin-stdlib:2.0.0")
84
+ }
85
+ }
86
+
87
+ // ✅ Prefer highest version (Gradle default — explicit for clarity)
88
+ configurations.all {
89
+ resolutionStrategy.eachDependency {
90
+ if (requested.group == "com.squareup.okhttp3") {
91
+ useVersion("4.12.0")
92
+ because("Align all OkHttp modules to same version")
93
+ }
94
+ }
95
+ }
96
+
97
+ // ✅ Exclude a transitive dependency
98
+ implementation(libs.some.library) {
99
+ exclude(group = "com.google.guava", module = "guava")
100
+ }
101
+
102
+ // ✅ Exclude globally
103
+ configurations.all {
104
+ exclude(group = "commons-logging", module = "commons-logging")
105
+ }
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Platform BOM (Bill of Materials)
111
+
112
+ ```kotlin
113
+ // ✅ BOM aligns all library versions in a group
114
+ dependencies {
115
+ // Firebase BOM — manages all Firebase SDK versions
116
+ implementation(platform(libs.firebase.bom))
117
+ implementation(libs.firebase.analytics) // no version needed
118
+ implementation(libs.firebase.crashlytics) // no version needed
119
+
120
+ // Compose BOM
121
+ implementation(platform(libs.compose.bom))
122
+ implementation(libs.compose.ui) // no version needed
123
+ implementation(libs.compose.material3) // no version needed
124
+ }
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Dependency Locking
130
+
131
+ ```kotlin
132
+ // ✅ Lock dependency versions for reproducible builds
133
+ // In settings.gradle.kts or build.gradle.kts
134
+ dependencyLocking {
135
+ lockAllConfigurations()
136
+ }
137
+
138
+ // Generate lock files
139
+ // ./gradlew dependencies --write-locks
140
+
141
+ // Verify locked versions
142
+ // ./gradlew dependencies --verify-metadata
143
+ ```
144
+
145
+ ```
146
+ # gradle/dependency-locks/*.lockfile — commit these to version control
147
+ # They ensure every developer and CI uses identical dependency versions
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Keeping Dependencies Updated
153
+
154
+ ```bash
155
+ # ✅ Use Gradle Versions Plugin
156
+ plugins {
157
+ id("com.github.ben-manes.versions") version "0.51.0"
158
+ }
159
+
160
+ # Check for updates
161
+ ./gradlew dependencyUpdates
162
+
163
+ # Report format options:
164
+ ./gradlew dependencyUpdates -Drevision=release
165
+ ```
166
+
167
+ ```kotlin
168
+ // ✅ Configure to only suggest stable releases
169
+ tasks.withType<DependencyUpdatesTask> {
170
+ rejectVersionIf {
171
+ isNonStable(candidate.version) && !isNonStable(currentVersion)
172
+ }
173
+ }
174
+
175
+ fun isNonStable(version: String): Boolean {
176
+ val unstableKeywords = listOf("alpha", "beta", "rc", "cr", "m", "preview", "eap")
177
+ return unstableKeywords.any { version.lowercase().contains(it) }
178
+ }
179
+ ```
180
+
181
+ ---
182
+
183
+ ## Module Dependency Graph
184
+
185
+ ```kotlin
186
+ // ✅ Enforce no circular dependencies between modules
187
+ // In build-logic convention plugin
188
+ configurations.all {
189
+ resolutionStrategy.dependencySubstitution {
190
+ // Feature modules must not depend on each other
191
+ }
192
+ }
193
+
194
+ // ✅ Use module dependency graph validation (see module-dependency-graph-validation skill)
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Common Conflict Scenarios
200
+
201
+ ```kotlin
202
+ // Scenario 1: Two libraries require different OkHttp versions
203
+ // Library A requires okhttp:3.x, Library B requires okhttp:4.x
204
+ // Gradle picks 4.x by default (highest) — usually fine but verify
205
+
206
+ // ✅ Verify by checking the dependency tree:
207
+ // ./gradlew :app:dependencyInsight --dependency okhttp
208
+
209
+ // Scenario 2: Kotlin stdlib version mismatch
210
+ // ✅ Force Kotlin stdlib version to match your Kotlin version
211
+ configurations.all {
212
+ resolutionStrategy.eachDependency {
213
+ if (requested.group == "org.jetbrains.kotlin" &&
214
+ requested.name.startsWith("kotlin-")) {
215
+ useVersion(libs.versions.kotlin.get())
216
+ because("Align all Kotlin modules to project Kotlin version")
217
+ }
218
+ }
219
+ }
220
+
221
+ // Scenario 3: Duplicate classes from different artifacts
222
+ // Example: guava-jre vs guava-android
223
+ implementation(libs.guava) {
224
+ exclude(group = "com.google.guava", module = "guava-jre")
225
+ }
226
+ ```
227
+
228
+ ---
229
+
230
+ ## `api` vs `implementation` in Library Modules
231
+
232
+ ```kotlin
233
+ // ✅ Use api() when consumers need the type in their code
234
+ // core/network module:
235
+ api(libs.retrofit) // ✅ consumers call Retrofit types in their code
236
+ implementation(libs.okhttp) // ✅ consumers don't see OkHttp directly
237
+
238
+ // ✅ Use implementation() for everything else
239
+ // Leaking implementation details via api() increases compilation coupling
240
+ // — changes to api() deps trigger recompilation of all consumers
241
+ ```
242
+
243
+ ---
244
+
245
+ ## Anti-Patterns
246
+
247
+ - Using `api()` for everything — every change triggers full recompilation
248
+ - Ignoring version conflict warnings — silent resolution may pick wrong version
249
+ - Not using BOM for library groups (Firebase, Compose) — version mismatches
250
+ - Transitive dependency assumption — a dep available via transitive might disappear
251
+ - No dependency locking in CI — different devs get different dependency versions
252
+ - Outdated dependencies — security vulnerabilities accumulate silently
253
+
254
+ ---
255
+
256
+ ## Related Skills
257
+ - `version-catalog` — centralized version definitions
258
+ - `gradle` — Gradle build configuration
259
+ - `build-cache` — caching with consistent dependencies
260
+ - `dependency-compatibility-resolver` — automated conflict resolution
261
+ - `module-dependency-graph-validation` — enforcing module boundaries
@@ -0,0 +1,284 @@
1
+ ---
2
+ name: gradle
3
+ description: >
4
+ Gradle build system setup and configuration for Android projects.
5
+ Load this skill when configuring build.gradle.kts files, setting up
6
+ Android build config, managing build types, or understanding Gradle
7
+ fundamentals in an Android context.
8
+ ---
9
+
10
+ # Gradle
11
+
12
+ ## Overview
13
+ Gradle is the build system for Android. It compiles code, manages dependencies, runs tests, and packages the APK/AAB. Android projects use the Kotlin DSL (`build.gradle.kts`) — preferred over Groovy DSL. Understanding Gradle's task graph and configuration phase is essential for maintaining fast, reliable builds.
14
+
15
+ ---
16
+
17
+ ## Core Principles
18
+
19
+ - Use **Kotlin DSL** (`build.gradle.kts`) — not Groovy (`build.gradle`)
20
+ - Use **Version Catalog** (`libs.versions.toml`) for all dependency versions
21
+ - Use **Convention Plugins** to share build logic across modules
22
+ - Never hardcode versions inline — always reference from Version Catalog
23
+ - Keep `build.gradle.kts` files **short** — logic belongs in convention plugins
24
+
25
+ ---
26
+
27
+ ## Project Structure
28
+
29
+ ```
30
+ project/
31
+ ├── build.gradle.kts ← root build file (minimal)
32
+ ├── settings.gradle.kts ← module declarations
33
+ ├── gradle/
34
+ │ ├── libs.versions.toml ← version catalog
35
+ │ └── wrapper/
36
+ │ └── gradle-wrapper.properties
37
+ ├── build-logic/ ← convention plugins
38
+ │ └── convention/
39
+ │ └── src/main/kotlin/
40
+ │ ├── AndroidApplicationConventionPlugin.kt
41
+ │ └── AndroidLibraryConventionPlugin.kt
42
+ ├── app/
43
+ │ └── build.gradle.kts
44
+ └── feature/
45
+ └── build.gradle.kts
46
+ ```
47
+
48
+ ---
49
+
50
+ ## settings.gradle.kts
51
+
52
+ ```kotlin
53
+ pluginManagement {
54
+ includeBuild("build-logic")
55
+ repositories {
56
+ google()
57
+ mavenCentral()
58
+ gradlePluginPortal()
59
+ }
60
+ }
61
+
62
+ dependencyResolutionManagement {
63
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
64
+ repositories {
65
+ google()
66
+ mavenCentral()
67
+ }
68
+ versionCatalogs {
69
+ create("libs") {
70
+ from(files("gradle/libs.versions.toml"))
71
+ }
72
+ }
73
+ }
74
+
75
+ rootProject.name = "MyApp"
76
+
77
+ include(":app")
78
+ include(":feature:home")
79
+ include(":feature:auth")
80
+ include(":core:network")
81
+ include(":core:database")
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Root build.gradle.kts
87
+
88
+ ```kotlin
89
+ // ✅ Root build file — minimal, only plugin declarations
90
+ plugins {
91
+ alias(libs.plugins.android.application) apply false
92
+ alias(libs.plugins.android.library) apply false
93
+ alias(libs.plugins.kotlin.android) apply false
94
+ alias(libs.plugins.kotlin.serialization) apply false
95
+ alias(libs.plugins.hilt) apply false
96
+ alias(libs.plugins.ksp) apply false
97
+ alias(libs.plugins.google.services) apply false
98
+ alias(libs.plugins.firebase.crashlytics) apply false
99
+ }
100
+ ```
101
+
102
+ ---
103
+
104
+ ## App Module build.gradle.kts
105
+
106
+ ```kotlin
107
+ plugins {
108
+ alias(libs.plugins.myapp.android.application) // convention plugin
109
+ alias(libs.plugins.myapp.android.hilt)
110
+ alias(libs.plugins.google.services)
111
+ }
112
+
113
+ android {
114
+ namespace = "com.example.app"
115
+
116
+ defaultConfig {
117
+ applicationId = "com.example.app"
118
+ versionCode = 1
119
+ versionName = "1.0.0"
120
+
121
+ // ✅ Build config fields for environment-specific values
122
+ buildConfigField("String", "API_BASE_URL", "\"https://api.example.com/\"")
123
+ }
124
+
125
+ buildTypes {
126
+ debug {
127
+ isDebuggable = true
128
+ applicationIdSuffix = ".debug"
129
+ buildConfigField("String", "API_BASE_URL", "\"https://dev.api.example.com/\"")
130
+ }
131
+ release {
132
+ isMinifyEnabled = true
133
+ isShrinkResources = true
134
+ proguardFiles(
135
+ getDefaultProguardFile("proguard-android-optimize.txt"),
136
+ "proguard-rules.pro"
137
+ )
138
+ signingConfig = signingConfigs.getByName("release")
139
+ }
140
+ }
141
+
142
+ buildFeatures {
143
+ buildConfig = true
144
+ compose = true
145
+ }
146
+ }
147
+
148
+ dependencies {
149
+ implementation(projects.core.network)
150
+ implementation(projects.core.database)
151
+ implementation(projects.feature.home)
152
+
153
+ implementation(platform(libs.firebase.bom))
154
+ implementation(libs.firebase.analytics)
155
+ }
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Library Module build.gradle.kts
161
+
162
+ ```kotlin
163
+ plugins {
164
+ alias(libs.plugins.myapp.android.library) // convention plugin
165
+ alias(libs.plugins.myapp.android.hilt)
166
+ }
167
+
168
+ android {
169
+ namespace = "com.example.core.network"
170
+ }
171
+
172
+ dependencies {
173
+ implementation(libs.retrofit)
174
+ implementation(libs.okhttp)
175
+ implementation(libs.kotlinx.serialization.json)
176
+ api(libs.retrofit.kotlinx.serialization) // ✅ api() exposes to consumers
177
+ }
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Build Config Access
183
+
184
+ ```kotlin
185
+ // ✅ Access BuildConfig fields in code
186
+ val baseUrl = BuildConfig.API_BASE_URL
187
+ val isDebug = BuildConfig.DEBUG
188
+ val versionName = BuildConfig.VERSION_NAME
189
+
190
+ // ✅ Enable BuildConfig generation
191
+ android {
192
+ buildFeatures {
193
+ buildConfig = true
194
+ }
195
+ }
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Signing Configuration
201
+
202
+ ```kotlin
203
+ // ✅ Read signing config from environment — never hardcode in build file
204
+ android {
205
+ signingConfigs {
206
+ create("release") {
207
+ storeFile = file(System.getenv("KEYSTORE_PATH") ?: "keystore.jks")
208
+ storePassword = System.getenv("KEYSTORE_PASSWORD")
209
+ keyAlias = System.getenv("KEY_ALIAS")
210
+ keyPassword = System.getenv("KEY_PASSWORD")
211
+ }
212
+ }
213
+ }
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Useful Gradle Tasks
219
+
220
+ ```bash
221
+ # Build
222
+ ./gradlew assembleDebug
223
+ ./gradlew assembleRelease
224
+ ./gradlew bundleRelease # AAB for Play Store
225
+
226
+ # Test
227
+ ./gradlew test # unit tests
228
+ ./gradlew connectedAndroidTest # instrumented tests
229
+
230
+ # Analysis
231
+ ./gradlew lint
232
+ ./gradlew detekt
233
+ ./gradlew dependencies # dependency tree
234
+ ./gradlew :app:dependencies --configuration debugRuntimeClasspath
235
+
236
+ # Build performance
237
+ ./gradlew assembleDebug --profile # generates HTML report
238
+ ./gradlew assembleDebug --scan # Gradle build scan
239
+
240
+ # Clean
241
+ ./gradlew clean
242
+ ```
243
+
244
+ ---
245
+
246
+ ## Gradle Properties
247
+
248
+ ```properties
249
+ # gradle.properties
250
+
251
+ # ✅ Performance
252
+ org.gradle.jvmargs=-Xmx4g -XX:+UseParallelGC
253
+ org.gradle.parallel=true
254
+ org.gradle.caching=true
255
+ org.gradle.configuration-cache=true
256
+
257
+ # ✅ Android
258
+ android.useAndroidX=true
259
+ android.nonTransitiveRClass=true
260
+ android.enableR8.fullMode=true
261
+
262
+ # ✅ Kotlin
263
+ kotlin.code.style=official
264
+ ```
265
+
266
+ ---
267
+
268
+ ## Anti-Patterns
269
+
270
+ - Groovy DSL (`build.gradle`) in new projects — use Kotlin DSL
271
+ - Hardcoded versions inline — use Version Catalog
272
+ - Business logic in `build.gradle.kts` — use convention plugins
273
+ - `implementation` everywhere — use `api()` when the type is part of public API
274
+ - Not enabling `nonTransitiveRClass` — slows builds in multi-module projects
275
+ - Committing signing credentials in build files — use environment variables
276
+
277
+ ---
278
+
279
+ ## Related Skills
280
+ - `version-catalog` — managing dependency versions
281
+ - `convention-plugin` — shared build logic
282
+ - `build-variant` — build types and flavors
283
+ - `dependency-management` — resolving dependency conflicts
284
+ - `build-cache` — caching build outputs