android-kotlin-compose
npx skills add https://github.com/drjacky/claude-android-ninja --skill android-kotlin-compose
Agent 安装分布
Skill 文档
Android Kotlin Compose Development
Create production-quality Android applications following Google’s official architecture guidance and best practices. Use when building Android apps with Kotlin, Jetpack Compose, MVVM architecture, Hilt dependency injection, Room database, or Android multi-module projects. Triggers on requests to create Android projects, screens, ViewModels, repositories, feature modules, or when asked about Android architecture patterns.
Quick Reference
| Task | Reference File |
|---|---|
| Project structure & modules | modularization.md |
| Architecture layers (Presentation, Domain, Data, UI) | architecture.md |
| Compose patterns, animation, effects, modifiers | compose-patterns.md |
| Accessibility & TalkBack support | android-accessibility.md |
| Notifications & foreground services | android-notifications.md |
| Data sync & offline-first patterns | android-data-sync.md |
| Material 3 theming & dynamic colors | android-theming.md |
| Navigation3 & adaptive navigation | android-navigation.md |
| Kotlin best practices | kotlin-patterns.md |
| Coroutines best practices | coroutines-patterns.md |
| Gradle & build configuration | gradle-setup.md |
| Testing approach | testing.md |
| Internationalization & localization | android-i18n.md |
| Icons, graphics, and custom drawing | android-graphics.md |
| Runtime permissions | android-permissions.md |
| Kotlin delegation patterns | kotlin-delegation.md |
| Crash reporting | crashlytics.md |
| StrictMode guardrails | android-strictmode.md |
| Multi-module dependencies | dependencies.md |
| Code quality (Detekt) | code-quality.md |
| Code coverage (JaCoCo) | android-code-coverage.md |
| Security (encryption, biometrics, pinning) | android-security.md |
| Design patterns | design-patterns.md |
| Android performance, recomposition & app startup | android-performance.md |
Workflow Decision Tree
Creating a new project?
â Start with templates/settings.gradle.kts.template for settings and module includes
â Start with templates/libs.versions.toml.template for the version catalog
â Copy all files from templates/convention/ to build-logic/convention/src/main/kotlin/
â Create build-logic/settings.gradle.kts (see templates/convention/QUICK_REFERENCE.md)
â Add includeBuild("build-logic") to root settings.gradle.kts
â Add plugin entries to gradle/libs.versions.toml (see templates/convention/QUICK_REFERENCE.md)
â Copy templates/proguard-rules.pro.template to app/proguard-rules.pro
â Read modularization.md for structure and module types
â Use gradle-setup.md for build files and build logic
Configuring Gradle/build files?
â Use gradle-setup.md for module build.gradle.kts patterns
â Copy convention plugins from templates/convention/ to build-logic/ in your project
â See templates/convention/QUICK_REFERENCE.md for setup instructions and examples
â Copy templates/proguard-rules.pro.template to app/proguard-rules.pro for R8 rules
Setting up code quality / Detekt?
â Use code-quality.md for Detekt convention plugin setup
â Start from templates/detekt.yml.template for rules and enable Compose rules
Adding or updating dependencies?
â Follow dependencies.md
â Update templates/libs.versions.toml.template if the dependency is missing
Adding a new feature/module?
â Follow module naming in modularization.md
â Implement Presentation in the feature module
â Follow dependency flow: Feature â Core/Domain â Core/Data
Building UI screens/components?
â Read compose-patterns.md for screen architecture, state, components, modifiers
â Use android-theming.md for Material 3 colors, typography, and shapes
â Always align Kotlin code with kotlin-patterns.md
â Create Screen + ViewModel + UiState in the feature module
â Use shared components from core/ui when possible
Setting up app theme (colors, typography, shapes)?
â Follow android-theming.md for Material 3 theming and dynamic colors
â Use semantic color roles from MaterialTheme.colorScheme (never hardcoded colors)
â Support light/dark themes with user preference toggle
â Enable dynamic color (Material You) for API 31+
Writing any Kotlin code?
â Always follow kotlin-patterns.md
â Ensure practices align with architecture.md, modularization.md, and compose-patterns.md
Setting up data/domain layers?
â Read architecture.md
â Create Repository interfaces in core/domain
â Implement Repository in core/data
â Create DataSource + DAO in core/data
Implementing offline-first or data synchronization?
â Follow android-data-sync.md for sync strategies, conflict resolution, and cache invalidation
â Use Room as single source of truth with sync metadata (syncStatus, lastModified)
â Schedule background sync with WorkManager
â Monitor network state before syncing
Setting up navigation?
â Follow android-navigation.md for Navigation3 architecture, state management, and adaptive navigation
â See modularization.md for feature module navigation components (Destination, Navigator, Graph)
â Configure navigation graph in the app module
â Use feature navigation destinations and navigator interfaces
Adding tests?
â Use testing.md for patterns and examples
â Keep test doubles in core/testing
Handling runtime permissions?
â Follow android-permissions.md for manifest declarations and Compose permission patterns
â Request permissions contextually and handle “Don’t ask again” flows
Showing notifications or foreground services?
â Use android-notifications.md for notification channels, styles, actions, and foreground services
â Check POST_NOTIFICATIONS permission on API 33+ before showing notifications
â Create notification channels at app startup (required for API 26+)
Sharing logic across ViewModels or avoiding base classes?
â Use delegation via interfaces as described in kotlin-delegation.md
â Prefer small, injected delegates for validation, analytics, or feature flags
Adding crash reporting / monitoring?
â Follow crashlytics.md for provider-agnostic interfaces and module placement
â Use DI bindings to swap between Firebase Crashlytics or Sentry
Enabling StrictMode guardrails?
â Follow android-strictmode.md for app-level setup and Compose compiler diagnostics
â Use Sentry/Firebase init from crashlytics.md to ship StrictMode logs
Choosing design patterns for a new feature, business logic, or system?
â Use design-patterns.md for Android-focused pattern guidance
â Align with architecture.md and modularization.md
Measuring performance regressions or startup/jank?
â Use android-performance.md for Macrobenchmark setup and commands
â Keep benchmark module aligned with benchmark build type in gradle-setup.md
Setting up app initialization or splash screen?
â Follow android-performance.md â “App Startup & Initialization” for App Startup library, lazy init, and splash screen
â Avoid ContentProvider-based auto-initialization – use Initializer interface instead
â Use installSplashScreen() with setKeepOnScreenCondition for loading state
Adding icons, images, or custom graphics?
â Use android-graphics.md for Material Symbols icons and custom drawing
â Download icons via Iconify API or Google Fonts (avoid deprecated Icons.Default.* library)
â Use Modifier.drawWithContent, drawBehind, or drawWithCache for custom graphics
Creating custom UI effects (glow, shadows, gradients)?
â Check android-graphics.md for Canvas drawing, BlendMode, and Palette API patterns
â Use rememberInfiniteTransition for animated effects
Ensuring accessibility compliance (TalkBack, touch targets, color contrast)?
â Follow android-accessibility.md for semantic properties and WCAG guidelines
â Provide contentDescription for all icons and images
â Ensure 48dp à 48dp minimum touch targets
â Test with TalkBack and Accessibility Scanner
Working with images and color extraction?
â Use android-graphics.md for Palette API and Coil3 integration
â Extract colors from images for dynamic theming
Implementing complex coroutine flows or background work?
â Follow coroutines-patterns.md for structured concurrency patterns
â Use appropriate dispatchers (IO, Default, Main) and proper cancellation handling
â Prefer StateFlow/SharedFlow over channels for state management
Need to share behavior across multiple classes?
â Use kotlin-delegation.md for interface delegation patterns
â Avoid base classes; prefer composition with delegated interfaces
â Examples: Analytics, FormValidator, CrashReporter
Refactoring existing code or improving architecture?
â Review architecture.md for layer responsibilities
â Check design-patterns.md for applicable patterns
â Follow kotlin-patterns.md for Kotlin-specific improvements
â Ensure compliance with modularization.md dependency rules
Debugging performance issues or memory leaks?
â Enable android-strictmode.md for development builds
â Use android-performance.md for profiling and benchmarking
â Check coroutines-patterns.md for coroutine cancellation patterns
Setting up CI/CD or code quality checks?
â Use code-quality.md for Detekt baseline and CI integration
â Use gradle-setup.md for build cache and convention plugins
â Use testing.md for test organization and coverage
Handling sensitive data or privacy concerns?
â Follow crashlytics.md for data scrubbing patterns
â Use android-permissions.md for proper permission justification
â Check android-strictmode.md for detecting cleartext network traffic
Migrating legacy code (LiveData, Fragments, Accompanist)?
â Replace LiveData with StateFlow using coroutines-patterns.md
â Replace Fragments with Compose screens using compose-patterns.md
â Replace Accompanist with official APIs per compose-patterns.md â “Deprecated Patterns & Migrations”
â Update navigation to Navigation3 using android-navigation.md
â Follow architecture.md for modern MVVM patterns
Adding Compose animations?
â Use compose-patterns.md â “Animation” for AnimatedVisibility, AnimatedContent, animate*AsState, Animatable, shared elements
â Use graphicsLayer for GPU-accelerated transforms (no recomposition)
â Always provide label parameter for Layout Inspector debugging
Using side effects (LaunchedEffect, DisposableEffect)?
â Use compose-patterns.md â “Side Effects” for effect selection guide
â LaunchedEffect(key) for state-driven coroutines, rememberCoroutineScope for event-driven
â DisposableEffect for listener/resource cleanup, always include onDispose
Working with Modifier ordering or custom modifiers?
â Use compose-patterns.md â “Modifiers” for chain ordering rules and patterns
â Use Modifier.Node for custom modifiers (not deprecated Modifier.composed)
â Order: size â padding â drawing â interaction
Migrating from Accompanist or deprecated Compose APIs?
â Use compose-patterns.md â “Deprecated Patterns & Migrations”
â Replace Accompanist libraries with official Foundation/Material3 equivalents
â Use collectAsStateWithLifecycle instead of collectAsState
â Use mutableIntStateOf instead of mutableStateOf(0) for primitives
Optimizing Compose recomposition or stability?
â Use compose-patterns.md for @Immutable/@Stable annotations
â Use android-performance.md â “Compose Recomposition Performance” for three phases, deferred state reads, Strong Skipping Mode
â Check gradle-setup.md for Compose Compiler metrics and stability reports
â Use kotlin-patterns.md for immutable data structures
Working with databases (Room)?
â Define DAOs and entities in core/database per modularization.md
â Use testing.md for in-memory database testing and migration tests
â Follow architecture.md for repository patterns with Room
Need internationalization/localization (i18n/l10n)?
â Use android-i18n.md for string resources, plurals, and RTL support
â Follow compose-patterns.md for RTL-aware Compose layouts
â Use testing.md for locale-specific testing
Implementing network calls (Retrofit)?
â Define API interfaces in core/network per modularization.md
â Use architecture.md for RemoteDataSource patterns
â Follow dependencies.md for Retrofit, OkHttp, and serialization setup
â Handle errors with generic Result<T> from kotlin-patterns.md
Creating custom lint rules or code checks?
â Use code-quality.md for Detekt custom rules
â Follow gradle-setup.md for convention plugin setup
â Check android-strictmode.md for runtime checks
Need code coverage reporting?
â Use android-code-coverage.md for JaCoCo setup
â Follow testing.md for test strategies
â Check gradle-setup.md for convention plugin integration
Implementing security features (encryption, biometrics, pinning)?
â Use android-security.md for comprehensive security guide
â Follow android-permissions.md for runtime permissions
â Check crashlytics.md for PII scrubbing and data privacy