@jakkrichm/create-nexus-devflow 2.0.0 → 2.0.1

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 (394) hide show
  1. package/README.md +96 -50
  2. package/package.json +1 -1
  3. package/template/.agents/skills/20-spec/SKILL.md +136 -136
  4. package/template/.agents/skills/30-plan/SKILL.md +206 -206
  5. package/template/.agents/skills/40-implement/SKILL.md +152 -152
  6. package/template/.agents/skills/50-verify/SKILL.md +174 -174
  7. package/template/.agents/skills/60-report/SKILL.md +168 -168
  8. package/template/.agents/skills/70-release/SKILL.md +141 -141
  9. package/template/.agents/skills/9arm-skills/README.md +51 -51
  10. package/template/.agents/skills/9arm-skills/debug-mantra/SKILL.md +86 -86
  11. package/template/.agents/skills/9arm-skills/management-talk/SKILL.md +79 -79
  12. package/template/.agents/skills/9arm-skills/post-mortem/SKILL.md +71 -71
  13. package/template/.agents/skills/9arm-skills/scrutinize/SKILL.md +72 -72
  14. package/template/.agents/skills/agent/SKILL.md +164 -164
  15. package/template/.agents/skills/api-and-interface-design/SKILL.md +294 -294
  16. package/template/.agents/skills/app-builder/SKILL.md +75 -75
  17. package/template/.agents/skills/app-builder/agent-coordination.md +71 -71
  18. package/template/.agents/skills/app-builder/feature-building.md +53 -53
  19. package/template/.agents/skills/app-builder/project-detection.md +34 -34
  20. package/template/.agents/skills/app-builder/scaffolding.md +118 -118
  21. package/template/.agents/skills/app-builder/tech-stack.md +40 -40
  22. package/template/.agents/skills/app-builder/templates/SKILL.md +39 -39
  23. package/template/.agents/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -76
  24. package/template/.agents/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -92
  25. package/template/.agents/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -88
  26. package/template/.agents/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -88
  27. package/template/.agents/skills/app-builder/templates/express-api/TEMPLATE.md +83 -83
  28. package/template/.agents/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -90
  29. package/template/.agents/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -90
  30. package/template/.agents/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -122
  31. package/template/.agents/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -122
  32. package/template/.agents/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -169
  33. package/template/.agents/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -134
  34. package/template/.agents/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -83
  35. package/template/.agents/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -119
  36. package/template/.agents/skills/architecture/SKILL.md +55 -55
  37. package/template/.agents/skills/architecture/context-discovery.md +43 -43
  38. package/template/.agents/skills/architecture/examples.md +94 -94
  39. package/template/.agents/skills/architecture/pattern-selection.md +68 -68
  40. package/template/.agents/skills/architecture/patterns-reference.md +50 -50
  41. package/template/.agents/skills/architecture/trade-off-analysis.md +77 -77
  42. package/template/.agents/skills/bash-linux/SKILL.md +199 -199
  43. package/template/.agents/skills/behavioral-modes/SKILL.md +242 -242
  44. package/template/.agents/skills/brainstorm/SKILL.md +157 -157
  45. package/template/.agents/skills/browser-testing-with-devtools/SKILL.md +302 -302
  46. package/template/.agents/skills/changelog/SKILL.md +108 -108
  47. package/template/.agents/skills/check-for-updates/SKILL.md +116 -116
  48. package/template/.agents/skills/ci-cd-and-automation/SKILL.md +390 -390
  49. package/template/.agents/skills/code-review-and-quality/SKILL.md +392 -392
  50. package/template/.agents/skills/code-simplification/SKILL.md +331 -331
  51. package/template/.agents/skills/commit/SKILL.md +62 -62
  52. package/template/.agents/skills/competitor-analysis/SKILL.md +66 -66
  53. package/template/.agents/skills/context-engineering/SKILL.md +290 -290
  54. package/template/.agents/skills/database-design/SKILL.md +52 -52
  55. package/template/.agents/skills/database-design/database-selection.md +43 -43
  56. package/template/.agents/skills/database-design/indexing.md +39 -39
  57. package/template/.agents/skills/database-design/migrations.md +48 -48
  58. package/template/.agents/skills/database-design/optimization.md +36 -36
  59. package/template/.agents/skills/database-design/orm-selection.md +30 -30
  60. package/template/.agents/skills/database-design/schema-design.md +56 -56
  61. package/template/.agents/skills/database-design/scripts/schema_validator.py +172 -172
  62. package/template/.agents/skills/debug/SKILL.md +116 -116
  63. package/template/.agents/skills/debugging-and-error-recovery/SKILL.md +298 -298
  64. package/template/.agents/skills/deploy/SKILL.md +90 -90
  65. package/template/.agents/skills/deployment-procedures/SKILL.md +241 -241
  66. package/template/.agents/skills/deprecation-and-migration/SKILL.md +206 -206
  67. package/template/.agents/skills/devflow-concept-intake/SKILL.md +150 -150
  68. package/template/.agents/skills/devflow-concept-intake/agents/openai.yaml +4 -4
  69. package/template/.agents/skills/devflow-concept-intake/references/adoption-proposal-template.md +60 -60
  70. package/template/.agents/skills/devflow-concept-intake/references/concept-report-template.md +47 -47
  71. package/template/.agents/skills/devflow-concept-intake/references/upstream-tracking-template.md +51 -51
  72. package/template/.agents/skills/devflow-wiki/SKILL.md +75 -75
  73. package/template/.agents/skills/documentation-and-adrs/SKILL.md +278 -278
  74. package/template/.agents/skills/english-to-thai-translator/SKILL.md +125 -125
  75. package/template/.agents/skills/followup/SKILL.md +78 -78
  76. package/template/.agents/skills/frontend-ui-engineering/SKILL.md +326 -326
  77. package/template/.agents/skills/frontend-ui-engineering/accessibility-checklist.md +159 -159
  78. package/template/.agents/skills/git-workflow-and-versioning/SKILL.md +300 -300
  79. package/template/.agents/skills/goal/SKILL.md +132 -132
  80. package/template/.agents/skills/help/SKILL.md +242 -242
  81. package/template/.agents/skills/human-review-decisions/SKILL.md +74 -74
  82. package/template/.agents/skills/i18n-localization/SKILL.md +154 -154
  83. package/template/.agents/skills/i18n-localization/scripts/i18n_checker.py +241 -241
  84. package/template/.agents/skills/idea-refine/SKILL.md +178 -178
  85. package/template/.agents/skills/idea-refine/examples.md +238 -238
  86. package/template/.agents/skills/idea-refine/frameworks.md +99 -99
  87. package/template/.agents/skills/idea-refine/refinement-criteria.md +113 -113
  88. package/template/.agents/skills/idea-refine/scripts/idea-refine.sh +15 -15
  89. package/template/.agents/skills/incremental-implementation/SKILL.md +248 -248
  90. package/template/.agents/skills/insight/SKILL.md +130 -130
  91. package/template/.agents/skills/insight-capture/SKILL.md +84 -84
  92. package/template/.agents/skills/intelligent-routing/SKILL.md +171 -171
  93. package/template/.agents/skills/issue-triage/SKILL.md +106 -106
  94. package/template/.agents/skills/lint-and-validate/SKILL.md +45 -45
  95. package/template/.agents/skills/lint-and-validate/scripts/lint_runner.py +184 -184
  96. package/template/.agents/skills/lint-and-validate/scripts/type_coverage.py +173 -173
  97. package/template/.agents/skills/mcp-builder/SKILL.md +176 -176
  98. package/template/.agents/skills/md2html/SKILL.md +154 -154
  99. package/template/.agents/skills/md2html/components.md +505 -505
  100. package/template/.agents/skills/md2html/template.html +1152 -1152
  101. package/template/.agents/skills/merge/SKILL.md +75 -75
  102. package/template/.agents/skills/mobile-design/SKILL.md +394 -394
  103. package/template/.agents/skills/mobile-design/decision-trees.md +516 -516
  104. package/template/.agents/skills/mobile-design/mobile-backend.md +491 -491
  105. package/template/.agents/skills/mobile-design/mobile-color-system.md +420 -420
  106. package/template/.agents/skills/mobile-design/mobile-debugging.md +122 -122
  107. package/template/.agents/skills/mobile-design/mobile-design-thinking.md +357 -357
  108. package/template/.agents/skills/mobile-design/mobile-navigation.md +458 -458
  109. package/template/.agents/skills/mobile-design/mobile-performance.md +767 -767
  110. package/template/.agents/skills/mobile-design/mobile-testing.md +356 -356
  111. package/template/.agents/skills/mobile-design/mobile-typography.md +433 -433
  112. package/template/.agents/skills/mobile-design/platform-android.md +666 -666
  113. package/template/.agents/skills/mobile-design/platform-ios.md +561 -561
  114. package/template/.agents/skills/mobile-design/scripts/mobile_audit.py +670 -670
  115. package/template/.agents/skills/mobile-design/touch-psychology.md +537 -537
  116. package/template/.agents/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +312 -312
  117. package/template/.agents/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -240
  118. package/template/.agents/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -490
  119. package/template/.agents/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -264
  120. package/template/.agents/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -581
  121. package/template/.agents/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -432
  122. package/template/.agents/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -684
  123. package/template/.agents/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -150
  124. package/template/.agents/skills/nextjs-react-expert/SKILL.md +286 -286
  125. package/template/.agents/skills/nextjs-react-expert/scripts/convert_rules.py +222 -222
  126. package/template/.agents/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -252
  127. package/template/.agents/skills/nodejs-best-practices/SKILL.md +333 -333
  128. package/template/.agents/skills/obsidian-bases/SKILL.md +506 -506
  129. package/template/.agents/skills/obsidian-bases/references/FUNCTIONS_REFERENCE.md +173 -173
  130. package/template/.agents/skills/obsidian-cli/SKILL.md +115 -115
  131. package/template/.agents/skills/obsidian-clipper-template-creator/SKILL.md +73 -73
  132. package/template/.agents/skills/obsidian-clipper-template-creator/assets/clipping-template.json +51 -51
  133. package/template/.agents/skills/obsidian-clipper-template-creator/assets/recipe-template.json +48 -48
  134. package/template/.agents/skills/obsidian-clipper-template-creator/references/analysis-workflow.md +79 -79
  135. package/template/.agents/skills/obsidian-clipper-template-creator/references/bases-workflow.md +44 -44
  136. package/template/.agents/skills/obsidian-clipper-template-creator/references/filters.md +51 -51
  137. package/template/.agents/skills/obsidian-clipper-template-creator/references/json-schema.md +77 -77
  138. package/template/.agents/skills/obsidian-clipper-template-creator/references/logic.md +67 -67
  139. package/template/.agents/skills/obsidian-clipper-template-creator/references/variables.md +64 -64
  140. package/template/.agents/skills/obsidian-markdown/SKILL.md +205 -205
  141. package/template/.agents/skills/obsidian-markdown/references/CALLOUTS.md +58 -58
  142. package/template/.agents/skills/obsidian-markdown/references/EMBEDS.md +63 -63
  143. package/template/.agents/skills/obsidian-markdown/references/PROPERTIES.md +61 -61
  144. package/template/.agents/skills/package-json-generator/SKILL.md +60 -60
  145. package/template/.agents/skills/package-json-generator/scripts/generate.js +120 -120
  146. package/template/.agents/skills/package-json-generator/scripts/run.sh +19 -19
  147. package/template/.agents/skills/parallel-agents/SKILL.md +144 -144
  148. package/template/.agents/skills/performance-optimization/SKILL.md +299 -299
  149. package/template/.agents/skills/performance-optimization/performance-checklist.md +113 -113
  150. package/template/.agents/skills/planning-and-task-breakdown/SKILL.md +239 -239
  151. package/template/.agents/skills/powershell-windows/SKILL.md +167 -167
  152. package/template/.agents/skills/pr/SKILL.md +92 -92
  153. package/template/.agents/skills/pr-review/SKILL.md +142 -142
  154. package/template/.agents/skills/pr-review-analysis/SKILL.md +89 -89
  155. package/template/.agents/skills/prd/SKILL.md +112 -112
  156. package/template/.agents/skills/preview/SKILL.md +116 -116
  157. package/template/.agents/skills/preview-local-check/SKILL.md +59 -59
  158. package/template/.agents/skills/prompt-addons/SKILL.md +99 -99
  159. package/template/.agents/skills/prp-dev-fastapi/SKILL.md +114 -114
  160. package/template/.agents/skills/prp-dev-multiplatform/SKILL.md +36 -36
  161. package/template/.agents/skills/prp-dev-odoo/SKILL.md +71 -71
  162. package/template/.agents/skills/prp-dev-php/SKILL.md +63 -63
  163. package/template/.agents/skills/prp-sa-ba/SKILL.md +52 -52
  164. package/template/.agents/skills/python-patterns/SKILL.md +441 -441
  165. package/template/.agents/skills/red-team-tactics/SKILL.md +199 -199
  166. package/template/.agents/skills/release-git-operations/SKILL.md +97 -97
  167. package/template/.agents/skills/research/SKILL.md +127 -127
  168. package/template/.agents/skills/review/SKILL.md +55 -55
  169. package/template/.agents/skills/review-followup-routing/SKILL.md +98 -98
  170. package/template/.agents/skills/roadmap-strategy/SKILL.md +97 -97
  171. package/template/.agents/skills/security-and-hardening/SKILL.md +349 -349
  172. package/template/.agents/skills/security-and-hardening/security-checklist.md +134 -134
  173. package/template/.agents/skills/security-review/SKILL.md +164 -164
  174. package/template/.agents/skills/seo-fundamentals/SKILL.md +129 -129
  175. package/template/.agents/skills/seo-fundamentals/scripts/seo_checker.py +219 -219
  176. package/template/.agents/skills/server-management/SKILL.md +161 -161
  177. package/template/.agents/skills/shipping-and-launch/SKILL.md +311 -311
  178. package/template/.agents/skills/silent-failure-audit/SKILL.md +73 -73
  179. package/template/.agents/skills/simplify/SKILL.md +74 -74
  180. package/template/.agents/skills/skill-development/SKILL.md +86 -86
  181. package/template/.agents/skills/spec-driven-development/SKILL.md +207 -207
  182. package/template/.agents/skills/spec-orchestration/SKILL.md +91 -91
  183. package/template/.agents/skills/specialist-agent-routing/SKILL.md +107 -107
  184. package/template/.agents/skills/tailwind-patterns/SKILL.md +269 -269
  185. package/template/.agents/skills/test/SKILL.md +77 -77
  186. package/template/.agents/skills/test-driven-development/SKILL.md +422 -422
  187. package/template/.agents/skills/test-driven-development/testing-patterns.md +236 -236
  188. package/template/.agents/skills/test-execution-and-coverage/SKILL.md +56 -56
  189. package/template/.agents/skills/type-design/SKILL.md +84 -84
  190. package/template/.agents/skills/ui-ux-pro-max/SKILL.md +75 -75
  191. package/template/.agents/skills/using-agent-skills/SKILL.md +171 -171
  192. package/template/.agents/skills/verification-orchestration/SKILL.md +68 -68
  193. package/template/.agents/skills/vulnerability-scanner/SKILL.md +276 -276
  194. package/template/.agents/skills/vulnerability-scanner/checklists.md +121 -121
  195. package/template/.agents/skills/vulnerability-scanner/scripts/security_scan.py +458 -458
  196. package/template/.agents/skills/wiki/SKILL.md +148 -148
  197. package/template/.agents/skills/workflow-documentation-sync/SKILL.md +87 -87
  198. package/template/.claude/skills/20-spec/SKILL.md +136 -136
  199. package/template/.claude/skills/30-plan/SKILL.md +206 -206
  200. package/template/.claude/skills/40-implement/SKILL.md +152 -152
  201. package/template/.claude/skills/50-verify/SKILL.md +174 -174
  202. package/template/.claude/skills/60-report/SKILL.md +168 -168
  203. package/template/.claude/skills/70-release/SKILL.md +141 -141
  204. package/template/.claude/skills/9arm-skills/README.md +51 -51
  205. package/template/.claude/skills/9arm-skills/debug-mantra/SKILL.md +86 -86
  206. package/template/.claude/skills/9arm-skills/management-talk/SKILL.md +79 -79
  207. package/template/.claude/skills/9arm-skills/post-mortem/SKILL.md +71 -71
  208. package/template/.claude/skills/9arm-skills/scrutinize/SKILL.md +72 -72
  209. package/template/.claude/skills/agent/SKILL.md +164 -164
  210. package/template/.claude/skills/api-and-interface-design/SKILL.md +294 -294
  211. package/template/.claude/skills/app-builder/SKILL.md +75 -75
  212. package/template/.claude/skills/app-builder/agent-coordination.md +71 -71
  213. package/template/.claude/skills/app-builder/feature-building.md +53 -53
  214. package/template/.claude/skills/app-builder/project-detection.md +34 -34
  215. package/template/.claude/skills/app-builder/scaffolding.md +118 -118
  216. package/template/.claude/skills/app-builder/tech-stack.md +40 -40
  217. package/template/.claude/skills/app-builder/templates/SKILL.md +39 -39
  218. package/template/.claude/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -76
  219. package/template/.claude/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -92
  220. package/template/.claude/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -88
  221. package/template/.claude/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -88
  222. package/template/.claude/skills/app-builder/templates/express-api/TEMPLATE.md +83 -83
  223. package/template/.claude/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -90
  224. package/template/.claude/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -90
  225. package/template/.claude/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -122
  226. package/template/.claude/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -122
  227. package/template/.claude/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -169
  228. package/template/.claude/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -134
  229. package/template/.claude/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -83
  230. package/template/.claude/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -119
  231. package/template/.claude/skills/architecture/SKILL.md +55 -55
  232. package/template/.claude/skills/architecture/context-discovery.md +43 -43
  233. package/template/.claude/skills/architecture/examples.md +94 -94
  234. package/template/.claude/skills/architecture/pattern-selection.md +68 -68
  235. package/template/.claude/skills/architecture/patterns-reference.md +50 -50
  236. package/template/.claude/skills/architecture/trade-off-analysis.md +77 -77
  237. package/template/.claude/skills/bash-linux/SKILL.md +199 -199
  238. package/template/.claude/skills/behavioral-modes/SKILL.md +242 -242
  239. package/template/.claude/skills/brainstorm/SKILL.md +157 -157
  240. package/template/.claude/skills/browser-testing-with-devtools/SKILL.md +302 -302
  241. package/template/.claude/skills/changelog/SKILL.md +108 -108
  242. package/template/.claude/skills/check-for-updates/SKILL.md +116 -116
  243. package/template/.claude/skills/ci-cd-and-automation/SKILL.md +390 -390
  244. package/template/.claude/skills/code-review-and-quality/SKILL.md +392 -392
  245. package/template/.claude/skills/code-simplification/SKILL.md +331 -331
  246. package/template/.claude/skills/commit/SKILL.md +62 -62
  247. package/template/.claude/skills/competitor-analysis/SKILL.md +66 -66
  248. package/template/.claude/skills/context-engineering/SKILL.md +290 -290
  249. package/template/.claude/skills/database-design/SKILL.md +52 -52
  250. package/template/.claude/skills/database-design/database-selection.md +43 -43
  251. package/template/.claude/skills/database-design/indexing.md +39 -39
  252. package/template/.claude/skills/database-design/migrations.md +48 -48
  253. package/template/.claude/skills/database-design/optimization.md +36 -36
  254. package/template/.claude/skills/database-design/orm-selection.md +30 -30
  255. package/template/.claude/skills/database-design/schema-design.md +56 -56
  256. package/template/.claude/skills/database-design/scripts/schema_validator.py +172 -172
  257. package/template/.claude/skills/debug/SKILL.md +116 -116
  258. package/template/.claude/skills/debugging-and-error-recovery/SKILL.md +298 -298
  259. package/template/.claude/skills/deploy/SKILL.md +90 -90
  260. package/template/.claude/skills/deployment-procedures/SKILL.md +241 -241
  261. package/template/.claude/skills/deprecation-and-migration/SKILL.md +206 -206
  262. package/template/.claude/skills/devflow-concept-intake/SKILL.md +150 -150
  263. package/template/.claude/skills/devflow-concept-intake/agents/openai.yaml +4 -4
  264. package/template/.claude/skills/devflow-concept-intake/references/adoption-proposal-template.md +60 -60
  265. package/template/.claude/skills/devflow-concept-intake/references/concept-report-template.md +47 -47
  266. package/template/.claude/skills/devflow-concept-intake/references/upstream-tracking-template.md +51 -51
  267. package/template/.claude/skills/devflow-wiki/SKILL.md +75 -75
  268. package/template/.claude/skills/documentation-and-adrs/SKILL.md +278 -278
  269. package/template/.claude/skills/english-to-thai-translator/SKILL.md +125 -125
  270. package/template/.claude/skills/followup/SKILL.md +78 -78
  271. package/template/.claude/skills/frontend-ui-engineering/SKILL.md +326 -326
  272. package/template/.claude/skills/frontend-ui-engineering/accessibility-checklist.md +159 -159
  273. package/template/.claude/skills/git-workflow-and-versioning/SKILL.md +300 -300
  274. package/template/.claude/skills/goal/SKILL.md +132 -132
  275. package/template/.claude/skills/help/SKILL.md +242 -242
  276. package/template/.claude/skills/human-review-decisions/SKILL.md +74 -74
  277. package/template/.claude/skills/i18n-localization/SKILL.md +154 -154
  278. package/template/.claude/skills/i18n-localization/scripts/i18n_checker.py +241 -241
  279. package/template/.claude/skills/idea-refine/SKILL.md +178 -178
  280. package/template/.claude/skills/idea-refine/examples.md +238 -238
  281. package/template/.claude/skills/idea-refine/frameworks.md +99 -99
  282. package/template/.claude/skills/idea-refine/refinement-criteria.md +113 -113
  283. package/template/.claude/skills/idea-refine/scripts/idea-refine.sh +15 -15
  284. package/template/.claude/skills/incremental-implementation/SKILL.md +248 -248
  285. package/template/.claude/skills/insight/SKILL.md +130 -130
  286. package/template/.claude/skills/insight-capture/SKILL.md +84 -84
  287. package/template/.claude/skills/intelligent-routing/SKILL.md +171 -171
  288. package/template/.claude/skills/issue-triage/SKILL.md +106 -106
  289. package/template/.claude/skills/lint-and-validate/SKILL.md +45 -45
  290. package/template/.claude/skills/lint-and-validate/scripts/lint_runner.py +184 -184
  291. package/template/.claude/skills/lint-and-validate/scripts/type_coverage.py +173 -173
  292. package/template/.claude/skills/mcp-builder/SKILL.md +176 -176
  293. package/template/.claude/skills/md2html/SKILL.md +154 -154
  294. package/template/.claude/skills/md2html/components.md +505 -505
  295. package/template/.claude/skills/md2html/template.html +1152 -1152
  296. package/template/.claude/skills/merge/SKILL.md +75 -75
  297. package/template/.claude/skills/mobile-design/SKILL.md +394 -394
  298. package/template/.claude/skills/mobile-design/decision-trees.md +516 -516
  299. package/template/.claude/skills/mobile-design/mobile-backend.md +491 -491
  300. package/template/.claude/skills/mobile-design/mobile-color-system.md +420 -420
  301. package/template/.claude/skills/mobile-design/mobile-debugging.md +122 -122
  302. package/template/.claude/skills/mobile-design/mobile-design-thinking.md +357 -357
  303. package/template/.claude/skills/mobile-design/mobile-navigation.md +458 -458
  304. package/template/.claude/skills/mobile-design/mobile-performance.md +767 -767
  305. package/template/.claude/skills/mobile-design/mobile-testing.md +356 -356
  306. package/template/.claude/skills/mobile-design/mobile-typography.md +433 -433
  307. package/template/.claude/skills/mobile-design/platform-android.md +666 -666
  308. package/template/.claude/skills/mobile-design/platform-ios.md +561 -561
  309. package/template/.claude/skills/mobile-design/scripts/mobile_audit.py +670 -670
  310. package/template/.claude/skills/mobile-design/touch-psychology.md +537 -537
  311. package/template/.claude/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +312 -312
  312. package/template/.claude/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -240
  313. package/template/.claude/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -490
  314. package/template/.claude/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -264
  315. package/template/.claude/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -581
  316. package/template/.claude/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -432
  317. package/template/.claude/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -684
  318. package/template/.claude/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -150
  319. package/template/.claude/skills/nextjs-react-expert/SKILL.md +286 -286
  320. package/template/.claude/skills/nextjs-react-expert/scripts/convert_rules.py +222 -222
  321. package/template/.claude/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -252
  322. package/template/.claude/skills/nodejs-best-practices/SKILL.md +333 -333
  323. package/template/.claude/skills/obsidian-bases/SKILL.md +506 -506
  324. package/template/.claude/skills/obsidian-bases/references/FUNCTIONS_REFERENCE.md +173 -173
  325. package/template/.claude/skills/obsidian-cli/SKILL.md +115 -115
  326. package/template/.claude/skills/obsidian-clipper-template-creator/SKILL.md +73 -73
  327. package/template/.claude/skills/obsidian-clipper-template-creator/assets/clipping-template.json +51 -51
  328. package/template/.claude/skills/obsidian-clipper-template-creator/assets/recipe-template.json +48 -48
  329. package/template/.claude/skills/obsidian-clipper-template-creator/references/analysis-workflow.md +79 -79
  330. package/template/.claude/skills/obsidian-clipper-template-creator/references/bases-workflow.md +44 -44
  331. package/template/.claude/skills/obsidian-clipper-template-creator/references/filters.md +51 -51
  332. package/template/.claude/skills/obsidian-clipper-template-creator/references/json-schema.md +77 -77
  333. package/template/.claude/skills/obsidian-clipper-template-creator/references/logic.md +67 -67
  334. package/template/.claude/skills/obsidian-clipper-template-creator/references/variables.md +64 -64
  335. package/template/.claude/skills/obsidian-markdown/SKILL.md +205 -205
  336. package/template/.claude/skills/obsidian-markdown/references/CALLOUTS.md +58 -58
  337. package/template/.claude/skills/obsidian-markdown/references/EMBEDS.md +63 -63
  338. package/template/.claude/skills/obsidian-markdown/references/PROPERTIES.md +61 -61
  339. package/template/.claude/skills/package-json-generator/SKILL.md +60 -60
  340. package/template/.claude/skills/package-json-generator/scripts/generate.js +120 -120
  341. package/template/.claude/skills/package-json-generator/scripts/run.sh +19 -19
  342. package/template/.claude/skills/parallel-agents/SKILL.md +144 -144
  343. package/template/.claude/skills/performance-optimization/SKILL.md +299 -299
  344. package/template/.claude/skills/performance-optimization/performance-checklist.md +113 -113
  345. package/template/.claude/skills/planning-and-task-breakdown/SKILL.md +239 -239
  346. package/template/.claude/skills/powershell-windows/SKILL.md +167 -167
  347. package/template/.claude/skills/pr/SKILL.md +92 -92
  348. package/template/.claude/skills/pr-review/SKILL.md +142 -142
  349. package/template/.claude/skills/pr-review-analysis/SKILL.md +89 -89
  350. package/template/.claude/skills/prd/SKILL.md +112 -112
  351. package/template/.claude/skills/preview/SKILL.md +116 -116
  352. package/template/.claude/skills/preview-local-check/SKILL.md +59 -59
  353. package/template/.claude/skills/prompt-addons/SKILL.md +99 -99
  354. package/template/.claude/skills/prp-dev-fastapi/SKILL.md +114 -114
  355. package/template/.claude/skills/prp-dev-multiplatform/SKILL.md +36 -36
  356. package/template/.claude/skills/prp-dev-odoo/SKILL.md +71 -71
  357. package/template/.claude/skills/prp-dev-php/SKILL.md +63 -63
  358. package/template/.claude/skills/prp-sa-ba/SKILL.md +52 -52
  359. package/template/.claude/skills/python-patterns/SKILL.md +441 -441
  360. package/template/.claude/skills/red-team-tactics/SKILL.md +199 -199
  361. package/template/.claude/skills/release-git-operations/SKILL.md +97 -97
  362. package/template/.claude/skills/research/SKILL.md +127 -127
  363. package/template/.claude/skills/review/SKILL.md +55 -55
  364. package/template/.claude/skills/review-followup-routing/SKILL.md +98 -98
  365. package/template/.claude/skills/roadmap-strategy/SKILL.md +97 -97
  366. package/template/.claude/skills/security-and-hardening/SKILL.md +349 -349
  367. package/template/.claude/skills/security-and-hardening/security-checklist.md +134 -134
  368. package/template/.claude/skills/security-review/SKILL.md +164 -164
  369. package/template/.claude/skills/seo-fundamentals/SKILL.md +129 -129
  370. package/template/.claude/skills/seo-fundamentals/scripts/seo_checker.py +219 -219
  371. package/template/.claude/skills/server-management/SKILL.md +161 -161
  372. package/template/.claude/skills/shipping-and-launch/SKILL.md +311 -311
  373. package/template/.claude/skills/silent-failure-audit/SKILL.md +73 -73
  374. package/template/.claude/skills/simplify/SKILL.md +74 -74
  375. package/template/.claude/skills/skill-development/SKILL.md +86 -86
  376. package/template/.claude/skills/spec-driven-development/SKILL.md +207 -207
  377. package/template/.claude/skills/spec-orchestration/SKILL.md +91 -91
  378. package/template/.claude/skills/specialist-agent-routing/SKILL.md +107 -107
  379. package/template/.claude/skills/tailwind-patterns/SKILL.md +269 -269
  380. package/template/.claude/skills/test/SKILL.md +77 -77
  381. package/template/.claude/skills/test-driven-development/SKILL.md +422 -422
  382. package/template/.claude/skills/test-driven-development/testing-patterns.md +236 -236
  383. package/template/.claude/skills/test-execution-and-coverage/SKILL.md +56 -56
  384. package/template/.claude/skills/type-design/SKILL.md +84 -84
  385. package/template/.claude/skills/ui-ux-pro-max/SKILL.md +75 -75
  386. package/template/.claude/skills/using-agent-skills/SKILL.md +171 -171
  387. package/template/.claude/skills/verification-orchestration/SKILL.md +68 -68
  388. package/template/.claude/skills/vulnerability-scanner/SKILL.md +276 -276
  389. package/template/.claude/skills/vulnerability-scanner/checklists.md +121 -121
  390. package/template/.claude/skills/vulnerability-scanner/scripts/security_scan.py +458 -458
  391. package/template/.claude/skills/wiki/SKILL.md +148 -148
  392. package/template/.claude/skills/workflow-documentation-sync/SKILL.md +87 -87
  393. package/template/.nexus/nexus-devflow.json +1 -1
  394. package/template/LICENSE +21 -21
