agentleFS
MindrallyMindrally/skills/android-development/SKILL.md

android-development

Skill266 starsChanged 10 months agoApache-2.0View on GitHub

Android development guidelines for Kotlin with clean architecture, MVI pattern, Material Design, and best practices for building robust mobile applications

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

31 rules. 0 are common, 30 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 30

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use English for all code and documentation

    line 11
  2. Distinctive:

    Always declare variable and function types explicitly

    line 12
  3. Very specific:

    Avoid the any type; create necessary custom types

    line 13
  4. Distinctive:

    Avoid magic numbers; define constants instead

    line 21
  5. Distinctive:

    Keep functions under 20 instructions with single responsibility

    line 26
  6. Distinctive:

    Use default parameters instead of null checks

    line 31
  7. Distinctive:

    Follow SOLID principles; prefer composition over inheritance

    line 38
  8. Distinctive:

    Keep classes under 200 instructions, 10 public methods, 10 properties

    line 39
  9. Distinctive:

    Create custom exception types for domain errors

    line 44
  10. Distinctive:

    Use repository pattern for data persistence and caching

    line 50
  11. Distinctive:

    Keep business logic in Use Cases or Interactors

    line 51
  12. Distinctive:

    Keep side effects predictable and traceable

    line 68
  13. Distinctive:

    Use Navigation Component for fragment and activity routing

    line 73
  14. Distinctive:

    Use BottomNavigationView for main destinations (Home, Profile, Settings, etc.)

    line 80
  15. Distinctive:

    Use ViewBinding for type-safe view access

    line 84
  16. Distinctive:

    Use Flow or LiveData for UI state management

    line 85
  17. Distinctive:

    Prefer XML layouts and Fragments over Jetpack Compose (unless Compose is specifically required)

    line 90
  18. Distinctive:

    Use ConstraintLayout for complex layouts

    line 91
  19. Distinctive:

    Follow responsive design practices for different screen sizes

    line 93
  20. Distinctive:

    Verify Email Screen - Email verification

    line 102
  21. Distinctive:

    Test ViewModels, Use Cases, and Repositories

    line 108
  22. Distinctive:

    Use test doubles for dependencies

    line 109
  23. Distinctive:

    Write integration tests for API modules

    line 114
  24. Distinctive:

    Use Espresso for instrumented tests

    line 116
  25. Distinctive:

    Avoid memory leaks from improper lifecycle handling

    line 122
  26. Distinctive:

    Use Coroutines for async operations

    line 126
  27. Distinctive:

    Use WorkManager for deferrable background work

    line 128
  28. Distinctive:

    Use Hilt or Dagger for dependency injection

    line 131
  29. Distinctive:

    Keep DI configuration organized

    line 133
  30. Distinctive:

    Avoid work on the main thread

    line 136
  31. Distinctive:

    Use lazy loading for heavy resources

    line 138

“Common” is measured: kept by at least 6 in 10 of the 5 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 Development Best Practices

General Kotlin Guidelines

Basic Principles

  • Use English for all code and documentation
  • Always declare variable and function types explicitly
  • Avoid the any type; create necessary custom types
  • Eliminate blank lines within function bodies

Naming Standards

  • PascalCase: Classes, interfaces, enums
  • camelCase: Variables, functions, methods
  • underscores_case: Files and directories
  • UPPERCASE: Environment variables, constants
  • Avoid magic numbers; define constants instead
  • Functions should start with action verbs
  • Boolean variables use prefixes: isLoading, hasError, canDelete

Function Design

  • Keep functions under 20 instructions with single responsibility
  • Use verb-based naming
  • Prefix boolean returns with is, has, or can
  • Prefix void returns with execute, save, send
  • Combat nesting through early returns, utility extraction, and higher-order functions
  • Use default parameters instead of null checks
  • Consolidate parameters into objects (RO-RO pattern)

Data and Classes

  • Employ data classes for data structures
  • Encapsulate primitives in composite types; validate internally
  • Favor immutability; use val for unchanging values
  • Follow SOLID principles; prefer composition over inheritance
  • Keep classes under 200 instructions, 10 public methods, 10 properties

Exception Handling

  • Reserve exceptions for unexpected errors
  • Catch exceptions only to fix anticipated issues or add context
  • Create custom exception types for domain errors

Android Architecture

Clean Architecture

  • Implement clean architecture with clear layer separation
  • Use repository pattern for data persistence and caching
  • Keep business logic in Use Cases or Interactors
  • Separate concerns between UI, domain, and data layers

Project Structure

app/
├── data/           # Data sources, repositories, models
├── domain/         # Use cases, domain models, interfaces
├── presentation/   # UI components, ViewModels, state
└── di/             # Dependency injection modules

MVI Pattern

  • Deploy MVI pattern for state and event management
  • ViewModels manage UI state as a single immutable state object
  • UI components observe state and render accordingly
  • Handle user intents/events through a single entry point
  • Keep side effects predictable and traceable

UI Development

Navigation

  • Use Navigation Component for fragment and activity routing
  • Define navigation graph for app flow
  • Handle deep links through Navigation Component
  • Implement safe args for type-safe navigation arguments

Main Activity Structure

  • MainActivity manages primary navigation
  • Use BottomNavigationView for main destinations (Home, Profile, Settings, etc.)
  • Handle navigation state properly across configuration changes

View Binding and State

  • Use ViewBinding for type-safe view access
  • Use Flow or LiveData for UI state management
  • Observe state changes in lifecycle-aware manner
  • Handle loading, error, and success states consistently

UI Framework Preferences

  • Prefer XML layouts and Fragments over Jetpack Compose (unless Compose is specifically required)
  • Use ConstraintLayout for complex layouts
  • Apply Material 3 design guidelines
  • Follow responsive design practices for different screen sizes

Authentication Flow

Structure authentication screens properly:

  1. Splash Screen - Initial app launch
  2. Login Screen - User authentication
  3. Register Screen - New user registration
  4. Forgot Password Screen - Password recovery
  5. Verify Email Screen - Email verification

Testing

Unit Testing

  • Follow Arrange-Act-Assert conventions
  • Test ViewModels, Use Cases, and Repositories
  • Use test doubles for dependencies
  • Achieve good coverage of business logic

UI Testing

  • Implement widget testing for UI components
  • Write integration tests for API modules
  • Test navigation flows
  • Use Espresso for instrumented tests

Best Practices

Lifecycle Management

  • Handle lifecycle events properly
  • Avoid memory leaks from improper lifecycle handling
  • Use lifecycle-aware components

Background Processing

  • Use Coroutines for async operations
  • Handle cancellation properly
  • Use WorkManager for deferrable background work

Dependency Injection

  • Use Hilt or Dagger for dependency injection
  • Scope dependencies appropriately
  • Keep DI configuration organized

Performance

  • Avoid work on the main thread
  • Optimize RecyclerView with DiffUtil
  • Use lazy loading for heavy resources
  • Profile and optimize memory usage

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.