@zimezone/z-command 1.1.1 → 1.1.2

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 (282) hide show
  1. package/README.md +13 -1
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +34 -9
  4. package/dist/commands/init.js.map +1 -1
  5. package/package.json +8 -3
  6. package/templates.zip +0 -0
  7. package/templates/agents/accessibility-expert.agent.md +0 -56
  8. package/templates/agents/ai-engineer.agent.md +0 -61
  9. package/templates/agents/angular-architect.agent.md +0 -49
  10. package/templates/agents/api-designer.agent.md +0 -40
  11. package/templates/agents/api-documenter.agent.md +0 -161
  12. package/templates/agents/architect-review.agent.md +0 -146
  13. package/templates/agents/arm-cortex-expert.agent.md +0 -288
  14. package/templates/agents/azure-infra-engineer.agent.md +0 -57
  15. package/templates/agents/backend-architect.agent.md +0 -309
  16. package/templates/agents/backend-developer.agent.md +0 -61
  17. package/templates/agents/backend-security-coder.agent.md +0 -152
  18. package/templates/agents/bash-pro.agent.md +0 -285
  19. package/templates/agents/blockchain-developer.agent.md +0 -57
  20. package/templates/agents/build-engineer.agent.md +0 -56
  21. package/templates/agents/business-analyst.agent.md +0 -47
  22. package/templates/agents/c-pro.agent.md +0 -35
  23. package/templates/agents/c4-code.agent.md +0 -320
  24. package/templates/agents/c4-component.agent.md +0 -227
  25. package/templates/agents/c4-container.agent.md +0 -248
  26. package/templates/agents/c4-context.agent.md +0 -235
  27. package/templates/agents/cli-developer.agent.md +0 -57
  28. package/templates/agents/cloud-architect.agent.md +0 -56
  29. package/templates/agents/code-architect.agent.md +0 -63
  30. package/templates/agents/code-reviewer.agent.md +0 -49
  31. package/templates/agents/competitive-analyst.agent.md +0 -48
  32. package/templates/agents/conductor-validator.agent.md +0 -245
  33. package/templates/agents/context-manager.agent.md +0 -55
  34. package/templates/agents/cpp-pro.agent.md +0 -59
  35. package/templates/agents/csharp-developer.agent.md +0 -57
  36. package/templates/agents/csharp-pro.agent.md +0 -38
  37. package/templates/agents/customer-support.agent.md +0 -148
  38. package/templates/agents/data-engineer.agent.md +0 -55
  39. package/templates/agents/data-researcher.agent.md +0 -55
  40. package/templates/agents/data-scientist.agent.md +0 -56
  41. package/templates/agents/database-admin.agent.md +0 -142
  42. package/templates/agents/database-administrator.agent.md +0 -50
  43. package/templates/agents/database-architect.agent.md +0 -238
  44. package/templates/agents/database-optimizer.agent.md +0 -144
  45. package/templates/agents/debugger.agent.md +0 -30
  46. package/templates/agents/deployment-engineer.agent.md +0 -0
  47. package/templates/agents/devops-engineer.agent.md +0 -59
  48. package/templates/agents/devops-troubleshooter.agent.md +0 -138
  49. package/templates/agents/django-developer.agent.md +0 -50
  50. package/templates/agents/django-pro.agent.md +0 -159
  51. package/templates/agents/docs-architect.agent.md +0 -77
  52. package/templates/agents/documentation-engineer.agent.md +0 -57
  53. package/templates/agents/dotnet-architect.agent.md +0 -175
  54. package/templates/agents/dx-optimizer.agent.md +0 -63
  55. package/templates/agents/electron-pro.agent.md +0 -56
  56. package/templates/agents/elixir-pro.agent.md +0 -38
  57. package/templates/agents/embedded-systems.agent.md +0 -55
  58. package/templates/agents/error-detective.agent.md +0 -32
  59. package/templates/agents/event-sourcing-architect.agent.md +0 -42
  60. package/templates/agents/fastapi-pro.agent.md +0 -171
  61. package/templates/agents/fintech-engineer.agent.md +0 -57
  62. package/templates/agents/firmware-analyst.agent.md +0 -330
  63. package/templates/agents/flutter-expert.agent.md +0 -50
  64. package/templates/agents/frontend-developer.agent.md +0 -59
  65. package/templates/agents/frontend-security-coder.agent.md +0 -149
  66. package/templates/agents/fullstack-developer.agent.md +0 -46
  67. package/templates/agents/git-workflow-manager.agent.md +0 -57
  68. package/templates/agents/golang-pro.agent.md +0 -50
  69. package/templates/agents/graphql-architect.agent.md +0 -48
  70. package/templates/agents/haskell-pro.agent.md +0 -37
  71. package/templates/agents/hr-pro.agent.md +0 -105
  72. package/templates/agents/incident-responder.agent.md +0 -190
  73. package/templates/agents/ios-developer.agent.md +0 -198
  74. package/templates/agents/iot-engineer.agent.md +0 -56
  75. package/templates/agents/java-architect.agent.md +0 -48
  76. package/templates/agents/java-pro.agent.md +0 -156
  77. package/templates/agents/javascript-pro.agent.md +0 -35
  78. package/templates/agents/julia-pro.agent.md +0 -187
  79. package/templates/agents/kotlin-specialist.agent.md +0 -50
  80. package/templates/agents/laravel-specialist.agent.md +0 -50
  81. package/templates/agents/legacy-modernizer.agent.md +0 -56
  82. package/templates/agents/legal-advisor.agent.md +0 -49
  83. package/templates/agents/llm-architect.agent.md +0 -58
  84. package/templates/agents/malware-analyst.agent.md +0 -272
  85. package/templates/agents/mcp-developer.agent.md +0 -54
  86. package/templates/agents/mermaid-expert.agent.md +0 -39
  87. package/templates/agents/microservices-architect.agent.md +0 -47
  88. package/templates/agents/minecraft-bukkit-pro.agent.md +0 -104
  89. package/templates/agents/ml-engineer.agent.md +0 -56
  90. package/templates/agents/mlops-engineer.agent.md +0 -56
  91. package/templates/agents/mobile-developer.agent.md +0 -45
  92. package/templates/agents/mobile-security-coder.agent.md +0 -163
  93. package/templates/agents/monorepo-architect.agent.md +0 -44
  94. package/templates/agents/multi-agent-coordinator.agent.md +0 -55
  95. package/templates/agents/network-engineer.agent.md +0 -57
  96. package/templates/agents/nextjs-developer.agent.md +0 -48
  97. package/templates/agents/nlp-engineer.agent.md +0 -58
  98. package/templates/agents/observability-engineer.agent.md +0 -228
  99. package/templates/agents/payment-integration.agent.md +0 -56
  100. package/templates/agents/performance-engineer.agent.md +0 -167
  101. package/templates/agents/performance-optimizer.agent.md +0 -57
  102. package/templates/agents/php-pro.agent.md +0 -43
  103. package/templates/agents/platform-engineer.agent.md +0 -57
  104. package/templates/agents/posix-shell-pro.agent.md +0 -284
  105. package/templates/agents/postgres-pro.agent.md +0 -58
  106. package/templates/agents/product-manager.agent.md +0 -55
  107. package/templates/agents/project-manager.agent.md +0 -57
  108. package/templates/agents/prompt-engineer.agent.md +0 -58
  109. package/templates/agents/python-pro.agent.md +0 -48
  110. package/templates/agents/quant-analyst.agent.md +0 -32
  111. package/templates/agents/rails-expert.agent.md +0 -50
  112. package/templates/agents/react-specialist.agent.md +0 -49
  113. package/templates/agents/refactoring-specialist.agent.md +0 -56
  114. package/templates/agents/reference-builder.agent.md +0 -167
  115. package/templates/agents/research-analyst.agent.md +0 -63
  116. package/templates/agents/reverse-engineer.agent.md +0 -202
  117. package/templates/agents/risk-manager.agent.md +0 -41
  118. package/templates/agents/ruby-pro.agent.md +0 -35
  119. package/templates/agents/rust-pro.agent.md +0 -156
  120. package/templates/agents/sales-automator.agent.md +0 -35
  121. package/templates/agents/scala-pro.agent.md +0 -60
  122. package/templates/agents/scrum-master.agent.md +0 -54
  123. package/templates/agents/search-specialist.agent.md +0 -59
  124. package/templates/agents/security-analyst.agent.md +0 -57
  125. package/templates/agents/security-auditor.agent.md +0 -138
  126. package/templates/agents/security-engineer.agent.md +0 -57
  127. package/templates/agents/seo-authority-builder.agent.md +0 -116
  128. package/templates/agents/seo-cannibalization-detector.agent.md +0 -103
  129. package/templates/agents/seo-content-auditor.agent.md +0 -63
  130. package/templates/agents/seo-content-planner.agent.md +0 -88
  131. package/templates/agents/seo-content-refresher.agent.md +0 -98
  132. package/templates/agents/seo-content-writer.agent.md +0 -76
  133. package/templates/agents/seo-keyword-strategist.agent.md +0 -75
  134. package/templates/agents/seo-meta-optimizer.agent.md +0 -72
  135. package/templates/agents/seo-snippet-hunter.agent.md +0 -94
  136. package/templates/agents/seo-specialist.agent.md +0 -57
  137. package/templates/agents/seo-structure-architect.agent.md +0 -88
  138. package/templates/agents/service-mesh-expert.agent.md +0 -41
  139. package/templates/agents/sql-pro.agent.md +0 -146
  140. package/templates/agents/sre-engineer.agent.md +0 -58
  141. package/templates/agents/swift-expert.agent.md +0 -49
  142. package/templates/agents/task-distributor.agent.md +0 -47
  143. package/templates/agents/tdd-orchestrator.agent.md +0 -183
  144. package/templates/agents/technical-writer.agent.md +0 -48
  145. package/templates/agents/temporal-python-pro.agent.md +0 -349
  146. package/templates/agents/terraform-engineer.agent.md +0 -57
  147. package/templates/agents/terraform-specialist.agent.md +0 -137
  148. package/templates/agents/test-automator.agent.md +0 -203
  149. package/templates/agents/test-engineer.agent.md +0 -55
  150. package/templates/agents/threat-modeling-expert.agent.md +0 -44
  151. package/templates/agents/trend-analyst.agent.md +0 -47
  152. package/templates/agents/tutorial-engineer.agent.md +0 -118
  153. package/templates/agents/typescript-pro.agent.md +0 -48
  154. package/templates/agents/ui-designer.agent.md +0 -48
  155. package/templates/agents/ui-ux-designer.agent.md +0 -188
  156. package/templates/agents/ui-visual-validator.agent.md +0 -192
  157. package/templates/agents/ux-researcher.agent.md +0 -48
  158. package/templates/agents/vector-database-engineer.agent.md +0 -43
  159. package/templates/agents/vue-expert.agent.md +0 -48
  160. package/templates/agents/websocket-engineer.agent.md +0 -49
  161. package/templates/agents/workflow-orchestrator.agent.md +0 -48
  162. package/templates/skills/angular-migration/SKILL.md +0 -410
  163. package/templates/skills/api-design-principles/SKILL.md +0 -528
  164. package/templates/skills/api-design-principles/assets/api-design-checklist.md +0 -155
  165. package/templates/skills/api-design-principles/assets/rest-api-template.py +0 -182
  166. package/templates/skills/api-design-principles/references/graphql-schema-design.md +0 -583
  167. package/templates/skills/api-design-principles/references/rest-best-practices.md +0 -408
  168. package/templates/skills/architecture-decision-records/SKILL.md +0 -428
  169. package/templates/skills/architecture-patterns/SKILL.md +0 -494
  170. package/templates/skills/async-python-patterns/SKILL.md +0 -694
  171. package/templates/skills/auth-implementation-patterns/SKILL.md +0 -634
  172. package/templates/skills/changelog-automation/SKILL.md +0 -552
  173. package/templates/skills/code-review/SKILL.md +0 -62
  174. package/templates/skills/code-review-excellence/SKILL.md +0 -520
  175. package/templates/skills/competitive-landscape/SKILL.md +0 -479
  176. package/templates/skills/context-driven-development/SKILL.md +0 -385
  177. package/templates/skills/cost-optimization/SKILL.md +0 -274
  178. package/templates/skills/cqrs-implementation/SKILL.md +0 -554
  179. package/templates/skills/data-quality-frameworks/SKILL.md +0 -587
  180. package/templates/skills/data-storytelling/SKILL.md +0 -453
  181. package/templates/skills/database-migration/SKILL.md +0 -424
  182. package/templates/skills/dbt-transformation-patterns/SKILL.md +0 -561
  183. package/templates/skills/debugging-strategies/SKILL.md +0 -527
  184. package/templates/skills/defi-protocol-templates/SKILL.md +0 -454
  185. package/templates/skills/dependency-upgrade/SKILL.md +0 -409
  186. package/templates/skills/deployment-pipeline-design/SKILL.md +0 -359
  187. package/templates/skills/distributed-tracing/SKILL.md +0 -438
  188. package/templates/skills/dotnet-backend-patterns/SKILL.md +0 -815
  189. package/templates/skills/dotnet-backend-patterns/assets/repository-template.cs +0 -523
  190. package/templates/skills/dotnet-backend-patterns/assets/service-template.cs +0 -336
  191. package/templates/skills/dotnet-backend-patterns/references/dapper-patterns.md +0 -544
  192. package/templates/skills/dotnet-backend-patterns/references/ef-core-best-practices.md +0 -355
  193. package/templates/skills/e2e-testing-patterns/SKILL.md +0 -547
  194. package/templates/skills/employment-contract-templates/SKILL.md +0 -507
  195. package/templates/skills/error-handling-patterns/SKILL.md +0 -636
  196. package/templates/skills/event-store-design/SKILL.md +0 -437
  197. package/templates/skills/fastapi-templates/SKILL.md +0 -567
  198. package/templates/skills/git-advanced-workflows/SKILL.md +0 -400
  199. package/templates/skills/github-actions-templates/SKILL.md +0 -333
  200. package/templates/skills/go-concurrency-patterns/SKILL.md +0 -655
  201. package/templates/skills/grafana-dashboards/SKILL.md +0 -369
  202. package/templates/skills/helm-chart-scaffolding/SKILL.md +0 -544
  203. package/templates/skills/helm-chart-scaffolding/assets/Chart.yaml.template +0 -42
  204. package/templates/skills/helm-chart-scaffolding/assets/values.yaml.template +0 -185
  205. package/templates/skills/helm-chart-scaffolding/references/chart-structure.md +0 -500
  206. package/templates/skills/helm-chart-scaffolding/scripts/validate-chart.sh +0 -244
  207. package/templates/skills/javascript-testing-patterns/SKILL.md +0 -1025
  208. package/templates/skills/langchain-architecture/SKILL.md +0 -338
  209. package/templates/skills/llm-evaluation/SKILL.md +0 -471
  210. package/templates/skills/microservices-patterns/SKILL.md +0 -595
  211. package/templates/skills/modern-javascript-patterns/SKILL.md +0 -911
  212. package/templates/skills/monorepo-management/SKILL.md +0 -622
  213. package/templates/skills/nextjs-app-router-patterns/SKILL.md +0 -544
  214. package/templates/skills/nodejs-backend-patterns/SKILL.md +0 -1020
  215. package/templates/skills/nx-workspace-patterns/SKILL.md +0 -452
  216. package/templates/skills/openapi-spec-generation/SKILL.md +0 -1028
  217. package/templates/skills/paypal-integration/SKILL.md +0 -467
  218. package/templates/skills/pci-compliance/SKILL.md +0 -466
  219. package/templates/skills/postgresql/SKILL.md +0 -204
  220. package/templates/skills/projection-patterns/SKILL.md +0 -490
  221. package/templates/skills/prometheus-configuration/SKILL.md +0 -392
  222. package/templates/skills/prompt-engineering-patterns/SKILL.md +0 -201
  223. package/templates/skills/prompt-engineering-patterns/assets/few-shot-examples.json +0 -106
  224. package/templates/skills/prompt-engineering-patterns/assets/prompt-template-library.md +0 -246
  225. package/templates/skills/prompt-engineering-patterns/references/chain-of-thought.md +0 -399
  226. package/templates/skills/prompt-engineering-patterns/references/few-shot-learning.md +0 -369
  227. package/templates/skills/prompt-engineering-patterns/references/prompt-optimization.md +0 -414
  228. package/templates/skills/prompt-engineering-patterns/references/prompt-templates.md +0 -470
  229. package/templates/skills/prompt-engineering-patterns/references/system-prompts.md +0 -189
  230. package/templates/skills/prompt-engineering-patterns/scripts/optimize-prompt.py +0 -279
  231. package/templates/skills/python-packaging/SKILL.md +0 -870
  232. package/templates/skills/python-performance-optimization/SKILL.md +0 -869
  233. package/templates/skills/python-testing-patterns/SKILL.md +0 -907
  234. package/templates/skills/rag-implementation/SKILL.md +0 -403
  235. package/templates/skills/react-modernization/SKILL.md +0 -513
  236. package/templates/skills/react-native-architecture/SKILL.md +0 -671
  237. package/templates/skills/react-state-management/SKILL.md +0 -429
  238. package/templates/skills/risk-metrics-calculation/SKILL.md +0 -555
  239. package/templates/skills/rust-async-patterns/SKILL.md +0 -517
  240. package/templates/skills/secrets-management/SKILL.md +0 -346
  241. package/templates/skills/security-requirement-extraction/SKILL.md +0 -677
  242. package/templates/skills/security-review/SKILL.md +0 -78
  243. package/templates/skills/shellcheck-configuration/SKILL.md +0 -454
  244. package/templates/skills/similarity-search-patterns/SKILL.md +0 -558
  245. package/templates/skills/slo-implementation/SKILL.md +0 -329
  246. package/templates/skills/sql-optimization-patterns/SKILL.md +0 -493
  247. package/templates/skills/stripe-integration/SKILL.md +0 -442
  248. package/templates/skills/systematic-debugging/SKILL.md +0 -57
  249. package/templates/skills/tailwind-design-system/SKILL.md +0 -666
  250. package/templates/skills/temporal-python-testing/SKILL.md +0 -158
  251. package/templates/skills/temporal-python-testing/resources/integration-testing.md +0 -455
  252. package/templates/skills/temporal-python-testing/resources/local-setup.md +0 -553
  253. package/templates/skills/temporal-python-testing/resources/replay-testing.md +0 -462
  254. package/templates/skills/temporal-python-testing/resources/unit-testing.md +0 -328
  255. package/templates/skills/terraform-module-library/SKILL.md +0 -249
  256. package/templates/skills/terraform-module-library/references/aws-modules.md +0 -63
  257. package/templates/skills/test-driven-development/SKILL.md +0 -46
  258. package/templates/skills/threat-mitigation-mapping/SKILL.md +0 -745
  259. package/templates/skills/track-management/SKILL.md +0 -593
  260. package/templates/skills/typescript-advanced-types/SKILL.md +0 -717
  261. package/templates/skills/ui-ux-pro-max/SKILL.md +0 -352
  262. package/templates/skills/ui-ux-pro-max/data/charts.csv +0 -26
  263. package/templates/skills/ui-ux-pro-max/data/colors.csv +0 -97
  264. package/templates/skills/ui-ux-pro-max/data/icons.csv +0 -101
  265. package/templates/skills/ui-ux-pro-max/data/landing.csv +0 -31
  266. package/templates/skills/ui-ux-pro-max/data/products.csv +0 -97
  267. package/templates/skills/ui-ux-pro-max/data/prompts.csv +0 -24
  268. package/templates/skills/ui-ux-pro-max/data/react-performance.csv +0 -45
  269. package/templates/skills/ui-ux-pro-max/data/styles.csv +0 -59
  270. package/templates/skills/ui-ux-pro-max/data/typography.csv +0 -58
  271. package/templates/skills/ui-ux-pro-max/data/ui-reasoning.csv +0 -101
  272. package/templates/skills/ui-ux-pro-max/data/ux-guidelines.csv +0 -100
  273. package/templates/skills/ui-ux-pro-max/data/web-interface.csv +0 -31
  274. package/templates/skills/ui-ux-pro-max/scripts/core.py +0 -258
  275. package/templates/skills/ui-ux-pro-max/scripts/design_system.py +0 -547
  276. package/templates/skills/ui-ux-pro-max/scripts/search.py +0 -76
  277. package/templates/skills/uv-package-manager/SKILL.md +0 -831
  278. package/templates/skills/vector-index-tuning/SKILL.md +0 -521
  279. package/templates/skills/wcag-audit-patterns/SKILL.md +0 -555
  280. package/templates/skills/workflow-orchestration-patterns/SKILL.md +0 -316
  281. package/templates/skills/workflow-patterns/SKILL.md +0 -623
  282. package/templates/skills/writing-plans/SKILL.md +0 -64
