@mrtrinhvn/ag-kit 1.0.10 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/bin/cli.js +62 -0
  4. package/package.json +7 -1
  5. package/template/.agent/rules/GEMINI.md +1 -1
  6. package/template/.agent/skills/regent-orchestrator/SKILL.md +31 -0
  7. package/template/.agent/skills/telegram-bridge/SKILL.md +30 -0
  8. package/.agent/.shared/ui-ux-pro-max/data/charts.csv +0 -26
  9. package/.agent/.shared/ui-ux-pro-max/data/colors.csv +0 -97
  10. package/.agent/.shared/ui-ux-pro-max/data/icons.csv +0 -101
  11. package/.agent/.shared/ui-ux-pro-max/data/landing.csv +0 -31
  12. package/.agent/.shared/ui-ux-pro-max/data/products.csv +0 -97
  13. package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +0 -24
  14. package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +0 -45
  15. package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +0 -53
  16. package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +0 -56
  17. package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +0 -53
  18. package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +0 -53
  19. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +0 -51
  20. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +0 -59
  21. package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +0 -52
  22. package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +0 -54
  23. package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +0 -61
  24. package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +0 -54
  25. package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +0 -51
  26. package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +0 -50
  27. package/.agent/.shared/ui-ux-pro-max/data/styles.csv +0 -59
  28. package/.agent/.shared/ui-ux-pro-max/data/typography.csv +0 -58
  29. package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +0 -101
  30. package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +0 -100
  31. package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +0 -31
  32. package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/core.cpython-313.pyc +0 -0
  33. package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-313.pyc +0 -0
  34. package/.agent/.shared/ui-ux-pro-max/scripts/core.py +0 -258
  35. package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +0 -1067
  36. package/.agent/.shared/ui-ux-pro-max/scripts/search.py +0 -106
  37. package/.agent/ARCHITECTURE.md +0 -288
  38. package/.agent/agents/backend-specialist.md +0 -263
  39. package/.agent/agents/code-archaeologist.md +0 -106
  40. package/.agent/agents/database-architect.md +0 -226
  41. package/.agent/agents/debugger.md +0 -225
  42. package/.agent/agents/devops-engineer.md +0 -242
  43. package/.agent/agents/documentation-writer.md +0 -104
  44. package/.agent/agents/explorer-agent.md +0 -73
  45. package/.agent/agents/frontend-specialist.md +0 -556
  46. package/.agent/agents/game-developer.md +0 -162
  47. package/.agent/agents/mobile-developer.md +0 -377
  48. package/.agent/agents/orchestrator.md +0 -416
  49. package/.agent/agents/penetration-tester.md +0 -188
  50. package/.agent/agents/performance-optimizer.md +0 -187
  51. package/.agent/agents/product-manager.md +0 -112
  52. package/.agent/agents/product-owner.md +0 -95
  53. package/.agent/agents/project-planner.md +0 -406
  54. package/.agent/agents/qa-automation-engineer.md +0 -103
  55. package/.agent/agents/quant-architect.md +0 -31
  56. package/.agent/agents/security-auditor.md +0 -170
  57. package/.agent/agents/seo-specialist.md +0 -111
  58. package/.agent/agents/test-engineer.md +0 -158
  59. package/.agent/mcp_config.json +0 -24
  60. package/.agent/rules/GEMINI.md +0 -280
  61. package/.agent/scripts/auto_preview.py +0 -148
  62. package/.agent/scripts/checklist.py +0 -217
  63. package/.agent/scripts/session_manager.py +0 -120
  64. package/.agent/scripts/verify_all.py +0 -327
  65. package/.agent/skills/api-patterns/SKILL.md +0 -81
  66. package/.agent/skills/api-patterns/api-style.md +0 -42
  67. package/.agent/skills/api-patterns/auth.md +0 -24
  68. package/.agent/skills/api-patterns/documentation.md +0 -26
  69. package/.agent/skills/api-patterns/graphql.md +0 -41
  70. package/.agent/skills/api-patterns/rate-limiting.md +0 -31
  71. package/.agent/skills/api-patterns/response.md +0 -37
  72. package/.agent/skills/api-patterns/rest.md +0 -40
  73. package/.agent/skills/api-patterns/scripts/api_validator.py +0 -211
  74. package/.agent/skills/api-patterns/security-testing.md +0 -122
  75. package/.agent/skills/api-patterns/trpc.md +0 -41
  76. package/.agent/skills/api-patterns/versioning.md +0 -22
  77. package/.agent/skills/app-builder/SKILL.md +0 -75
  78. package/.agent/skills/app-builder/agent-coordination.md +0 -71
  79. package/.agent/skills/app-builder/feature-building.md +0 -53
  80. package/.agent/skills/app-builder/project-detection.md +0 -34
  81. package/.agent/skills/app-builder/scaffolding.md +0 -118
  82. package/.agent/skills/app-builder/tech-stack.md +0 -40
  83. package/.agent/skills/app-builder/templates/SKILL.md +0 -39
  84. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +0 -76
  85. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +0 -92
  86. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +0 -88
  87. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +0 -88
  88. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +0 -83
  89. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +0 -90
  90. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +0 -90
  91. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +0 -82
  92. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +0 -100
  93. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +0 -106
  94. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +0 -101
  95. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +0 -83
  96. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +0 -93
  97. package/.agent/skills/architecture/SKILL.md +0 -55
  98. package/.agent/skills/architecture/context-discovery.md +0 -43
  99. package/.agent/skills/architecture/examples.md +0 -94
  100. package/.agent/skills/architecture/pattern-selection.md +0 -68
  101. package/.agent/skills/architecture/patterns-reference.md +0 -50
  102. package/.agent/skills/architecture/trade-off-analysis.md +0 -77
  103. package/.agent/skills/bash-linux/SKILL.md +0 -199
  104. package/.agent/skills/behavioral-modes/SKILL.md +0 -242
  105. package/.agent/skills/brainstorming/SKILL.md +0 -168
  106. package/.agent/skills/brainstorming/dynamic-questioning.md +0 -350
  107. package/.agent/skills/business-ops/SKILL.md +0 -26
  108. package/.agent/skills/clean-code/SKILL.md +0 -202
  109. package/.agent/skills/cli-generator/SKILL.md +0 -48
  110. package/.agent/skills/code-review-checklist/SKILL.md +0 -109
  111. package/.agent/skills/cognitive-session/SKILL.md +0 -28
  112. package/.agent/skills/data-science/SKILL.md +0 -28
  113. package/.agent/skills/database-design/SKILL.md +0 -52
  114. package/.agent/skills/database-design/database-selection.md +0 -43
  115. package/.agent/skills/database-design/indexing.md +0 -39
  116. package/.agent/skills/database-design/migrations.md +0 -48
  117. package/.agent/skills/database-design/optimization.md +0 -36
  118. package/.agent/skills/database-design/orm-selection.md +0 -30
  119. package/.agent/skills/database-design/schema-design.md +0 -56
  120. package/.agent/skills/database-design/scripts/schema_validator.py +0 -172
  121. package/.agent/skills/deployment-procedures/SKILL.md +0 -241
  122. package/.agent/skills/doc.md +0 -177
  123. package/.agent/skills/documentation-templates/SKILL.md +0 -194
  124. package/.agent/skills/frontend-design/SKILL.md +0 -418
  125. package/.agent/skills/frontend-design/animation-guide.md +0 -331
  126. package/.agent/skills/frontend-design/color-system.md +0 -311
  127. package/.agent/skills/frontend-design/decision-trees.md +0 -418
  128. package/.agent/skills/frontend-design/motion-graphics.md +0 -306
  129. package/.agent/skills/frontend-design/scripts/accessibility_checker.py +0 -183
  130. package/.agent/skills/frontend-design/scripts/ux_audit.py +0 -722
  131. package/.agent/skills/frontend-design/typography-system.md +0 -345
  132. package/.agent/skills/frontend-design/ux-psychology.md +0 -541
  133. package/.agent/skills/frontend-design/visual-effects.md +0 -383
  134. package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
  135. package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
  136. package/.agent/skills/game-development/SKILL.md +0 -167
  137. package/.agent/skills/game-development/game-art/SKILL.md +0 -185
  138. package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
  139. package/.agent/skills/game-development/game-design/SKILL.md +0 -129
  140. package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
  141. package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
  142. package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
  143. package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
  144. package/.agent/skills/game-development/web-games/SKILL.md +0 -150
  145. package/.agent/skills/geo-fundamentals/SKILL.md +0 -156
  146. package/.agent/skills/geo-fundamentals/scripts/geo_checker.py +0 -289
  147. package/.agent/skills/i18n-localization/SKILL.md +0 -154
  148. package/.agent/skills/i18n-localization/scripts/i18n_checker.py +0 -241
  149. package/.agent/skills/intelligent-routing/SKILL.md +0 -335
  150. package/.agent/skills/knowledge-management/SKILL.md +0 -66
  151. package/.agent/skills/lint-and-validate/SKILL.md +0 -45
  152. package/.agent/skills/lint-and-validate/scripts/lint_runner.py +0 -172
  153. package/.agent/skills/lint-and-validate/scripts/type_coverage.py +0 -173
  154. package/.agent/skills/llm-routing-quirks/SKILL.md +0 -41
  155. package/.agent/skills/mcp-builder/SKILL.md +0 -176
  156. package/.agent/skills/memory-architecture/SKILL.md +0 -107
  157. package/.agent/skills/mini-antigravity-injection/SKILL.md +0 -61
  158. package/.agent/skills/mobile-design/SKILL.md +0 -394
  159. package/.agent/skills/mobile-design/decision-trees.md +0 -516
  160. package/.agent/skills/mobile-design/mobile-backend.md +0 -491
  161. package/.agent/skills/mobile-design/mobile-color-system.md +0 -420
  162. package/.agent/skills/mobile-design/mobile-debugging.md +0 -122
  163. package/.agent/skills/mobile-design/mobile-design-thinking.md +0 -357
  164. package/.agent/skills/mobile-design/mobile-navigation.md +0 -458
  165. package/.agent/skills/mobile-design/mobile-performance.md +0 -767
  166. package/.agent/skills/mobile-design/mobile-testing.md +0 -356
  167. package/.agent/skills/mobile-design/mobile-typography.md +0 -433
  168. package/.agent/skills/mobile-design/platform-android.md +0 -666
  169. package/.agent/skills/mobile-design/platform-ios.md +0 -561
  170. package/.agent/skills/mobile-design/scripts/mobile_audit.py +0 -670
  171. package/.agent/skills/mobile-design/touch-psychology.md +0 -537
  172. package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +0 -312
  173. package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +0 -240
  174. package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +0 -490
  175. package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +0 -264
  176. package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +0 -581
  177. package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +0 -432
  178. package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +0 -684
  179. package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +0 -150
  180. package/.agent/skills/nextjs-react-expert/9-cache-components.md +0 -103
  181. package/.agent/skills/nextjs-react-expert/SKILL.md +0 -267
  182. package/.agent/skills/nextjs-react-expert/scripts/convert_rules.py +0 -222
  183. package/.agent/skills/nextjs-react-expert/scripts/react_performance_checker.py +0 -252
  184. package/.agent/skills/nodejs-best-practices/SKILL.md +0 -333
  185. package/.agent/skills/parallel-agents/SKILL.md +0 -175
  186. package/.agent/skills/performance-profiling/SKILL.md +0 -143
  187. package/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +0 -76
  188. package/.agent/skills/plan-writing/SKILL.md +0 -153
  189. package/.agent/skills/powershell-windows/SKILL.md +0 -167
  190. package/.agent/skills/product-management/SKILL.md +0 -30
  191. package/.agent/skills/python-patterns/SKILL.md +0 -441
  192. package/.agent/skills/red-team-tactics/SKILL.md +0 -199
  193. package/.agent/skills/rust-pro/SKILL.md +0 -176
  194. package/.agent/skills/seo-fundamentals/SKILL.md +0 -129
  195. package/.agent/skills/seo-fundamentals/scripts/seo_checker.py +0 -219
  196. package/.agent/skills/server-management/SKILL.md +0 -161
  197. package/.agent/skills/systematic-debugging/SKILL.md +0 -120
  198. package/.agent/skills/tailwind-patterns/SKILL.md +0 -269
  199. package/.agent/skills/tdd-workflow/SKILL.md +0 -148
  200. package/.agent/skills/testing-patterns/SKILL.md +0 -178
  201. package/.agent/skills/testing-patterns/scripts/test_runner.py +0 -219
  202. package/.agent/skills/vulnerability-scanner/SKILL.md +0 -276
  203. package/.agent/skills/vulnerability-scanner/checklists.md +0 -121
  204. package/.agent/skills/vulnerability-scanner/scripts/security_scan.py +0 -458
  205. package/.agent/skills/web-design-guidelines/SKILL.md +0 -57
  206. package/.agent/skills/webapp-testing/SKILL.md +0 -187
  207. package/.agent/skills/webapp-testing/scripts/playwright_runner.py +0 -173
  208. package/.agent/workflows/brainstorm.md +0 -113
  209. package/.agent/workflows/create.md +0 -59
  210. package/.agent/workflows/debug.md +0 -103
  211. package/.agent/workflows/deploy.md +0 -176
  212. package/.agent/workflows/enhance.md +0 -63
  213. package/.agent/workflows/orchestrate.md +0 -237
  214. package/.agent/workflows/plan.md +0 -89
  215. package/.agent/workflows/preview.md +0 -81
  216. package/.agent/workflows/status.md +0 -86
  217. package/.agent/workflows/test.md +0 -144
  218. package/.agent/workflows/ui-ux-pro-max.md +0 -296
