AI Skills in Development: Powering Your Android Workflow
Table of Contents
🧠 What are AI Skills? Theory and Concepts
In the world of Prompt Engineering, a Skill is not simply an “instruction”. Technically, a Skill is a persistent context configuration designed to specialize a Large Language Model (LLM) in a specific task.
Generalist LLMs (like GPT-4 or Gemini Pro) know “a little bit of everything”. By defining a Skill, we are applying a technique called Persona Adoption combined with Few-Shot Prompting:
- Persona Adoption: “Act as a Senior Android Engineer expert in Clean Architecture”.
- Constraints: “Use only Kotlin, never Java. Prefer StateFlow over LiveData”.
- Few-Shot Examples: “Here are 3 examples of how I want the code to look”.
This combination transforms the generic assistant into a surgical precision tool for your specific project.
The Prompting Hierarchy
To understand why Skills are superior to manual prompts, let’s look at the hierarchy:
- Zero-Shot Prompt: “Make a login”. (Result: Generic code, possibly in Java or with old libraries).
- One-Shot Prompt: “Make a login using MVVM”. (Result: Better structure, but inconsistent details).
- AI Skill (System Prompt + Context): “Act as the expert for project X. Use the architecture defined in agents.md. Here is the exact pattern of our ViewModels. Generate the login”. (Result: Production-ready code).
🛠️ Configuring Skills for Android Development
Below, we detail how to configure these “virtual experts” for the most critical tasks in Android development.
1. MVVM Architecture Skill (The Architect)
This skill is fundamental. Its goal is not just to generate code, but to maintain the architectural integrity of the project.
Theory behind the Skill: In modern Android, separation of concerns is critical. This skill enforces Unidirectional Data Flow (UDF) and reactive state management.
Configuration (System Instruction):
# Role
Act as a Principal Android Architect.
# Objective
Generate MVVM components that strictly comply with Clean Architecture.
# Rules
1. **State Management**: NEVER use `LiveData` in new ViewModels. Use `StateFlow` with `asStateFlow()` to expose immutable state.
2. **UI State**: Every ViewModel must expose a single `uiState` (Sealed Interface).
3. **Concurrency**: Use `viewModelScope` and `Coroutines`. Avoid `RxJava`.
4. **Dependency Injection**: Everything must be injectable via Hilt (`@HiltViewModel`, `@Inject`).
Expected Output Example (Few-Shot):
@HiltViewModel
class UserViewModel @Inject constructor(
private val getUserUseCase: GetUserUseCase // Inject UseCase, not Repo directly
) : ViewModel() {
// Backing property for strict encapsulation
private val _uiState = MutableStateFlow<UserUiState>(UserUiState.Loading)
val uiState: StateFlow<UserUiState> = _uiState.asStateFlow()
fun loadUser(userId: String) {
viewModelScope.launch {
_uiState.value = UserUiState.Loading
getUserUseCase(userId)
.fold(
onSuccess = { _uiState.value = UserUiState.Success(it) },
onFailure = { _uiState.value = UserUiState.Error(it) }
)
}
}
}
2. Comprehensive Testing Skill (The QA Engineer)
Writing tests is often tedious, leading to low coverage. This skill automates the creation of robust tests.
Theory behind the Skill:
A good test must follow the AAA pattern (Arrange, Act, Assert) and be deterministic. In the world of Coroutines, this implies correctly handling TestDispatchers.
Configuration:
# Role
Senior Android Test Engineer.
# Rules
1. **Frameworks**: JUnit5 (not 4), MockK (not Mockito), Turbine (for Flows).
2. **Naming**: `should [ExpectedBehavior] when [Condition]`.
3. **Coroutines**: Use `runTest` and `StandardTestDispatcher`.
4. **Isolation**: Each test must be independent.
Output Example:
@Test
fun `should emit Error state when repository fails`() = runTest {
// Arrange
val exception = IOException("Network Error")
coEvery { userRepository.getUser(any()) } throws exception
// Act
viewModel.loadUser("123")
// Assert
viewModel.uiState.test { // Turbine library
assertEquals(UserUiState.Loading, awaitItem())
val errorState = awaitItem() as UserUiState.Error
assertEquals(exception.message, errorState.message)
}
}
3. Jetpack Compose Skill (The UI Designer)
Compose simplifies UI, but introduces new risks (unnecessary recompositions). This skill ensures performance by default.
Critical Rules for the Skill:
- Statelessness: Low-level Composables should not have
ViewModel. They receive data and lambdas. - Hoisting: State is hoisted to the lowest common ancestor (usually a Screen Composable).
- Semantics: Accessibility is mandatory (
contentDescription).
// Skill Output Example
@Composable
fun UserCard(
user: User,
onLegacyClick: () -> Unit, // Lambda instead of handling event here
modifier: Modifier = Modifier // Modifier always exposed
) {
Card(modifier = modifier) {
// ...
}
}
🚀 High-Level Practical Skills
Skill: Network Infrastructure Generator (API Clients)
Writing Retrofit interfaces and DTO models is repetitive. This skill converts a JSON or Swagger specification into safe Kotlin code.
User Input: “Here is the JSON response from the /users endpoint.”
Skill Action:
- Analyzes the JSON.
- Generates Data Classes (
@JsonClass(generateAdapter = true)for Moshi). - Generates Retrofit interface (
suspend functions,Response<T>). - Generates Mappers (DTO -> Domain Model).
// Generated Mapper
fun UserDto.toDomain(): User {
return User(
id = this.id ?: throw ApiException("Missing ID"),
email = this.email.orEmpty()
)
}
Skill: Database Architect (Room)
This skill optimizes SQL queries and correctly defines relationships between entities.
Skill Rules:
- Always use
suspendfor I/O. - Return
Flow<List<T>>for observable lists. - Indices on frequently searched columns.
@Dao
interface UserDao {
// The skill knows that returning Flow makes Room notify changes automatically
@Query("SELECT * FROM users ORDER BY last_active DESC")
fun getUsersStream(): Flow<List<UserEntity>>
}
📈 Best Practices: The Lifecycle of a Skill
Creating a skill is not a “Set and Forget” task. It must be treated as source code.
- Drafting: Create the first version of the prompt/instruction.
- Validation: Test it with 5-10 real use cases.
- Refinement: If the skill fails (e.g., uses an old library), update the rules explicitly (“Do NOT use Gson”).
- Sharing: Save the skill in a shared repository (
skills/android-mvvm.md) so the whole team uses the same standard.
Skill Documentation
Just like we document APIs, we document Skills:
# Android MVVM Skill
**Version**: 2.1
**Updated**: 2025-12-29
**Changes**:
- Migrated from LiveData to StateFlow.
- Added support for SavedStateHandle.
🛡️ CI/CD Integration: Skills as Validators
We can take the concept further and use Skills in our Continuous Integration Pipeline.
Concept: A script that sends the modified code to an LLM with the “Code Reviewer” Skill and blocks the PR if it detects serious violations.
/**
* Skill: Android Code Analyzer
* Executed in GitHub Actions
*/
class CodeReviewSkill {
fun analyze(diff: String): ReviewResult {
// The LLM checks:
// 1. Is there business logic in the Fragment? (Bad)
// 2. Are exceptions being caught in coroutines? (Good)
// 3. Do names follow convention?
}
}
🎯 Conclusion
AI Skills represent maturity in the use of Artificial Intelligence for development. We are no longer “playing” with a chatbot; we are programming the synthetic programmer.
By investing time in defining and refining these skills:
- You eliminate the “mental boilerplate” of remembering implementation details.
- You guarantee that even automatically generated code meets your highest quality standards.
- You multiply your productivity, focusing on what to build, while your expert Skills handle the how.
Start today: take your most repetitive task (Creating ViewModels? Mappers?), write the rules, and create your first Skill.
You might also be interested in
agents.md: The New Standard for AI Development
Discover why agents.md has become the de facto standard for configuring AI agents and how to effectively implement it in Android projects.
Power Up Your AI Agents with Skills: From Gemini to Copilot
Discover how to transform your generalist AI assistant into a team of specialists using Agent Skills. Includes practical examples for Android, Kotlin, and Conventional Commits.
Clean Architecture + AI: The Dynamic Duo of Modern Development
Discover how Artificial Intelligence and Clean Architecture empower each other to create maintainable, scalable, and precisely auto-generated Android code.