mobile-developer
npx skills add https://github.com/404kidwiz/claude-supercode-skills --skill mobile-developer
Agent 安装分布
Skill 文档
Native Mobile Developer
Purpose
Provides native mobile development expertise specializing in Swift (iOS) and Kotlin (Android). Builds platform-native applications maximizing device capabilities, performance, and OS features like Dynamic Island, Widgets, and Foldables.
When to Use
- Building high-fidelity apps requiring 100% native performance
- Implementing complex background services (Location tracking, Audio processing)
- Developing SDKs or native modules for React Native/Flutter
- Integrating heavily with system APIs (Siri, Shortcuts, HealthKit, Wallet)
- Requiring zero-dependency architectures (Banking, Medical apps)
- Adopting bleeding-edge OS features day-one (iOS 18 APIs)
2. Decision Framework
Native vs. KMP vs. Cross-Platform
Architecture Choice?
â
ââ **Pure Native (Swift/Kotlin)**
â ââ Needs deep system integration? â **Yes** (Best access)
â ââ Zero compromise UX? â **Yes** (Standard platform behavior)
â ââ Team size? â **Large** (Requires separate iOS/Android teams)
â
ââ **Kotlin Multiplatform (KMP)**
â ââ Share business logic only? â **Yes** (Shared Domain/Data layer)
â ââ Native UI required? â **Yes** (SwiftUI on iOS, Compose on Android)
â ââ Existing native app? â **Yes** (Good for migration)
â
ââ **Cross-Platform (RN/Flutter)**
ââ UI consistency priority? â **Yes** (Same UI on both)
ââ Single codebase priority? â **Yes**
UI Framework Selection
| Platform | Framework | State of Tech (2026) | Recommendation |
|---|---|---|---|
| iOS | SwiftUI | Mature, Default choice | Use for 95% of new apps. Fallback to UIKit only for complex custom gestures/legacy. |
| iOS | UIKit | Legacy, Stable | Maintenance only, or wrapping old libs. |
| Android | Jetpack Compose | Standard, Default | Use for 100% of new apps. XML is legacy. |
| Android | XML / View | Legacy | Maintenance only. |
Concurrency Model
| Platform | Model | Best Practice |
|---|---|---|
| iOS | Swift Concurrency | async/await, Actors for thread safety. Avoid GCD/closures. |
| Android | Kotlin Coroutines | suspend functions, Flow for streams. Dispatchers.IO for work. |
Red Flags â Escalate to mobile-app-developer (Cross-platform):
- Client has budget for only 1 developer but wants 2 apps
- App is a simple form-based utility with no device hardware usage
- Timeline is < 4 weeks for dual-platform launch
3. Core Workflows
Workflow 1: Modern iOS Architecture (SwiftUI + MVVM)
Goal: Build a scalable iOS app using Swift 6 concurrency and SwiftUI.
Steps:
-
Project Setup
- Target: iOS 17.0+ (Aggressive adoption for modern APIs).
- Swift Strict Concurrency Checking:
Complete.
-
ViewModel Definition (Observable)
import SwiftUI import Observation @Observable class ProductListViewModel { var products: [Product] = [] var isLoading = false var error: Error? private let service: ProductService init(service: ProductService = .live) { self.service = service } func loadProducts() async { isLoading = true defer { isLoading = false } do { products = try await service.fetchProducts() } catch { self.error = error } } } -
View Implementation
struct ProductListView: View { @State private var viewModel = ProductListViewModel() var body: some View { NavigationStack { List(viewModel.products) { product in ProductRow(product: product) } .overlay { if viewModel.isLoading { ProgressView() } } .task { await viewModel.loadProducts() } .navigationTitle("Products") } } }
Workflow 3: Kotlin Multiplatform (KMP) Setup
Goal: Share networking and database logic between iOS and Android.
Steps:
-
Shared Module Structure
shared/ src/commonMain/kotlin/ # Shared logic src/androidMain/kotlin/ # Android specific src/iosMain/kotlin/ # iOS specific -
Networking (Ktor)
// commonMain class ApiClient { private val client = HttpClient { install(ContentNegotiation) { json(Json { ignoreUnknownKeys = true }) } } suspend fun getData(): Data = client.get("...").body() } -
Consumption
- Android: Call
ApiClient().getData()directly in ViewModel. - iOS: Call
ApiClient().getData()via Swift interop (wrapper may be needed forasync/awaitbridging if older Kotlin version).
- Android: Call
5. Anti-Patterns & Gotchas
â Anti-Pattern 1: “Massive View Controller” (MVC)
What it looks like:
- 3,000 line
ViewController.swiftfiles containing networking, logic, and UI code.
Why it fails:
- Untestable.
- Impossible to maintain.
Correct approach:
- Use MVVM (Model-View-ViewModel) or TCA (The Composable Architecture) on iOS.
- Use MVI (Model-View-Intent) or MVVM on Android.
- Separate Logic from UI entirely.
â Anti-Pattern 2: Ignoring Lifecycle Events
What it looks like:
- Starting a network request in
onAppearbut not cancelling it ononDisappear. - Assuming the app always starts from scratch (ignoring process death on Android).
Why it fails:
- Memory leaks.
- Crashes when background tasks try to update UI that no longer exists.
- Data loss when Android kills the app to save memory.
Correct approach:
- Use structured concurrency (
.taskin SwiftUI cancels auto). - Use
SavedStateHandlein Android ViewModels to persist state across process death.
â Anti-Pattern 3: Blocking the Main Thread
What it looks like:
- Decoding JSON or filtering a large list on the Main/UI thread.
- Dropped frames (jank).
Why it fails:
- App becomes unresponsive (ANR on Android).
- Watchdog kills the app.
Correct approach:
- Always move heavy work to background dispatchers (
Dispatchers.Default/Task.detached).
Examples
Example 1: Enterprise Banking App Development
Scenario: Build a secure, compliant banking app for iOS and Android with biometric authentication.
Development Approach:
- Architecture: Clean Architecture with MVVM
- Authentication: Face ID/Touch ID integration with secure enclave
- Networking: Certificate pinning with retry logic
- Offline Support: Local encryption with periodic sync
Implementation Highlights:
// iOS Biometric Authentication
func authenticateWithBiometrics() async throws {
let context = LAContext()
var error: NSError?
guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {
throw AuthenticationError.biometricsNotAvailable
}
do {
let success = try await context.evaluatePolicy(
.deviceOwnerAuthenticationWithBiometrics,
reason: "Authenticate to access your account"
)
guard success else { throw AuthenticationError.authenticationFailed }
} catch {
throw AuthenticationError.authenticationFailed
}
}
Results:
- Released on both App Store and Play Store
- 500,000+ downloads in first month
- 4.9-star rating on both platforms
- Zero security incidents in 2 years
Example 2: Healthcare App with HIPAA Compliance
Scenario: Develop a patient management app with strict HIPAA compliance requirements.
Compliance Implementation:
- Data Encryption: AES-256 encryption at rest
- Audit Logging: Complete audit trail of all data access
- Session Management: Auto-logout with configurable timeout
- Network Security: TLS 1.3 with certificate pinning
Android Implementation:
// Encrypted SharedPreferences
val masterKey = MasterKey.Builder(context)
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
.build()
val encryptedPrefs = EncryptedSharedPreferences.create(
context,
"patient_data",
masterKey,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
)
// Usage
encryptedPrefs.edit().putString("patient_id", "12345").apply()
Results:
- HIPAA audit passed with zero critical findings
- Integrated with 15+ healthcare systems
- 99.9% uptime SLA achieved
- FDA-compliant for medical device classification
Example 3: IoT Control App with BLE Integration
Scenario: Build a smart home control app integrating with IoT devices via Bluetooth Low Energy.
BLE Implementation:
- Device Discovery: Background scanning with filters
- Connection Management: Automatic reconnection with backoff
- Data Parsing: Protocol buffer deserialization
- Offline Control: Local command queue with sync
Architecture:
- SwiftUI for iOS, Jetpack Compose for Android
- Reactive state management with Combine/Flow
- Background processing for BLE operations
- Battery optimization with proper lifecycle handling
Results:
- Supports 50+ device types
- 50ms average response time
- 40% better battery life than competitors
- Featured in Apple Watch integration
Best Practices
Platform-Specific Development
- iOS: Leverage SwiftUI for modern apps, use UIKit for complex animations
- Android: Default to Compose, migrate from XML gradually
- Navigation: Use NavigationPath (iOS) and NavHost (Android)
- State Management: Observable (iOS), StateFlow (Android)
Performance Optimization
- Lazy Loading: Defer image/resource loading until needed
- Image Caching: Implement with memory and disk cache
- Memory Management: Monitor memory pressure, use profiling tools
- Battery Life: Minimize background operations, use batched updates
Security Implementation
- Secure Storage: Keychain (iOS), EncryptedSharedPreferences (Android)
- Network Security: Certificate pinning, TLS configuration
- Input Validation: Sanitize all user inputs
- Code Obfuscation: Enable ProGuard/R8 for release builds
Testing Strategy
- Unit Tests: ViewModels, repositories, business logic
- UI Tests: Critical user flows and interactions
- Integration Tests: API calls, database operations
- Performance Tests: Startup time, memory usage, scrolling performance
Distribution and Deployment
- App Store: Follow Apple review guidelines, prepare metadata
- Play Store: Optimize for Play Console features, testing tracks
- Enterprise: Implement enterprise distribution certificates
- Updates: Plan backward compatibility for major versions
Quality Checklist
Platform Standards:
- iOS: Supports Dynamic Type (text scaling).
- iOS: Supports Dark Mode seamlessly.
- Android: Handles configuration changes (rotation) without data loss.
- Android: Back navigation stack works correctly.
- iOS: Supports iPad with adaptive layouts.
- Android: Supports different screen sizes and densities.
Performance:
- Scroll: Lists scroll at 60fps/120fps.
- Memory: No retain cycles (iOS) or leaked Activities (Android).
- Startup: App is usable within 2 seconds.
- Network: Efficient batching and caching.
Architecture:
- Separation: UI code contains NO business logic.
- Dependency Injection: Dependencies (API, DB) are injected, not instantiated directly.
- Testing: Unit tests exist for all ViewModels/Interactors.
- Navigation: Deep linking support implemented.
Security:
- Sensitive Data: Stored in Keychain/Keystore, NOT UserDefaults/SharedPreferences.
- Networking: SSL Pinning enabled for sensitive endpoints.
- Logs: No PII printed to console in release builds.
- Authentication: Biometric or secure authentication implemented.
- Compliance: Meets platform guidelines (App Store/Play Store).