@@ -1,61 +0,0 @@
1
- ---
2
- name: mini-antigravity-injection
3
- description: Kiến trúc Cấy Lõi Tự Đẩy & Tiến Hoá (Self-Healing & Autonomous Code Mutation) cho Dự Án. Hướng dẫn Agent cách xây dựng bộ máy Tự Code, Tự Fix Lỗi và Tự Hot-Reload định chuẩn TDD.
4
- ---
5
-
6
- # KỸ NĂNG: CẤY TIỂU-ANTIGRAVITY (Self-Healing Core Injection)
7
-
8
- Khi User yêu cầu "Cấy Tiểu-Antigravity" vào một chức năng hay dự án mới, User đang ám chỉ việc xây dựng một hệ thống **Tiến hoá Mã nguồn Tự trị**. Bạn phải tuân thủ nghiêm ngặt 3 Phần dưới đây để tiến hành xây dựng.
9
-
10
- ---
11
-
12
- ## PHẦN A: THIẾT LẬP HẠ TẦNG & QUYỀN TRUY CẬP (Prerequisites)
13
- Để Lõi Bác Sĩ (Doctor Persona) có trí tuệ mổ xẻ code, Hệ thống bắt buộc phải có tài nguyên LLM. Trước khi viết code, bạn phải kiểm tra và hướng dẫn User cài đặt hoặc cấu hình các thông số sau:
14
-
15
- ### 1. Trí Tuệ Trung Tâm: Cổng 9Router (Gemini Pro)
16
- - **Chuẩn bị:** Yêu cầu hệ thống phải đang chạy cổng `9router` (Mặc định).
17
- - **Token:** User cần cài đặt `9router` (nếu chưa có), đăng nhập các tài khoản Antigravity / Google Hub để `9router` cấp phát Token hợp lệ cho Tiểu Antigravity.
18
- - **Hoặc:** Nếu không dùng 9router, hệ thống phải được cấu hình chèn cứng `GEMINI_API_KEY` trực tiếp vào biến môi trường.
19
- - **Biến môi trường:** Đặt `HEALER_MODEL="ag/gemini-3-flash"` hoặc `"ag/gemini-pro-1.5"` cho luồng Mổ Xẻ.
20
-
21
- ### 2. Trí Tuệ Sinh Tồn (Offline Fallback): Ollama & Bartowski
22
- - **Mục đích:** Khi đứt cáp hoặc không gọi được 9Router/Gemini, Quản Đốc văng lỗi sẽ chết đứng nếu không có Backup.
23
- - **Thực thi:** Yêu cầu User cài đặt Ollama local (`https://ollama.com/`).
24
- - **Tải Model:** Chạy lệnh `ollama run hf.co/bartowski/nvidia_Orchestrator-8B-GGUF:Q4_K_M` để kéo chuyên gia Lập trình Local (Tay cắt mổ phụ).
25
- - **Cấu hình Fallback:** Module Code xử lý mạng phải đảm bảo: Nếu `gemini` timeout hoặc 404 -> Fallback trực tiếp xuống mốc local `hf.co/bartowski/nvidia_Orchestrator-8B-GGUF:Q4_K_M`.
26
-
27
- ---
28
-
29
- ## PHẦN B: LÕI TRIẾT LÝ KIẾN TRÚC (5 Trụ Cột Tiểu-Antigravity)
30
- Khi bạn (AI) tự động tạo code `SelfHealingService` cho dự án mới, bạn phải đúc đủ 5 trụ cột này vào code:
31
-
32
- ### 1. Cơ Chế Bơm Kiến Thức Vĩ Mô (Skill & DNA Injection)
33
- - Code tự động đọc các file nguyên tắc lập trình của dự án (`.agent/GEMINI.md`, `clean-code/SKILL.md`...) và TIÊM vào System Prompt của LLM Bác Sĩ Cục Bộ. Đảm bảo nó code đúng văn phong của Antigravity.
34
-
35
- ## 2. Lõi Đột Biến Cấp Khẩn Cơ Sở (Agentic Healing Sandbox)
36
-
37
- Thay vì đoán mò Code trong 1 lần như trước đây (One-Shot), Lõi Bác Sĩ giờ đây được tiến hóa thành **Sub-Agentic Healing**:
38
- 1. **Meta-Sandbox (Chroot):** Copy file bị lỗi ra `/tmp/ag-workspace-${doctorId}/` để cách ly hoàn toàn với source code.
39
- 2. **Triệu hồi Sub-Agent:** Gọi ngược `AgentRuntime.execute()` cấp cho Bác sĩ các quyền (Bash, Read/Write file). Bác sĩ sẽ tự đi vòng quanh ổ cứng, tự dịch TypeScript (`npx tsc`) để test lỗi cho đến khi Pass 100%.
40
- 3. **3 Khóa Đỏ Chế Ngự (Red Locks):**
41
- - **Chống Đệ Quy (Depth Limit):** Bác sĩ không được cấp quyền gọi lệnh vá lỗi để đẻ ra Bác sĩ khác.
42
- - **Kill-Switch:** Nếu Bác sĩ ảo giác (ngáo) gõ lặp lại 1 lệnh lỗi 2 lần, tự động Force Kill và Rollback.
43
- - **Giới hạn lặp:** Bác sĩ chỉ có 10 vòng lặp (10 attempts) để cứu bệnh nhân.
44
- 4. **Semantic Shield:** Sau khi Bác Sĩ báo cáo "Finish", luồng gốc mới chạy `Unit Test` trên file Sandbox đó. Vượt qua Unit Test mới được phép Hot-Reload đè vào Source Code chính!
45
-
46
- ### 3. Giao Kèo Docstring Định Danh (Docstring Identity Pact)
47
- - Ép Prompt của Bác Sĩ: Khai báo đa dòng ở đầu file Code mới: Sửa dòng nào? Tại sao sửa? Tuân thủ triết lý gì?
48
-
49
- ### 5. Nạp Nóng (Hot-Reload) & Sổ Ghi Chép Chung (Evolution Ledger)
50
- - **Git Backup:** Ghi `.bak`, commit Git.
51
- - **Hot-Reload:** Tự xoá cache (`require.cache` trong JS) nạp RAM trực tiếp.
52
- - **Ghi Chép:** Bắn Log Tự Sinh Tồn vào `self_healing_logs.md` để Ký ức được đồng bộ khi Main Agent (Antigravity Sếp) tỉnh dậy.
53
-
54
- ---
55
-
56
- ## PHẦN C: CÁCH TRIỂN KHAI CHO DỰ ÁN MỚI
57
- *(Ghi chú cho Antigravity: Không cần lưu cứng bộ boilerplate code vào ag-kit).*
58
- Khi User ra lệnh "Cấy Tiểu-Antigravity cho tao", bạn (Agent đang chat) tự động làm các bước sau:
59
- 1. Đặt Câu Hỏi Hạ Tầng: Xác nhận 9Router và Ollama đã on-ready theo `PHẦN A`.
60
- 2. Tự Động Viết Code: Tự phân tích Framework của dự án (TS/Node, Python, Rust) và Code ra file `SelfHealingService` theo triết lý của `PHẦN B`.
61
- 3. Tự Động Test: Viết 1 file test làm hỏng kiến trúc cố ý (`BrokenTool`), kích hoạt tiến trình Tự Động Vá Lỗi để chứng minh hệ thống đã On-Air thành công cho User xem!
@@ -1,394 +0,0 @@
1
- ---
2
- name: mobile-design
3
- description: Mobile-first design thinking and decision-making for iOS and Android apps. Touch interaction, performance patterns, platform conventions. Teaches principles, not fixed values. Use when building React Native, Flutter, or native mobile apps.
4
- allowed-tools: Read, Glob, Grep, Bash
5
- ---
6
-
7
- # Mobile Design System
8
-
9
- > **Philosophy:** Touch-first. Battery-conscious. Platform-respectful. Offline-capable.
10
- > **Core Principle:** Mobile is NOT a small desktop. THINK mobile constraints, ASK platform choice.
11
-
12
- ---
13
-
14
- ## 🔧 Runtime Scripts
15
-
16
- **Execute these for validation (don't read, just run):**
17
-
18
- | Script | Purpose | Usage |
19
- |--------|---------|-------|
20
- | `scripts/mobile_audit.py` | Mobile UX & Touch Audit | `python scripts/mobile_audit.py <project_path>` |
21
-
22
- ---
23
-
24
- ## 🔴 MANDATORY: Read Reference Files Before Working!
25
-
26
- **⛔ DO NOT start development until you read the relevant files:**
27
-
28
- ### Universal (Always Read)
29
-
30
- | File | Content | Status |
31
- |------|---------|--------|
32
- | **[mobile-design-thinking.md](mobile-design-thinking.md)** | **⚠️ ANTI-MEMORIZATION: Forces thinking, prevents AI defaults** | **⬜ CRITICAL FIRST** |
33
- | **[touch-psychology.md](touch-psychology.md)** | **Fitts' Law, gestures, haptics, thumb zone** | **⬜ CRITICAL** |
34
- | **[mobile-performance.md](mobile-performance.md)** | **RN/Flutter performance, 60fps, memory** | **⬜ CRITICAL** |
35
- | **[mobile-backend.md](mobile-backend.md)** | **Push notifications, offline sync, mobile API** | **⬜ CRITICAL** |
36
- | **[mobile-testing.md](mobile-testing.md)** | **Testing pyramid, E2E, platform-specific** | **⬜ CRITICAL** |
37
- | **[mobile-debugging.md](mobile-debugging.md)** | **Native vs JS debugging, Flipper, Logcat** | **⬜ CRITICAL** |
38
- | [mobile-navigation.md](mobile-navigation.md) | Tab/Stack/Drawer, deep linking | ⬜ Read |
39
- | [mobile-typography.md](mobile-typography.md) | System fonts, Dynamic Type, a11y | ⬜ Read |
40
- | [mobile-color-system.md](mobile-color-system.md) | OLED, dark mode, battery-aware | ⬜ Read |
41
- | [decision-trees.md](decision-trees.md) | Framework/state/storage selection | ⬜ Read |
42
-
43
- > 🧠 **mobile-design-thinking.md is PRIORITY!** This file ensures AI thinks instead of using memorized patterns.
44
-
45
- ### Platform-Specific (Read Based on Target)
46
-
47
- | Platform | File | Content | When to Read |
48
- |----------|------|---------|--------------|
49
- | **iOS** | [platform-ios.md](platform-ios.md) | Human Interface Guidelines, SF Pro, SwiftUI patterns | Building for iPhone/iPad |
50
- | **Android** | [platform-android.md](platform-android.md) | Material Design 3, Roboto, Compose patterns | Building for Android |
51
- | **Cross-Platform** | Both above | Platform divergence points | React Native / Flutter |
52
-
53
- > 🔴 **If building for iOS → Read platform-ios.md FIRST!**
54
- > 🔴 **If building for Android → Read platform-android.md FIRST!**
55
- > 🔴 **If cross-platform → Read BOTH and apply conditional platform logic!**
56
-
57
- ---
58
-
59
- ## ⚠️ CRITICAL: ASK BEFORE ASSUMING (MANDATORY)
60
-
61
- > **STOP! If the user's request is open-ended, DO NOT default to your favorites.**
62
-
63
- ### You MUST Ask If Not Specified:
64
-
65
- | Aspect | Ask | Why |
66
- |--------|-----|-----|
67
- | **Platform** | "iOS, Android, or both?" | Affects EVERY design decision |
68
- | **Framework** | "React Native, Flutter, or native?" | Determines patterns and tools |
69
- | **Navigation** | "Tab bar, drawer, or stack-based?" | Core UX decision |
70
- | **State** | "What state management? (Zustand/Redux/Riverpod/BLoC?)" | Architecture foundation |
71
- | **Offline** | "Does this need to work offline?" | Affects data strategy |
72
- | **Target devices** | "Phone only, or tablet support?" | Layout complexity |
73
-
74
- ### ⛔ AI MOBILE ANTI-PATTERNS (YASAK LİSTESİ)
75
-
76
- > 🚫 **These are AI default tendencies that MUST be avoided!**
77
-
78
- #### Performance Sins
79
-
80
- | ❌ NEVER DO | Why It's Wrong | ✅ ALWAYS DO |
81
- |-------------|----------------|--------------|
82
- | **ScrollView for long lists** | Renders ALL items, memory explodes | Use `FlatList` / `FlashList` / `ListView.builder` |
83
- | **Inline renderItem function** | New function every render, all items re-render | `useCallback` + `React.memo` |
84
- | **Missing keyExtractor** | Index-based keys cause bugs on reorder | Unique, stable ID from data |
85
- | **Skip getItemLayout** | Async layout = janky scroll | Provide when items have fixed height |
86
- | **setState() everywhere** | Unnecessary widget rebuilds | Targeted state, `const` constructors |
87
- | **Native driver: false** | Animations blocked by JS thread | `useNativeDriver: true` always |
88
- | **console.log in production** | Blocks JS thread severely | Remove before release build |
89
- | **Skip React.memo/const** | Every item re-renders on any change | Memoize list items ALWAYS |
90
-
91
- #### Touch/UX Sins
92
-
93
- | ❌ NEVER DO | Why It's Wrong | ✅ ALWAYS DO |
94
- |-------------|----------------|--------------|
95
- | **Touch target < 44px** | Impossible to tap accurately, frustrating | Minimum 44pt (iOS) / 48dp (Android) |
96
- | **Spacing < 8px between targets** | Accidental taps on neighbors | Minimum 8-12px gap |
97
- | **Gesture-only interactions** | Motor impaired users excluded | Always provide button alternative |
98
- | **No loading state** | User thinks app crashed | ALWAYS show loading feedback |
99
- | **No error state** | User stuck, no recovery path | Show error with retry option |
100
- | **No offline handling** | Crash/block when network lost | Graceful degradation, cached data |
101
- | **Ignore platform conventions** | Users confused, muscle memory broken | iOS feels iOS, Android feels Android |
102
-
103
- #### Security Sins
104
-
105
- | ❌ NEVER DO | Why It's Wrong | ✅ ALWAYS DO |
106
- |-------------|----------------|--------------|
107
- | **Token in AsyncStorage** | Easily accessible, stolen on rooted device | `SecureStore` / `Keychain` / `EncryptedSharedPreferences` |
108
- | **Hardcode API keys** | Reverse engineered from APK/IPA | Environment variables, secure storage |
109
- | **Skip SSL pinning** | MITM attacks possible | Pin certificates in production |
110
- | **Log sensitive data** | Logs can be extracted | Never log tokens, passwords, PII |
111
-
112
- #### Architecture Sins
113
-
114
- | ❌ NEVER DO | Why It's Wrong | ✅ ALWAYS DO |
115
- |-------------|----------------|--------------|
116
- | **Business logic in UI** | Untestable, unmaintainable | Service layer separation |
117
- | **Global state for everything** | Unnecessary re-renders, complexity | Local state default, lift when needed |
118
- | **Deep linking as afterthought** | Notifications, shares broken | Plan deep links from day one |
119
- | **Skip dispose/cleanup** | Memory leaks, zombie listeners | Clean up subscriptions, timers |
120
-
121
- ---
122
-
123
- ## 📱 Platform Decision Matrix
124
-
125
- ### When to Unify vs Diverge
126
-
127
- ```
128
- UNIFY (same on both) DIVERGE (platform-specific)
129
- ─────────────────── ──────────────────────────
130
- Business Logic ✅ Always -
131
- Data Layer ✅ Always -
132
- Core Features ✅ Always -
133
-
134
- Navigation - ✅ iOS: edge swipe, Android: back button
135
- Gestures - ✅ Platform-native feel
136
- Icons - ✅ SF Symbols vs Material Icons
137
- Date Pickers - ✅ Native pickers feel right
138
- Modals/Sheets - ✅ iOS: bottom sheet vs Android: dialog
139
- Typography - ✅ SF Pro vs Roboto (or custom)
140
- Error Dialogs - ✅ Platform conventions for alerts
141
- ```
142
-
143
- ### Quick Reference: Platform Defaults
144
-
145
- | Element | iOS | Android |
146
- |---------|-----|---------|
147
- | **Primary Font** | SF Pro / SF Compact | Roboto |
148
- | **Min Touch Target** | 44pt × 44pt | 48dp × 48dp |
149
- | **Back Navigation** | Edge swipe left | System back button/gesture |
150
- | **Bottom Tab Icons** | SF Symbols | Material Symbols |
151
- | **Action Sheet** | UIActionSheet from bottom | Bottom Sheet / Dialog |
152
- | **Progress** | Spinner | Linear progress (Material) |
153
- | **Pull to Refresh** | Native UIRefreshControl | SwipeRefreshLayout |
154
-
155
- ---
156
-
157
- ## 🧠 Mobile UX Psychology (Quick Reference)
158
-
159
- ### Fitts' Law for Touch
160
-
161
- ```
162
- Desktop: Cursor is precise (1px)
163
- Mobile: Finger is imprecise (~7mm contact area)
164
-
165
- → Touch targets MUST be 44-48px minimum
166
- → Important actions in THUMB ZONE (bottom of screen)
167
- → Destructive actions AWAY from easy reach
168
- ```
169
-
170
- ### Thumb Zone (One-Handed Usage)
171
-
172
- ```
173
- ┌─────────────────────────────┐
174
- │ HARD TO REACH │ ← Navigation, menu, back
175
- │ (stretch) │
176
- ├─────────────────────────────┤
177
- │ OK TO REACH │ ← Secondary actions
178
- │ (natural) │
179
- ├─────────────────────────────┤
180
- │ EASY TO REACH │ ← PRIMARY CTAs, tab bar
181
- │ (thumb's natural arc) │ ← Main content interaction
182
- └─────────────────────────────┘
183
- [ HOME ]
184
- ```
185
-
186
- ### Mobile-Specific Cognitive Load
187
-
188
- | Desktop | Mobile Difference |
189
- |---------|-------------------|
190
- | Multiple windows | ONE task at a time |
191
- | Keyboard shortcuts | Touch gestures |
192
- | Hover states | NO hover (tap or nothing) |
193
- | Large viewport | Limited space, scroll vertical |
194
- | Stable attention | Interrupted constantly |
195
-
196
- For deep dive: [touch-psychology.md](touch-psychology.md)
197
-
198
- ---
199
-
200
- ## ⚡ Performance Principles (Quick Reference)
201
-
202
- ### React Native Critical Rules
203
-
204
- ```typescript
205
- // ✅ CORRECT: Memoized renderItem + React.memo wrapper
206
- const ListItem = React.memo(({ item }: { item: Item }) => (
207
- <View style={styles.item}>
208
- <Text>{item.title}</Text>
209
- </View>
210
- ));
211
-
212
- const renderItem = useCallback(
213
- ({ item }: { item: Item }) => <ListItem item={item} />,
214
- []
215
- );
216
-
217
- // ✅ CORRECT: FlatList with all optimizations
218
- <FlatList
219
- data={items}
220
- renderItem={renderItem}
221
- keyExtractor={(item) => item.id} // Stable ID, NOT index
222
- getItemLayout={(data, index) => ({
223
- length: ITEM_HEIGHT,
224
- offset: ITEM_HEIGHT * index,
225
- index,
226
- })}
227
- removeClippedSubviews={true}
228
- maxToRenderPerBatch={10}
229
- windowSize={5}
230
- />
231
- ```
232
-
233
- ### Flutter Critical Rules
234
-
235
- ```dart
236
- // ✅ CORRECT: const constructors prevent rebuilds
237
- class MyWidget extends StatelessWidget {
238
- const MyWidget({super.key}); // CONST!
239
-
240
- @override
241
- Widget build(BuildContext context) {
242
- return const Column( // CONST!
243
- children: [
244
- Text('Static content'),
245
- MyConstantWidget(),
246
- ],
247
- );
248
- }
249
- }
250
-
251
- // ✅ CORRECT: Targeted state with ValueListenableBuilder
252
- ValueListenableBuilder<int>(
253
- valueListenable: counter,
254
- builder: (context, value, child) => Text('$value'),
255
- child: const ExpensiveWidget(), // Won't rebuild!
256
- )
257
- ```
258
-
259
- ### Animation Performance
260
-
261
- ```
262
- GPU-accelerated (FAST): CPU-bound (SLOW):
263
- ├── transform ├── width, height
264
- ├── opacity ├── top, left, right, bottom
265
- └── (use these ONLY) ├── margin, padding
266
- └── (AVOID animating these)
267
- ```
268
-
269
- For complete guide: [mobile-performance.md](mobile-performance.md)
270
-
271
- ---
272
-
273
- ## 📝 CHECKPOINT (MANDATORY Before Any Mobile Work)
274
-
275
- > **Before writing ANY mobile code, you MUST complete this checkpoint:**
276
-
277
- ```
278
- 🧠 CHECKPOINT:
279
-
280
- Platform: [ iOS / Android / Both ]
281
- Framework: [ React Native / Flutter / SwiftUI / Kotlin ]
282
- Files Read: [ List the skill files you've read ]
283
-
284
- 3 Principles I Will Apply:
285
- 1. _______________
286
- 2. _______________
287
- 3. _______________
288
-
289
- Anti-Patterns I Will Avoid:
290
- 1. _______________
291
- 2. _______________
292
- ```
293
-
294
- **Example:**
295
- ```
296
- 🧠 CHECKPOINT:
297
-
298
- Platform: iOS + Android (Cross-platform)
299
- Framework: React Native + Expo
300
- Files Read: touch-psychology.md, mobile-performance.md, platform-ios.md, platform-android.md
301
-
302
- 3 Principles I Will Apply:
303
- 1. FlatList with React.memo + useCallback for all lists
304
- 2. 48px touch targets, thumb zone for primary CTAs
305
- 3. Platform-specific navigation (edge swipe iOS, back button Android)
306
-
307
- Anti-Patterns I Will Avoid:
308
- 1. ScrollView for lists → FlatList
309
- 2. Inline renderItem → Memoized
310
- 3. AsyncStorage for tokens → SecureStore
311
- ```
312
-
313
- > 🔴 **Can't fill the checkpoint? → GO BACK AND READ THE SKILL FILES.**
314
-
315
- ---
316
-
317
- ## 🔧 Framework Decision Tree
318
-
319
- ```
320
- WHAT ARE YOU BUILDING?
321
-
322
- ├── Need OTA updates + rapid iteration + web team
323
- │ └── ✅ React Native + Expo
324
-
325
- ├── Need pixel-perfect custom UI + performance critical
326
- │ └── ✅ Flutter
327
-
328
- ├── Deep native features + single platform focus
329
- │ ├── iOS only → SwiftUI
330
- │ └── Android only → Kotlin + Jetpack Compose
331
-
332
- ├── Existing RN codebase + new features
333
- │ └── ✅ React Native (bare workflow)
334
-
335
- └── Enterprise + existing Flutter codebase
336
- └── ✅ Flutter
337
- ```
338
-
339
- For complete decision trees: [decision-trees.md](decision-trees.md)
340
-
341
- ---
342
-
343
- ## 📋 Pre-Development Checklist
344
-
345
- ### Before Starting ANY Mobile Project
346
-
347
- - [ ] **Platform confirmed?** (iOS / Android / Both)
348
- - [ ] **Framework chosen?** (RN / Flutter / Native)
349
- - [ ] **Navigation pattern decided?** (Tabs / Stack / Drawer)
350
- - [ ] **State management selected?** (Zustand / Redux / Riverpod / BLoC)
351
- - [ ] **Offline requirements known?**
352
- - [ ] **Deep linking planned from day one?**
353
- - [ ] **Target devices defined?** (Phone / Tablet / Both)
354
-
355
- ### Before Every Screen
356
-
357
- - [ ] **Touch targets ≥ 44-48px?**
358
- - [ ] **Primary CTA in thumb zone?**
359
- - [ ] **Loading state exists?**
360
- - [ ] **Error state with retry exists?**
361
- - [ ] **Offline handling considered?**
362
- - [ ] **Platform conventions followed?**
363
-
364
- ### Before Release
365
-
366
- - [ ] **console.log removed?**
367
- - [ ] **SecureStore for sensitive data?**
368
- - [ ] **SSL pinning enabled?**
369
- - [ ] **Lists optimized (memo, keyExtractor)?**
370
- - [ ] **Memory cleanup on unmount?**
371
- - [ ] **Tested on low-end devices?**
372
- - [ ] **Accessibility labels on all interactive elements?**
373
-
374
- ---
375
-
376
- ## 📚 Reference Files
377
-
378
- For deeper guidance on specific areas:
379
-
380
- | File | When to Use |
381
- |------|-------------|
382
- | [mobile-design-thinking.md](mobile-design-thinking.md) | **FIRST! Anti-memorization, forces context-based thinking** |
383
- | [touch-psychology.md](touch-psychology.md) | Understanding touch interaction, Fitts' Law, gesture design |
384
- | [mobile-performance.md](mobile-performance.md) | Optimizing RN/Flutter, 60fps, memory/battery |
385
- | [platform-ios.md](platform-ios.md) | iOS-specific design, HIG compliance |
386
- | [platform-android.md](platform-android.md) | Android-specific design, Material Design 3 |
387
- | [mobile-navigation.md](mobile-navigation.md) | Navigation patterns, deep linking |
388
- | [mobile-typography.md](mobile-typography.md) | Type scale, system fonts, accessibility |
389
- | [mobile-color-system.md](mobile-color-system.md) | OLED optimization, dark mode, battery |
390
- | [decision-trees.md](decision-trees.md) | Framework, state, storage decisions |
391
-
392
- ---
393
-
394
- > **Remember:** Mobile users are impatient, interrupted, and using imprecise fingers on small screens. Design for the WORST conditions: bad network, one hand, bright sun, low battery. If it works there, it works everywhere.