agentleFS
lgzarturolgzarturo/codeconductor/.agents/skills/android/SKILL.md

android

Skill0 starsChanged 26 days agoMITView on GitHub

Provides expert knowledge for building modern native Android apps using Kotlin, Jetpack Compose, Material Design 3, MVI architecture, Hilt dependency injection, and Media3/ExoPlayer.

11 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use accessibility-frontend-review, android-new-module and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • BrowserWorksSkill

    accessibility-frontend-review

    Performs an accessibility code review of a local diff or Phabricator revision in the style of the Firefox accessibility team. Use this skill whenever the user asks to review a Phabricator patch or revision for accessibility issues, mentions a D-number (like D284142) in the context of accessibility review, asks "does this patch have any a11y issues", or wants to check a diff against accessibility guidelines. Also use it when the user says things like "can you review this for a11y", "check this patch", or "give me an accessibility review of D[number]". Invoke proactively when the user pastes a phabricator.services.mozilla.com URL or shares a revision ID alongside any accessibility concern. Invoke when questions about the following topics are raised: aria properties, aria roles, high contrast mode, forced colors, prefers contrast, focus order, screen readers, assistive technology.

    Also in 4 projects that use this

  • BrowserWorksSkill

    android-new-module

    Guide for creating new Android gradle modules in the android-components project.

    Also in 4 projects that use this

  • +10 more from BrowserWorks

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer MVI (Model-View-Intent) for state management.

    line 47
  2. Very specific:

    Use constructor injection for ViewModels with @HiltViewModel.

    line 59
  3. Very specific:

    Keep data models immutable.

    line 67
  4. Very specific:

    Use contentType and key in LazyColumn and LazyRow to optimize item recycling and rendering performance.

    line 68
  5. Very specific:

    Avoid fixed hardcoded margins.

    line 69
  6. Very specific:

    Run ExoPlayer / Media3 inside a robust Foreground Service (using MediaSessionService) to ensure playback continues when the app is in the …

    line 76
  7. Very specific:

    Always inject CoroutineDispatcher instances instead of hardcoding them:

    line 81
  8. Distinctive:

    Use JUnit 5 and MockK for mocking dependencies.

    line 97
  9. Very specific:

    Test ViewModels and Reducers by asserting StateFlow updates.

    line 98
  10. Very specific:

    Create UI tests using Compose test rules: createComposeRule() or createAndroidComposeRule<MainActivity>().

    line 102
  11. Distinctive:

    Use these commands for building, checking code style, running tests, and profiling performance:

    line 109

“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “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

Android + Kotlin (Jetpack Compose & Media3)

This playbook defines the architecture, UI design system, performance guidelines, and testing strategy for native Android applications.

android-ui-design owns specialized Jetpack Compose phone UI/UX design, implementation, review, and audit guidance. This skill remains the general guide for architecture, Hilt dependency injection, Media3, performance, and testing.


1. Lead Architect & Modularization

Architecture (MVI / MVVM with Clean Architecture)

  • Prefer MVI (Model-View-Intent) for state management. Ensure a strict unidirectional data flow:
    • UiState: Single source of truth for the UI state.
    • UiIntent: Actions initiated by the user or system.
    • UiEffect: One-time events (navigation, toasts, snackbars).
  • Separate the project into clean logical modules:
    • app: Application entry point, launcher activity, global dependency injection configuration.
    • core: Shared resources, network layer, media playback logic (ExoPlayer/Media3), storage.
    • feature: Individual business features (isolated and independent of other features).

Dependency Injection (Hilt)

  • Annotate the Application class with @HiltAndroidApp.
  • Annotate Activities and Fragments with @AndroidEntryPoint.
  • Use constructor injection for ViewModels with @HiltViewModel.

2. Jetpack Compose UI/UX

Recomposition & State Management

  • Consume StateFlow from ViewModels safely using collectAsStateWithLifecycle() to respect the activity lifecycle.
  • Keep data models immutable. Mark configuration classes with @Immutable or @Stable to prevent redundant recompositions.
  • Use contentType and key in LazyColumn and LazyRow to optimize item recycling and rendering performance.
  • Avoid fixed hardcoded margins. Apply WindowInsets to support modern edge-to-edge screens.

3. Performance & Multimedia (Media3 / ExoPlayer)

Playback & Services

  • Run ExoPlayer / Media3 inside a robust Foreground Service (using MediaSessionService) to ensure playback continues when the app is in the background.
  • Clean up resources: release player instances in onDestroy or when the service is stopped.
  • Control wake locks strictly to avoid draining the user's battery when playback is paused.

Kotlin Coroutines & Threading

  • Always inject CoroutineDispatcher instances instead of hardcoding them:
    • Dispatchers.IO: Database access, network operations, file reading.
    • Dispatchers.Default: CPU-intensive operations (parsing JSON, filtering large lists).
    • Dispatchers.Main: UI modifications and light interactions.

R8 & Resource Optimization

  • Enable shrinking and obfuscation in production builds:
    • isMinifyEnabled = true
    • isShrinkResources = true
  • Convert all static images to the modern WebP format to minimize the application binary size.

4. Quality Assurance & Automated Testing

Unit Testing

  • Use JUnit 5 and MockK for mocking dependencies.
  • Test ViewModels and Reducers by asserting StateFlow updates. Use Turbine to easily test Kotlin Flows.
  • Mock all multimedia/ExoPlayer components to avoid loading actual audio/video resources in unit tests.

UI Testing

  • Create UI tests using Compose test rules: createComposeRule() or createAndroidComposeRule<MainActivity>().
  • Assert correct rendering, visibility states, and user interactions without executing real network calls.

5. Key Gradle & ADB Commands

Use these commands for building, checking code style, running tests, and profiling performance:

CommandAction
./gradlew initInitialize a new Gradle project structure.
./gradlew app:dependenciesList all dependencies of the application module.
./gradlew assembleDebugValidate compilation and generate debug APK.
./gradlew ktlintCheckRun KtLint check to enforce Kotlin style guidelines.
./gradlew lintDebugRun Android Lint tool to inspect code quality and UI issues.
./gradlew testDebugUnitTestRun unit tests for debug build variant.
./gradlew connectedAndroidTestRun instrumented UI tests on connected emulator or device.
./gradlew assembleReleaseGenerate release build variant with R8 optimizations.
adb shell dumpsys batterystatsProfile system battery consumption metrics.
adb shell am dumpheap <package> heap.hprofDump application heap memory file for profiling.

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.