Kotlin + Android Rules
Native Android development with Kotlin and Jetpack Compose
# Role You are an expert Kotlin developer building Android apps with Jetpack Compose. # Tech Stack - Kotlin 2.0+ - Jetpack Compose - Room - Hilt - Ktor/Retrofit # Code Conventions - Use Jetpack Compose for all UI — no XML layouts. - Follow MVVM architecture with ViewModel and StateFlow. - Use Hilt for dependency injection. - Use Room for local database with Flow/StateFlow. - Use Kotlin coroutines for async operations. - Use Navigation Compose for screen navigation. - Use Material 3 design components. - Write UI previews with `@Preview` annotation. # Code Style Preferences - Use TypeScript strict mode. Define types for all variables, parameters, and return values. - Never use the `any` type. Use `unknown` if the type is truly uncertain, then narrow it. - Use `const` by default. Only use `let` when reassignment is needed. Never use `var`. - Always handle errors explicitly. Use try/catch for async operations. Never silently swallow errors. - Use early returns (guard clauses) to reduce nesting and improve readability. - Use descriptive, meaningful names for variables, functions, and classes. Avoid abbreviations. - Keep functions small and focused. Each function should do one thing. Aim for under 50 lines. # What to Avoid - Do not use XML layouts — use Compose. - Do not use LiveData — prefer StateFlow. - Do not block the main thread. - Do not use `!!` operator — handle nullability properly.
About Kotlin + Android AI Rules
AI coding rules files help your AI assistant (Cursor, Windsurf, Claude Code, GitHub Copilot, or Cline) understand your project's conventions, tech stack, and coding standards. This ensures the AI generates code that matches your team's style and follows best practices for Android.
This preset is designed for Kotlin + Android projects and includes rules for:
- Use Jetpack Compose for all UI — no XML layouts.
- Follow MVVM architecture with ViewModel and StateFlow.
- Use Hilt for dependency injection.
- Use Room for local database with Flow/StateFlow.
- Use Kotlin coroutines for async operations.
Simply select your preferred AI IDE format above, then copy or download the generated rules file. Place it in your project's root directory and your AI assistant will automatically follow these conventions.
Get This Preset for a Specific IDE
Cursor
Kotlin + Android rules for Cursor
Windsurf
Kotlin + Android rules for Windsurf
Claude Code
Kotlin + Android rules for Claude Code
GitHub Copilot
Kotlin + Android rules for GitHub Copilot
Cline
Kotlin + Android rules for Cline
Zed AI
Kotlin + Android rules for Zed AI
Aider
Kotlin + Android rules for Aider
Continue.dev
Kotlin + Android rules for Continue.dev
Devin AI
Kotlin + Android rules for Devin AI
Amazon Q
Kotlin + Android rules for Amazon Q
Bolt.new
Kotlin + Android rules for Bolt.new
Lovable
Kotlin + Android rules for Lovable
Replit AI
Kotlin + Android rules for Replit AI
Augment Code
Kotlin + Android rules for Augment Code
JetBrains AI
Kotlin + Android rules for JetBrains AI