Preparing an Android project for the agent
The agent's quality on an Android project depends mostly on how the repo is prepared. Four files carry that preparation:
- `CLAUDE.md` — build commands, architecture rules, prohibitions.
- `.claude/settings.json` — permission rules (secrets in
deny, everyday commands inallow). - `.claude/skills/` — the team's recurring procedures.
- `.mcp.json` — connected external systems, when needed.
All are committed. As a result, when a new developer clones the project, the agent is already configured for them too.
| Android-specific problem | Fix in CLAUDE.md |
|---|---|
| A full build takes minutes; the agent waits every iteration | Spell out the narrow module-level commands |
| The agent doesn't see the version catalog and guesses APIs | "Check `libs.versions.toml` before adding a dependency" |
| It writes a new screen in XML | "New UI is always Compose; do not add new XML layouts" |
| Hardcoded strings | "Every user-visible string lives in `strings.xml`" |
| It touches legacy code | "Don't touch `legacy/` — it has its own migration plan" |
| It breaks module boundaries | "`ui/` never depends on `data/` directly" |
The single highest-impact change is pinning down the build commands. If the agent runs ./gradlew build and that takes 7 minutes, every iteration costs 7 minutes. ./gradlew :feature:orders:compileDebugKotlin might take 20 seconds. That saves both time and tokens.
my-android-app/
├── CLAUDE.md ← build commands, architecture, prohibitions
├── .claude/
│ ├── settings.json ← permission rules (committed)
│ ├── settings.local.json ← personal (gitignored)
│ ├── rules/
│ │ ├── testing.md ← paths: **/src/test/**
│ │ └── compose.md ← paths: **/ui/**/*.kt
│ └── skills/
│ ├── compose-review/
│ ├── new-feature-module/
│ └── release-check/
├── .mcp.json ← external systems (if used)
├── gradle/libs.versions.toml
└── app/, feature/, core/The layout of an Android repo prepared for the agent. Everything except `settings.local.json` is committed.
A practical way to test the setup: open a fresh session and ask the agent questions without having it write code —
- "Explain this project's module structure and architectural pattern."
- "What steps are needed to add a new feature module?"
- "Which command would you run to verify a change?"
If the answers are wrong, the problem is the configuration, not the agent. The same check works during a new developer's onboarding.
📚 Sources and documentation
- Memory and CLAUDE.mdofficialcode.claude.com
- Android architecture recommendationsofficialdeveloper.android.com
The reference point for the architecture rules you write into CLAUDE.md.
- Configure your buildofficialdeveloper.android.com