mobile
Building mobile apps: choosing native, React Native or Flutter, reading an existing app, the platform conventions, lifecycle, offline and flaky networks, permissions, performance, accessibility and store rules, the defaults for a new app, and which skill holds each. Read before building or changing a mobile app.
- License 许可
- Apache-2.0
- 所属仓库
- enowdev/enowxcli
- 最近更新
- 2026-10-06
- Stars
- ★ 67
- Forks
- 21
01 前言 Front Matter
- name
- mobile
- description
- Building mobile apps: choosing native, React Native or Flutter, reading an existing app, the platform conventions, lifecycle, offline and flaky networks, permissions, performance, accessibility and store rules, the defaults for a new app, and which skill holds each. Read before building or changing a mobile app.
03 SKILL.md 正文
Building mobile apps
The generated mobile app is a web page squeezed into a phone: custom navigation that ignores the back gesture, a spinner on every screen, a blank screen in a lift with no signal, every permission asked on first launch, the token in plain storage, a 60 MB download, and a crash when the phone rotates or the app returns from the background. This skill is the frame an experienced mobile engineer works in: which stack, how to read the app you are given, the rules that hold on every platform, the defaults for a new app, and which skill in this family holds the detail.
1. Choosing the stack
The existing code and the team decide first. For a new app:
| Stack | Choose when | What it costs |
|---|---|---|
| Native: Swift and SwiftUI, Kotlin and Compose | Deep platform integration (widgets, Live Activities, watch, CarPlay, background audio, camera pipelines, Bluetooth, HealthKit), the best performance, new OS features on day one | Two codebases, two skill sets |
| React Native with Expo | A TypeScript and React team ships both platforms; real platform views; logic shared with a web app; JavaScript updates over the air | Native modules for unusual APIs; an SDK upgrade roughly three times a year |
| Flutter | One custom-rendered UI identical on both platforms, a brand-heavy design, a Dart team | Widgets imitate the platform rather than being it; platform features through plugins |
| Kotlin Multiplatform | An Android team shares business logic with a native iOS UI (Compose Multiplatform shares the UI too, stable on iOS since 2025) | Swift interop to learn; a smaller library ecosystem |
- Criteria in order: the code that exists, team skills, the platform APIs the product needs, the UI style (platform-native or brand-custom), code shared with a web app.
- Not a WebView wrapper for a store app: Apple rejects apps that are a website in a shell (guideline 4.2, minimum functionality), and users feel it on the first scroll.
2. Reading an existing app
Before changing anything, read what decides how the change is made:
| File | What it tells you |
|---|---|
package.json, app.json or app.config.ts, eas.json |
React Native and Expo SDK versions, config plugins, build profiles, update channels |
pubspec.yaml, lib/main*.dart, analysis_options.yaml |
Flutter, the state library, flavors, lint rules |
*.xcodeproj, Package.swift, Podfile, *.xcconfig, Info.plist, PrivacyInfo.xcprivacy |
iOS deployment target, schemes and configurations, permissions, privacy declarations |
settings.gradle.kts, app/build.gradle.kts, gradle/libs.versions.toml, AndroidManifest.xml |
minSdk and targetSdk, flavors, dependencies, permissions |
ios/ and android/ in an Expo app |
Committed (native code owned by the project) or generated by prebuild and ignored by git |
.github/workflows, fastlane/, codemagic.yaml, bitrise.yml |
How builds are signed and shipped |
Then find the navigation library and its route list, the state and data layers (TanStack Query, Redux, Riverpod, Bloc, ViewModels), the local database, where tokens are stored, and for React Native whether the New Architecture is on.
npx expo-doctor # Expo: version mismatches, config problems
npx expo config --type public # the resolved app config
flutter doctor -v && flutter --version
xcodebuild -list -project App.xcodeproj # schemes and configurations
./gradlew -q :app:dependencies --configuration releaseRuntimeClasspath
The project's navigation, state library and folder structure win over the
defaults below (code). Do not upgrade an SDK, Kotlin, the Android Gradle
Plugin or Flutter as a side effect of a feature.
3. Rules on every platform
- Platform conventions: the iOS edge swipe and the Android back gesture
always work; system components (navigation bars, sheets, pickers, the
share sheet, date pickers) before custom ones (
mobile-ux). - Interruptions are normal: a call, a notification tapped, the app switcher, the OS killing a backgrounded app to free memory. Save drafts as the user types or when the app goes to the background; restore the screen and scroll position on return.
- Lifecycle: iOS
scenePhase, Android lifecycleON_STARTandON_STOP, React NativeAppState, FlutterAppLifecycleListener. Going to the background: pause playback and timers, save, stop location that is not needed. Coming back: refresh data older than a few minutes, check the session and permissions again. - Configuration changes: on Android, rotation, dark mode, font size, language, split screen and folding recreate the activity. State lives in a ViewModel or saved state, never only in the view.
- Offline and slow networks: every screen that loads data has loading,
empty, error and offline states; cached data shows first; writes queue and
retry; every request has a timeout (
mobile-data). - Permissions: asked at the moment of use, after saying why; the app
still works when one is denied (
mobile-ux). - Secrets: tokens in the Keychain or Android Keystore (through
expo-secure-store or flutter_secure_storage), never AsyncStorage,
UserDefaults, SharedPreferences or a file. No API secret in the app at
all: anything shipped can be extracted, including
EXPO_PUBLIC_and--dart-definevalues. Calls that need a secret go through your server. - Accessibility: screen reader labels, Dynamic Type and font scale up to the largest size, 44pt and 48dp touch targets, contrast, reduced motion.
- Battery and data: no polling loops, batched requests, background work
through the OS schedulers, images decoded at the size shown
(
mobile-performance). - Store rules shape features: digital goods through in-app purchase
(with regional exceptions), account deletion inside the app when accounts
can be created, a demo account for review, privacy declarations that match
what the SDKs collect (
mobile-release).
4. Defaults for a new app
| Stack | Default |
|---|---|
| Cross-platform (when nothing else decides) | Expo on the current SDK with Expo Router, strict TypeScript, TanStack Query for server data, Zustand for small client state, expo-secure-store, expo-image, FlashList, Reanimated and Gesture Handler, EAS Build, Submit and Update, Jest with React Native Testing Library, Maestro |
| Flutter | Riverpod with riverpod_generator (Bloc if the team knows it), go_router, freezed and json_serializable, Dio, Drift for local data, flutter_secure_storage, flutter_lints or very_good_analysis, flavors |
| iOS | SwiftUI with @Observable, NavigationStack, Swift 6 language mode, async/await, SwiftData (GRDB or Core Data when SwiftData falls short), Swift Testing, Swift Package Manager; deployment target iOS 17 or later |
| Android | Kotlin, Compose with Material 3, ViewModel with StateFlow, Navigation Compose with type-safe routes, Hilt, Room, DataStore, WorkManager, Coil, Retrofit or Ktor with kotlinx.serialization, a version catalogue, KSP; minSdk 26 unless the audience needs older |
- The bundle identifier and application id (
com.company.app) are decided once: they cannot change after the first release. - Development, staging and production as separate identifiers
(
com.company.app.dev), so they install side by side, each with its own icon badge and API base URL. - Crash reporting from the first build; no analytics or tracking SDK without a reason and a declaration.
5. Running what you build
npx expo start # Expo dev server for a development build
npx expo run:ios # compile and run on the iOS simulator
npx expo run:android # compile and run on an emulator or device
flutter devices && flutter run -d <device-id>
xcodebuild -scheme App -destination 'platform=iOS Simulator,name=iPhone 17' build
./gradlew installDebug && adb shell am start -n com.acme.app/.MainActivity
- Pick simulator names from
xcrun simctl list devices available; the list depends on the installed Xcode. - iOS builds need macOS with Xcode. On Linux, build and test Android and the shared code, and say plainly that iOS was not built.
- In an Expo app whose native folders are generated, change native settings
through
app.config.tsand config plugins; edits insideios/orandroid/are lost at the next prebuild. - Never submit to a store, bump release versions or touch signing keys
unless asked (
mobile-release).
6. Definition of done
- Builds for each target platform. For changes near release (R8, Hermes bytecode, tree shaking, obfuscation), a release build too: it behaves differently from debug.
- Runs on a simulator or emulator, and on a device when possible: camera, push notifications, biometrics and real performance only show there.
- Tests pass; lint and analysers are clean; no new warnings.
- Checked with the largest text size, dark mode, the smallest supported
screen (375pt wide on iPhone SE, 360dp on Android), landscape if the app
supports it, and a right-to-left language if the app is localised (
i18n). - Tried offline, on a slow network, backgrounded and resumed, and with a permission denied.
- The report says what ran, what passed, and what could not be run.
7. Which skill for which job
mobile: this frame, the defaults and the rules above.mobile-ux: native-feeling screens, navigation, safe areas, type, forms, permission prompts, states, screen readers.mobile-react-native: Expo, Expo Router, FlashList, Reanimated, native modules, EAS.mobile-flutter: structure, Riverpod or Bloc, go_router, theming, widget and golden tests, flavors.mobile-ios: SwiftUI, Observation, concurrency, SwiftData, Keychain, background tasks, privacy manifest.mobile-android: Compose, ViewModel and StateFlow, Hilt, Room, WorkManager, permissions, edge-to-edge, Gradle and R8.mobile-data: offline-first storage, sync, conflicts, retries, secure storage, local migrations.mobile-release: versions, signing, TestFlight and Play tracks, review rules, privacy forms, rollouts, over-the-air updates.mobile-performance: startup, scrolling, memory, battery, app size, profiling.mobile-testing: the test shape, end-to-end tools, the device matrix, conditions and flows that break.
Beyond the family: ui for design principles, motion-stacks for native
animation APIs, motion-comfort for reduced motion, i18n for text and
right-to-left, backend-api for the server side of sync.
Check it
- The project's own checks:
npx tsc --noEmitandnpx expo lint;flutter analyzeandflutter test;xcodebuild ... build test;./gradlew assembleDebug testDebugUnitTest lintDebug. - Walk the change on a simulator or emulator: a cold launch; background for a minute and return; airplane mode on a screen that loads data; a denied permission; the largest text size; dark mode; rotation.
- Android process death: press Home, run
adb shell am kill com.acme.app, reopen from recents. The screen, its input and its scroll position are still there.
Avoid
A web layout in an app shell; custom back buttons that replace the system gesture; a full-screen spinner for every load; nothing to show offline; permissions on first launch; tokens or API secrets in plain storage or the bundle; state kept only in views; a stack chosen against the team and the existing code; SDK upgrades slipped into a feature; claiming an iOS build passed on a machine without Xcode.
04 同仓库更多 Skills
demo-skill
Project-scope demo skill for tests.
writing
Writing words people read: the specific thing instead of claims, words to drop, sentences, interface copy (buttons, labels, errors, empty states, confirmations), page copy, notifications and emails, alt text and link text, numbers and dates, words that translate well, documentation and voice. Read before writing a page's copy, an interface's text or a document.
ui
Designing or restyling an interface: direction, layout, type, colour, icons, components, states, responsive behaviour. Read before building a page, a screen or a set of components.
ui-themes
Light and dark themes, and colour that holds in both: tokens with a value per theme, and what each kind of content needs to stay visible (icons, SVG drawings and line art, logos, photos, screenshots, charts, code, maps, borders, shadows, focus, form controls), switching without a flash, and checking both. Read before building a second theme or a theme toggle, and before any drawing, logo or chart on a page that has two themes.
ui-structure
Structure before styling: the blueprint written before any interface code (the screen's job, the regions its kind of page needs, their order and why, the layout skeleton in numbers, the components and their states), the anatomy and order of a homepage, a dashboard, a list, a detail page, settings, a form, sign-in, pricing, docs, an article and a checkout, and how to turn the blueprint into code (tokens, layout primitives, components, sections, page). Read first, before building or rebuilding any page or screen.
ui-stack-vue
Building interfaces in Vue 3 and Nuxt: project layout, script setup with typed defineProps, defineEmits and defineModel, attribute fallthrough, slots and scoped slots, template refs, ref, reactive and computed, watch versus watchEffect, composables and VueUse, provide and inject, Pinia, keyed v-for, transitions, Nuxt 4 (app directory, pages, layouts, useFetch and useAsyncData keys, $fetch in handlers, server routes, runtime config, useSeoMeta, NuxtImg, middleware), VeeValidate forms, Reka UI and Nuxt UI, testing, vue-tsc, and the traps. Read when the project uses Vue or Nuxt.