android-modularization-pro
Skill8 starsChanged 12 days agoMITView on GitHub
Plans, audits, and migrates Android apps to a multi-module Gradle build (the Now in Android layout) — a thin :app over feature (api/impl), data, domain, model, and core modules, with cross-feature navigation through :app, Hilt bindings per module, non-transitive resources, and an enforced dependency graph. Use when modularizing a single-module app, designing a new app's module graph, splitting an oversized module, or reviewing whether a multi-module project's graph is healthy.
In this repository40 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- android-accessibility-proSkill
- android-adaptive-layout-proSkill
- android-compose-proSkill
- android-coroutines-proSkill
- android-design-system-proSkill
- android-gradle-architecture-proSkill
- android-library-proSkill
- android-memory-storage-proSkill
- app-intents-proSkill
- beta-deployment-proSkill
- coredata-swift6-proSkill
- cross-platform-parity-proSkill
- flaky-tests-proSkill
- foundation-models-proSkill
- instruments-profiling-proSkill
- linting-proSkill
- localization-proSkill
- motion-design-proSkill
- r8-shrink-proSkill
- store-compliance-proSkill
- swift-accessibility-proSkill
- swift-adaptive-layout-proSkill
- swift-concurrency-proSkill
- swiftdata-proSkill
- swift-design-system-proSkill
- swift-docc-proSkill
- swift-error-handling-proSkill
- swift-library-proSkill
- swift-logging-proSkill
- swift-memory-storage-proSkill
- swift-modularization-proSkill
- swift-package-proSkill
- swift-testing-proSkill
- swiftui-proSkill
- visionos-proSkill
- xcode-security-proSkill
- xml-to-compose-migration-proSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Check the graph with references/module-graph.md and the dependency report in references/audit.md: feature→feature impl edges, features …
- Very specific: line 23
Check navigation and DI with references/navigation-and-di.md: how features reach each other, where the NavHost lives, Hilt module …
- Very specific: line 24
Check resources, visibility, and build flags: non-transitive R, resource prefixes, internal/explicit API, configuration cache and build …
- Distinctive: line 25
Check enforcement: is there a module-graph assertion in CI, and a module table in CLAUDE.md?
- Distinctive: line 27
If doing a partial review, load only the relevant reference file.
- Distinctive: line 34
Incremental, never big-bang: Every step leaves the app building and shippable.
- Distinctive: line 87
Shape: add a module-graph assertion and a module table in CLAUDE.md.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Turn an Android app into a thin :app over many small Gradle modules, or check one that already is. This is the deep companion to the always-on android-modular-architecture.md rule. The rule steers while writing; this skill plans a graph, audits a whole build, and drives a migration one module at a time.
Pick the mode from the request:
- Plan: a new app, or a single-module app before any move. Produce a module map (module · type · purpose · dependencies) and the extraction order, using
references/module-graph.md. Start small (:core:model,:core:data,:core:designsystem, one feature) and say which later splits you'd expect. - Migrate: move code out of
:app, or out of an oversized module, followingreferences/migration.md. One module per step, the app building and tests passing after each. - Audit: an app that already has modules. Run the checks in
references/audit.md, then report findings ranked by severity.
Review process (audit mode):
- Inventory:
settings.gradle.ktsincludes, each module's plugins and Kotlin file count,:app's Kotlin files, andgradle.propertiesbuild flags. Usereferences/audit.md("Inventory"). - Check the graph with
references/module-graph.mdand the dependency report inreferences/audit.md: feature→featureimpledges, features reaching data sources,api(...)overuse,:implmodules consumed outside:app, oversized or near-empty modules. - Check navigation and DI with
references/navigation-and-di.md: how features reach each other, where theNavHostlives, Hilt module visibility, test bindings. - Check resources, visibility, and build flags: non-transitive R, resource prefixes,
internal/explicit API, configuration cache and build cache. - Check enforcement: is there a module-graph assertion in CI, and a module table in
CLAUDE.md?
If doing a partial review, load only the relevant reference file.
Core Instructions
:appis an assembler. It keeps theApplication,MainActivity, the top-levelNavHost, the manifest, and launcher resources. Screens, ViewModels, and repositories belong in modules.- Direction is the architecture.
:app→ features → domain → data → data sources → model. Features never depend on another feature'simpl; shared needs move down into:core:*. - Navigation goes through
:app. Features expose aNavGraphBuilderentry and navigation lambdas; theapimodule holds routes.:appconnects them. - Incremental, never big-bang. Every step leaves the app building and shippable. Convention plugins come first so each new module costs a few lines.
implementationandinternalby default.api(...)and public symbols are deliberate, reviewed choices.- Granularity follows real boundaries. Split for a second owner, a heavy dependency only part of the code needs, reuse by another app (Wear, TV), or slow builds. Don't split speculatively.
- Enforce what you decide. A graph rule without a CI check is a suggestion.
- Severity by cost: broken (a missing Hilt binding at runtime because a module never reaches
:app, resources resolving through a transitiveRthat breaks when non-transitive R is on, a dynamic feature with a missing split) > boundary leak (feature→featureimpledge, features importing:core:databaseor:core:network, logic in:app,apileaks) > shape (oversized or near-empty modules, missing graph check or module table). - Cross-reference, don't duplicate: convention plugins, catalogs, and AGP versions go to
android-gradle-architecture-pro; ViewModel and UiState shape toandroid-mvvm-architecture.md; repositories toandroid-repository-pattern.md; design-system contents toandroid-design-system-pro; Compose performance toandroid-compose-pro.
Output Format
Plan mode: a module table (module · type · purpose · depends on), a Mermaid or indented-text graph, the extraction order with one line per step, and what :app will contain at the end.
Migrate mode: for each step, the files moved, the new module's build.gradle.kts (convention plugins plus dependencies), the settings.gradle.kts include, symbols made public or internal, and the commands run to verify it (./gradlew :module:check, ./gradlew :app:assembleDebug).
Audit mode: findings grouped by module (or "Build"). Each finding gives the file and line, the violated principle, why it costs something (build time, testability, a runtime break), and a brief before/after. Skip clean modules. End with an inventory table and a prioritized plan.
Example finding:
feature/settings/build.gradle.kts
Line 14: :feature:settings depends on :feature:account to open the account screen. Every change inside Account now recompiles Settings, and Settings can't be tested without Account's whole dependency tree.
// Before
dependencies {
implementation(projects.feature.account)
}
// After: Settings only knows a lambda; :app connects it to Account's route
dependencies {
// no feature dependency
}
// :feature:settings:impl
fun NavGraphBuilder.settingsGraph(onAccountClick: () -> Unit) { /* ... */ }
// :app
settingsGraph(onAccountClick = navController::navigateToAccount) // from :feature:account:apiSummary
| Inventory | Count |
| Modules | 11 |
Kotlin files in :app (excluding Application / MainActivity) | 23 |
Feature→feature impl edges | 2 |
Features depending on :core:database / :core:network | 1 |
api(...) declarations | 9 |
| Graph check in CI | none |
- Broken:
:feature:tasksreadsR.string.app_namefrom:appthrough the transitiveR; it fails onceandroid.nonTransitiveRClass=true. Move the string to the module. - Boundary leak: 23 files in
:app, includingTaskListViewModel. Move them to:feature:tasks:implwith their tests. - Boundary leak: the Settings → Account and Tasks → Settings edges.
- Shape: add a module-graph assertion and a module table in
CLAUDE.md.
End of example.
References
references/module-graph.md— module types and what each holds, allowed edges, theapi/implsplit, naming, granularity heuristics, extra targets (Wear, widgets, dynamic features), a worked example graph.references/migration.md— what stays in:app, prerequisites, extraction order, per-step checklist, resources and non-transitive R, Hilt and manifest merging, common breakages.references/navigation-and-di.md— type-safe routes inapimodules,NavGraphBuilderentries, lambdas wired in:app, Hilt bindings per module,internalmodules, test replacement with@TestInstallIn.references/audit.md— inventory commands, a dependency-rule script overbuild.gradle.ktsfiles, searches, the module-graph-assertion setup, and the CI job.references/architecture-conventions.md— the fullandroid-modular-architecturerule (the installed rule is its checklist): why modularize, the module-type table, dependency rules, Hilt, resources, build performance, migration.
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.

