mobileui-os 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/AGENTS.md +47 -0
  2. package/CHANGELOG.md +25 -0
  3. package/README.md +78 -0
  4. package/bin/cli.mjs +375 -0
  5. package/knowledge/android/00-apple-to-android-adaption.md +1499 -0
  6. package/knowledge/android/accessibility.md +333 -0
  7. package/knowledge/android/components-controls.md +270 -0
  8. package/knowledge/android/material-design-3.md +174 -0
  9. package/knowledge/android/navigation-patterns.md +212 -0
  10. package/knowledge/apple/00-skill-reading-protocol.md +1296 -0
  11. package/knowledge/apple/Accessibility, Inclusive Design & Human Factors Intelligence.md +735 -0
  12. package/knowledge/apple/Advanced Interaction Patterns, Gestures, Feedback & State Transitions.md +1140 -0
  13. package/knowledge/apple/Advanced Navigation, Information Architecture & Wayfinding.md +551 -0
  14. package/knowledge/apple/Autonomus Ui-UX Improvement Loop.md +611 -0
  15. package/knowledge/apple/Color, Materials, Contrast, Themes & Visual Depth.md +1351 -0
  16. package/knowledge/apple/Content, Copy, Microinteractions & UX Communication.md +642 -0
  17. package/knowledge/apple/Data-Heavy Interfaces, Tables, Lists, Search, Filtering & Large-Scale Content.md +721 -0
  18. package/knowledge/apple/Design Systems & Component Architecture.md +412 -0
  19. package/knowledge/apple/Forms, Input, Data Entry & Validation Intelligence.md +705 -0
  20. package/knowledge/apple/Interaction, State & Edge-Case Engineering.md +491 -0
  21. package/knowledge/apple/Interaction-behaviour.md +1378 -0
  22. package/knowledge/apple/Layout Architecture, Responsive Design & Spatial Systems.md +1365 -0
  23. package/knowledge/apple/MASTER UI-UX ORCHESTRATOR.md +1210 -0
  24. package/knowledge/apple/Navigation Architecture, Routing, Deep Linking & State Restoration.md +1392 -0
  25. package/knowledge/apple/Navigation, Information Architecture & Spatial Hierarchy.md +1613 -0
  26. package/knowledge/apple/Notifications, Permissions, Privacy and Trust.md +1540 -0
  27. package/knowledge/apple/Patterns-templates-composition.md +647 -0
  28. package/knowledge/apple/Performance, Perceived Speed, Motion & Rendering Intelligence.md +855 -0
  29. package/knowledge/apple/Responsive, Adaptive & Cross-Platform UI Intelligence.md +669 -0
  30. package/knowledge/apple/Responsive, Adaptive, Accessible & Performant UI.md +545 -0
  31. package/knowledge/apple/Tablet Adaptation & Multi-Device UX.md +1447 -0
  32. package/knowledge/apple/UI Implementation & Refactoring.md +498 -0
  33. package/knowledge/apple/UI-UX Decision-Making, Prioritization & Trade-offs.md +533 -0
  34. package/knowledge/apple/UI-UX Project Lifecycle & Delivery.md +544 -0
  35. package/knowledge/apple/User Flows & Experience Architecture.md +335 -0
  36. package/knowledge/apple/Visual Design Systems, Theming, Tokens & Brand Intelligence.md +764 -0
  37. package/knowledge/apple/Visual QA, Testing & Validation.md +557 -0
  38. package/knowledge/apple/accessibility-inclusive-interaction.md +1361 -0
  39. package/knowledge/apple/accessibility.md +2162 -0
  40. package/knowledge/apple/color.md +1933 -0
  41. package/knowledge/apple/component-architecture.md +2208 -0
  42. package/knowledge/apple/components.md +2172 -0
  43. package/knowledge/apple/design-decision-framework.md +1883 -0
  44. package/knowledge/apple/design-review-engine.md +2108 -0
  45. package/knowledge/apple/design-tokens.md +1943 -0
  46. package/knowledge/apple/designing-for-ios.md +1680 -0
  47. package/knowledge/apple/gestures, touch behavior, feedback, motion, and micro-interactions.md +1538 -0
  48. package/knowledge/apple/hig-foundation.md +1806 -0
  49. package/knowledge/apple/iconography.md +1903 -0
  50. package/knowledge/apple/interaction-patterns.md +2513 -0
  51. package/knowledge/apple/interaction.md +2141 -0
  52. package/knowledge/apple/ios-alerts-confirmations-destructive-actions.md +1342 -0
  53. package/knowledge/apple/ios-components-and-controls.md +1634 -0
  54. package/knowledge/apple/ios-components-patterns.md +1343 -0
  55. package/knowledge/apple/ios-design-system-architecture.md +1520 -0
  56. package/knowledge/apple/ios-empty-error-offline-states.md +1370 -0
  57. package/knowledge/apple/ios-empty-loading-error-recovery.md +1674 -0
  58. package/knowledge/apple/ios-forms-and-input.md +1458 -0
  59. package/knowledge/apple/ios-forms-input-data-entry.md +1308 -0
  60. package/knowledge/apple/ios-gestures-and-touch.md +1272 -0
  61. package/knowledge/apple/ios-lists-collections-and-data-display.md +1735 -0
  62. package/knowledge/apple/ios-loading-progress-async-states.md +1378 -0
  63. package/knowledge/apple/ios-materials-and-surfaces.md +1543 -0
  64. package/knowledge/apple/ios-motion-animation-transitions.md +1178 -0
  65. package/knowledge/apple/ios-navigation-and-information-architecture.md +1674 -0
  66. package/knowledge/apple/ios-navigation-user-flows-design-architecture.md +1195 -0
  67. package/knowledge/apple/ios-search-and-discovery.md +1456 -0
  68. package/knowledge/apple/ios-search-filtering-discovery.md +1402 -0
  69. package/knowledge/apple/ios-sheets-modals-popovers.md +1205 -0
  70. package/knowledge/apple/ios-typography-icons-visual-hierarchy.md +1431 -0
  71. package/knowledge/apple/layout.md +2331 -0
  72. package/knowledge/apple/media-centric-content-ui-patterns.md +1470 -0
  73. package/knowledge/apple/motion, transitions, physics, and animation language.md +1535 -0
  74. package/knowledge/apple/motion-and-animation.md +1698 -0
  75. package/knowledge/apple/motion.md +2087 -0
  76. package/knowledge/apple/navigation.md +2281 -0
  77. package/knowledge/apple/responsive-adaptive.md +2159 -0
  78. package/knowledge/apple/screen-architecture.md +2067 -0
  79. package/knowledge/apple/typography, Content Hierarchy & Readability.md +1411 -0
  80. package/knowledge/apple/typography.md +1802 -0
  81. package/knowledge/apple/ui-ux inteligence audit.md +106 -0
  82. package/knowledge/apple/visual-design-and-premium-ui.md +1555 -0
  83. package/knowledge/apple/visual-hierarchy-engine.md +1647 -0
  84. package/knowledge/apple/visual-materials.md +2189 -0
  85. package/package.json +53 -0
  86. package/principles/design-principles.md +37 -0
  87. package/principles/platform-principles.md +25 -0
  88. package/principles/ux-principles.md +16 -0
  89. package/references/official-links.md +11 -0
  90. package/skills/accessibility-engineer/SKILL.md +125 -0
  91. package/skills/analytics-engineer/SKILL.md +283 -0
  92. package/skills/animation-engineer/SKILL.md +316 -0
  93. package/skills/component-designer/SKILL.md +75 -0
  94. package/skills/component-library-engineer/SKILL.md +140 -0
  95. package/skills/component-library-ops/SKILL.md +155 -0
  96. package/skills/design-system/SKILL.md +77 -0
  97. package/skills/design-token-engineer/SKILL.md +203 -0
  98. package/skills/design-token-pipeline/SKILL.md +277 -0
  99. package/skills/device-lab-engineer/SKILL.md +387 -0
  100. package/skills/forms-engineer/SKILL.md +79 -0
  101. package/skills/internationalization-engineer/SKILL.md +256 -0
  102. package/skills/motion-designer/SKILL.md +77 -0
  103. package/skills/native-data-fetching/SKILL.md +50 -0
  104. package/skills/navigation-architect/SKILL.md +65 -0
  105. package/skills/performance-engineer/SKILL.md +250 -0
  106. package/skills/platform-specialist/SKILL.md +95 -0
  107. package/skills/pre-release-gate/SKILL.md +75 -0
  108. package/skills/screen-designer/SKILL.md +117 -0
  109. package/skills/security-engineer/SKILL.md +375 -0
  110. package/skills/skills.json +134 -0
  111. package/skills/testing-auditor/SKILL.md +62 -0
  112. package/skills/ui-architect/SKILL.md +86 -0
  113. package/skills/ui-implementer/SKILL.md +188 -0
  114. package/skills/ux-architect/SKILL.md +49 -0
  115. package/skills/ux-auditor/SKILL.md +52 -0
  116. package/skills/visual-auditor/SKILL.md +71 -0
  117. package/templates/audit-report.md +29 -0
  118. package/templates/design-tokens.ts +33 -0
  119. package/templates/screen-spec.md +61 -0
  120. package/workflows/new-screen.md +17 -0
  121. package/workflows/pre-release.md +21 -0
  122. package/workflows/redesign.md +14 -0
  123. package/workflows/ui-audit.md +22 -0
