agentleFS
wrinfotelwrinfotel/verified-android-skills/skills/gradle-build-logic/SKILL.md

gradle-build-logic

Skill0 starsChanged 35 days agoMITView on GitHub

Gradle build discipline for Android projects: version catalogs over hardcoded coordinates, KSP over kapt, R8 minification for release, build-speed flags in gradle.properties, and convention plugins. Use when editing build.gradle.kts, libs.versions.toml, gradle.properties, or shared build logic. Core rules have machine checks in checks/.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    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. Distinctive:

    After ANY build-script edit, run the Verification step (bottom of this file).

    line 15
  2. Very specific:

    MUST declare dependency coordinates and versions in gradle/libs.versions.toml and reference them through type-safe libs.* accessors.

    line 20
  3. Distinctive:

    MUST use KSP for annotation processing: "kapt ...

    line 39
  4. Distinctive:

    MUST enable R8 in the release build type of application modules: "set isMinifyEnabled = true (for code optimization) and isShrinkResources …

    line 56
  5. Very specific:

    MUST enable, in gradle.properties: org.gradle.caching=true (the build cache is off by default), org.gradle.parallel=true (parallel …

    line 80
  6. Very specific:

    No deterministic check covers this section.

    line 106
  7. Distinctive:

    Run after any build-script edit (from the project root):

    line 111
  8. Distinctive:

    All four must pass (exit 0) before declaring the task done.

    line 120

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Gradle Build Logic

Operational rules for a coding agent. RIGHT/WRONG pairs are canonical. After ANY build-script edit, run the Verification step (bottom of this file).

1. Version catalogs — one source of dependency truth

MUST declare dependency coordinates and versions in gradle/libs.versions.toml and reference them through type-safe libs.* accessors. "Instead of hardcoding dependency names and versions in individual build files and updating each entry whenever you need to upgrade a dependency" — centralize them.

WRONG:

implementation("androidx.core:core-ktx:1.9.0")

RIGHT:

// gradle/libs.versions.toml: androidx-ktx = { ... version.ref = "ktx" }
implementation(libs.androidx.core.ktx)

2. KSP, not kapt

MUST use KSP for annotation processing: "kapt ... is significantly slower than Kotlin KSP. If you ... use tools that process annotations (such as Room) with KSP support, migrate to KSP." Use kapt only for processors without KSP support (document the reason at the declaration).

WRONG:

kapt(libs.hilt.compiler)

RIGHT:

ksp(libs.hilt.compiler)

3. Release builds are minified

MUST enable R8 in the release build type of application modules: "set isMinifyEnabled = true (for code optimization) and isShrinkResources = true (for resource optimization) ... We recommend that you always enable both settings." On AGP 9.3+ the optimization { enable = true } block replaces both. Tests and libraries are exempt.

WRONG:

release {
    isMinifyEnabled = false
}

RIGHT:

release {
    isMinifyEnabled = true
    isShrinkResources = true
    proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}

4. Build-speed flags are on

MUST enable, in gradle.properties: org.gradle.caching=true (the build cache is off by default), org.gradle.parallel=true (parallel subproject execution), and org.gradle.configuration-cache=true (verify plugin compatibility first).

WRONG:

# defaults: caching off, configuration cache off

RIGHT:

org.gradle.caching=true
org.gradle.parallel=true
org.gradle.configuration-cache=true

5. Convention plugins (review-verified)

For multi-module projects, share build configuration through convention plugins in a build-logic included build instead of copy-pasting config across modules. Reference catalog entries with alias and non-catalog plugins (the convention plugins themselves) with id. Prefer type-safe accessors (implementation(...)) and keep compiler options in the convention plugin, not per module.

No deterministic check covers this section; verify against references/gradle.md.

Verification

Run after any build-script edit (from the project root):

bash <skill-dir>/checks/check_version_catalog.sh   <project-root>
bash <skill-dir>/checks/check_no_kapt.sh           <project-root>
bash <skill-dir>/checks/check_release_minify.sh    <project-root>
bash <skill-dir>/checks/check_gradle_properties.sh <project-root>

All four must pass (exit 0) before declaring the task done. Checks are deterministic text heuristics over build files; if release configuration lives in a convention plugin, point the minify check at the build-logic directory too.

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.