software-mobile by vasilyu1983/ai-agents-public
npx skills add https://github.com/vasilyu1983/ai-agents-public --skill software-mobile此技能为移动开发者提供用于构建原生和跨平台移动应用的、可直接执行的模式。当您需要 iOS/Android 应用架构、UI 组件、导航流程、API 集成、离线存储、身份验证或移动端特定功能时,请应用这些模式。
在您需要以下内容时使用此技能:
| 任务 | iOS | Android | 跨平台 | 何时使用 |
|---|---|---|---|---|
| 原生 UI | SwiftUI + UIKit | Jetpack Compose + Views | React Native | 原生:最佳性能;跨平台:代码共享 |
| 导航 | NavigationStack |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| Navigation Component |
| React Navigation |
| 平台特定以获得原生体验 |
| 状态管理 | @State/@Observable | ViewModel + StateFlow | Redux/MobX | iOS: @Observable; Android: ViewModel; RN: Redux |
| 网络请求 | URLSession + async/await | Retrofit + Coroutines | Axios/Fetch | 原生:类型安全;RN: JavaScript 生态系统 |
| 本地存储 | Core Data + SwiftData | Room Database | AsyncStorage/SQLite | 原生:完全控制;RN: 更简单 |
| 推送通知 | APNs | FCM | React Native Firebase | 原生:平台特定;RN: 统一 API |
| 后台任务 | BGTaskScheduler | WorkManager | Headless JS | 用于计划/后台工作 |
| 深度链接 | Universal Links | App Links | React Navigation linking | 用于基于 URL 的应用入口 |
| 身份验证 | AuthenticationServices | Credential Manager | Expo AuthSession | 用于社交/生物识别认证 |
| 分析 | Firebase/Amplitude | Firebase/Amplitude | Expo Analytics | 跟踪用户行为 |
需要为以下目标构建移动应用:[目标受众]
│
├─ 仅 iOS?
│ ├─ 新应用? → SwiftUI (现代,声明式)
│ ├─ 现有 UIKit 代码库? → UIKit + 逐步采用 SwiftUI
│ └─ 复杂动画? → UIKit 用于精细控制
│
├─ 仅 Android?
│ ├─ 新应用? → Jetpack Compose (现代,声明式)
│ ├─ 现有 Views 代码库? → Views + 逐步采用 Compose
│ └─ 复杂自定义视图? → Custom View 用于精细控制
│
├─ 同时需要 iOS 和 Android?
│ ├─ 需要最大性能 / 平台保真度?
│ │ └─ 构建独立的原生应用 (Swift + Kotlin)
│ │
│ ├─ 需要更快的开发 + 代码共享?
│ │ ├─ JavaScript/TypeScript 团队? → React Native (Expo 托管或裸项目)
│ │ ├─ Dart 团队? → Flutter
│ │ └─ Kotlin 团队? → Kotlin Multiplatform (KMP)
│ │
│ ├─ Kotlin Multiplatform (KMP)?
│ │ ├─ 仅共享业务逻辑? → KMP 共享模块 + 原生 UI
│ │ ├─ 共享部分 UI? → Compose Multiplatform (根据您的需求验证 iOS 成熟度)
│ │ └─ 共享模块需要平台 UI? → 保持原生 UI,共享领域/数据/网络层
│ │
│ └─ 包装现有 Web 应用?
│ ├─ 简单包装? → WebView (iOS WKWebView / Android WebView)
│ └─ 需要原生功能? → Capacitor 或 React Native WebView
│
└─ 仅原型/MVP?
└─ 使用 React Native 或 Flutter 进行最快迭代
选择架构模式?
│
├─ iOS (Swift)?
│ ├─ SwiftUI 应用? → 使用 @Observable/ObservableObject 的 MVVM (基于操作系统基线)
│ ├─ 复杂 SwiftUI? → TCA (Composable Architecture) 以提高可测试性
│ ├─ UIKit 应用? → MVVM-C (协调器模式)
│ ├─ 大型团队? → Clean Architecture + MVVM
│ └─ 简单应用? → MVC (Apple 默认)
│
├─ Android (Kotlin)?
│ ├─ Compose 应用? → 使用 ViewModel + StateFlow 的 MVVM
│ ├─ Views 应用? → 使用 LiveData 的 MVVM
│ ├─ 大型团队? → Clean Architecture + MVVM
│ └─ 简单应用? → 基于 Activity/Fragment
│
└─ React Native?
├─ 小型应用? → Context API + useState
├─ 中型应用? → Redux Toolkit 或 Zustand
└─ 大型应用? → Redux + RTK Query + 基于功能的结构
需要在本地存储数据?
│
├─ 简单的键值对?
│ ├─ iOS → UserDefaults
│ ├─ Android → SharedPreferences / DataStore
│ └─ RN → AsyncStorage
│
├─ 具有关系的结构化数据?
│ ├─ iOS → Core Data 或 SwiftData
│ ├─ Android → Room Database
│ └─ RN → WatermelonDB 或 Realm
│
├─ 安全凭据?
│ ├─ iOS → Keychain
│ ├─ Android → EncryptedSharedPreferences / Keystore
│ └─ RN → react-native-keychain
│
└─ 大文件/媒体?
├─ iOS → FileManager (Documents/Cache)
├─ Android → Internal/External Storage
└─ RN → react-native-fs
需要进行 API 调用?
│
├─ iOS?
│ ├─ 简单 REST? → URLSession + async/await
│ ├─ 复杂 API? → URLSession + Codable
│ └─ GraphQL? → Apollo iOS
│
├─ Android?
│ ├─ 简单 REST? → Retrofit + Coroutines
│ ├─ 复杂 API? → Retrofit + OkHttp interceptors
│ └─ GraphQL? → Apollo Android
│
└─ React Native?
├─ 简单 REST? → fetch() 或 Axios
├─ 复杂 API? → RTK Query 或 React Query
└─ GraphQL? → Apollo Client
@MainActor 上;酌情启用严格并发检查注意 : 除非应用包含 AI/自动化功能,否则请跳过。
初始化依赖项
检查认证状态
配置应用状态
1. 本地优先数据访问
- 始终从本地数据库读取
- 立即显示缓存数据
- 为同步显示加载指示器
2. 后台同步
- 队列化写入操作
- 有网络连接时同步
- 处理冲突解决
3. 乐观更新
- 立即更新 UI
- 在后台同步
- 失败时回滚
iOS (APNs):
1. 启用推送通知功能
2. 请求用户权限
3. 注册远程通知
4. 处理设备令牌
5. 实现通知委托
Android (FCM):
1. 将 Firebase 添加到项目
2. 实现 FirebaseMessagingService
3. 处理通知/数据消息
4. 管理通知渠道 (Android 8+)
5. 处理后台/前台状态
| 领域 | iOS | Android | 指标 |
|---|---|---|---|
| 启动时间 | 预热,懒加载 | 冷启动优化 | < 2s 冷启动 |
| 列表滚动 | LazyVStack, 预取 | LazyColumn, 分页 | 60 FPS |
| 图片加载 | AsyncImage, 缓存 | Coil/Glide, 磁盘缓存 | < 100ms 可见 |
| 内存 | Instruments 性能分析 | LeakCanary, Profiler | 无内存泄漏 |
| 电池 | 后台应用刷新限制 | 遵守 Doze 模式 | 最小消耗 |
CC-*)| 反模式 | 问题 | 解决方案 |
|---|---|---|
| 阻塞主线程 | UI 冻结,ANR | 对所有 I/O 使用 async/协程 |
| 庞大的视图控制器 | 难以测试/维护 | 提取到 MVVM/服务 |
| 硬编码字符串 | 无法本地化 | 使用 NSLocalizedString/strings.xml |
| 忽略生命周期 | 内存泄漏,崩溃 | 尊重 activity/view 生命周期 |
| 无离线处理 | 无网络时用户体验差 | 缓存数据,队列化操作 |
| 在代码中存储密钥 | 安全漏洞 | 使用 Keychain/Keystore |
使用没有回退的 decode() | 在 API 数据缺失/格式错误时崩溃 | 使用带默认值的 decodeIfPresent() |
| @Observable 缺少 @Bindable | NavigationStack 绑定不起作用 | 在 body 中添加 @Bindable var vm = vm |
重要 : 当用户询问有关移动开发的推荐问题时,您必须在回答前使用网络搜索功能 (如果可用) 检查当前趋势。如果网络搜索不可用,请说明情况,并使用 data/sources.json 进行回答,并明确标记该推荐可能已过时。
"mobile development best practices 2026""[iOS/Android/React Native/Flutter] updates 2026""mobile framework comparison 2026""[Expo/Swift/Kotlin] new features 2026"搜索后,提供:
每周安装数
79
仓库
GitHub Stars
49
首次出现
Jan 23, 2026
安全审计
安装于
codex63
gemini-cli62
cursor61
opencode61
github-copilot58
amp52
This skill equips mobile developers with execution-ready patterns for building native and cross-platform mobile applications. Apply these patterns when you need iOS/Android app architecture, UI components, navigation flows, API integration, offline storage, authentication, or mobile-specific features.
Use this skill when you need:
| Task | iOS | Android | Cross-Platform | When to Use |
|---|---|---|---|---|
| Native UI | SwiftUI + UIKit | Jetpack Compose + Views | React Native | Native: Best performance; Cross-platform: Code sharing |
| Navigation | NavigationStack | Navigation Component | React Navigation | Platform-specific for native feel |
| State Management | @State/@Observable | ViewModel + StateFlow | Redux/MobX | iOS: @Observable; Android: ViewModel; RN: Redux |
| Networking | URLSession + async/await | Retrofit + Coroutines | Axios/Fetch | Native: Type-safe; RN: JavaScript ecosystem |
| Local Storage | Core Data + SwiftData | Room Database | AsyncStorage/SQLite | Native: Full control; RN: Simpler |
| Push Notifications | APNs | FCM | React Native Firebase | Native: Platform-specific; RN: Unified API |
| Background Tasks | BGTaskScheduler | WorkManager | Headless JS | For scheduled/background work |
| Deep Linking | Universal Links | App Links | React Navigation linking | For URL-based app entry |
| Authentication | AuthenticationServices | Credential Manager | Expo AuthSession | For social/biometric auth |
| Analytics | Firebase/Amplitude | Firebase/Amplitude | Expo Analytics | Track user behavior |
Need to build mobile app for: [Target Audience]
│
├─ iOS only?
│ ├─ New app? → SwiftUI (modern, declarative)
│ ├─ Existing UIKit codebase? → UIKit + incremental SwiftUI adoption
│ └─ Complex animations? → UIKit for fine-grained control
│
├─ Android only?
│ ├─ New app? → Jetpack Compose (modern, declarative)
│ ├─ Existing Views codebase? → Views + incremental Compose adoption
│ └─ Complex custom views? → Custom View for fine-grained control
│
├─ Both iOS and Android?
│ ├─ Need maximum performance / platform fidelity?
│ │ └─ Build separate native apps (Swift + Kotlin)
│ │
│ ├─ Need faster development + code sharing?
│ │ ├─ JavaScript/TypeScript team? → React Native (Expo-managed or bare)
│ │ ├─ Dart team? → Flutter
│ │ └─ Kotlin team? → Kotlin Multiplatform (KMP)
│ │
│ ├─ Kotlin Multiplatform (KMP)?
│ │ ├─ Share business logic only? → KMP shared module + native UI
│ │ ├─ Share some UI? → Compose Multiplatform (validate iOS maturity for your needs)
│ │ └─ Shared modules need platform UI? → Keep native UI, share domain/data/networking
│ │
│ └─ Wrapping existing web app?
│ ├─ Simple wrapper? → WebView (iOS WKWebView / Android WebView)
│ └─ Native features needed? → Capacitor or React Native WebView
│
└─ Prototype/MVP only?
└─ React Native or Flutter for fastest iteration
Choosing architecture pattern?
│
├─ iOS (Swift)?
│ ├─ SwiftUI app? → MVVM with @Observable/ObservableObject (based on OS baseline)
│ ├─ Complex SwiftUI? → TCA (Composable Architecture) for testability
│ ├─ UIKit app? → MVVM-C (Coordinator pattern)
│ ├─ Large team? → Clean Architecture + MVVM
│ └─ Simple app? → MVC (Apple default)
│
├─ Android (Kotlin)?
│ ├─ Compose app? → MVVM with ViewModel + StateFlow
│ ├─ Views app? → MVVM with LiveData
│ ├─ Large team? → Clean Architecture + MVVM
│ └─ Simple app? → Activity/Fragment-based
│
└─ React Native?
├─ Small app? → Context API + useState
├─ Medium app? → Redux Toolkit or Zustand
└─ Large app? → Redux + RTK Query + feature-based structure
Need to store data locally?
│
├─ Simple key-value pairs?
│ ├─ iOS → UserDefaults
│ ├─ Android → SharedPreferences / DataStore
│ └─ RN → AsyncStorage
│
├─ Structured data with relationships?
│ ├─ iOS → Core Data or SwiftData
│ ├─ Android → Room Database
│ └─ RN → WatermelonDB or Realm
│
├─ Secure credentials?
│ ├─ iOS → Keychain
│ ├─ Android → EncryptedSharedPreferences / Keystore
│ └─ RN → react-native-keychain
│
└─ Large files/media?
├─ iOS → FileManager (Documents/Cache)
├─ Android → Internal/External Storage
└─ RN → react-native-fs
Need to make API calls?
│
├─ iOS?
│ ├─ Simple REST? → URLSession + async/await
│ ├─ Complex API? → URLSession + Codable
│ └─ GraphQL? → Apollo iOS
│
├─ Android?
│ ├─ Simple REST? → Retrofit + Coroutines
│ ├─ Complex API? → Retrofit + OkHttp interceptors
│ └─ GraphQL? → Apollo Android
│
└─ React Native?
├─ Simple REST? → fetch() or Axios
├─ Complex API? → RTK Query or React Query
└─ GraphQL? → Apollo Client
@MainActor; enable strict concurrency checks as appropriateNote : Skip unless the app ships AI/automation features.
Initialize dependencies
Check authentication state
Configure app state
1. Local-first data access
- Always read from local database
- Display cached data immediately
- Show loading indicator for sync
2. Background sync
- Queue write operations
- Sync when connectivity available
- Handle conflict resolution
3. Optimistic updates
- Update UI immediately
- Sync in background
- Rollback on failure
iOS (APNs):
1. Enable Push Notifications capability
2. Request user permission
3. Register for remote notifications
4. Handle device token
5. Implement notification delegate
Android (FCM):
1. Add Firebase to project
2. Implement FirebaseMessagingService
3. Handle notification/data messages
4. Manage notification channels (Android 8+)
5. Handle background/foreground states
| Area | iOS | Android | Metric |
|---|---|---|---|
| Launch time | Pre-warm, lazy loading | Cold start optimization | < 2s cold start |
| List scrolling | LazyVStack, prefetch | LazyColumn, paging | 60 FPS |
| Image loading | AsyncImage, cache | Coil/Glide, disk cache | < 100ms visible |
| Memory | Instruments profiling | LeakCanary, Profiler | No memory leaks |
| Battery | Background App Refresh limits | Doze mode compliance | Minimal drain |
CC-*) for citation| Anti-Pattern | Problem | Solution |
|---|---|---|
| Blocking main thread | UI freezes, ANRs | Use async/coroutines for all I/O |
| Massive view controllers | Hard to test/maintain | Extract to MVVM/services |
| Hardcoded strings | No localization | Use NSLocalizedString/strings.xml |
| Ignoring lifecycle | Memory leaks, crashes | Respect activity/view lifecycle |
| No offline handling | Poor UX without network | Cache data, queue operations |
| Storing secrets in code | Security vulnerability | Use Keychain/Keystore |
Using decode() without fallback | Crashes on missing/malformed API data | Use decodeIfPresent() with defaults |
IMPORTANT : When users ask recommendation questions about mobile development, you MUST use a web search capability (if available) to check current trends before answering. If web search is unavailable, say so and answer using data/sources.json, clearly flagging that the recommendation may be stale.
"mobile development best practices 2026""[iOS/Android/React Native/Flutter] updates 2026""mobile framework comparison 2026""[Expo/Swift/Kotlin] new features 2026"After searching, provide:
Weekly Installs
79
Repository
GitHub Stars
49
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
codex63
gemini-cli62
cursor61
opencode61
github-copilot58
amp52
Apple Reminders CLI (remindctl) - 终端管理苹果提醒事项,同步iPhone/iPad
969 周安装
| Missing @Bindable for @Observable | NavigationStack bindings don't work | Add @Bindable var vm = vm in body |