@@ -0,0 +1,256 @@
1
+ # Internationalization Engineer
2
+
3
+ Build apps that work globally: RTL, locales, pluralization, formatting, translation workflow.
4
+
5
+ ## Core Principles
6
+
7
+ - **No hardcoded strings** — every user-facing string is externalized
8
+ - **Locale ≠ Language** — `en-US` vs `en-GB` (date, number, currency)
9
+ - **RTL is structural** — layout mirrors, not just text direction
10
+ - **Dynamic content** — names, numbers, dates interpolated correctly
11
+ - **Fallback chain** — `ar-SA` → `ar` → `en` → key
12
+
13
+ ## String Externalization
14
+
15
+ ### Format: ICU MessageFormat
16
+ ```json
17
+ // en.json
18
+ {
19
+ "welcome": "Welcome, {name}!",
20
+ "itemsCount": "{count, plural, =0 {No items} one {1 item} other {# items}}",
21
+ "lastUpdated": "Updated {date, datetime, short}",
22
+ "price": "{price, number, ::currency/USD}",
23
+ "userProfile": "{name} ({role, select, admin {Administrator} user {User} other {Guest}})"
24
+ }
25
+ ```
26
+
27
+ ### React Native (expo-localization + i18n-js / i18next)
28
+ ```tsx
29
+ // i18n.ts
30
+ import i18n from 'i18next';
31
+ import { initReactI18next } from 'react-i18next';
32
+ import * as Localization from 'expo-localization';
33
+ import en from './locales/en.json';
34
+ import ar from './locales/ar.json';
35
+
36
+ i18n
37
+ .use(initReactI18next)
38
+ .init({
39
+ resources: { en: { translation: en }, ar: { translation: ar } },
40
+ lng: Localization.getLocales()[0]?.languageCode ?? 'en',
41
+ fallbackLng: 'en',
42
+ interpolation: { escapeValue: false },
43
+ compatibilityJSON: 'v4', // ICU support
44
+ });
45
+
46
+ export default i18n;
47
+ ```
48
+
49
+ ```tsx
50
+ // Usage
51
+ import { t } from 'i18next';
52
+
53
+ <Text>{t('welcome', { name: user.name })}</Text>
54
+ <Text>{t('itemsCount', { count: items.length })}</Text>
55
+ ```
56
+
57
+ ### Compose Multiplatform
58
+ ```kotlin
59
+ // strings.xml (per locale)
60
+ <!-- values/strings.xml -->
61
+ <string name="welcome">Welcome, %1$s!</string>
62
+ <string name="itemsCount">
63
+ <plurals name="itemsCount">
64
+ <item quantity="zero">No items</item>
65
+ <item quantity="one">1 item</item>
66
+ <item quantity="other">%1$d items</item>
67
+ </plurals>
68
+ </string>
69
+
70
+ // Usage
71
+ stringResource(R.string.welcome, user.name)
72
+ pluralStringResource(R.plurals.itemsCount, count, count)
73
+ ```
74
+
75
+ ### SwiftUI
76
+ ```swift
77
+ // Localizable.strings (per locale)
78
+ "welcome" = "Welcome, %@!";
79
+ "itemsCount" = "%d items"; // Use .stringsdict for plurals
80
+
81
+ // Usage
82
+ Text("welcome".localized(user.name))
83
+ Text(String.localizedStringWithFormat("itemsCount".localized, count))
84
+ ```
85
+
86
+ ## RTL Support
87
+
88
+ ### Layout Mirroring
89
+ | Property | LTR | RTL |
90
+ |----------|-----|-----|
91
+ | `marginStart` | left | right |
92
+ | `marginEnd` | right | left |
93
+ | `paddingStart` | left | right |
94
+ | `flexDirection: row` | ← → | → ← |
95
+ | `textAlign: start` | left | right |
96
+ | Icon direction | forward | mirrored |
97
+
98
+ ### Implementation
99
+
100
+ #### React Native
101
+ ```tsx
102
+ import { I18nManager, View, Text } from 'react-native';
103
+
104
+ // Allow RTL (run once at startup)
105
+ I18nManager.allowRTL(true);
106
+ I18nManager.forceRTL(locale.startsWith('ar') || locale.startsWith('he'));
107
+
108
+ // Use start/end not left/right
109
+ <View style={{ marginStart: 16, paddingEnd: 12 }}>
110
+ <Text style={{ textAlign: 'start' }}>{t('welcome')}</Text>
111
+ </View>
112
+
113
+ // Mirror icons conditionally
114
+ <Image
115
+ source={require('./chevron.png')}
116
+ style={{ transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }] }}
117
+ />
118
+ ```
119
+
120
+ #### Compose
121
+ ```kotlin
122
+ // Automatic with Material3
123
+ MaterialTheme {
124
+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
125
+ // Layout mirrors automatically
126
+ Row(Modifier.padding(start = 16.dp, end = 12.dp)) {
127
+ Text(textAlign = TextAlign.Start, stringResource(R.string.welcome))
128
+ }
129
+ }
130
+ }
131
+
132
+ // Manual icon mirroring
133
+ Icon(
134
+ imageVector = Icons.Default.ChevronRight,
135
+ modifier = Modifier.graphicsLayer { scaleX = if (LocalLayoutDirection.current == LayoutDirection.Rtl) -1f else 1f }
136
+ )
137
+ ```
138
+
139
+ #### SwiftUI
140
+ ```swift
141
+ // Automatic with .environment(\.layoutDirection, .rightToLeft)
142
+ ContentView()
143
+ .environment(\.locale, Locale(identifier: "ar"))
144
+ .environment(\.layoutDirection, .rightToLeft)
145
+
146
+ // Manual flip
147
+ Image(systemName: "chevron.right")
148
+ .scaleEffect(x: -1, y: 1) // Or use .flipsForRightToLeftLayoutDirection(true)
149
+ ```
150
+
151
+ ## Number, Date, Currency Formatting
152
+
153
+ ### React Native (Intl / expo-localization)
154
+ ```tsx
155
+ import { formatNumber, formatDate, formatCurrency } from 'react-native-localize';
156
+
157
+ const locale = 'ar-SA';
158
+
159
+ formatNumber(1234.5, locale); // "١٬٢٣٤٫٥"
160
+ formatDate(new Date(), locale, { dateStyle: 'medium' }); // "١٤٤٥/٠٨/١١"
161
+ formatCurrency(99.99, 'USD', locale); // "٩٩٫٩٩ $US"
162
+ ```
163
+
164
+ ### Compose (Java/Kotlin stdlib)
165
+ ```kotlin
166
+ val locale = Locale("ar", "SA")
167
+ NumberFormat.getNumberInstance(locale).format(1234.5) // "١٬٢٣٤٫٥"
168
+ DateFormat.getMediumDateFormat(locale).format(Date()) // "١٤٤٥/٠٨/١١"
169
+ NumberFormat.getCurrencyInstance(locale).apply { currency = Currency.getInstance("USD") }.format(99.99) // "٩٩٫٩٩ $US"
170
+ ```
171
+
172
+ ### SwiftUI (Foundation)
173
+ ```swift
174
+ let locale = Locale(identifier: "ar_SA")
175
+ let formatter = NumberFormatter()
176
+ formatter.locale = locale
177
+ formatter.numberStyle = .decimal
178
+ formatter.string(from: 1234.5) // "١٬٢٣٤٫٥"
179
+
180
+ let dateFormatter = DateFormatter()
181
+ dateFormatter.locale = locale
182
+ dateFormatter.dateStyle = .medium
183
+ dateFormatter.string(from: Date()) // "١٤٤٥/٠٨/١١"
184
+
185
+ let currencyFormatter = NumberFormatter()
186
+ currencyFormatter.locale = locale
187
+ currencyFormatter.numberStyle = .currency
188
+ currencyFormatter.currencyCode = "USD"
189
+ currencyFormatter.string(from: 99.99) // "٩٩٫٩٩ $US"
190
+ ```
191
+
192
+ ## Pluralization Rules (CLDR)
193
+
194
+ | Language | Categories | Example |
195
+ |----------|------------|---------|
196
+ | English | one, other | 1 item / 2 items |
197
+ | Arabic | zero, one, two, few, many, other | 0 / 1 / 2 / 3-10 / 11-99 / 100+ |
198
+ | Russian | one, few, many, other | 1 / 2-4 / 5-20 / 21+ |
199
+ | Chinese | other | No plural distinction |
200
+
201
+ **Always use ICU plural format** — never `if count === 1`.
202
+
203
+ ## Translation Workflow
204
+
205
+ ### Extraction
206
+ ```bash
207
+ # i18next
208
+ npx i18next-scanner --config i18next-scanner.config.js
209
+
210
+ # Compose
211
+ ./gradlew extractStrings
212
+
213
+ # SwiftUI
214
+ xcodebuild -exportLocalizations -localizationPath ./locales
215
+ ```
216
+
217
+ ### CI Integration
218
+ ```yaml
219
+ # .github/workflows/i18n.yml
220
+ on:
221
+ push:
222
+ paths: ['src/**/*.tsx', 'src/**/*.kt', 'Sources/**/*.swift']
223
+ jobs:
224
+ extract:
225
+ runs-on: ubuntu-latest
226
+ steps:
227
+ - uses: actions/checkout@v4
228
+ - run: npm run i18n:extract
229
+ - run: ./gradlew extractStrings
230
+ - uses: github-actions-xcodebuild/export-localizations@v1
231
+ - uses: peter-evans/create-pull-request@v5
232
+ with:
233
+ token: ${{ secrets.GITHUB_TOKEN }}
234
+ branch: i18n/update-strings
235
+ title: 'chore(i18n): update translation strings'
236
+ ```
237
+
238
+ ### Translation Management
239
+ - **Crowdin / Lokalise / Transifex** — sync via CLI
240
+ - **Machine translation** — first pass, human review required
241
+ - **Context** — screenshots, comments, character limits
242
+ - **QA** — pseudo-localization (ßü∂ðô żĉ), length testing
243
+
244
+ ## Testing Checklist
245
+
246
+ - [ ] All strings externalized (no hardcoded text)
247
+ - [ ] ICU plural format used everywhere
248
+ - [ ] RTL: layout mirrors, icons flip, text aligns start/end
249
+ - [ ] Numbers/dates/currencies format per locale
250
+ - [ ] Font fallbacks for CJK, Arabic, Indic scripts
251
+ - [ ] Line height accommodates taller glyphs (Arabic, Devanagari)
252
+ - [ ] Input: IME works for target languages
253
+ - [ ] Search: diacritic-insensitive, RTL-aware
254
+ - [ ] Sorting: locale-aware collation
255
+ - [ ] Pseudo-localization: no clipping, no overflow
256
+ - [ ] Fallback chain works: `ar-SA` → `ar` → `en` → key
@@ -0,0 +1,77 @@
1
+ # Motion Designer
2
+
3
+ Motion must serve feedback, state change, spatial continuity, hierarchy, or gesture response.
4
+
5
+ ## Principles
6
+
7
+ - **Purposeful** — Every animation communicates; no decoration
8
+ - **Interruptible** — Gestures can cancel/reverse mid-flight
9
+ - **Context-preserving** — Spatial continuity (shared elements, layout transitions)
10
+ - **Performant** — Native driver only; 60fps on mid-range devices
11
+ - **Accessible** — Respects `prefers-reduced-motion`; instant for essential
12
+
13
+ ## Motion Tokens
14
+
15
+ | Token | Duration | Easing | Use Case |
16
+ |-------|----------|--------|----------|
17
+ | `fast` | 150ms | `cubic-bezier(0.2, 0, 0, 1)` | Micro-feedback, hover, tap |
18
+ | `standard` | 250ms | `cubic-bezier(0.2, 0, 0, 1)` | Screen transitions, modal appear |
19
+ | `expressive` | 400ms | `cubic-bezier(0.2, 0, 0, 1)` | Hero transitions, celebrations |
20
+ | `spring` | — | `damping:20, stiffness:150` | Gesture follow, bouncy feel |
21
+ | `snappy` | — | `damping:25, stiffness:250` | Precise, fast, no overshoot |
22
+
23
+ ## Required Animations (Per Screen Spec)
24
+
25
+ | Trigger | Animation | Platform Notes |
26
+ |---------|-----------|----------------|
27
+ | Screen push | Slide + fade (300ms) | iOS: swipe-back interactive; Android: predictive back |
28
+ | Modal sheet | Scale + fade (250ms spring) | iOS: detents, grabber; Android: bottom sheet |
29
+ | Tab switch | Cross-fade (150ms) | No slide (cognitive load) |
30
+ | List insert/delete | Layout animation (300ms spring) | Reanimated `Layout` / Compose `animateContentSize` |
31
+ | Pull-to-refresh | Spinner + content offset | Native `UIRefreshControl` / `SwipeRefreshLayout` |
32
+ | Button press | Scale 0.98 (fast spring) | Native ripple (Android) / haptic (iOS) |
33
+ | Toggle/switch | Thumb slide (150ms) | Native `UISwitch` / `SwitchMaterial` |
34
+ | Toast/snackbar | Slide up + fade (200ms) | Auto-dismiss 4s/10s |
35
+ | Error shake | Horizontal 3× (reduced motion: none) | `accessibilityReduceMotion` check |
36
+
37
+ ## Shared Element Transitions
38
+
39
+ - **Expo Router**: `SharedTransition` (expo-ui)
40
+ - **Compose**: `SharedTransitionScope` + `SharedTransitionItem`
41
+ - **SwiftUI**: `matchedGeometryEffect` + `.navigationTransition(.zoom)`
42
+
43
+ ## Reduced Motion Implementation
44
+
45
+ ```typescript
46
+ // React Native
47
+ const reduceMotion = useReducedMotion();
48
+ const config = reduceMotion ? { duration: 0 } : springs.gentle;
49
+
50
+ // Compose
51
+ val reduceMotion = LocalReduceMotion.current
52
+ val spec = if (reduceMotion) spring(dampingRatio = 1e10) else springs.gentle
53
+
54
+ // SwiftUI
55
+ @Environment(\.accessibilityReduceMotion) var reduceMotion
56
+ withAnimation(reduceMotion ? .none : .spring()) { ... }
57
+ ```
58
+
59
+ ## Anti-Patterns
60
+
61
+ - Animating `width`/`height`/`top`/`left` (layout thrashing)
62
+ - `useNativeDriver: false` for transform/opacity
63
+ - Sequencing >2 animations (user waits)
64
+ - Decorative parallax, confetti, loading spinners as entertainment
65
+ - No reduced-motion support
66
+ - Spring on critical path with overshoot (use `snappy`)
67
+
68
+ ## Performance Budget
69
+
70
+ - Frame time: <16.67ms (60fps) p99
71
+ - Zero jank frames during transitions
72
+ - Memory: no leaks after 50 transitions
73
+ - JS thread: <5ms/frame during animation
74
+
75
+ ## Output
76
+
77
+ Motion spec per screen: trigger → animation → token → platform notes + reduced-motion fallback.
@@ -0,0 +1,50 @@
1
+ # Native Data Fetching Engineer
2
+
3
+ Implement robust data fetching for mobile: loading, error, empty, offline, and recovery states.
4
+
5
+ ## Core Responsibilities
6
+
7
+ - Choose the right strategy: Expo Router loaders (`useLoaderData`), React Query, SWR, or bare `fetch`
8
+ - Design all required states per screen-spec: loading, empty, content, error, offline, permission
9
+ - Implement optimistic updates with rollback on failure
10
+ - Handle background refresh and stale-while-revalidate
11
+ - Preserve user input during recoverable failures (UX principle #12)
12
+ - Implement pagination, infinite scroll, and pull-to-refresh
13
+ - Configure caching, deduping, and retry policies per endpoint
14
+ - Handle authentication token refresh transparently
15
+
16
+ ## State Requirements (Non-Negotiable)
17
+
18
+ | State | Must Communicate |
19
+ |-------|------------------|
20
+ | Loading | Progress or layout stability (skeleton, not spinner-only) |
21
+ | Empty | What happened + what to do next (UX principle #9) |
22
+ | Error | Problem, impact, recovery path (UX principle #10) |
23
+ | Offline | Cached data available? When will it sync? |
24
+ | Permission | Why needed + how to grant |
25
+
26
+ ## Platform Adaptations
27
+
28
+ - iOS: Pull-to-refresh on scroll views, background app refresh
29
+ - Android: SwipeRefreshLayout, WorkManager for background sync
30
+ - Both: Respect `reduced-motion` for loading animations
31
+
32
+ ## Implementation Checklist
33
+
34
+ - [ ] Loader returns typed data + error union
35
+ - [ ] Skeleton matches content structure (not generic cards)
36
+ - [ ] Error boundary catches render errors separately from fetch errors
37
+ - [ ] Retry with exponential backoff + user-initiated retry
38
+ - [ ] Offline-first: show cached data immediately, sync in background
39
+ - [ ] Optimistic updates: update UI instantly, rollback on error toast
40
+ - [ ] Cancellation on unmount / route change
41
+ - [ ] Dynamic text scaling doesn't break loading layouts
42
+ - [ ] Screen readers announce state changes (loading → content/error)
43
+
44
+ ## Anti-Patterns
45
+
46
+ - Full-screen spinner blocking interaction
47
+ - Generic "Something went wrong" without recovery action
48
+ - Losing user input on error
49
+ - No offline indicator when cached data is stale
50
+ - Refetching on focus without user intent
@@ -0,0 +1,65 @@
1
+ # Navigation Architect
2
+
3
+ Design and implement Expo Router navigation: structure, deep linking, state restoration, platform adaptations.
4
+
5
+ ## Responsibilities
6
+
7
+ - Define route hierarchy: tabs, stacks, modals, drawers
8
+ - Configure deep links with typed params (expo-linking)
9
+ - Implement state restoration (iOS scene restoration, Android process death)
10
+ - Design platform-specific patterns: iOS large titles, Android back handling
11
+ - Manage navigation context: user, auth, onboarding, feature flags
12
+ - Coordinate with data fetching (loaders) and analytics
13
+
14
+ ## Route Patterns
15
+
16
+ | Pattern | Use Case | Platform Notes |
17
+ |---------|----------|----------------|
18
+ | Tabs (bottom) | 3-5 primary destinations | iOS: SF Symbols, large titles; Android: Material icons, no labels on narrow |
19
+ | Stack (push) | Drill-down, detail screens | iOS: swipe-back; Android: system back |
20
+ | Modal (sheet) | Tasks, forms, pickers | iOS: detents, grabber; Android: bottom sheet |
21
+ | Drawer | Secondary navigation | Rare on iOS; common on Android |
22
+ | Full-screen cover | Auth, onboarding, immersive | iOS: `.fullScreenCover`; Android: activity |
23
+
24
+ ## Deep Linking
25
+
26
+ - Define URL scheme + universal links / app links
27
+ - Typed route params: `/profile/:userId?tab=posts`
28
+ - Handle cold start → navigate after auth restore
29
+ - Validate params, fallback to home on invalid
30
+
31
+ ## State Restoration
32
+
33
+ - iOS: `UIKit` scene restoration + `expo-router` `restoreState`
34
+ - Android: `onSaveInstanceState` + process death recovery
35
+ - Persist: current route, scroll position, form input, tab selection
36
+ - Test: kill app → relaunch → verify context preserved
37
+
38
+ ## Platform Adaptations
39
+
40
+ | Behavior | iOS | Android |
41
+ |----------|-----|---------|
42
+ | Back gesture | Swipe from edge | System back (gesture or button) |
43
+ | Large titles | Yes (scroll) | No (toolbar) |
44
+ | Tab bar | Fixed, translucent | Fixed, elevation |
45
+ | Modal dismiss | Swipe down | Swipe down / back |
46
+ | Search | Nav bar integration | Toolbar / separate screen |
47
+
48
+ ## Implementation Checklist
49
+
50
+ - [ ] Route tree matches IA (information architecture)
51
+ - [ ] All deep links tested: cold, warm, background
52
+ - [ ] State restoration verified on process death
53
+ - [ ] Platform back behavior correct (no double-back exit)
54
+ - [ ] Tab bar hides on scroll (iOS) / correct elevation (Android)
55
+ - [ ] Modal detents: medium + large (iOS), expandable (Android)
56
+ - [ ] Analytics: screen_view on every route change
57
+ - [ ] Type-safe navigation: `router.push('/profile/123')` not strings
58
+
59
+ ## Anti-Patterns
60
+
61
+ - Hardcoded route strings
62
+ - Navigation logic in components (use hooks)
63
+ - Modal stacks > 2 deep
64
+ - Tabs as primary on Android with >5 items
65
+ - Losing scroll/form state on tab switch
@@ -0,0 +1,250 @@
1
+ # Performance Engineer
2
+
3
+ Profile, optimize, and enforce performance budgets for mobile apps.
4
+
5
+ ## Performance Budgets (Non-Negotiable)
6
+
7
+ | Metric | Budget | Measurement |
8
+ |--------|--------|-------------|
9
+ | Cold start (TTID) | < 2.0s | `react-native-performance`, Xcode Instruments, Android Studio |
10
+ | Warm start | < 0.8s | Same |
11
+ | JS bundle (gzipped) | < 200KB | `expo bundle --analyze` |
12
+ | Frame time (p99) | < 16.67ms (60fps) | `why-did-you-render`, Flipper, Systrace |
13
+ | Jank frames | 0 per screen | `react-native-performance` |
14
+ | Memory (baseline) | < 150MB | Xcode / Android Studio |
15
+ | Memory (peak) | < 300MB | Same |
16
+ | List scroll (100 items) | 60fps sustained | FlashList / Shopify FlashList |
17
+ | Image decode | < 16ms/frame | `react-native-fast-image`, `expo-image` |
18
+ | Network (critical path) | < 500ms p95 | Expo Router loaders, React Query |
19
+
20
+ ## Profiling Tools
21
+
22
+ ### React Native
23
+ ```bash
24
+ # JS Profiling
25
+ npx react-native-profile --dev false
26
+
27
+ # Hermes Sampling Profiler
28
+ npx hermestrace profile.hcp
29
+
30
+ # Flipper Plugins
31
+ - React DevTools (Profiler tab)
32
+ - React Native Performance
33
+ - Hermes Debugger
34
+ - Network Inspector
35
+ ```
36
+
37
+ ### iOS (Xcode Instruments)
38
+ ```bash
39
+ # Time Profiler
40
+ xcodebuild -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 15' test
41
+
42
+ # Key Instruments:
43
+ - Time Profiler (CPU)
44
+ - Allocations (Memory)
45
+ - Leaks
46
+ - Core Animation (GPU, color hits)
47
+ - App Launch (TTID breakdown)
48
+ ```
49
+
50
+ ### Android (Android Studio Profiler)
51
+ ```bash
52
+ # CPU, Memory, Network, Energy
53
+ ./gradlew profile
54
+
55
+ # Systrace for frame analysis
56
+ python systrace.py -o trace.html -t 10 sched gfx view
57
+ ```
58
+
59
+ ## Optimization Strategies
60
+
61
+ ### Startup
62
+ - **Code splitting**: Dynamic `import()` for non-critical screens
63
+ - **Hermes bytecode**: `hermes-bytecode` in CI
64
+ - **Inline requires**: `babel-plugin-transform-inline-requires`
65
+ - **Defer non-critical**: Analytics, logging, heavy libs
66
+ - **Splash screen**: Show immediately, hide on `useEffect` mount
67
+
68
+ ```tsx
69
+ // App.tsx
70
+ import { SplashScreen } from 'expo-splash-screen';
71
+ SplashScreen.preventAutoHideAsync();
72
+
73
+ useEffect(() => {
74
+ // Load critical data
75
+ Promise.all([loadFonts(), loadAuth()]).then(() => {
76
+ SplashScreen.hideAsync();
77
+ });
78
+ }, []);
79
+ ```
80
+
81
+ ### Rendering
82
+ - **Memoize**: `React.memo`, `useMemo`, `useCallback`
83
+ - **Virtualize lists**: `FlashList` (not `FlatList`)
84
+ - **Image optimization**: WebP, correct dimensions, `expo-image`
85
+ - **Avoid inline styles**: Use `StyleSheet.create`
86
+ - **Reduce re-renders**: `why-did-you-render` in dev
87
+
88
+ ```tsx
89
+ // FlashList (Shopify) - 60fps for 1000+ items
90
+ import { FlashList } from '@shopify/flash-list';
91
+
92
+ <FlashList
93
+ data={items}
94
+ renderItem={({ item }) => <Item item={item} />}
95
+ estimatedItemSize={80}
96
+ keyExtractor={item => item.id}
97
+ maintainPosition
98
+ removeClippedSubviews
99
+ />
100
+ ```
101
+
102
+ ### Navigation
103
+ - **Lazy screens**: `React.lazy` + `Suspense` in Expo Router
104
+ - **Preload**: `router.prefetch('/detail/123')` on hover/focus
105
+ - **Reset stack**: Avoid deep stacks (>10), use `replace`
106
+
107
+ ```tsx
108
+ // Expo Router lazy
109
+ const DetailScreen = React.lazy(() => import('./DetailScreen'));
110
+
111
+ export default function Layout() {
112
+ return (
113
+ <Suspense fallback={<Skeleton />}>
114
+ <Stack.Screen name="detail" component={DetailScreen} />
115
+ </Suspense>
116
+ );
117
+ }
118
+ ```
119
+
120
+ ### State Management
121
+ - **Colocate state**: Keep local, lift only when needed
122
+ - **Selector granularity**: `useSelector(state => state.user.name)` not whole object
123
+ - **Immer**: Immutable updates without spread explosion
124
+ - **Persist selectively**: Only user preferences, not cache
125
+
126
+ ### Images & Media
127
+ ```tsx
128
+ // expo-image (web-like API, native performance)
129
+ import { Image } from 'expo-image';
130
+
131
+ <Image
132
+ source={{ uri: item.imageUrl }}
133
+ contentFit="cover"
134
+ transition={200}
135
+ placeholder={require('./placeholder.png')}
136
+ priority={index < 3 ? 'high' : 'low'}
137
+ />
138
+ ```
139
+
140
+ - **Resize server-side**: Don't download 4MB for 100dp thumb
141
+ - **WebP/AVIF**: 30-50% smaller than JPEG/PNG
142
+ - **Progressive JPEG**: Perceived speed
143
+ - **Cache**: `expo-file-system` + `expo-image` handles automatically
144
+
145
+ ## Bundle Analysis
146
+
147
+ ```bash
148
+ # Expo
149
+ npx expo bundle --platform ios --dev false --output bundle.js --analyze
150
+
151
+ # Visualize
152
+ npx react-native-bundle-visualizer
153
+
154
+ # Output: bundle-report.html
155
+ # Look for:
156
+ # - Duplicate dependencies
157
+ # - Large libs (moment → date-fns, lodash → es-toolkit)
158
+ # - Unused code (tree shaking)
159
+ ```
160
+
161
+ ### Common Bundle Bloat
162
+ | Library | Alternative | Savings |
163
+ |---------|-------------|---------|
164
+ | `moment` | `date-fns` / `dayjs` | ~60KB → ~5KB |
165
+ | `lodash` | `es-toolkit` / native | ~70KB → ~10KB |
166
+ | `axios` | `fetch` / `ky` | ~13KB → ~1KB |
167
+ | `react-icons` | `@expo/vector-icons` | Tree-shaken |
168
+ | Full `react-native` | Expo SDK (tree-shaken) | Auto |
169
+
170
+ ## Memory Leaks
171
+
172
+ ### Common Sources
173
+ - Unsubscribed listeners (`useEffect` cleanup)
174
+ - Unclosed timers/intervals
175
+ - Cached images not released
176
+ - Navigation stack holding refs
177
+ - Event emitters not removed
178
+
179
+ ### Detection
180
+ ```tsx
181
+ // Dev-only leak detection
182
+ if (__DEV__) {
183
+ whyDidYouRender(Component, { trackAllPureComponents: true });
184
+ }
185
+
186
+ // Memory snapshot comparison
187
+ // Xcode: Debug → Memory Graph → Leaks
188
+ // Android: Profiler → Heap Dump → Compare
189
+ ```
190
+
191
+ ## CI Performance Gates
192
+
193
+ ```yaml
194
+ # .github/workflows/performance.yml
195
+ jobs:
196
+ perf:
197
+ runs-on: macos-latest
198
+ steps:
199
+ - uses: actions/checkout@v4
200
+ - run: npm ci
201
+ - run: npm run build:ios -- --configuration Release
202
+ - name: Run performance tests
203
+ run: |
204
+ xcodebuild test-without-building \
205
+ -scheme MyApp \
206
+ -destination 'platform=iOS Simulator,name=iPhone 15' \
207
+ -only-testing:MyAppUITests/PerformanceTests
208
+ - name: Check budgets
209
+ run: |
210
+ npx perf-budgets-check --config perf-budgets.json
211
+ ```
212
+
213
+ ```json
214
+ // perf-budgets.json
215
+ {
216
+ "coldStart": { "max": 2000, "unit": "ms" },
217
+ "bundleSize": { "max": 200, "unit": "kb" },
218
+ "frameTime": { "max": 16.67, "unit": "ms", "percentile": 99 },
219
+ "memory": { "max": 150, "unit": "mb" }
220
+ }
221
+ ```
222
+
223
+ ## Device Testing Matrix
224
+
225
+ | Tier | Devices | Purpose |
226
+ |------|---------|---------|
227
+ | High-end | iPhone 15 Pro, Pixel 8 Pro | Baseline, 120fps |
228
+ | Mid-range | iPhone 14, Pixel 7a | Typical user |
229
+ | Low-end | iPhone SE (3rd), Galaxy A14 | Stress test |
230
+ | Old OS | iOS 16, Android 12 | Compatibility |
231
+
232
+ ## Monitoring (Production)
233
+
234
+ - **Sentry / Bugsnag**: JS errors, native crashes, ANRs
235
+ - **Firebase Performance**: App start, screen render, network
236
+ - **React Native Performance**: Custom marks/measures
237
+ - **Custom events**: `track('screen_load', { duration, route })`
238
+
239
+ ## Optimization Checklist
240
+
241
+ - [ ] Cold start < 2s on mid-range device
242
+ - [ ] Bundle < 200KB gzipped
243
+ - [ ] 60fps scroll on 100-item list
244
+ - [ ] No memory leaks in 10-min session
245
+ - [ ] Images: correct size, WebP, cached
246
+ - [ ] Code splitting on non-critical routes
247
+ - [ ] Hermes enabled + bytecode compiled
248
+ - [ ] `why-did-you-render` clean in dev
249
+ - [ ] CI gates: budgets enforced
250
+ - [ ] Production monitoring: p95 metrics alerting