@@ -1,767 +1,767 @@
1
- # Mobile Performance Reference
2
-
3
- > Deep dive into React Native and Flutter performance optimization, 60fps animations, memory management, and battery considerations.
4
- > **This file covers the #1 area where AI-generated code FAILS.**
5
-
6
- ---
7
-
8
- ## 1. The Mobile Performance Mindset
9
-
10
- ### Why Mobile Performance is Different
11
-
12
- ```
13
- DESKTOP: MOBILE:
14
- ├── Unlimited power ├── Battery matters
15
- ├── Abundant RAM ├── RAM is shared, limited
16
- ├── Stable network ├── Network is unreliable
17
- ├── CPU always available ├── CPU throttles when hot
18
- └── User expects fast anyway └── User expects INSTANT
19
- ```
20
-
21
- ### Performance Budget Concept
22
-
23
- ```
24
- Every frame must complete in:
25
- ├── 60fps → 16.67ms per frame
26
- ├── 120fps (ProMotion) → 8.33ms per frame
27
-
28
- If your code takes longer:
29
- ├── Frame drops → Janky scroll/animation
30
- ├── User perceives as "slow" or "broken"
31
- └── They WILL uninstall your app
32
- ```
33
-
34
- ---
35
-
36
- ## 2. React Native Performance
37
-
38
- ### 🚫 The #1 AI Mistake: ScrollView for Lists
39
-
40
- ```javascript
41
- // ❌ NEVER DO THIS - AI's favorite mistake
42
- <ScrollView>
43
- {items.map(item => (
44
- <ItemComponent key={item.id} item={item} />
45
- ))}
46
- </ScrollView>
47
-
48
- // Why it's catastrophic:
49
- // ├── Renders ALL items immediately (1000 items = 1000 renders)
50
- // ├── Memory explodes
51
- // ├── Initial render takes seconds
52
- // └── Scroll becomes janky
53
-
54
- // ✅ ALWAYS USE FlatList
55
- <FlatList
56
- data={items}
57
- renderItem={renderItem}
58
- keyExtractor={item => item.id}
59
- />
60
- ```
61
-
62
- ### FlatList Optimization Checklist
63
-
64
- ```javascript
65
- // ✅ CORRECT: All optimizations applied
66
-
67
- // 1. Memoize the item component
68
- const ListItem = React.memo(({ item }: { item: Item }) => {
69
- return (
70
- <Pressable style={styles.item}>
71
- <Text>{item.title}</Text>
72
- </Pressable>
73
- );
74
- });
75
-
76
- // 2. Memoize renderItem with useCallback
77
- const renderItem = useCallback(
78
- ({ item }: { item: Item }) => <ListItem item={item} />,
79
- [] // Empty deps = never recreated
80
- );
81
-
82
- // 3. Stable keyExtractor (NEVER use index!)
83
- const keyExtractor = useCallback((item: Item) => item.id, []);
84
-
85
- // 4. Provide getItemLayout for fixed-height items
86
- const getItemLayout = useCallback(
87
- (data: Item[] | null, index: number) => ({
88
- length: ITEM_HEIGHT, // Fixed height
89
- offset: ITEM_HEIGHT * index,
90
- index,
91
- }),
92
- []
93
- );
94
-
95
- // 5. Apply to FlatList
96
- <FlatList
97
- data={items}
98
- renderItem={renderItem}
99
- keyExtractor={keyExtractor}
100
- getItemLayout={getItemLayout}
101
- // Performance props
102
- removeClippedSubviews={true} // Android: detach off-screen
103
- maxToRenderPerBatch={10} // Items per batch
104
- windowSize={5} // Render window (5 = 2 screens each side)
105
- initialNumToRender={10} // Initial items
106
- updateCellsBatchingPeriod={50} // Batching delay
107
- />
108
- ```
109
-
110
- ### Why Each Optimization Matters
111
-
112
- | Optimization | What It Prevents | Impact |
113
- |--------------|------------------|--------|
114
- | `React.memo` | Re-render on parent change | 🔴 Critical |
115
- | `useCallback renderItem` | New function every render | 🔴 Critical |
116
- | Stable `keyExtractor` | Wrong item recycling | 🔴 Critical |
117
- | `getItemLayout` | Async layout calculation | 🟡 High |
118
- | `removeClippedSubviews` | Memory from off-screen | 🟡 High |
119
- | `maxToRenderPerBatch` | Blocking main thread | 🟢 Medium |
120
- | `windowSize` | Memory usage | 🟢 Medium |
121
-
122
- ### FlashList: The Better Option
123
-
124
- ```javascript
125
- // Consider FlashList for better performance
126
- import { FlashList } from "@shopify/flash-list";
127
-
128
- <FlashList
129
- data={items}
130
- renderItem={renderItem}
131
- estimatedItemSize={ITEM_HEIGHT}
132
- keyExtractor={keyExtractor}
133
- />
134
-
135
- // Benefits over FlatList:
136
- // ├── Faster recycling
137
- // ├── Better memory management
138
- // ├── Simpler API
139
- // └── Fewer optimization props needed
140
- ```
141
-
142
- ### Animation Performance
143
-
144
- ```javascript
145
- // ❌ JS-driven animation (blocks JS thread)
146
- Animated.timing(value, {
147
- toValue: 1,
148
- duration: 300,
149
- useNativeDriver: false, // BAD!
150
- }).start();
151
-
152
- // ✅ Native-driver animation (runs on UI thread)
153
- Animated.timing(value, {
154
- toValue: 1,
155
- duration: 300,
156
- useNativeDriver: true, // GOOD!
157
- }).start();
158
-
159
- // Native driver supports ONLY:
160
- // ├── transform (translate, scale, rotate)
161
- // └── opacity
162
- //
163
- // Does NOT support:
164
- // ├── width, height
165
- // ├── backgroundColor
166
- // ├── borderRadius changes
167
- // └── margin, padding
168
- ```
169
-
170
- ### Reanimated for Complex Animations
171
-
172
- ```javascript
173
- // For animations native driver can't handle, use Reanimated 3
174
-
175
- import Animated, {
176
- useSharedValue,
177
- useAnimatedStyle,
178
- withSpring,
179
- } from 'react-native-reanimated';
180
-
181
- const Component = () => {
182
- const offset = useSharedValue(0);
183
-
184
- const animatedStyles = useAnimatedStyle(() => ({
185
- transform: [{ translateX: withSpring(offset.value) }],
186
- }));
187
-
188
- return <Animated.View style={animatedStyles} />;
189
- };
190
-
191
- // Benefits:
192
- // ├── Runs on UI thread (60fps guaranteed)
193
- // ├── Can animate any property
194
- // ├── Gesture-driven animations
195
- // └── Worklets for complex logic
196
- ```
197
-
198
- ### Memory Leak Prevention
199
-
200
- ```javascript
201
- // ❌ Memory leak: uncleared interval
202
- useEffect(() => {
203
- const interval = setInterval(() => {
204
- fetchData();
205
- }, 5000);
206
- // Missing cleanup!
207
- }, []);
208
-
209
- // ✅ Proper cleanup
210
- useEffect(() => {
211
- const interval = setInterval(() => {
212
- fetchData();
213
- }, 5000);
214
-
215
- return () => clearInterval(interval); // CLEANUP!
216
- }, []);
217
-
218
- // Common memory leak sources:
219
- // ├── Timers (setInterval, setTimeout)
220
- // ├── Event listeners
221
- // ├── Subscriptions (WebSocket, PubSub)
222
- // ├── Async operations that update state after unmount
223
- // └── Image caching without limits
224
- ```
225
-
226
- ### React Native Performance Checklist
227
-
228
- ```markdown
229
- ## Before Every List
230
- - [ ] Using FlatList or FlashList (NOT ScrollView)
231
- - [ ] renderItem is useCallback memoized
232
- - [ ] List items are React.memo wrapped
233
- - [ ] keyExtractor uses stable ID (NOT index)
234
- - [ ] getItemLayout provided (if fixed height)
235
-
236
- ## Before Every Animation
237
- - [ ] useNativeDriver: true (if possible)
238
- - [ ] Using Reanimated for complex animations
239
- - [ ] Only animating transform/opacity
240
- - [ ] Tested on low-end Android device
241
-
242
- ## Before Any Release
243
- - [ ] console.log statements removed
244
- - [ ] Cleanup functions in all useEffects
245
- - [ ] No memory leaks (test with profiler)
246
- - [ ] Tested in release build (not dev)
247
- ```
248
-
249
- ---
250
-
251
- ## 3. Flutter Performance
252
-
253
- ### 🚫 The #1 AI Mistake: setState Overuse
254
-
255
- ```dart
256
- // ❌ WRONG: setState rebuilds ENTIRE widget tree
257
- class BadCounter extends StatefulWidget {
258
- @override
259
- State<BadCounter> createState() => _BadCounterState();
260
- }
261
-
262
- class _BadCounterState extends State<BadCounter> {
263
- int _counter = 0;
264
-
265
- void _increment() {
266
- setState(() {
267
- _counter++; // This rebuilds EVERYTHING below!
268
- });
269
- }
270
-
271
- @override
272
- Widget build(BuildContext context) {
273
- return Column(
274
- children: [
275
- Text('Counter: $_counter'),
276
- ExpensiveWidget(), // Rebuilds unnecessarily!
277
- AnotherExpensiveWidget(), // Rebuilds unnecessarily!
278
- ],
279
- );
280
- }
281
- }
282
- ```
283
-
284
- ### The `const` Constructor Revolution
285
-
286
- ```dart
287
- // ✅ CORRECT: const prevents rebuilds
288
-
289
- class GoodCounter extends StatefulWidget {
290
- const GoodCounter({super.key}); // CONST constructor!
291
-
292
- @override
293
- State<GoodCounter> createState() => _GoodCounterState();
294
- }
295
-
296
- class _GoodCounterState extends State<GoodCounter> {
297
- int _counter = 0;
298
-
299
- @override
300
- Widget build(BuildContext context) {
301
- return Column(
302
- children: [
303
- Text('Counter: $_counter'),
304
- const ExpensiveWidget(), // Won't rebuild!
305
- const AnotherExpensiveWidget(), // Won't rebuild!
306
- ],
307
- );
308
- }
309
- }
310
-
311
- // RULE: Add `const` to EVERY widget that doesn't depend on state
312
- ```
313
-
314
- ### Targeted State Management
315
-
316
- ```dart
317
- // ❌ setState rebuilds whole tree
318
- setState(() => _value = newValue);
319
-
320
- // ✅ ValueListenableBuilder: surgical rebuilds
321
- class TargetedState extends StatelessWidget {
322
- final ValueNotifier<int> counter = ValueNotifier(0);
323
-
324
- @override
325
- Widget build(BuildContext context) {
326
- return Column(
327
- children: [
328
- // Only this rebuilds when counter changes
329
- ValueListenableBuilder<int>(
330
- valueListenable: counter,
331
- builder: (context, value, child) => Text('$value'),
332
- child: const Icon(Icons.star), // Won't rebuild!
333
- ),
334
- const ExpensiveWidget(), // Never rebuilds
335
- ],
336
- );
337
- }
338
- }
339
- ```
340
-
341
- ### Riverpod/Provider Best Practices
342
-
343
- ```dart
344
- // ❌ WRONG: Reading entire provider in build
345
- Widget build(BuildContext context) {
346
- final state = ref.watch(myProvider); // Rebuilds on ANY change
347
- return Text(state.name);
348
- }
349
-
350
- // ✅ CORRECT: Select only what you need
351
- Widget build(BuildContext context) {
352
- final name = ref.watch(myProvider.select((s) => s.name));
353
- return Text(name); // Only rebuilds when name changes
354
- }
355
- ```
356
-
357
- ### ListView Optimization
358
-
359
- ```dart
360
- // ❌ WRONG: ListView without builder (renders all)
361
- ListView(
362
- children: items.map((item) => ItemWidget(item)).toList(),
363
- )
364
-
365
- // ✅ CORRECT: ListView.builder (lazy rendering)
366
- ListView.builder(
367
- itemCount: items.length,
368
- itemBuilder: (context, index) => ItemWidget(items[index]),
369
- // Additional optimizations:
370
- itemExtent: 56, // Fixed height = faster layout
371
- cacheExtent: 100, // Pre-render distance
372
- )
373
-
374
- // ✅ EVEN BETTER: ListView.separated for dividers
375
- ListView.separated(
376
- itemCount: items.length,
377
- itemBuilder: (context, index) => ItemWidget(items[index]),
378
- separatorBuilder: (context, index) => const Divider(),
379
- )
380
- ```
381
-
382
- ### Image Optimization
383
-
384
- ```dart
385
- // ❌ WRONG: No caching, full resolution
386
- Image.network(url)
387
-
388
- // ✅ CORRECT: Cached with proper sizing
389
- CachedNetworkImage(
390
- imageUrl: url,
391
- width: 100,
392
- height: 100,
393
- fit: BoxFit.cover,
394
- memCacheWidth: 200, // Cache at 2x for retina
395
- memCacheHeight: 200,
396
- placeholder: (context, url) => const Skeleton(),
397
- errorWidget: (context, url, error) => const Icon(Icons.error),
398
- )
399
- ```
400
-
401
- ### Dispose Pattern
402
-
403
- ```dart
404
- class MyWidget extends StatefulWidget {
405
- @override
406
- State<MyWidget> createState() => _MyWidgetState();
407
- }
408
-
409
- class _MyWidgetState extends State<MyWidget> {
410
- late final StreamSubscription _subscription;
411
- late final AnimationController _controller;
412
- late final TextEditingController _textController;
413
-
414
- @override
415
- void initState() {
416
- super.initState();
417
- _subscription = stream.listen((_) {});
418
- _controller = AnimationController(vsync: this);
419
- _textController = TextEditingController();
420
- }
421
-
422
- @override
423
- void dispose() {
424
- // ALWAYS dispose in reverse order of creation
425
- _textController.dispose();
426
- _controller.dispose();
427
- _subscription.cancel();
428
- super.dispose();
429
- }
430
-
431
- @override
432
- Widget build(BuildContext context) => Container();
433
- }
434
- ```
435
-
436
- ### Flutter Performance Checklist
437
-
438
- ```markdown
439
- ## Before Every Widget
440
- - [ ] const constructor added (if no runtime args)
441
- - [ ] const keywords on static children
442
- - [ ] Minimal setState scope
443
- - [ ] Using selectors for provider watches
444
-
445
- ## Before Every List
446
- - [ ] Using ListView.builder (NOT ListView with children)
447
- - [ ] itemExtent provided (if fixed height)
448
- - [ ] Image caching with size limits
449
-
450
- ## Before Any Animation
451
- - [ ] Using Impeller (Flutter 3.16+)
452
- - [ ] Avoiding Opacity widget (use FadeTransition)
453
- - [ ] TickerProviderStateMixin for AnimationController
454
-
455
- ## Before Any Release
456
- - [ ] All dispose() methods implemented
457
- - [ ] No print() in production
458
- - [ ] Tested in profile/release mode
459
- - [ ] DevTools performance overlay checked
460
- ```
461
-
462
- ---
463
-
464
- ## 4. Animation Performance (Both Platforms)
465
-
466
- ### The 60fps Imperative
467
-
468
- ```
469
- Human eye detects:
470
- ├── < 24 fps → "Slideshow" (broken)
471
- ├── 24-30 fps → "Choppy" (uncomfortable)
472
- ├── 30-45 fps → "Noticeably not smooth"
473
- ├── 45-60 fps → "Smooth" (acceptable)
474
- ├── 60 fps → "Buttery" (target)
475
- └── 120 fps → "Premium" (ProMotion devices)
476
-
477
- NEVER ship < 60fps animations.
478
- ```
479
-
480
- ### GPU vs CPU Animation
481
-
482
- ```
483
- GPU-ACCELERATED (FAST): CPU-BOUND (SLOW):
484
- ├── transform: translate ├── width, height
485
- ├── transform: scale ├── top, left, right, bottom
486
- ├── transform: rotate ├── margin, padding
487
- ├── opacity ├── border-radius (animated)
488
- └── (Composited, off main) └── box-shadow (animated)
489
-
490
- RULE: Only animate transform and opacity.
491
- Everything else causes layout recalculation.
492
- ```
493
-
494
- ### Animation Timing Guide
495
-
496
- | Animation Type | Duration | Easing |
497
- |----------------|----------|--------|
498
- | Micro-interaction | 100-200ms | ease-out |
499
- | Standard transition | 200-300ms | ease-out |
500
- | Page transition | 300-400ms | ease-in-out |
501
- | Complex/dramatic | 400-600ms | ease-in-out |
502
- | Loading skeletons | 1000-1500ms | linear (loop) |
503
-
504
- ### Spring Physics
505
-
506
- ```javascript
507
- // React Native Reanimated
508
- withSpring(targetValue, {
509
- damping: 15, // How quickly it settles (higher = faster stop)
510
- stiffness: 150, // How "tight" the spring (higher = faster)
511
- mass: 1, // Weight of the object
512
- })
513
-
514
- // Flutter
515
- SpringSimulation(
516
- SpringDescription(
517
- mass: 1,
518
- stiffness: 150,
519
- damping: 15,
520
- ),
521
- start,
522
- end,
523
- velocity,
524
- )
525
-
526
- // Natural feel ranges:
527
- // Damping: 10-20 (bouncy to settled)
528
- // Stiffness: 100-200 (loose to tight)
529
- // Mass: 0.5-2 (light to heavy)
530
- ```
531
-
532
- ---
533
-
534
- ## 5. Memory Management
535
-
536
- ### Common Memory Leaks
537
-
538
- | Source | Platform | Solution |
539
- |--------|----------|----------|
540
- | Timers | Both | Clear in cleanup/dispose |
541
- | Event listeners | Both | Remove in cleanup/dispose |
542
- | Subscriptions | Both | Cancel in cleanup/dispose |
543
- | Large images | Both | Limit cache, resize |
544
- | Async after unmount | RN | isMounted check or AbortController |
545
- | Animation controllers | Flutter | Dispose controllers |
546
-
547
- ### Image Memory
548
-
549
- ```
550
- Image memory = width × height × 4 bytes (RGBA)
551
-
552
- 1080p image = 1920 × 1080 × 4 = 8.3 MB
553
- 4K image = 3840 × 2160 × 4 = 33.2 MB
554
-
555
- 10 4K images = 332 MB → App crash!
556
-
557
- RULE: Always resize images to display size (or 2-3x for retina).
558
- ```
559
-
560
- ### Memory Profiling
561
-
562
- ```
563
- React Native:
564
- ├── Flipper → Memory tab
565
- ├── Xcode Instruments (iOS)
566
- └── Android Studio Profiler
567
-
568
- Flutter:
569
- ├── DevTools → Memory tab
570
- ├── Observatory
571
- └── flutter run --profile
572
- ```
573
-
574
- ---
575
-
576
- ## 6. Battery Optimization
577
-
578
- ### Battery Drain Sources
579
-
580
- | Source | Impact | Mitigation |
581
- |--------|--------|------------|
582
- | **Screen on** | 🔴 Highest | Dark mode on OLED |
583
- | **GPS continuous** | 🔴 Very high | Use significant change |
584
- | **Network requests** | 🟡 High | Batch, cache aggressively |
585
- | **Animations** | 🟡 Medium | Reduce when low battery |
586
- | **Background work** | 🟡 Medium | Defer non-critical |
587
- | **CPU computation** | 🟢 Lower | Offload to backend |
588
-
589
- ### OLED Battery Saving
590
-
591
- ```
592
- OLED screens: Black pixels = OFF = 0 power
593
-
594
- Dark mode savings:
595
- ├── True black (#000000) → Maximum savings
596
- ├── Dark gray (#1a1a1a) → Slight savings
597
- ├── Any color → Some power
598
- └── White (#FFFFFF) → Maximum power
599
-
600
- RULE: On dark mode, use true black for backgrounds.
601
- ```
602
-
603
- ### Background Task Guidelines
604
-
605
- ```
606
- iOS:
607
- ├── Background refresh: Limited, system-scheduled
608
- ├── Push notifications: Use for important updates
609
- ├── Background modes: Location, audio, VoIP only
610
- └── Background tasks: Max ~30 seconds
611
-
612
- Android:
613
- ├── WorkManager: System-scheduled, battery-aware
614
- ├── Foreground service: Visible to user, continuous
615
- ├── JobScheduler: Batch network operations
616
- └── Doze mode: Respect it, batch operations
617
- ```
618
-
619
- ---
620
-
621
- ## 7. Network Performance
622
-
623
- ### Offline-First Architecture
624
-
625
- ```
626
- ┌──────────────┐
627
- │ UI │
628
- └──────┬───────┘
629
-
630
- ┌──────▼───────┐
631
- │ Cache │ ← Read from cache FIRST
632
- └──────┬───────┘
633
-
634
- ┌──────▼───────┐
635
- │ Network │ ← Update cache from network
636
- └──────────────┘
637
-
638
- Benefits:
639
- ├── Instant UI (no loading spinner for cached data)
640
- ├── Works offline
641
- ├── Reduces data usage
642
- └── Better UX on slow networks
643
- ```
644
-
645
- ### Request Optimization
646
-
647
- ```
648
- BATCH: Combine multiple requests into one
649
- ├── 10 small requests → 1 batch request
650
- ├── Reduces connection overhead
651
- └── Better for battery (radio on once)
652
-
653
- CACHE: Don't re-fetch unchanged data
654
- ├── ETag/If-None-Match headers
655
- ├── Cache-Control headers
656
- └── Stale-while-revalidate pattern
657
-
658
- COMPRESS: Reduce payload size
659
- ├── gzip/brotli compression
660
- ├── Request only needed fields (GraphQL)
661
- └── Paginate large lists
662
- ```
663
-
664
- ---
665
-
666
- ## 8. Performance Testing
667
-
668
- ### What to Test
669
-
670
- | Metric | Target | Tool |
671
- |--------|--------|------|
672
- | **Frame rate** | ≥ 60fps | Performance overlay |
673
- | **Memory** | Stable, no growth | Profiler |
674
- | **Cold start** | < 2s | Manual timing |
675
- | **TTI (Time to Interactive)** | < 3s | Lighthouse |
676
- | **List scroll** | No jank | Manual feel |
677
- | **Animation smoothness** | No drops | Performance monitor |
678
-
679
- ### Test on Real Devices
680
-
681
- ```
682
- ⚠️ NEVER trust only:
683
- ├── Simulator/emulator (faster than real)
684
- ├── Dev mode (slower than release)
685
- ├── High-end devices only
686
-
687
- ✅ ALWAYS test on:
688
- ├── Low-end Android (< $200 phone)
689
- ├── Older iOS device (iPhone 8 or SE)
690
- ├── Release/profile build
691
- └── With real data (not 10 items)
692
- ```
693
-
694
- ### Performance Monitoring Checklist
695
-
696
- ```markdown
697
- ## During Development
698
- - [ ] Performance overlay enabled
699
- - [ ] Watching for dropped frames
700
- - [ ] Memory usage stable
701
- - [ ] No console warnings about performance
702
-
703
- ## Before Release
704
- - [ ] Tested on low-end device
705
- - [ ] Profiled memory over extended use
706
- - [ ] Cold start time measured
707
- - [ ] List scroll tested with 1000+ items
708
- - [ ] Animations tested at 60fps
709
- - [ ] Network tested on slow 3G
710
- ```
711
-
712
- ---
713
-
714
- ## 9. Quick Reference Card
715
-
716
- ### React Native Essentials
717
-
718
- ```javascript
719
- // List: Always use
720
- <FlatList
721
- data={data}
722
- renderItem={useCallback(({item}) => <MemoItem item={item} />, [])}
723
- keyExtractor={useCallback(item => item.id, [])}
724
- getItemLayout={useCallback((_, i) => ({length: H, offset: H*i, index: i}), [])}
725
- />
726
-
727
- // Animation: Always native
728
- useNativeDriver: true
729
-
730
- // Cleanup: Always present
731
- useEffect(() => {
732
- return () => cleanup();
733
- }, []);
734
- ```
735
-
736
- ### Flutter Essentials
737
-
738
- ```dart
739
- // Widgets: Always const
740
- const MyWidget()
741
-
742
- // Lists: Always builder
743
- ListView.builder(itemBuilder: ...)
744
-
745
- // State: Always targeted
746
- ValueListenableBuilder() or ref.watch(provider.select(...))
747
-
748
- // Dispose: Always cleanup
749
- @override
750
- void dispose() {
751
- controller.dispose();
752
- super.dispose();
753
- }
754
- ```
755
-
756
- ### Animation Targets
757
-
758
- ```
759
- Transform/Opacity only ← What to animate
760
- 16.67ms per frame ← Time budget
761
- 60fps minimum ← Target
762
- Low-end Android ← Test device
763
- ```
764
-
765
- ---
766
-
767
- > **Remember:** Performance is not optimization—it's baseline quality. A slow app is a broken app. Test on the worst device your users have, not the best device you have.
1
+ # Mobile Performance Reference
2
+
3
+ > Deep dive into React Native and Flutter performance optimization, 60fps animations, memory management, and battery considerations.
4
+ > **This file covers the #1 area where AI-generated code FAILS.**
5
+
6
+ ---
7
+
8
+ ## 1. The Mobile Performance Mindset
9
+
10
+ ### Why Mobile Performance is Different
11
+
12
+ ```
13
+ DESKTOP: MOBILE:
14
+ ├── Unlimited power ├── Battery matters
15
+ ├── Abundant RAM ├── RAM is shared, limited
16
+ ├── Stable network ├── Network is unreliable
17
+ ├── CPU always available ├── CPU throttles when hot
18
+ └── User expects fast anyway └── User expects INSTANT
19
+ ```
20
+
21
+ ### Performance Budget Concept
22
+
23
+ ```
24
+ Every frame must complete in:
25
+ ├── 60fps → 16.67ms per frame
26
+ ├── 120fps (ProMotion) → 8.33ms per frame
27
+
28
+ If your code takes longer:
29
+ ├── Frame drops → Janky scroll/animation
30
+ ├── User perceives as "slow" or "broken"
31
+ └── They WILL uninstall your app
32
+ ```
33
+
34
+ ---
35
+
36
+ ## 2. React Native Performance
37
+
38
+ ### 🚫 The #1 AI Mistake: ScrollView for Lists
39
+
40
+ ```javascript
41
+ // ❌ NEVER DO THIS - AI's favorite mistake
42
+ <ScrollView>
43
+ {items.map(item => (
44
+ <ItemComponent key={item.id} item={item} />
45
+ ))}
46
+ </ScrollView>
47
+
48
+ // Why it's catastrophic:
49
+ // ├── Renders ALL items immediately (1000 items = 1000 renders)
50
+ // ├── Memory explodes
51
+ // ├── Initial render takes seconds
52
+ // └── Scroll becomes janky
53
+
54
+ // ✅ ALWAYS USE FlatList
55
+ <FlatList
56
+ data={items}
57
+ renderItem={renderItem}
58
+ keyExtractor={item => item.id}
59
+ />
60
+ ```
61
+
62
+ ### FlatList Optimization Checklist
63
+
64
+ ```javascript
65
+ // ✅ CORRECT: All optimizations applied
66
+
67
+ // 1. Memoize the item component
68
+ const ListItem = React.memo(({ item }: { item: Item }) => {
69
+ return (
70
+ <Pressable style={styles.item}>
71
+ <Text>{item.title}</Text>
72
+ </Pressable>
73
+ );
74
+ });
75
+
76
+ // 2. Memoize renderItem with useCallback
77
+ const renderItem = useCallback(
78
+ ({ item }: { item: Item }) => <ListItem item={item} />,
79
+ [] // Empty deps = never recreated
80
+ );
81
+
82
+ // 3. Stable keyExtractor (NEVER use index!)
83
+ const keyExtractor = useCallback((item: Item) => item.id, []);
84
+
85
+ // 4. Provide getItemLayout for fixed-height items
86
+ const getItemLayout = useCallback(
87
+ (data: Item[] | null, index: number) => ({
88
+ length: ITEM_HEIGHT, // Fixed height
89
+ offset: ITEM_HEIGHT * index,
90
+ index,
91
+ }),
92
+ []
93
+ );
94
+
95
+ // 5. Apply to FlatList
96
+ <FlatList
97
+ data={items}
98
+ renderItem={renderItem}
99
+ keyExtractor={keyExtractor}
100
+ getItemLayout={getItemLayout}
101
+ // Performance props
102
+ removeClippedSubviews={true} // Android: detach off-screen
103
+ maxToRenderPerBatch={10} // Items per batch
104
+ windowSize={5} // Render window (5 = 2 screens each side)
105
+ initialNumToRender={10} // Initial items
106
+ updateCellsBatchingPeriod={50} // Batching delay
107
+ />
108
+ ```
109
+
110
+ ### Why Each Optimization Matters
111
+
112
+ | Optimization | What It Prevents | Impact |
113
+ |--------------|------------------|--------|
114
+ | `React.memo` | Re-render on parent change | 🔴 Critical |
115
+ | `useCallback renderItem` | New function every render | 🔴 Critical |
116
+ | Stable `keyExtractor` | Wrong item recycling | 🔴 Critical |
117
+ | `getItemLayout` | Async layout calculation | 🟡 High |
118
+ | `removeClippedSubviews` | Memory from off-screen | 🟡 High |
119
+ | `maxToRenderPerBatch` | Blocking main thread | 🟢 Medium |
120
+ | `windowSize` | Memory usage | 🟢 Medium |
121
+
122
+ ### FlashList: The Better Option
123
+
124
+ ```javascript
125
+ // Consider FlashList for better performance
126
+ import { FlashList } from "@shopify/flash-list";
127
+
128
+ <FlashList
129
+ data={items}
130
+ renderItem={renderItem}
131
+ estimatedItemSize={ITEM_HEIGHT}
132
+ keyExtractor={keyExtractor}
133
+ />
134
+
135
+ // Benefits over FlatList:
136
+ // ├── Faster recycling
137
+ // ├── Better memory management
138
+ // ├── Simpler API
139
+ // └── Fewer optimization props needed
140
+ ```
141
+
142
+ ### Animation Performance
143
+
144
+ ```javascript
145
+ // ❌ JS-driven animation (blocks JS thread)
146
+ Animated.timing(value, {
147
+ toValue: 1,
148
+ duration: 300,
149
+ useNativeDriver: false, // BAD!
150
+ }).start();
151
+
152
+ // ✅ Native-driver animation (runs on UI thread)
153
+ Animated.timing(value, {
154
+ toValue: 1,
155
+ duration: 300,
156
+ useNativeDriver: true, // GOOD!
157
+ }).start();
158
+
159
+ // Native driver supports ONLY:
160
+ // ├── transform (translate, scale, rotate)
161
+ // └── opacity
162
+ //
163
+ // Does NOT support:
164
+ // ├── width, height
165
+ // ├── backgroundColor
166
+ // ├── borderRadius changes
167
+ // └── margin, padding
168
+ ```
169
+
170
+ ### Reanimated for Complex Animations
171
+
172
+ ```javascript
173
+ // For animations native driver can't handle, use Reanimated 3
174
+
175
+ import Animated, {
176
+ useSharedValue,
177
+ useAnimatedStyle,
178
+ withSpring,
179
+ } from 'react-native-reanimated';
180
+
181
+ const Component = () => {
182
+ const offset = useSharedValue(0);
183
+
184
+ const animatedStyles = useAnimatedStyle(() => ({
185
+ transform: [{ translateX: withSpring(offset.value) }],
186
+ }));
187
+
188
+ return <Animated.View style={animatedStyles} />;
189
+ };
190
+
191
+ // Benefits:
192
+ // ├── Runs on UI thread (60fps guaranteed)
193
+ // ├── Can animate any property
194
+ // ├── Gesture-driven animations
195
+ // └── Worklets for complex logic
196
+ ```
197
+
198
+ ### Memory Leak Prevention
199
+
200
+ ```javascript
201
+ // ❌ Memory leak: uncleared interval
202
+ useEffect(() => {
203
+ const interval = setInterval(() => {
204
+ fetchData();
205
+ }, 5000);
206
+ // Missing cleanup!
207
+ }, []);
208
+
209
+ // ✅ Proper cleanup
210
+ useEffect(() => {
211
+ const interval = setInterval(() => {
212
+ fetchData();
213
+ }, 5000);
214
+
215
+ return () => clearInterval(interval); // CLEANUP!
216
+ }, []);
217
+
218
+ // Common memory leak sources:
219
+ // ├── Timers (setInterval, setTimeout)
220
+ // ├── Event listeners
221
+ // ├── Subscriptions (WebSocket, PubSub)
222
+ // ├── Async operations that update state after unmount
223
+ // └── Image caching without limits
224
+ ```
225
+
226
+ ### React Native Performance Checklist
227
+
228
+ ```markdown
229
+ ## Before Every List
230
+ - [ ] Using FlatList or FlashList (NOT ScrollView)
231
+ - [ ] renderItem is useCallback memoized
232
+ - [ ] List items are React.memo wrapped
233
+ - [ ] keyExtractor uses stable ID (NOT index)
234
+ - [ ] getItemLayout provided (if fixed height)
235
+
236
+ ## Before Every Animation
237
+ - [ ] useNativeDriver: true (if possible)
238
+ - [ ] Using Reanimated for complex animations
239
+ - [ ] Only animating transform/opacity
240
+ - [ ] Tested on low-end Android device
241
+
242
+ ## Before Any Release
243
+ - [ ] console.log statements removed
244
+ - [ ] Cleanup functions in all useEffects
245
+ - [ ] No memory leaks (test with profiler)
246
+ - [ ] Tested in release build (not dev)
247
+ ```
248
+
249
+ ---
250
+
251
+ ## 3. Flutter Performance
252
+
253
+ ### 🚫 The #1 AI Mistake: setState Overuse
254
+
255
+ ```dart
256
+ // ❌ WRONG: setState rebuilds ENTIRE widget tree
257
+ class BadCounter extends StatefulWidget {
258
+ @override
259
+ State<BadCounter> createState() => _BadCounterState();
260
+ }
261
+
262
+ class _BadCounterState extends State<BadCounter> {
263
+ int _counter = 0;
264
+
265
+ void _increment() {
266
+ setState(() {
267
+ _counter++; // This rebuilds EVERYTHING below!
268
+ });
269
+ }
270
+
271
+ @override
272
+ Widget build(BuildContext context) {
273
+ return Column(
274
+ children: [
275
+ Text('Counter: $_counter'),
276
+ ExpensiveWidget(), // Rebuilds unnecessarily!
277
+ AnotherExpensiveWidget(), // Rebuilds unnecessarily!
278
+ ],
279
+ );
280
+ }
281
+ }
282
+ ```
283
+
284
+ ### The `const` Constructor Revolution
285
+
286
+ ```dart
287
+ // ✅ CORRECT: const prevents rebuilds
288
+
289
+ class GoodCounter extends StatefulWidget {
290
+ const GoodCounter({super.key}); // CONST constructor!
291
+
292
+ @override
293
+ State<GoodCounter> createState() => _GoodCounterState();
294
+ }
295
+
296
+ class _GoodCounterState extends State<GoodCounter> {
297
+ int _counter = 0;
298
+
299
+ @override
300
+ Widget build(BuildContext context) {
301
+ return Column(
302
+ children: [
303
+ Text('Counter: $_counter'),
304
+ const ExpensiveWidget(), // Won't rebuild!
305
+ const AnotherExpensiveWidget(), // Won't rebuild!
306
+ ],
307
+ );
308
+ }
309
+ }
310
+
311
+ // RULE: Add `const` to EVERY widget that doesn't depend on state
312
+ ```
313
+
314
+ ### Targeted State Management
315
+
316
+ ```dart
317
+ // ❌ setState rebuilds whole tree
318
+ setState(() => _value = newValue);
319
+
320
+ // ✅ ValueListenableBuilder: surgical rebuilds
321
+ class TargetedState extends StatelessWidget {
322
+ final ValueNotifier<int> counter = ValueNotifier(0);
323
+
324
+ @override
325
+ Widget build(BuildContext context) {
326
+ return Column(
327
+ children: [
328
+ // Only this rebuilds when counter changes
329
+ ValueListenableBuilder<int>(
330
+ valueListenable: counter,
331
+ builder: (context, value, child) => Text('$value'),
332
+ child: const Icon(Icons.star), // Won't rebuild!
333
+ ),
334
+ const ExpensiveWidget(), // Never rebuilds
335
+ ],
336
+ );
337
+ }
338
+ }
339
+ ```
340
+
341
+ ### Riverpod/Provider Best Practices
342
+
343
+ ```dart
344
+ // ❌ WRONG: Reading entire provider in build
345
+ Widget build(BuildContext context) {
346
+ final state = ref.watch(myProvider); // Rebuilds on ANY change
347
+ return Text(state.name);
348
+ }
349
+
350
+ // ✅ CORRECT: Select only what you need
351
+ Widget build(BuildContext context) {
352
+ final name = ref.watch(myProvider.select((s) => s.name));
353
+ return Text(name); // Only rebuilds when name changes
354
+ }
355
+ ```
356
+
357
+ ### ListView Optimization
358
+
359
+ ```dart
360
+ // ❌ WRONG: ListView without builder (renders all)
361
+ ListView(
362
+ children: items.map((item) => ItemWidget(item)).toList(),
363
+ )
364
+
365
+ // ✅ CORRECT: ListView.builder (lazy rendering)
366
+ ListView.builder(
367
+ itemCount: items.length,
368
+ itemBuilder: (context, index) => ItemWidget(items[index]),
369
+ // Additional optimizations:
370
+ itemExtent: 56, // Fixed height = faster layout
371
+ cacheExtent: 100, // Pre-render distance
372
+ )
373
+
374
+ // ✅ EVEN BETTER: ListView.separated for dividers
375
+ ListView.separated(
376
+ itemCount: items.length,
377
+ itemBuilder: (context, index) => ItemWidget(items[index]),
378
+ separatorBuilder: (context, index) => const Divider(),
379
+ )
380
+ ```
381
+
382
+ ### Image Optimization
383
+
384
+ ```dart
385
+ // ❌ WRONG: No caching, full resolution
386
+ Image.network(url)
387
+
388
+ // ✅ CORRECT: Cached with proper sizing
389
+ CachedNetworkImage(
390
+ imageUrl: url,
391
+ width: 100,
392
+ height: 100,
393
+ fit: BoxFit.cover,
394
+ memCacheWidth: 200, // Cache at 2x for retina
395
+ memCacheHeight: 200,
396
+ placeholder: (context, url) => const Skeleton(),
397
+ errorWidget: (context, url, error) => const Icon(Icons.error),
398
+ )
399
+ ```
400
+
401
+ ### Dispose Pattern
402
+
403
+ ```dart
404
+ class MyWidget extends StatefulWidget {
405
+ @override
406
+ State<MyWidget> createState() => _MyWidgetState();
407
+ }
408
+
409
+ class _MyWidgetState extends State<MyWidget> {
410
+ late final StreamSubscription _subscription;
411
+ late final AnimationController _controller;
412
+ late final TextEditingController _textController;
413
+
414
+ @override
415
+ void initState() {
416
+ super.initState();
417
+ _subscription = stream.listen((_) {});
418
+ _controller = AnimationController(vsync: this);
419
+ _textController = TextEditingController();
420
+ }
421
+
422
+ @override
423
+ void dispose() {
424
+ // ALWAYS dispose in reverse order of creation
425
+ _textController.dispose();
426
+ _controller.dispose();
427
+ _subscription.cancel();
428
+ super.dispose();
429
+ }
430
+
431
+ @override
432
+ Widget build(BuildContext context) => Container();
433
+ }
434
+ ```
435
+
436
+ ### Flutter Performance Checklist
437
+
438
+ ```markdown
439
+ ## Before Every Widget
440
+ - [ ] const constructor added (if no runtime args)
441
+ - [ ] const keywords on static children
442
+ - [ ] Minimal setState scope
443
+ - [ ] Using selectors for provider watches
444
+
445
+ ## Before Every List
446
+ - [ ] Using ListView.builder (NOT ListView with children)
447
+ - [ ] itemExtent provided (if fixed height)
448
+ - [ ] Image caching with size limits
449
+
450
+ ## Before Any Animation
451
+ - [ ] Using Impeller (Flutter 3.16+)
452
+ - [ ] Avoiding Opacity widget (use FadeTransition)
453
+ - [ ] TickerProviderStateMixin for AnimationController
454
+
455
+ ## Before Any Release
456
+ - [ ] All dispose() methods implemented
457
+ - [ ] No print() in production
458
+ - [ ] Tested in profile/release mode
459
+ - [ ] DevTools performance overlay checked
460
+ ```
461
+
462
+ ---
463
+
464
+ ## 4. Animation Performance (Both Platforms)
465
+
466
+ ### The 60fps Imperative
467
+
468
+ ```
469
+ Human eye detects:
470
+ ├── < 24 fps → "Slideshow" (broken)
471
+ ├── 24-30 fps → "Choppy" (uncomfortable)
472
+ ├── 30-45 fps → "Noticeably not smooth"
473
+ ├── 45-60 fps → "Smooth" (acceptable)
474
+ ├── 60 fps → "Buttery" (target)
475
+ └── 120 fps → "Premium" (ProMotion devices)
476
+
477
+ NEVER ship < 60fps animations.
478
+ ```
479
+
480
+ ### GPU vs CPU Animation
481
+
482
+ ```
483
+ GPU-ACCELERATED (FAST): CPU-BOUND (SLOW):
484
+ ├── transform: translate ├── width, height
485
+ ├── transform: scale ├── top, left, right, bottom
486
+ ├── transform: rotate ├── margin, padding
487
+ ├── opacity ├── border-radius (animated)
488
+ └── (Composited, off main) └── box-shadow (animated)
489
+
490
+ RULE: Only animate transform and opacity.
491
+ Everything else causes layout recalculation.
492
+ ```
493
+
494
+ ### Animation Timing Guide
495
+
496
+ | Animation Type | Duration | Easing |
497
+ |----------------|----------|--------|
498
+ | Micro-interaction | 100-200ms | ease-out |
499
+ | Standard transition | 200-300ms | ease-out |
500
+ | Page transition | 300-400ms | ease-in-out |
501
+ | Complex/dramatic | 400-600ms | ease-in-out |
502
+ | Loading skeletons | 1000-1500ms | linear (loop) |
503
+
504
+ ### Spring Physics
505
+
506
+ ```javascript
507
+ // React Native Reanimated
508
+ withSpring(targetValue, {
509
+ damping: 15, // How quickly it settles (higher = faster stop)
510
+ stiffness: 150, // How "tight" the spring (higher = faster)
511
+ mass: 1, // Weight of the object
512
+ })
513
+
514
+ // Flutter
515
+ SpringSimulation(
516
+ SpringDescription(
517
+ mass: 1,
518
+ stiffness: 150,
519
+ damping: 15,
520
+ ),
521
+ start,
522
+ end,
523
+ velocity,
524
+ )
525
+
526
+ // Natural feel ranges:
527
+ // Damping: 10-20 (bouncy to settled)
528
+ // Stiffness: 100-200 (loose to tight)
529
+ // Mass: 0.5-2 (light to heavy)
530
+ ```
531
+
532
+ ---
533
+
534
+ ## 5. Memory Management
535
+
536
+ ### Common Memory Leaks
537
+
538
+ | Source | Platform | Solution |
539
+ |--------|----------|----------|
540
+ | Timers | Both | Clear in cleanup/dispose |
541
+ | Event listeners | Both | Remove in cleanup/dispose |
542
+ | Subscriptions | Both | Cancel in cleanup/dispose |
543
+ | Large images | Both | Limit cache, resize |
544
+ | Async after unmount | RN | isMounted check or AbortController |
545
+ | Animation controllers | Flutter | Dispose controllers |
546
+
547
+ ### Image Memory
548
+
549
+ ```
550
+ Image memory = width × height × 4 bytes (RGBA)
551
+
552
+ 1080p image = 1920 × 1080 × 4 = 8.3 MB
553
+ 4K image = 3840 × 2160 × 4 = 33.2 MB
554
+
555
+ 10 4K images = 332 MB → App crash!
556
+
557
+ RULE: Always resize images to display size (or 2-3x for retina).
558
+ ```
559
+
560
+ ### Memory Profiling
561
+
562
+ ```
563
+ React Native:
564
+ ├── Flipper → Memory tab
565
+ ├── Xcode Instruments (iOS)
566
+ └── Android Studio Profiler
567
+
568
+ Flutter:
569
+ ├── DevTools → Memory tab
570
+ ├── Observatory
571
+ └── flutter run --profile
572
+ ```
573
+
574
+ ---
575
+
576
+ ## 6. Battery Optimization
577
+
578
+ ### Battery Drain Sources
579
+
580
+ | Source | Impact | Mitigation |
581
+ |--------|--------|------------|
582
+ | **Screen on** | 🔴 Highest | Dark mode on OLED |
583
+ | **GPS continuous** | 🔴 Very high | Use significant change |
584
+ | **Network requests** | 🟡 High | Batch, cache aggressively |
585
+ | **Animations** | 🟡 Medium | Reduce when low battery |
586
+ | **Background work** | 🟡 Medium | Defer non-critical |
587
+ | **CPU computation** | 🟢 Lower | Offload to backend |
588
+
589
+ ### OLED Battery Saving
590
+
591
+ ```
592
+ OLED screens: Black pixels = OFF = 0 power
593
+
594
+ Dark mode savings:
595
+ ├── True black (#000000) → Maximum savings
596
+ ├── Dark gray (#1a1a1a) → Slight savings
597
+ ├── Any color → Some power
598
+ └── White (#FFFFFF) → Maximum power
599
+
600
+ RULE: On dark mode, use true black for backgrounds.
601
+ ```
602
+
603
+ ### Background Task Guidelines
604
+
605
+ ```
606
+ iOS:
607
+ ├── Background refresh: Limited, system-scheduled
608
+ ├── Push notifications: Use for important updates
609
+ ├── Background modes: Location, audio, VoIP only
610
+ └── Background tasks: Max ~30 seconds
611
+
612
+ Android:
613
+ ├── WorkManager: System-scheduled, battery-aware
614
+ ├── Foreground service: Visible to user, continuous
615
+ ├── JobScheduler: Batch network operations
616
+ └── Doze mode: Respect it, batch operations
617
+ ```
618
+
619
+ ---
620
+
621
+ ## 7. Network Performance
622
+
623
+ ### Offline-First Architecture
624
+
625
+ ```
626
+ ┌──────────────┐
627
+ │ UI │
628
+ └──────┬───────┘
629
+
630
+ ┌──────▼───────┐
631
+ │ Cache │ ← Read from cache FIRST
632
+ └──────┬───────┘
633
+
634
+ ┌──────▼───────┐
635
+ │ Network │ ← Update cache from network
636
+ └──────────────┘
637
+
638
+ Benefits:
639
+ ├── Instant UI (no loading spinner for cached data)
640
+ ├── Works offline
641
+ ├── Reduces data usage
642
+ └── Better UX on slow networks
643
+ ```
644
+
645
+ ### Request Optimization
646
+
647
+ ```
648
+ BATCH: Combine multiple requests into one
649
+ ├── 10 small requests → 1 batch request
650
+ ├── Reduces connection overhead
651
+ └── Better for battery (radio on once)
652
+
653
+ CACHE: Don't re-fetch unchanged data
654
+ ├── ETag/If-None-Match headers
655
+ ├── Cache-Control headers
656
+ └── Stale-while-revalidate pattern
657
+
658
+ COMPRESS: Reduce payload size
659
+ ├── gzip/brotli compression
660
+ ├── Request only needed fields (GraphQL)
661
+ └── Paginate large lists
662
+ ```
663
+
664
+ ---
665
+
666
+ ## 8. Performance Testing
667
+
668
+ ### What to Test
669
+
670
+ | Metric | Target | Tool |
671
+ |--------|--------|------|
672
+ | **Frame rate** | ≥ 60fps | Performance overlay |
673
+ | **Memory** | Stable, no growth | Profiler |
674
+ | **Cold start** | < 2s | Manual timing |
675
+ | **TTI (Time to Interactive)** | < 3s | Lighthouse |
676
+ | **List scroll** | No jank | Manual feel |
677
+ | **Animation smoothness** | No drops | Performance monitor |
678
+
679
+ ### Test on Real Devices
680
+
681
+ ```
682
+ ⚠️ NEVER trust only:
683
+ ├── Simulator/emulator (faster than real)
684
+ ├── Dev mode (slower than release)
685
+ ├── High-end devices only
686
+
687
+ ✅ ALWAYS test on:
688
+ ├── Low-end Android (< $200 phone)
689
+ ├── Older iOS device (iPhone 8 or SE)
690
+ ├── Release/profile build
691
+ └── With real data (not 10 items)
692
+ ```
693
+
694
+ ### Performance Monitoring Checklist
695
+
696
+ ```markdown
697
+ ## During Development
698
+ - [ ] Performance overlay enabled
699
+ - [ ] Watching for dropped frames
700
+ - [ ] Memory usage stable
701
+ - [ ] No console warnings about performance
702
+
703
+ ## Before Release
704
+ - [ ] Tested on low-end device
705
+ - [ ] Profiled memory over extended use
706
+ - [ ] Cold start time measured
707
+ - [ ] List scroll tested with 1000+ items
708
+ - [ ] Animations tested at 60fps
709
+ - [ ] Network tested on slow 3G
710
+ ```
711
+
712
+ ---
713
+
714
+ ## 9. Quick Reference Card
715
+
716
+ ### React Native Essentials
717
+
718
+ ```javascript
719
+ // List: Always use
720
+ <FlatList
721
+ data={data}
722
+ renderItem={useCallback(({item}) => <MemoItem item={item} />, [])}
723
+ keyExtractor={useCallback(item => item.id, [])}
724
+ getItemLayout={useCallback((_, i) => ({length: H, offset: H*i, index: i}), [])}
725
+ />
726
+
727
+ // Animation: Always native
728
+ useNativeDriver: true
729
+
730
+ // Cleanup: Always present
731
+ useEffect(() => {
732
+ return () => cleanup();
733
+ }, []);
734
+ ```
735
+
736
+ ### Flutter Essentials
737
+
738
+ ```dart
739
+ // Widgets: Always const
740
+ const MyWidget()
741
+
742
+ // Lists: Always builder
743
+ ListView.builder(itemBuilder: ...)
744
+
745
+ // State: Always targeted
746
+ ValueListenableBuilder() or ref.watch(provider.select(...))
747
+
748
+ // Dispose: Always cleanup
749
+ @override
750
+ void dispose() {
751
+ controller.dispose();
752
+ super.dispose();
753
+ }
754
+ ```
755
+
756
+ ### Animation Targets
757
+
758
+ ```
759
+ Transform/Opacity only ← What to animate
760
+ 16.67ms per frame ← Time budget
761
+ 60fps minimum ← Target
762
+ Low-end Android ← Test device
763
+ ```
764
+
765
+ ---
766
+
767
+ > **Remember:** Performance is not optimization—it's baseline quality. A slow app is a broken app. Test on the worst device your users have, not the best device you have.