agentleFS
kelvinkosbabkelvinkosbab/AppBootstrapAI/.claude/skills/android-modularization-pro/SKILL.md

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.

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
  1. Very specific:

    Check the graph with references/module-graph.md and the dependency report in references/audit.md: feature→feature impl edges, features …

    line 22
  2. Very specific:

    Check navigation and DI with references/navigation-and-di.md: how features reach each other, where the NavHost lives, Hilt module …

    line 23
  3. Very specific:

    Check resources, visibility, and build flags: non-transitive R, resource prefixes, internal/explicit API, configuration cache and build …

    line 24
  4. Distinctive:

    Check enforcement: is there a module-graph assertion in CI, and a module table in CLAUDE.md?

    line 25
  5. Distinctive:

    If doing a partial review, load only the relevant reference file.

    line 27
  6. Distinctive:

    Incremental, never big-bang: Every step leaves the app building and shippable.

    line 34
  7. Distinctive:

    Shape: add a module-graph assertion and a module table in CLAUDE.md.

    line 87

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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, following references/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):

  1. Inventory: settings.gradle.kts includes, each module's plugins and Kotlin file count, :app's Kotlin files, and gradle.properties build flags. Use references/audit.md ("Inventory").
  2. Check the graph with references/module-graph.md and the dependency report in references/audit.md: feature→feature impl edges, features reaching data sources, api(...) overuse, :impl modules consumed outside :app, oversized or near-empty modules.
  3. Check navigation and DI with references/navigation-and-di.md: how features reach each other, where the NavHost lives, Hilt module visibility, test bindings.
  4. Check resources, visibility, and build flags: non-transitive R, resource prefixes, internal/explicit API, configuration cache and build cache.
  5. 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

  • :app is an assembler. It keeps the Application, MainActivity, the top-level NavHost, 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's impl; shared needs move down into :core:*.
  • Navigation goes through :app. Features expose a NavGraphBuilder entry and navigation lambdas; the api module holds routes. :app connects 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.
  • implementation and internal by 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 transitive R that breaks when non-transitive R is on, a dynamic feature with a missing split) > boundary leak (feature→feature impl edge, features importing :core:database or :core:network, logic in :app, api leaks) > 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 to android-mvvm-architecture.md; repositories to android-repository-pattern.md; design-system contents to android-design-system-pro; Compose performance to android-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:api

Summary

InventoryCount
Modules11
Kotlin files in :app (excluding Application / MainActivity)23
Feature→feature impl edges2
Features depending on :core:database / :core:network1
api(...) declarations9
Graph check in CInone
  1. Broken: :feature:tasks reads R.string.app_name from :app through the transitive R; it fails once android.nonTransitiveRClass=true. Move the string to the module.
  2. Boundary leak: 23 files in :app, including TaskListViewModel. Move them to :feature:tasks:impl with their tests.
  3. Boundary leak: the Settings → Account and Tasks → Settings edges.
  4. 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, the api/impl split, 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 in api modules, NavGraphBuilder entries, lambdas wired in :app, Hilt bindings per module, internal modules, test replacement with @TestInstallIn.
  • references/audit.md — inventory commands, a dependency-rule script over build.gradle.kts files, searches, the module-graph-assertion setup, and the CI job.
  • references/architecture-conventions.md — the full android-modular-architecture rule (the installed rule is its checklist): why modularize, the module-type table, dependency rules, Hilt, resources, build performance, migration.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.