Skip to content
Agent Friendly Code

What to put in an AGENTS.md for Android

Agents learned Android builds from AGP 7 and 8, so say you are on AGP 9, where built-in Kotlin and the new DSL are the default. Android Studio's agent reads AGENTS.md from the current directory and every parent, so a module can have its own.

Which commands should it list?

  • ./gradlew assembleDebugdebug APK, signed with the debug key
  • ./gradlew testlocal unit tests on the JVM
  • ./gradlew connectedAndroidTestinstrumented tests, on a device or emulator
  • ./gradlew lintnot run by the build; default variant only

Write them as your repo runs them, with its package manager and flags, plus how to run one test.

What layout should it explain?

  • Which module is the app, which are libraries, and which have their own AGENTS.md.
  • That versions live in gradle/libs.versions.toml and build files use its libs. aliases.
  • Jetpack Compose or XML views, and which one new screens use.

What do agents get wrong?

  • AGP 9 has built-in Kotlin: don't add the org.jetbrains.kotlin.android plugin, which the new DSL rejects.
  • AGP 9 removed applicationVariants and the old variant API; use androidComponents.onVariants.
  • Signing passwords stay out of build files and git.

From the official docs: developer.android.com/agent-files (new tab) · developer.android.com/agp-9-0-0-release-notes (new tab) · developer.android.com/building-cmdline (new tab) · developer.android.com/command-line (new tab) · developer.android.com/lint (new tab) · developer.android.com/migrate-to-catalogs (new tab). The rest of the file is the same for any project: what goes in an AGENTS.md.

Android repos with an AGENTS.md or CLAUDE.md (3)

Built on Android; 3 pass the AGENTS.md check in full.

Android repos with an AGENTS.md or CLAUDE.md
RepoFileLength
square/leakcanaryAGENTS.md 9,766
coil-kt/coilAGENTS.md 3,164
championswimmer/TwoFacAGENTS.md 3,271

More examples: Next.js · React · FastAPI · Django · Rails · Vue · Laravel · Flutter · all examples