MediumPierrick CAENTutorial
Making AI Write Android Code Our Way: A Practical Guide to Agent Skills
Summary
An Android team at Medium describes how it encoded its project conventions so AI assistants generate code aligned with Clean Architecture, Kotlin, Jetpack Compose, Hilt, Apollo GraphQL, and feature modules. An AGENTS.md file provides persistent context about module structure, dependency injection, state management, navigation, testing, and commands, while Markdown skills in .agents/skills/ provide ordered runbooks for specific tasks. Examples cover scaffolding screens and feature modules, migrating Material 2 to Material 3, enforcing ViewModel feature-flag handling, and adding deeplinks, analytics, translations, and tests. Detailed patterns include ViewModel-injecting and @VisibleForTesting composables, assisted injection, StateFlow, Result, MockK, Turbine, and Robolectric. The team iterates skills from review feedback, keeps them version-controlled, and plans file-aware rules plus commands for release diffs and reporting.
Context
The team’s coding conventions were distributed across pull-request comments, Slack threads, and experienced engineers’ knowledge. Generic AI-generated Kotlin missed the team’s architecture, component library, conventions, and testing style.
Approach / What changed
The team uses a root AGENTS.md file for broad project context and version-controlled Markdown skills in .agents/skills/ for detailed, step-by-step workflows. The skills cover scaffolding, migrations, pattern enforcement, and repetitive tasks, and are refined from review feedback and example pull requests.
Takeaways
AGENTS.md documents module structure, Hilt dependency injection, StateFlow and SharedFlow state management, centralized navigation, repository patterns, testing strategy, and common Gradle and Detekt commands.
The create-compose-screen skill produces a ViewModel-injecting composable and a separate @VisibleForTesting overload, along with previews, test tags, listeners, and supporting files.
The team plans to replace the broad AGENTS.md context with file-aware rules that activate for relevant Compose, repository, testing, or ViewModel files.
Source and freshness
- Source
- medium.engineering
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.