@@ -1,671 +0,0 @@
1
- ---
2
- name: react-native-architecture
3
- description: Build production React Native apps with Expo, navigation, native modules, offline sync, and cross-platform patterns. Use when developing mobile apps, implementing native integrations, or architecting React Native projects.
4
- ---
5
-
6
- # React Native Architecture
7
-
8
- Production-ready patterns for React Native development with Expo, including navigation, state management, native modules, and offline-first architecture.
9
-
10
- ## When to Use This Skill
11
-
12
- - Starting a new React Native or Expo project
13
- - Implementing complex navigation patterns
14
- - Integrating native modules and platform APIs
15
- - Building offline-first mobile applications
16
- - Optimizing React Native performance
17
- - Setting up CI/CD for mobile releases
18
-
19
- ## Core Concepts
20
-
21
- ### 1. Project Structure
22
-
23
- ```
24
- src/
25
- ├── app/ # Expo Router screens
26
- │ ├── (auth)/ # Auth group
27
- │ ├── (tabs)/ # Tab navigation
28
- │ └── _layout.tsx # Root layout
29
- ├── components/
30
- │ ├── ui/ # Reusable UI components
31
- │ └── features/ # Feature-specific components
32
- ├── hooks/ # Custom hooks
33
- ├── services/ # API and native services
34
- ├── stores/ # State management
35
- ├── utils/ # Utilities
36
- └── types/ # TypeScript types
37
- ```
38
-
39
- ### 2. Expo vs Bare React Native
40
-
41
- | Feature | Expo | Bare RN |
42
- |---------|------|---------|
43
- | Setup complexity | Low | High |
44
- | Native modules | EAS Build | Manual linking |
45
- | OTA updates | Built-in | Manual setup |
46
- | Build service | EAS | Custom CI |
47
- | Custom native code | Config plugins | Direct access |
48
-
49
- ## Quick Start
50
-
51
- ```bash
52
- # Create new Expo project
53
- npx create-expo-app@latest my-app -t expo-template-blank-typescript
54
-
55
- # Install essential dependencies
56
- npx expo install expo-router expo-status-bar react-native-safe-area-context
57
- npx expo install @react-native-async-storage/async-storage
58
- npx expo install expo-secure-store expo-haptics
59
- ```
60
-
61
- ```typescript
62
- // app/_layout.tsx
63
- import { Stack } from 'expo-router'
64
- import { ThemeProvider } from '@/providers/ThemeProvider'
65
- import { QueryProvider } from '@/providers/QueryProvider'
66
-
67
- export default function RootLayout() {
68
- return (
69
- <QueryProvider>
70
- <ThemeProvider>
71
- <Stack screenOptions={{ headerShown: false }}>
72
- <Stack.Screen name="(tabs)" />
73
- <Stack.Screen name="(auth)" />
74
- <Stack.Screen name="modal" options={{ presentation: 'modal' }} />
75
- </Stack>
76
- </ThemeProvider>
77
- </QueryProvider>
78
- )
79
- }
80
- ```
81
-
82
- ## Patterns
83
-
84
- ### Pattern 1: Expo Router Navigation
85
-
86
- ```typescript
87
- // app/(tabs)/_layout.tsx
88
- import { Tabs } from 'expo-router'
89
- import { Home, Search, User, Settings } from 'lucide-react-native'
90
- import { useTheme } from '@/hooks/useTheme'
91
-
92
- export default function TabLayout() {
93
- const { colors } = useTheme()
94
-
95
- return (
96
- <Tabs
97
- screenOptions={{
98
- tabBarActiveTintColor: colors.primary,
99
- tabBarInactiveTintColor: colors.textMuted,
100
- tabBarStyle: { backgroundColor: colors.background },
101
- headerShown: false,
102
- }}
103
- >
104
- <Tabs.Screen
105
- name="index"
106
- options={{
107
- title: 'Home',
108
- tabBarIcon: ({ color, size }) => <Home size={size} color={color} />,
109
- }}
110
- />
111
- <Tabs.Screen
112
- name="search"
113
- options={{
114
- title: 'Search',
115
- tabBarIcon: ({ color, size }) => <Search size={size} color={color} />,
116
- }}
117
- />
118
- <Tabs.Screen
119
- name="profile"
120
- options={{
121
- title: 'Profile',
122
- tabBarIcon: ({ color, size }) => <User size={size} color={color} />,
123
- }}
124
- />
125
- <Tabs.Screen
126
- name="settings"
127
- options={{
128
- title: 'Settings',
129
- tabBarIcon: ({ color, size }) => <Settings size={size} color={color} />,
130
- }}
131
- />
132
- </Tabs>
133
- )
134
- }
135
-
136
- // app/(tabs)/profile/[id].tsx - Dynamic route
137
- import { useLocalSearchParams } from 'expo-router'
138
-
139
- export default function ProfileScreen() {
140
- const { id } = useLocalSearchParams<{ id: string }>()
141
-
142
- return <UserProfile userId={id} />
143
- }
144
-
145
- // Navigation from anywhere
146
- import { router } from 'expo-router'
147
-
148
- // Programmatic navigation
149
- router.push('/profile/123')
150
- router.replace('/login')
151
- router.back()
152
-
153
- // With params
154
- router.push({
155
- pathname: '/product/[id]',
156
- params: { id: '123', referrer: 'home' },
157
- })
158
- ```
159
-
160
- ### Pattern 2: Authentication Flow
161
-
162
- ```typescript
163
- // providers/AuthProvider.tsx
164
- import { createContext, useContext, useEffect, useState } from 'react'
165
- import { useRouter, useSegments } from 'expo-router'
166
- import * as SecureStore from 'expo-secure-store'
167
-
168
- interface AuthContextType {
169
- user: User | null
170
- isLoading: boolean
171
- signIn: (credentials: Credentials) => Promise<void>
172
- signOut: () => Promise<void>
173
- }
174
-
175
- const AuthContext = createContext<AuthContextType | null>(null)
176
-
177
- export function AuthProvider({ children }: { children: React.ReactNode }) {
178
- const [user, setUser] = useState<User | null>(null)
179
- const [isLoading, setIsLoading] = useState(true)
180
- const segments = useSegments()
181
- const router = useRouter()
182
-
183
- // Check authentication on mount
184
- useEffect(() => {
185
- checkAuth()
186
- }, [])
187
-
188
- // Protect routes
189
- useEffect(() => {
190
- if (isLoading) return
191
-
192
- const inAuthGroup = segments[0] === '(auth)'
193
-
194
- if (!user && !inAuthGroup) {
195
- router.replace('/login')
196
- } else if (user && inAuthGroup) {
197
- router.replace('/(tabs)')
198
- }
199
- }, [user, segments, isLoading])
200
-
201
- async function checkAuth() {
202
- try {
203
- const token = await SecureStore.getItemAsync('authToken')
204
- if (token) {
205
- const userData = await api.getUser(token)
206
- setUser(userData)
207
- }
208
- } catch (error) {
209
- await SecureStore.deleteItemAsync('authToken')
210
- } finally {
211
- setIsLoading(false)
212
- }
213
- }
214
-
215
- async function signIn(credentials: Credentials) {
216
- const { token, user } = await api.login(credentials)
217
- await SecureStore.setItemAsync('authToken', token)
218
- setUser(user)
219
- }
220
-
221
- async function signOut() {
222
- await SecureStore.deleteItemAsync('authToken')
223
- setUser(null)
224
- }
225
-
226
- if (isLoading) {
227
- return <SplashScreen />
228
- }
229
-
230
- return (
231
- <AuthContext.Provider value={{ user, isLoading, signIn, signOut }}>
232
- {children}
233
- </AuthContext.Provider>
234
- )
235
- }
236
-
237
- export const useAuth = () => {
238
- const context = useContext(AuthContext)
239
- if (!context) throw new Error('useAuth must be used within AuthProvider')
240
- return context
241
- }
242
- ```
243
-
244
- ### Pattern 3: Offline-First with React Query
245
-
246
- ```typescript
247
- // providers/QueryProvider.tsx
248
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
249
- import { createAsyncStoragePersister } from '@tanstack/query-async-storage-persister'
250
- import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client'
251
- import AsyncStorage from '@react-native-async-storage/async-storage'
252
- import NetInfo from '@react-native-community/netinfo'
253
- import { onlineManager } from '@tanstack/react-query'
254
-
255
- // Sync online status
256
- onlineManager.setEventListener((setOnline) => {
257
- return NetInfo.addEventListener((state) => {
258
- setOnline(!!state.isConnected)
259
- })
260
- })
261
-
262
- const queryClient = new QueryClient({
263
- defaultOptions: {
264
- queries: {
265
- gcTime: 1000 * 60 * 60 * 24, // 24 hours
266
- staleTime: 1000 * 60 * 5, // 5 minutes
267
- retry: 2,
268
- networkMode: 'offlineFirst',
269
- },
270
- mutations: {
271
- networkMode: 'offlineFirst',
272
- },
273
- },
274
- })
275
-
276
- const asyncStoragePersister = createAsyncStoragePersister({
277
- storage: AsyncStorage,
278
- key: 'REACT_QUERY_OFFLINE_CACHE',
279
- })
280
-
281
- export function QueryProvider({ children }: { children: React.ReactNode }) {
282
- return (
283
- <PersistQueryClientProvider
284
- client={queryClient}
285
- persistOptions={{ persister: asyncStoragePersister }}
286
- >
287
- {children}
288
- </PersistQueryClientProvider>
289
- )
290
- }
291
-
292
- // hooks/useProducts.ts
293
- import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
294
-
295
- export function useProducts() {
296
- return useQuery({
297
- queryKey: ['products'],
298
- queryFn: api.getProducts,
299
- // Use stale data while revalidating
300
- placeholderData: (previousData) => previousData,
301
- })
302
- }
303
-
304
- export function useCreateProduct() {
305
- const queryClient = useQueryClient()
306
-
307
- return useMutation({
308
- mutationFn: api.createProduct,
309
- // Optimistic update
310
- onMutate: async (newProduct) => {
311
- await queryClient.cancelQueries({ queryKey: ['products'] })
312
- const previous = queryClient.getQueryData(['products'])
313
-
314
- queryClient.setQueryData(['products'], (old: Product[]) => [
315
- ...old,
316
- { ...newProduct, id: 'temp-' + Date.now() },
317
- ])
318
-
319
- return { previous }
320
- },
321
- onError: (err, newProduct, context) => {
322
- queryClient.setQueryData(['products'], context?.previous)
323
- },
324
- onSettled: () => {
325
- queryClient.invalidateQueries({ queryKey: ['products'] })
326
- },
327
- })
328
- }
329
- ```
330
-
331
- ### Pattern 4: Native Module Integration
332
-
333
- ```typescript
334
- // services/haptics.ts
335
- import * as Haptics from 'expo-haptics'
336
- import { Platform } from 'react-native'
337
-
338
- export const haptics = {
339
- light: () => {
340
- if (Platform.OS !== 'web') {
341
- Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light)
342
- }
343
- },
344
- medium: () => {
345
- if (Platform.OS !== 'web') {
346
- Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium)
347
- }
348
- },
349
- heavy: () => {
350
- if (Platform.OS !== 'web') {
351
- Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy)
352
- }
353
- },
354
- success: () => {
355
- if (Platform.OS !== 'web') {
356
- Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success)
357
- }
358
- },
359
- error: () => {
360
- if (Platform.OS !== 'web') {
361
- Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error)
362
- }
363
- },
364
- }
365
-
366
- // services/biometrics.ts
367
- import * as LocalAuthentication from 'expo-local-authentication'
368
-
369
- export async function authenticateWithBiometrics(): Promise<boolean> {
370
- const hasHardware = await LocalAuthentication.hasHardwareAsync()
371
- if (!hasHardware) return false
372
-
373
- const isEnrolled = await LocalAuthentication.isEnrolledAsync()
374
- if (!isEnrolled) return false
375
-
376
- const result = await LocalAuthentication.authenticateAsync({
377
- promptMessage: 'Authenticate to continue',
378
- fallbackLabel: 'Use passcode',
379
- disableDeviceFallback: false,
380
- })
381
-
382
- return result.success
383
- }
384
-
385
- // services/notifications.ts
386
- import * as Notifications from 'expo-notifications'
387
- import { Platform } from 'react-native'
388
- import Constants from 'expo-constants'
389
-
390
- Notifications.setNotificationHandler({
391
- handleNotification: async () => ({
392
- shouldShowAlert: true,
393
- shouldPlaySound: true,
394
- shouldSetBadge: true,
395
- }),
396
- })
397
-
398
- export async function registerForPushNotifications() {
399
- let token: string | undefined
400
-
401
- if (Platform.OS === 'android') {
402
- await Notifications.setNotificationChannelAsync('default', {
403
- name: 'default',
404
- importance: Notifications.AndroidImportance.MAX,
405
- vibrationPattern: [0, 250, 250, 250],
406
- })
407
- }
408
-
409
- const { status: existingStatus } = await Notifications.getPermissionsAsync()
410
- let finalStatus = existingStatus
411
-
412
- if (existingStatus !== 'granted') {
413
- const { status } = await Notifications.requestPermissionsAsync()
414
- finalStatus = status
415
- }
416
-
417
- if (finalStatus !== 'granted') {
418
- return null
419
- }
420
-
421
- const projectId = Constants.expoConfig?.extra?.eas?.projectId
422
- token = (await Notifications.getExpoPushTokenAsync({ projectId })).data
423
-
424
- return token
425
- }
426
- ```
427
-
428
- ### Pattern 5: Platform-Specific Code
429
-
430
- ```typescript
431
- // components/ui/Button.tsx
432
- import { Platform, Pressable, StyleSheet, Text, ViewStyle } from 'react-native'
433
- import * as Haptics from 'expo-haptics'
434
- import Animated, {
435
- useAnimatedStyle,
436
- useSharedValue,
437
- withSpring,
438
- } from 'react-native-reanimated'
439
-
440
- const AnimatedPressable = Animated.createAnimatedComponent(Pressable)
441
-
442
- interface ButtonProps {
443
- title: string
444
- onPress: () => void
445
- variant?: 'primary' | 'secondary' | 'outline'
446
- disabled?: boolean
447
- }
448
-
449
- export function Button({
450
- title,
451
- onPress,
452
- variant = 'primary',
453
- disabled = false,
454
- }: ButtonProps) {
455
- const scale = useSharedValue(1)
456
-
457
- const animatedStyle = useAnimatedStyle(() => ({
458
- transform: [{ scale: scale.value }],
459
- }))
460
-
461
- const handlePressIn = () => {
462
- scale.value = withSpring(0.95)
463
- if (Platform.OS !== 'web') {
464
- Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light)
465
- }
466
- }
467
-
468
- const handlePressOut = () => {
469
- scale.value = withSpring(1)
470
- }
471
-
472
- return (
473
- <AnimatedPressable
474
- onPress={onPress}
475
- onPressIn={handlePressIn}
476
- onPressOut={handlePressOut}
477
- disabled={disabled}
478
- style={[
479
- styles.button,
480
- styles[variant],
481
- disabled && styles.disabled,
482
- animatedStyle,
483
- ]}
484
- >
485
- <Text style={[styles.text, styles[`${variant}Text`]]}>{title}</Text>
486
- </AnimatedPressable>
487
- )
488
- }
489
-
490
- // Platform-specific files
491
- // Button.ios.tsx - iOS-specific implementation
492
- // Button.android.tsx - Android-specific implementation
493
- // Button.web.tsx - Web-specific implementation
494
-
495
- // Or use Platform.select
496
- const styles = StyleSheet.create({
497
- button: {
498
- paddingVertical: 12,
499
- paddingHorizontal: 24,
500
- borderRadius: 8,
501
- alignItems: 'center',
502
- ...Platform.select({
503
- ios: {
504
- shadowColor: '#000',
505
- shadowOffset: { width: 0, height: 2 },
506
- shadowOpacity: 0.1,
507
- shadowRadius: 4,
508
- },
509
- android: {
510
- elevation: 4,
511
- },
512
- }),
513
- },
514
- primary: {
515
- backgroundColor: '#007AFF',
516
- },
517
- secondary: {
518
- backgroundColor: '#5856D6',
519
- },
520
- outline: {
521
- backgroundColor: 'transparent',
522
- borderWidth: 1,
523
- borderColor: '#007AFF',
524
- },
525
- disabled: {
526
- opacity: 0.5,
527
- },
528
- text: {
529
- fontSize: 16,
530
- fontWeight: '600',
531
- },
532
- primaryText: {
533
- color: '#FFFFFF',
534
- },
535
- secondaryText: {
536
- color: '#FFFFFF',
537
- },
538
- outlineText: {
539
- color: '#007AFF',
540
- },
541
- })
542
- ```
543
-
544
- ### Pattern 6: Performance Optimization
545
-
546
- ```typescript
547
- // components/ProductList.tsx
548
- import { FlashList } from '@shopify/flash-list'
549
- import { memo, useCallback } from 'react'
550
-
551
- interface ProductListProps {
552
- products: Product[]
553
- onProductPress: (id: string) => void
554
- }
555
-
556
- // Memoize list item
557
- const ProductItem = memo(function ProductItem({
558
- item,
559
- onPress,
560
- }: {
561
- item: Product
562
- onPress: (id: string) => void
563
- }) {
564
- const handlePress = useCallback(() => onPress(item.id), [item.id, onPress])
565
-
566
- return (
567
- <Pressable onPress={handlePress} style={styles.item}>
568
- <FastImage
569
- source={{ uri: item.image }}
570
- style={styles.image}
571
- resizeMode="cover"
572
- />
573
- <Text style={styles.title}>{item.name}</Text>
574
- <Text style={styles.price}>${item.price}</Text>
575
- </Pressable>
576
- )
577
- })
578
-
579
- export function ProductList({ products, onProductPress }: ProductListProps) {
580
- const renderItem = useCallback(
581
- ({ item }: { item: Product }) => (
582
- <ProductItem item={item} onPress={onProductPress} />
583
- ),
584
- [onProductPress]
585
- )
586
-
587
- const keyExtractor = useCallback((item: Product) => item.id, [])
588
-
589
- return (
590
- <FlashList
591
- data={products}
592
- renderItem={renderItem}
593
- keyExtractor={keyExtractor}
594
- estimatedItemSize={100}
595
- // Performance optimizations
596
- removeClippedSubviews={true}
597
- maxToRenderPerBatch={10}
598
- windowSize={5}
599
- // Pull to refresh
600
- onRefresh={onRefresh}
601
- refreshing={isRefreshing}
602
- />
603
- )
604
- }
605
- ```
606
-
607
- ## EAS Build & Submit
608
-
609
- ```json
610
- // eas.json
611
- {
612
- "cli": { "version": ">= 5.0.0" },
613
- "build": {
614
- "development": {
615
- "developmentClient": true,
616
- "distribution": "internal",
617
- "ios": { "simulator": true }
618
- },
619
- "preview": {
620
- "distribution": "internal",
621
- "android": { "buildType": "apk" }
622
- },
623
- "production": {
624
- "autoIncrement": true
625
- }
626
- },
627
- "submit": {
628
- "production": {
629
- "ios": { "appleId": "your@email.com", "ascAppId": "123456789" },
630
- "android": { "serviceAccountKeyPath": "./google-services.json" }
631
- }
632
- }
633
- }
634
- ```
635
-
636
- ```bash
637
- # Build commands
638
- eas build --platform ios --profile development
639
- eas build --platform android --profile preview
640
- eas build --platform all --profile production
641
-
642
- # Submit to stores
643
- eas submit --platform ios
644
- eas submit --platform android
645
-
646
- # OTA updates
647
- eas update --branch production --message "Bug fixes"
648
- ```
649
-
650
- ## Best Practices
651
-
652
- ### Do's
653
- - **Use Expo** - Faster development, OTA updates, managed native code
654
- - **FlashList over FlatList** - Better performance for long lists
655
- - **Memoize components** - Prevent unnecessary re-renders
656
- - **Use Reanimated** - 60fps animations on native thread
657
- - **Test on real devices** - Simulators miss real-world issues
658
-
659
- ### Don'ts
660
- - **Don't inline styles** - Use StyleSheet.create for performance
661
- - **Don't fetch in render** - Use useEffect or React Query
662
- - **Don't ignore platform differences** - Test on both iOS and Android
663
- - **Don't store secrets in code** - Use environment variables
664
- - **Don't skip error boundaries** - Mobile crashes are unforgiving
665
-
666
- ## Resources
667
-
668
- - [Expo Documentation](https://docs.expo.dev/)
669
- - [Expo Router](https://docs.expo.dev/router/introduction/)
670
- - [React Native Performance](https://reactnative.dev/docs/performance)
671
- - [FlashList](https://shopify.github.io/flash-list/)