@cometchat/skills 4.3.0 → 4.4.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 (233) hide show
  1. package/LICENSE +21 -0
  2. package/bin/install.js +27 -0
  3. package/package.json +14 -1
  4. package/skills/cometchat/SKILL.md +233 -69
  5. package/skills/cometchat/references/asking-questions.md +48 -0
  6. package/skills/cometchat-a11y/SKILL.md +3 -2
  7. package/skills/cometchat-android-v5/SKILL.md +2 -1
  8. package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
  9. package/skills/cometchat-android-v5-calls/references/README.md +1 -1
  10. package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
  11. package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
  12. package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
  13. package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
  14. package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
  15. package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
  16. package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
  17. package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
  18. package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
  19. package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
  20. package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
  21. package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
  22. package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
  23. package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
  24. package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
  25. package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
  26. package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
  27. package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
  28. package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
  29. package/skills/cometchat-android-v5-components/SKILL.md +4 -3
  30. package/skills/cometchat-android-v5-core/SKILL.md +5 -3
  31. package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
  32. package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
  33. package/skills/cometchat-android-v5-features/SKILL.md +5 -4
  34. package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
  35. package/skills/cometchat-android-v5-production/SKILL.md +2 -1
  36. package/skills/cometchat-android-v5-push/SKILL.md +2 -3
  37. package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
  38. package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
  39. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
  40. package/skills/cometchat-android-v6/SKILL.md +2 -1
  41. package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
  42. package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
  43. package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
  44. package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
  45. package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
  46. package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
  47. package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
  48. package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
  49. package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
  50. package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
  51. package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
  52. package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
  53. package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
  54. package/skills/cometchat-android-v6-core/SKILL.md +208 -28
  55. package/skills/cometchat-android-v6-events/SKILL.md +4 -1
  56. package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
  57. package/skills/cometchat-android-v6-features/SKILL.md +26 -2
  58. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
  59. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
  60. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
  61. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
  62. package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
  63. package/skills/cometchat-android-v6-production/SKILL.md +6 -3
  64. package/skills/cometchat-android-v6-push/SKILL.md +43 -2
  65. package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
  66. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
  67. package/skills/cometchat-angular-calls/SKILL.md +256 -389
  68. package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
  69. package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
  70. package/skills/cometchat-angular-calls/references/call-session.md +2 -2
  71. package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
  72. package/skills/cometchat-angular-calls/references/device-management.md +53 -34
  73. package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
  74. package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
  75. package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
  76. package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
  77. package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
  78. package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
  79. package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
  80. package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
  81. package/skills/cometchat-angular-components/SKILL.md +149 -620
  82. package/skills/cometchat-angular-core/SKILL.md +232 -312
  83. package/skills/cometchat-angular-customization/SKILL.md +415 -223
  84. package/skills/cometchat-angular-features/SKILL.md +216 -334
  85. package/skills/cometchat-angular-patterns/SKILL.md +168 -359
  86. package/skills/cometchat-angular-placement/SKILL.md +189 -560
  87. package/skills/cometchat-angular-production/SKILL.md +241 -92
  88. package/skills/cometchat-angular-push/SKILL.md +280 -294
  89. package/skills/cometchat-angular-testing/SKILL.md +430 -158
  90. package/skills/cometchat-angular-theming/SKILL.md +190 -265
  91. package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
  92. package/skills/cometchat-astro-patterns/SKILL.md +2 -1
  93. package/skills/cometchat-calls/SKILL.md +25 -19
  94. package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
  95. package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
  96. package/skills/cometchat-calls/references/use-case-support.md +3 -4
  97. package/skills/cometchat-calls/references/use-case-team.md +23 -12
  98. package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
  99. package/skills/cometchat-components/SKILL.md +163 -25
  100. package/skills/cometchat-core/SKILL.md +255 -19
  101. package/skills/cometchat-customization/SKILL.md +50 -25
  102. package/skills/cometchat-features/SKILL.md +313 -34
  103. package/skills/cometchat-flutter-v5/SKILL.md +10 -4
  104. package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
  105. package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
  106. package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
  107. package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
  108. package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
  109. package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
  110. package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
  111. package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
  112. package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
  113. package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
  114. package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
  115. package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
  116. package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
  117. package/skills/cometchat-flutter-v5-core/SKILL.md +5 -4
  118. package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
  119. package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
  120. package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
  121. package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
  122. package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
  123. package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
  124. package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
  125. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
  126. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
  127. package/skills/cometchat-flutter-v6/SKILL.md +17 -16
  128. package/skills/cometchat-flutter-v6-calls/SKILL.md +72 -57
  129. package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +5 -3
  130. package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
  131. package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
  132. package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
  133. package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
  134. package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
  135. package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
  136. package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
  137. package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
  138. package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
  139. package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
  140. package/skills/cometchat-flutter-v6-core/SKILL.md +182 -21
  141. package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
  142. package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
  143. package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
  144. package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
  145. package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
  146. package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
  147. package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
  148. package/skills/cometchat-flutter-v6-push/SKILL.md +41 -19
  149. package/skills/cometchat-flutter-v6-testing/SKILL.md +4 -4
  150. package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
  151. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
  152. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
  153. package/skills/cometchat-i18n/SKILL.md +139 -78
  154. package/skills/cometchat-ios/SKILL.md +4 -2
  155. package/skills/cometchat-ios-calls/SKILL.md +225 -95
  156. package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
  157. package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
  158. package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
  159. package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
  160. package/skills/cometchat-ios-calls/references/call-session.md +51 -54
  161. package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
  162. package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
  163. package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
  164. package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
  165. package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
  166. package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
  167. package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
  168. package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
  169. package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
  170. package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
  171. package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
  172. package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
  173. package/skills/cometchat-ios-components/SKILL.md +200 -12
  174. package/skills/cometchat-ios-core/SKILL.md +173 -45
  175. package/skills/cometchat-ios-customization/SKILL.md +276 -110
  176. package/skills/cometchat-ios-features/SKILL.md +64 -36
  177. package/skills/cometchat-ios-placement/SKILL.md +15 -12
  178. package/skills/cometchat-ios-production/SKILL.md +12 -4
  179. package/skills/cometchat-ios-push/SKILL.md +53 -19
  180. package/skills/cometchat-ios-testing/SKILL.md +14 -9
  181. package/skills/cometchat-ios-theming/SKILL.md +39 -3
  182. package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
  183. package/skills/cometchat-native-bare-patterns/SKILL.md +34 -17
  184. package/skills/cometchat-native-calls/SKILL.md +28 -16
  185. package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
  186. package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
  187. package/skills/cometchat-native-calls/references/call-session.md +2 -2
  188. package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
  189. package/skills/cometchat-native-calls/references/device-management.md +53 -30
  190. package/skills/cometchat-native-calls/references/group-calls.md +35 -30
  191. package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
  192. package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
  193. package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
  194. package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
  195. package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
  196. package/skills/cometchat-native-calls/references/share-invite.md +7 -5
  197. package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
  198. package/skills/cometchat-native-components/SKILL.md +84 -52
  199. package/skills/cometchat-native-core/SKILL.md +101 -32
  200. package/skills/cometchat-native-customization/SKILL.md +150 -28
  201. package/skills/cometchat-native-expo-patterns/SKILL.md +57 -26
  202. package/skills/cometchat-native-features/SKILL.md +23 -16
  203. package/skills/cometchat-native-placement/SKILL.md +19 -10
  204. package/skills/cometchat-native-production/SKILL.md +9 -3
  205. package/skills/cometchat-native-push/SKILL.md +2 -1
  206. package/skills/cometchat-native-testing/SKILL.md +1 -2
  207. package/skills/cometchat-native-theming/SKILL.md +54 -29
  208. package/skills/cometchat-native-troubleshooting/SKILL.md +9 -3
  209. package/skills/cometchat-nextjs-patterns/SKILL.md +20 -6
  210. package/skills/cometchat-placement/SKILL.md +42 -3
  211. package/skills/cometchat-production/SKILL.md +12 -5
  212. package/skills/cometchat-react-calls/SKILL.md +220 -10
  213. package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
  214. package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
  215. package/skills/cometchat-react-calls/references/call-session.md +1 -1
  216. package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
  217. package/skills/cometchat-react-calls/references/device-management.md +55 -51
  218. package/skills/cometchat-react-calls/references/group-calls.md +18 -23
  219. package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
  220. package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
  221. package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
  222. package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
  223. package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
  224. package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
  225. package/skills/cometchat-react-calls/references/share-invite.md +4 -5
  226. package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
  227. package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
  228. package/skills/cometchat-react-patterns/SKILL.md +44 -4
  229. package/skills/cometchat-react-push/SKILL.md +258 -72
  230. package/skills/cometchat-react-router-patterns/SKILL.md +10 -4
  231. package/skills/cometchat-react-testing/SKILL.md +14 -5
  232. package/skills/cometchat-theming/SKILL.md +181 -18
  233. package/skills/cometchat-troubleshooting/SKILL.md +40 -20
@@ -3,26 +3,125 @@ name: cometchat-core
3
3
  description: "Shared rules for CometChat React UI Kit v6. Always loaded alongside framework + placement skills. Read this first."
4
4
  license: "MIT"
5
5
  compatibility: "Node.js >=18; React >=18; @cometchat/chat-uikit-react ^6; @cometchat/chat-sdk-javascript ^4"
6
- allowed-tools: "shell, file-read, file-search, file-list"
7
6
  metadata:
8
7
  author: "CometChat"
9
8
  version: "3.0.0"
10
9
  tags: "chat cometchat react core rules initialization patterns"
11
10
  ---
12
11
 
12
+ > **Ground truth:** the installed `@cometchat/chat-uikit-react@^6` + `@cometchat/chat-sdk-javascript@^4` package types (`node_modules/@cometchat/chat-uikit-react`) + `docs/ui-kit/react`. **Official docs:** https://www.cometchat.com/docs/ui-kit/react/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly on agents without MCP). Verify any non-obvious symbol against the installed package types before relying on it.
13
+
13
14
  ## Purpose
14
15
 
15
16
  This is the foundational skill for every CometChat React UI Kit v6 integration. It teaches Claude HOW CometChat works -- initialization, login, CSS, environment variables, SSR safety, and the provider pattern -- so Claude can write project-appropriate code instead of relying on templates.
16
17
 
17
18
  **Read this skill first, before any framework or placement skill.**
18
19
 
20
+ ## When to use
21
+
22
+ - Any React-family integration: Vite + React, Next.js (App or Pages Router), React Router v6/v7, Astro with React islands.
23
+ - BEFORE loading any framework-specific patterns skill (`cometchat-react-patterns`, `cometchat-nextjs-patterns`, etc.) — those layer on top of this.
24
+ - When the user is asking about CometChat init, login, env vars, CSS, provider pattern, SSR safety, or production auth.
25
+
26
+ ## When NOT to use
27
+
28
+ - **React Native** (Expo or bare) — load `cometchat-native-core` instead. The wrappers, env-var prefixes, and lifecycle are different.
29
+ - **Angular** — load `cometchat-angular-core`. Uses `APP_INITIALIZER` + `CUSTOM_ELEMENTS_SCHEMA` + `environment.ts`, not React's provider chain.
30
+ - **Native Android (V5 or V6)** — load `cometchat-android-v5-core` or `cometchat-android-v6-core`. Kotlin init, `local.properties` credentials.
31
+ - **Native iOS (V5)** — load `cometchat-ios-core`. Swift init, CocoaPods/SPM.
32
+ - **Flutter (V5 or V6)** — load `cometchat-flutter-v5-core` or `cometchat-flutter-v6-core`. Dart init via `pubspec.yaml`.
33
+ - **Backend-only token-mint server work** — load `cometchat-production` for the REST-API token recipes; this skill is client-side.
34
+
35
+ ## Common Rationalizations — and why they're wrong
36
+
37
+ A two-column anti-skip defense. Every excuse below has been used by agents (or could plausibly be) to skip rules in this skill. The rebuttal cites the validated incident.
38
+
39
+ | Excuse the agent might invent | Reality |
40
+ |---|---|
41
+ | "StrictMode double-invocation is a dev-only quirk, so I can skip the in-flight login promise pattern (§2)" | The same race fires anywhere a parent component re-mounts (React Router v6 nested routes, Suspense boundary retries, error-boundary resets). Skipping yields the canonical `"Please wait until the previous login request ends"` error on production refreshes too. |
42
+ | "This is a quick prototype, I'll hardcode `cometchat-uid-1` instead of asking the user" | Two testers shipped apps where the default UID was a Bot in their dashboard (ENG-35717). Auth-key login refuses bot users by design; the error `Auth token creation not allowed for this bot <uid>` is opaque. **Always ask via the dispatcher's Step 3d.1 prompt.** |
43
+ | "I'll use `setError(String(e))` for now and pretty-print later" | `String(e)` on a CometChatException renders `[object Object]` — testers wasted 10-minute debugging sessions on this (ENG-35719). Always emit the §6 `formatCometChatError` helper from `cometchat/errors.ts`. "Later" never comes. |
44
+ | "The env file looks right, I don't need to run `config show --json`" | Two testers shipped code with empty `VITE_COMETCHAT_APP_ID` because the dispatcher moved on without confirming (ENG-35718). The pre-flight is 1 second; the cost of skipping is a customer-facing init failure. |
45
+ | "I know React, I can skip reading the framework-specific patterns skill" | The framework patterns carry version-pinned traps that aren't in training data: the Next.js 15+ rule `dynamic(ssr:false)` must live in a Client Component (verified by runtime smoke 2026-06-02), the Vite Visual Builder `tsconfig` patches (resolveJsonModule, jsx: react-jsx, verbatimModuleSyntax: false), the React Router v7 `appDirectory` constraint. Skipping = customer-visible build failure. |
46
+ | "I'll add the telemetry hook later; the basic provider works without it" | The telemetry prop is opt-in by design (no-op if not passed) — but the four lifecycle events (init_started / init_finished / login_started / login_finished + their _failed variants) are how customers wire analytics into onboarding funnels without monkey-patching. Skipping ENG-35715 wiring means the customer has to refactor their provider post-launch. |
47
+
48
+ ## Red flags — signs you're misapplying this skill
49
+
50
+ - The agent emitted `setError(String(e))` anywhere in code — should be `setError(formatCometChatError(e))` per §6 (ENG-35719).
51
+ - The agent's plan (Step 3f) doesn't include `cometchat/errors.ts` as a created file.
52
+ - The agent emitted bare `CometChatUIKit.login(uid)` without the in-flight-promise guard (`ensureLoggedIn`) — guaranteed StrictMode race in dev.
53
+ - A `<style>` or CSS rule targets internal class names like `.cometchat-conversation-list-item` (anti-pattern §8.3) instead of the `--cometchat-*` CSS variables.
54
+ - The agent picked `cometchat-uid-1` without asking the user (ENG-35717 — the bot-flag failure mode).
55
+ - The agent's env file uses the wrong framework prefix (e.g., `VITE_*` in a Next.js project, or `EXPO_PUBLIC_*` in a Vite project).
56
+ - The provider doesn't gate `{children}` on `isReady` — chat components mount before init completes and throw `CometChat is not initialized` errors.
57
+
58
+ ## Verification — before declaring this skill applied
59
+
60
+ Run through this checklist before saying "done" for any task that touched cometchat-core territory:
61
+
62
+ - [ ] `grep -nE "setError\(String\(" src/` returns ZERO matches (ENG-35719 — must use `formatCometChatError`).
63
+ - [ ] `src/cometchat/errors.ts` exists and exports `formatCometChatError` + `logCometChatError`.
64
+ - [ ] The provider has an `ensureLoggedIn`-style in-flight guard (no bare `CometChatUIKit.login` calls).
65
+ - [ ] `tsc --noEmit` passes against the project's existing `tsconfig`.
66
+ - [ ] Env vars use the **detected framework's prefix** (`VITE_*` / `NEXT_PUBLIC_*` / `PUBLIC_*` / `EXPO_PUBLIC_*`), and `.env` (or `.env.local` for Next.js) is in `.gitignore`.
67
+ - [ ] CSS imports happen once at the entry / root (per framework section in §3).
68
+ - [ ] If the user is on Next.js: the page that owns CometChat components has `"use client"` (App Router) or is dynamic-imported with `ssr: false` (App Router only inside another Client Component, per the Next.js 15+ rule verified 2026-06-02).
69
+ - [ ] The user confirmed the dev-mode UID via the dispatcher's Step 3d.1 prompt — NOT silently picked.
70
+
19
71
  ---
20
72
 
21
73
  ## 1. Initialization
22
74
 
23
75
  CometChat must be initialized exactly once before any UI component renders. Initialization is asynchronous and must complete fully before mounting any `CometChat*` component.
24
76
 
25
- ### The UIKitSettingsBuilder
77
+ ### File-based init with `cometchat-settings.json` (recommended)
78
+
79
+ > **Version requirement (ENG-35866 — Skills Telemetry).** `CometChatUIKit.initFromSettings(settings)` reads a `cometchat-settings.json` object and lets the SDK self-report `integrationSource = "ai-agent"` to `/user_sessions`. It ships GA in **`@cometchat/chat-uikit-react >= 6.5.2`** + **`@cometchat/chat-sdk-javascript >= 4.1.11`** (npm `latest`). On an older UI Kit the method does not exist — use the **`UIKitSettingsBuilder` fallback** below.
80
+
81
+ **Step 1 — create `cometchat-settings.json` at the project root.** Fill `appId` / `region` / `credentials.authKey` from the CLI `provision setup` output; leave everything else at the defaults below. This is the single source of credentials — no second copy to keep in sync.
82
+
83
+ ```json
84
+ {
85
+ "appId": "APP_ID_HERE",
86
+ "region": "us",
87
+ "credentials": {
88
+ "authKey": "AUTH_KEY_HERE"
89
+ },
90
+ "chatSDK": {
91
+ "presenceSubscription": {
92
+ "type": "ALL_USERS",
93
+ "roles": []
94
+ },
95
+ "autoEstablishSocketConnection": true,
96
+ "adminHost": null,
97
+ "clientHost": null
98
+ },
99
+ "callsSDK": {
100
+ "host": null,
101
+ "adminHost": null,
102
+ "clientHost": null,
103
+ "callsHost": null
104
+ },
105
+ "uiKit": {
106
+ "subscribePresenceForAllUsers": true
107
+ }
108
+ }
109
+ ```
110
+
111
+ **Step 2 — init by importing the JSON as a build-time module.** Vite, CRA, Next.js, and Astro all have `resolveJsonModule` on by default, so the import is type-safe with no extra config:
112
+
113
+ ```typescript
114
+ // initFromSettings ships GA in @cometchat/chat-uikit-react >= 6.5.2 (ENG-35866)
115
+ import { CometChatUIKit } from "@cometchat/chat-uikit-react";
116
+ import cometchatSettings from "./cometchat-settings.json"; // adjust path to the file's location
117
+
118
+ await CometChatUIKit.initFromSettings(cometchatSettings);
119
+ ```
120
+
121
+ - **Do NOT gitignore `cometchat-settings.json`.** The dev-mode `authKey` it holds is no more exposed than a `VITE_COMETCHAT_AUTH_KEY=…` env value (both ship in the built bundle); production integrations migrate to server-minted auth tokens regardless.
122
+ - The same module-flag / `useEffect` / entry-point placement rules in the rest of this section apply unchanged — just swap `CometChatUIKit.init(settings)` for `CometChatUIKit.initFromSettings(cometchatSettings)`.
123
+
124
+ ### The UIKitSettingsBuilder (fallback — UI Kit before file-based init)
26
125
 
27
126
  ```typescript
28
127
  import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
@@ -46,6 +145,16 @@ async function initCometChat(): Promise<void> {
46
145
  if (initialized) return;
47
146
  initialized = true;
48
147
 
148
+ // Fail loud if env vars didn't load. Empty credentials otherwise surface
149
+ // much later as a cryptic `ERROR_API_KEY_NOT_FOUND` / failed init that's hard
150
+ // to trace back to a missing/mis-prefixed .env. (audit P0-5)
151
+ if (!APP_ID || !REGION || !AUTH_KEY) {
152
+ throw new Error(
153
+ "CometChat credentials are empty — check .env and the framework's env prefix " +
154
+ "(VITE_ / NEXT_PUBLIC_ / PUBLIC_), and restart the dev server after editing .env.",
155
+ );
156
+ }
157
+
49
158
  const settings = new UIKitSettingsBuilder()
50
159
  .setAppId(APP_ID)
51
160
  .setRegion(REGION)
@@ -116,7 +225,13 @@ async function ensureLoggedIn(
116
225
  authToken?: string,
117
226
  ): Promise<void> {
118
227
  const existing = await CometChatUIKit.getLoggedinUser();
119
- if (existing) return; // sequential case already logged in
228
+ // Same user already logged in → nothing to do (sequential case).
229
+ if (existing && existing.getUid?.() === uid) return;
230
+ // A DIFFERENT user is logged in (account switch, or logout → login-as-other).
231
+ // Log out first: otherwise the SDK keeps the old session and login() silently
232
+ // no-ops, so the app shows the previous account. (Switching accounts requires
233
+ // an explicit logout — login() is a no-op against an existing session.)
234
+ if (existing) await CometChatUIKit.logout();
120
235
  if (loginInFlight) { // concurrent case — reuse pending promise
121
236
  await loginInFlight;
122
237
  return;
@@ -386,12 +501,23 @@ async function ensureLoggedIn(
386
501
  }
387
502
  }
388
503
 
504
+ // ENG-35715 telemetry hook — opt-in callback for init/login lifecycle.
505
+ // Fires at six phases. If `telemetry` prop is not passed, all calls are no-ops.
506
+ export type CometChatTelemetryEvent =
507
+ | { phase: "init_started"; appId: string; region: string }
508
+ | { phase: "init_finished"; durationMs: number }
509
+ | { phase: "init_failed"; error: unknown }
510
+ | { phase: "login_started"; uid: string; mode: "authKey" | "authToken" }
511
+ | { phase: "login_finished"; durationMs: number }
512
+ | { phase: "login_failed"; error: unknown };
513
+
389
514
  interface CometChatProviderProps {
390
515
  appId: string;
391
516
  region: string;
392
517
  authKey?: string;
393
518
  authToken?: string;
394
519
  uid?: string;
520
+ telemetry?: (event: CometChatTelemetryEvent) => void; // ← opt-in lifecycle hook
395
521
  children: React.ReactNode;
396
522
  }
397
523
 
@@ -401,6 +527,7 @@ export function CometChatProvider({
401
527
  authKey,
402
528
  authToken,
403
529
  uid = "cometchat-uid-1",
530
+ telemetry,
404
531
  children,
405
532
  }: CometChatProviderProps) {
406
533
  const [isReady, setIsReady] = useState(false);
@@ -408,9 +535,11 @@ export function CometChatProvider({
408
535
 
409
536
  useEffect(() => {
410
537
  async function setup() {
538
+ const initStart = performance.now();
411
539
  try {
412
540
  if (!initialized) {
413
541
  initialized = true;
542
+ telemetry?.({ phase: "init_started", appId, region });
414
543
  const builder = new UIKitSettingsBuilder()
415
544
  .setAppId(appId)
416
545
  .setRegion(region)
@@ -422,18 +551,25 @@ export function CometChatProvider({
422
551
 
423
552
  const settings = builder.build();
424
553
  await CometChatUIKit.init(settings);
554
+ telemetry?.({ phase: "init_finished", durationMs: performance.now() - initStart });
425
555
  }
426
556
 
557
+ const loginStart = performance.now();
558
+ telemetry?.({ phase: "login_started", uid, mode: authToken ? "authToken" : "authKey" });
427
559
  await ensureLoggedIn(uid, authToken);
560
+ telemetry?.({ phase: "login_finished", durationMs: performance.now() - loginStart });
428
561
 
429
562
  setIsReady(true);
430
563
  } catch (e) {
431
- setError(String(e));
564
+ // If init never completed, this is an init_failed; otherwise login_failed.
565
+ const phase = isReady ? "login_failed" : "init_failed";
566
+ telemetry?.({ phase, error: e } as CometChatTelemetryEvent);
567
+ setError(formatCometChatError(e));
432
568
  }
433
569
  }
434
570
 
435
571
  setup();
436
- }, [appId, region, authKey, authToken, uid]);
572
+ }, [appId, region, authKey, authToken, uid, telemetry]);
437
573
 
438
574
  if (error) {
439
575
  return (
@@ -463,6 +599,16 @@ export function CometChatProvider({
463
599
  appId={import.meta.env.VITE_COMETCHAT_APP_ID}
464
600
  region={import.meta.env.VITE_COMETCHAT_REGION}
465
601
  authKey={import.meta.env.VITE_COMETCHAT_AUTH_KEY}
602
+ // Optional — wire your analytics on each lifecycle event (ENG-35715):
603
+ telemetry={(event) => {
604
+ if (event.phase === "init_finished" || event.phase === "login_finished") {
605
+ analytics.track(`cometchat.${event.phase}`, { ms: event.durationMs });
606
+ } else if (event.phase === "init_failed" || event.phase === "login_failed") {
607
+ analytics.trackError(`cometchat.${event.phase}`, { error: String(event.error) });
608
+ } else {
609
+ analytics.track(`cometchat.${event.phase}`, event);
610
+ }
611
+ }}
466
612
  >
467
613
  <ChatPage />
468
614
  </CometChatProvider>
@@ -470,6 +616,83 @@ export function CometChatProvider({
470
616
 
471
617
  The provider pattern keeps init/login logic in one place. Chat components inside `<CometChatProvider>` are guaranteed to render only after init and login succeed.
472
618
 
619
+ ### Pretty-print errors — DO NOT `String(error)` (ENG-35719)
620
+
621
+ `CometChat.CometChatException` objects look like `{ code: "ERROR_API_KEY_NOT_FOUND", message: "Auth Key cannot be empty", details: ..., source: ... }` (in some kit versions the fields are `errorCode` / `errorDescription`). Calling `String(e)` on them yields `"[object Object]"` — the integrator then has to open devtools, copy the error to the console, and `JSON.stringify` it by hand just to read the message. Testers consistently flag this as the most frustrating moment of the first-run integration.
622
+
623
+ **Emit this helper in `cometchat/errors.ts` and reuse it from the provider, login screen, and any feature module that catches a kit error:**
624
+
625
+ ```typescript
626
+ // cometchat/errors.ts
627
+ export function formatCometChatError(e: unknown): string {
628
+ if (e == null) return "Unknown CometChat error.";
629
+ const err = e as Record<string, unknown>;
630
+ const code =
631
+ (err.code as string | undefined) ??
632
+ (err.errorCode as string | undefined);
633
+ const message =
634
+ (err.message as string | undefined) ??
635
+ (err.errorDescription as string | undefined);
636
+ if (code && message) return `[CometChat ${code}] ${message}`;
637
+ if (message) return `[CometChat] ${message}`;
638
+ try {
639
+ return `[CometChat] ${JSON.stringify(e)}`;
640
+ } catch {
641
+ return `[CometChat] ${String(e)}`;
642
+ }
643
+ }
644
+
645
+ const KNOWN_DOC_HINTS: Record<string, string> = {
646
+ ERROR_API_KEY_NOT_FOUND:
647
+ "Auth Key is missing or invalid. Check your env vars (VITE_COMETCHAT_AUTH_KEY / EXPO_PUBLIC_COMETCHAT_AUTH_KEY) and confirm the key in Dashboard → App → Credentials.",
648
+ ERR_UID_NOT_FOUND:
649
+ "The UID you're logging in with doesn't exist in this CometChat app. Create the user in Dashboard → Users, or pick one of the pre-seeded test UIDs (cometchat-uid-1 .. cometchat-uid-5).",
650
+ ERR_AUTH_TOKEN_NOT_FOUND:
651
+ "Auth token is empty or expired. Re-mint it from your backend via the CometChat REST API.",
652
+ AUTH_ERR_BOT:
653
+ "This UID is flagged as a Bot in the dashboard — auth-key login is refused for bot users by design. Toggle Bot OFF in Dashboard → Users, or pick a non-bot UID.",
654
+ };
655
+
656
+ export function logCometChatError(e: unknown): void {
657
+ const formatted = formatCometChatError(e);
658
+ console.error(formatted, e);
659
+ const code = (e as { code?: string; errorCode?: string })?.code ??
660
+ (e as { code?: string; errorCode?: string })?.errorCode;
661
+ if (code && KNOWN_DOC_HINTS[code]) {
662
+ console.warn(`[CometChat hint] ${KNOWN_DOC_HINTS[code]}`);
663
+ }
664
+ }
665
+ ```
666
+
667
+ Then in the provider:
668
+
669
+ ```typescript
670
+ } catch (e) {
671
+ logCometChatError(e);
672
+ setError(formatCometChatError(e));
673
+ }
674
+ ```
675
+
676
+ And in the error renderer:
677
+
678
+ ```tsx
679
+ if (error) {
680
+ return (
681
+ <div role="alert" style={{ color: "#b91c1c", padding: 16, fontFamily: "ui-monospace, monospace", whiteSpace: "pre-wrap" }}>
682
+ <strong>CometChat failed to initialize.</strong>
683
+ <div style={{ marginTop: 8 }}>{error}</div>
684
+ <div style={{ marginTop: 8, fontSize: 12, opacity: 0.7 }}>
685
+ See the browser console for the full error object and any [CometChat hint] line above it.
686
+ </div>
687
+ </div>
688
+ );
689
+ }
690
+ ```
691
+
692
+ This three-part recipe — `formatCometChatError` for the visible message, `logCometChatError` for the console (with a docs hint for known codes), and a multi-line render that points at the console — turns "ERR_API_KEY_NOT_FOUND" from a 10-minute debugging session into a 10-second fix.
693
+
694
+ > ⚠️ **Replace `setError(String(e))` everywhere.** The two earlier examples in this skill (§1 init-in-useEffect, §6 provider's setup() catch) use `setError(String(e))` for compactness — when you scaffold the real integration, emit `formatCometChatError(e)` instead and import it from `cometchat/errors.ts`. The same applies to RN (`cometchat-native-core`), Angular (`cometchat-angular-core`), and the native cores — the helper is platform-agnostic, just adapt the file extension.
695
+
473
696
  ---
474
697
 
475
698
  ## 7. RTL, i18n, and accessibility
@@ -496,23 +719,27 @@ CometChatLocalize.init({
496
719
  });
497
720
  ```
498
721
 
499
- For a dynamic language switcher, call `CometChatLocalize.setLocale(newLang)` when the user picks a language. The UI Kit re-renders with the new strings.
722
+ For a dynamic language switcher, call `CometChatLocalize.setCurrentLanguage(newLang)` when the user picks a language (NOT `setLocale` — that method doesn't exist in v6). The UI Kit re-renders with the new strings.
500
723
 
501
- **To override a string:** the `resources` option accepts custom translations merged over the defaults. Useful for brand-specific terms:
724
+ **To override a string:** there's no nested `resources: { en: {...} }` option. Use either `translationsForLanguage` at init (a FLAT key→value map for the chosen `language`), or the standalone `CometChatLocalize.addTranslation({...})`:
502
725
 
503
726
  ```typescript
727
+ // (a) at init — flat map for the active language
504
728
  CometChatLocalize.init({
505
729
  language: "en",
506
- resources: {
507
- en: {
508
- "type a message": "Write your message…",
509
- "start a conversation": "Say hi 👋",
510
- },
730
+ translationsForLanguage: {
731
+ "type a message": "Write your message…",
732
+ "start a conversation": "Say hi 👋",
511
733
  },
512
734
  });
735
+
736
+ // (b) anytime after init
737
+ CometChatLocalize.addTranslation({
738
+ "type a message": "Write your message…",
739
+ });
513
740
  ```
514
741
 
515
- **Full translation key list** lives in `node_modules/@cometchat/chat-uikit-react/dist/resources/` or the docs MCP. Don't invent keys — unknown keys fall through to the default.
742
+ **Full translation key list** lives under `node_modules/@cometchat/chat-uikit-react/dist/types/resources/` (types) or the docs MCP. Don't invent keys — unknown keys fall through to the default.
516
743
 
517
744
  ### Accessibility
518
745
 
@@ -629,6 +856,11 @@ Install with your project's package manager:
629
856
  npm install @cometchat/chat-uikit-react @cometchat/chat-sdk-javascript
630
857
  ```
631
858
 
859
+ > 💡 **Cost transparency (ENG-35722) — disclose proactively when integrating into a new project:** the kit adds roughly **2.8 MB of JS** (~860 KB gzipped), **~860 KB of CSS**, and **~1.5 MB of Roboto TTF fonts** (9 weights bundled). If the customer's app already loads custom fonts, the Roboto bundle is redundant; override via the `--cometchat-font-family` CSS variable to skip preloading the kit fonts (the TTFs still ship but the browser doesn't download them unless they're actually used). For SaaS founders evaluating CometChat vs self-build, also mention:
860
+ > - **Pricing:** https://www.cometchat.com/pricing (free tier covers small dev/test use)
861
+ > - **Data extraction / migration:** REST API endpoints `GET /v3/users`, `GET /v3/groups`, `GET /v3/messages?conversationId=` can export everything; no proprietary lock-in
862
+ > - **Demo without account:** for `intent: "evaluating"` users, point at the hosted demo at https://app.cometchat.com/login (sign-up gives a free app immediately; ENG-35722 demo-without-account hosted-demo is a vendor follow-up)
863
+
632
864
  ### SDK types you will use
633
865
 
634
866
  ```typescript
@@ -648,9 +880,11 @@ CometChat.getGroup(guid: string): Promise<CometChat.Group>
648
880
 
649
881
  ## 11. Visual Builder integration
650
882
 
651
- When the dispatcher's Step 3.1 sets `customize=visual`, skills runs **`cometchat builder export --platform react`** — a single CLI command that mirrors the dashboard's Export-button workflow. It downloads the canonical static template ZIP from `preview.cometchat.com/downloads/cometchat-builder-react.zip`, fetches the per-builder settings JSON via `GET /vcb/builders/{id}`, unzips the template, patches `CometChatSettings.ts` with the fetched JSON + missing-field defaults + a sentinel comment, and writes the result to `--output` (default: `src/CometChat/`).
883
+ When the dispatcher's Step 3.1 sets `customize=visual`, skills runs **`cometchat builder export --platform react`** — a single CLI command that mirrors the dashboard's Export-button workflow. It downloads the canonical static template ZIP from `preview.cometchat.com/downloads/cometchat-builder-react.zip`, fetches the per-builder settings JSON via `GET /vcb/builders/{id}`, unzips the template, **splices** the fetched JSON (+ missing-field defaults) into `CometChatSettings.ts`, and writes the result to `--output` (default: `src/CometChat/`).
652
884
 
653
- The `src/CometChat/` directory contains `CometChatApp.tsx`, the repo's own `CometChatProvider`-style context, `CometChatHome` with tabs (Chats / Calls / Users / Groups), theme hooks (`useThemeStyles`, `useSystemColorScheme`), login listener wiring, and 13 supporting components. Skills does NOT hand-roll a wrapper — the canonical app IS the wrapper.
885
+ **How `CometChatSettings.ts` is patched (splice, not full-file overwrite):** the canonical file declares both `export interface CometChatSettingsInterface { ... }` and `export const CometChatSettings: CometChatSettingsInterface = { ... }`. The CLI rewrites **only the `export const CometChatSettings = {...}` object literal** with the per-builder JSON, **preserving the `export interface CometChatSettingsInterface`** above it (the const is typed against that interface destroying it breaks the build). The sentinel comment (`SKILLS-AUTO-GENERATED — do not edit by hand. Last sync: <ISO>`) is **prepended to the spliced file**. Do not describe this as a full-file replace.
886
+
887
+ The `src/CometChat/` directory contains `CometChatApp.tsx`, the repo's own `CometChatProvider`-style context, `CometChatHome` with tabs (Chats / Calls / Users / Groups), theme hooks (`useThemeStyles`, `useSystemColorScheme`), login listener wiring, and 13 supporting components. Skills does NOT hand-roll these — the copied directory is the integration. Two valid render entry points exist: the canonical CRA app's own `src/App.tsx` composes `CometChatHome` + `CometChatLogin` directly (gated on a login listener), while the Next.js entry renders the higher-level `<CometChatApp />` wrapper. Both are fine — `<CometChatApp />` is the simplest, but don't assume it's the only canonical shape.
654
888
 
655
889
  This is the same pattern iOS (verbatim `MessagesVC.swift`), Android v6 (verbatim `BuilderSettingsHelper.kt`), and Flutter v6 (verbatim `chat_builder/` package) use. React just happens to copy a directory of TSX files instead of a single class.
656
890
 
@@ -670,7 +904,7 @@ This produces the full per-builder integration in one shot:
670
904
  | Fetches per-builder settings | `GET /vcb/builders/{builderId}` via the same `Bearer` token used elsewhere |
671
905
  | Applies F3 + F10 missing-field defaults | `chatFeatures.inAppSounds` + `chatFeatures.deeperUserEngagement.mentionAll` |
672
906
  | Unzips template into temp dir | `/tmp/cometchat-builder-export-XXXX/extracted/` |
673
- | Patches `CometChatSettings.ts` | Per-builder JSON + sentinel comment ("SKILLS-AUTO-GENERATED — do not edit by hand. Last sync: <ISO>") |
907
+ | Splices `CometChatSettings.ts` | Rewrites only the `export const CometChatSettings = {...}` literal with the per-builder JSON; preserves `export interface CometChatSettingsInterface`; prepends the sentinel comment ("SKILLS-AUTO-GENERATED — do not edit by hand. Last sync: <ISO>") |
674
908
  | Copies to `--output` | Default `src/CometChat/` |
675
909
  | Reports JSON | `{ status: "exported", builderId, appId, platform, output, settings_file, builder_name }` |
676
910
 
@@ -684,9 +918,9 @@ The `builder export` command writes the canonical files. Skills then patches the
684
918
 
685
919
  | Path | Patch |
686
920
  |---|---|
687
- | `package.json` | (1) `npm install @cometchat/chat-uikit-react@6.4.3 @cometchat/calls-sdk-javascript@4.2.5` — **pinned versions from the canonical repo's README**. Older/newer versions of `chat-uikit-react` may drift from the exported `src/CometChat/` directory's expected API surface. (2) **Add a top-level `cometChatCustomConfig` block** the canonical context reads it via `import packageJson from "../../../package.json"` and accesses `packageJson.cometChatCustomConfig.name` / `.version` / `.production` for init wiring. Without it, the build fails with `TS2339: Property 'cometChatCustomConfig' does not exist`. Shape: `"cometChatCustomConfig": { "name": "<your-app-name>", "version": "<your-app-version>", "production": true }`. |
921
+ | `package.json` | (1) `npm install @cometchat/chat-uikit-react@6.4.3 @cometchat/calls-sdk-javascript@4.2.5` — **pinned versions from the canonical repo's README**. Older/newer versions of `chat-uikit-react` may drift from the exported `src/CometChat/` directory's expected API surface. (2) **REQUIRED for Vite — add the `cometChatCustomConfig` block to `package.json`.** The canonical `package.json` carries a top-level `cometChatCustomConfig` block, and the copied context (`CometChat/context/CometChatContext.tsx:~216`) reads `pkg?.default?.cometChatCustomConfig.name`. This **IS build-breaking on Vite**: the Builder tsconfig requires `resolveJsonModule: true` (next row), so `tsc -b` (the project-references build `npm run build` runs) **statically types `package.json`** → `TS2339: Property 'cometChatCustomConfig' does not exist` when absent. (`tsc --noEmit` passes and HIDES this — use `tsc -b`/`npm run build` for the build proof. Verified 2026-06-14 on a real export build.) Add: `"cometChatCustomConfig": { "name": "<your-app-name>", "version": "<your-app-version>", "production": true }`. |
688
922
  | Entry file — `src/main.tsx` (Vite) / `src/index.tsx` (CRA) / new client component (Next.js) / route file (React Router) / `.astro` page (Astro) | Init UI Kit + render `<CometChatProvider><App /></CometChatProvider>`. Pattern below — varies by framework. |
689
- | `tsconfig.app.json` (Vite 7+) or `tsconfig.json` (CRA / older Vite) | **Multiple non-negotiable adjustments** beyond `resolveJsonModule` + `jsx`. The canonical `src/CometChat/` was authored under CRA's looser TS settings; Vite 7+ template defaults are too strict and will fail the build with dozens of `TS6133` / `TS1484` errors:<br>• `"resolveJsonModule": true` — non-negotiable (`utils/utils.ts` imports a JSON locale)<br>• `"jsx": "react-jsx"` — non-negotiable<br>• `"verbatimModuleSyntax": false` — Vite 7+ default is `true`; canonical code uses mixed value + type imports without the `type` modifier<br>• `"noUnusedLocals": false` — Vite 7+ default is `true`; canonical code has many unused-by-default destructured listener args (e.g. `({ groupOwner, kickedUser, ... })`)<br>• `"noUnusedParameters": false` — same rationale<br>• `"erasableSyntaxOnly": false` — Vite 7+ template flag; canonical code uses const enums / namespace patterns<br>• `"allowJs": true` — canonical app's tsconfig sets this; some kit internals may rely on JS fallthrough<br>Validated 2026-05-21 against `create-vite@8` + canonical `uikit-builder-app-master` + `@cometchat/chat-uikit-react@6.4.3`. |
923
+ | `tsconfig.app.json` (Vite 7+) or `tsconfig.json` (CRA / older Vite) | **Imports resolve on Vite as-is** the current `builder export` writes `src/CometChat/` with **relative imports** (`../utils/utils`, `../context/CometChatContext`), NOT the bare `CometChat/…`-rooted imports older CRA exports used. So you do **NOT** need `vite-tsconfig-paths` / `baseUrl` (verified 2026-06-14: zero `from "CometChat/…"` in a fresh export; resolves on Vite out of the box). *(Historical: pre-2026 CRA exports used `baseUrl:"./src"` bare imports that needed `vite-tsconfig-paths`; the current template ships relative.)*<br><br>You DO still need these stricter-than-CRA tsconfig flags — Vite 7+ template defaults will otherwise fail the build with `TS6133` / `TS1484`:<br>• `"resolveJsonModule": true` — required (`utils/utils.ts` imports a JSON locale)<br>• `"jsx": "react-jsx"` — required<br>• `"verbatimModuleSyntax": false` — Vite 7+ default is `true`; canonical code uses mixed value + type imports without the `type` modifier<br>• `"noUnusedLocals": false` — Vite 7+ default is `true`; canonical code has many unused-by-default destructured listener args (e.g. `({ groupOwner, kickedUser, ... })`)<br>• `"noUnusedParameters": false` — same rationale<br>• `"erasableSyntaxOnly": false` — Vite 7+ template flag; canonical code uses const enums / namespace patterns<br>• `"allowJs": true` — canonical app's tsconfig sets this; some kit internals may rely on JS fallthrough<br>Validated 2026-05-21 against `create-vite@8` + canonical `uikit-builder-app` (CRA) + `@cometchat/chat-uikit-react@6.4.3`. |
690
924
  | `.env` (framework-prefixed) | Already written by Step 2c provision. Skip if present; warn if missing. |
691
925
 
692
926
  The `builder export` command handles the JSON patching + sentinel comment automatically. Skills only needs to patch the four files above (package.json, entry file, tsconfig, .env).
@@ -790,7 +1024,7 @@ This matches the product contract for step 7 of the UI Kit Builder workflow:
790
1024
  3. Apply the F3 + F10 missing-field defaults
791
1025
  4. Replace the `src/CometChat/` directory entirely
792
1026
 
793
- **Customer hand-edits inside `src/CometChat/` are lost on resync.** This is intentional — the SKILLS-AUTO-GENERATED sentinel comment on `CometChatSettings.ts` documents the "do not edit by hand" contract.
1027
+ **Customer hand-edits inside `src/CometChat/` are lost on resync.** This is intentional — the SKILLS-AUTO-GENERATED sentinel comment prepended to `CometChatSettings.ts` documents the "do not edit by hand" contract. (Note the export itself is a splice — only the `export const CometChatSettings = {...}` literal is rewritten and `export interface CometChatSettingsInterface` is preserved — but on `--force` resync the whole `src/CometChat/` directory is re-downloaded and replaced, so any in-folder hand-edits are discarded regardless.)
794
1028
 
795
1029
  If a customer needs to override beyond what the Visual Builder exposes, the supported escape hatches are:
796
1030
  - Edit the entry file (e.g., `src/main.tsx`) — outside `src/CometChat/`, never touched by resync
@@ -798,6 +1032,8 @@ If a customer needs to override beyond what the Visual Builder exposes, the supp
798
1032
  - Use `cometchat apply-feature <id>` for extension toggles (server-side, survives resync)
799
1033
  - For one-off CSS overrides, edit `src/index.css` or equivalent — also outside `src/CometChat/`
800
1034
 
1035
+ > **Builder feature toggles vs. dashboard extensions — two independent layers.** The Visual Builder's `chatFeatures` toggles (baked into `CometChatSettings.ts`) only control whether a feature's **UI** is shown. Extension- and AI-backed features (polls, message translation, collaborative document/whiteboard, stickers, smart replies, conversation starter/summary) need their **server-side capability** enabled separately — the dashboard extensions store, which `cometchat apply-feature <id>` writes and the builder export **never touches**. So: (a) `apply-feature`'d extensions always survive `builder export --force`; (b) turning a feature ON in the builder shows its UI but it fails at runtime until the matching extension is enabled — that's why `builder export` reports a `dashboardSetupNeeded` list (the dispatcher runs `apply-feature` for each). The two flows are complementary: the builder draws the UI, `apply-feature` turns on the capability behind it.
1036
+
801
1037
  The `cometchat-core` §11.7 "Override hook pattern" documents the recommended places to override without touching the canonical.
802
1038
 
803
1039
  `verify --builder` runs after resync to confirm the new export is structurally sound.
@@ -3,13 +3,14 @@ name: cometchat-customization
3
3
  description: Customize a CometChat React UI Kit integration beyond what `cometchat init` and `cometchat apply-feature` produce — custom message bubbles, custom header views, custom subtitle views, custom empty/loading states, custom action menus, request builder filters, event listeners, and component composition. Picks up where the framework skills end (after Phase A init succeeds).
4
4
  license: "MIT"
5
5
  compatibility: "Node.js >=18; @cometchat/chat-uikit-react ^6"
6
- allowed-tools: "shell, file-read, file-search, file-list, grep"
7
6
  metadata:
8
7
  author: "CometChat"
9
8
  version: "3.0.0"
10
9
  tags: "cometchat react customization custom-view message-bubble header-view subtitle-view request-builder events"
11
10
  ---
12
11
 
12
+ > **Ground truth:** the per-platform UI Kit customization systems (theme objects / CSS vars, message templates, text formatters) verified against the installed kit. (Official docs linked below.) Verify symbols against the installed package/source before relying on them.
13
+
13
14
  > **Companion skills:** `cometchat-components` provides the component
14
15
  > catalog (what exists); this skill provides the customization workflow
15
16
  > (how to modify what exists). Use `cometchat-components` to look up
@@ -41,8 +42,8 @@ Trigger phrases:
41
42
  - The user wants to enable a **packaged feature** (calls, polls, AI smart
42
43
  replies, etc.) → use `cometchat-features` instead
43
44
  - The user wants to change **theme tokens** (primary color, font,
44
- border radius) → use `cometchat-theming` instead — `cometchat
45
- apply-theme` is deterministic and doesn't need this skill
45
+ border radius) → use `cometchat-theming` instead (CSS-variable
46
+ overrides written directly into the project there is no theming CLI)
46
47
  - The user wants to **start a new integration** → use the `cometchat`
47
48
  dispatcher skill to run Phase A first
48
49
  - The user wants to **fix something broken** → use
@@ -56,13 +57,19 @@ event topic, CSS selector) that lives in the canonical CometChat docs,
56
57
  not in this skill's text. Embedding examples here would create drift
57
58
  the moment the SDK changes.
58
59
 
59
- The CometChat docs MCP at `cometchat-docs` is a **hard requirement**
60
- for this skill. It's the source of truth for:
60
+ The canonical CometChat docs are the source of truth for this skill. The
61
+ docs MCP at `cometchat-docs` is the **best** way to query them when
62
+ available, but it is **not** a hard requirement — fall back to the public
63
+ docs site for any agent without it. The docs cover:
61
64
 
62
65
  - Component prop tables (every component, every prop, every default)
63
66
  - Custom view slots: `headerView`, `subtitleView`, `tailView`,
64
- `optionsView`, `bubbleView`, `emptyStateView`, `loadingStateView`,
65
- `errorStateView` (which components support which slots)
67
+ `optionsView`, `bubbleView`, `emptyView`, `loadingView`, `errorView`
68
+ (which components support which slots — verified against the v6 React
69
+ kit: the list components `CometChatConversations`/`MessageList`/`Users`/
70
+ `Groups` use `emptyView`/`loadingView`/`errorView`, **not** the
71
+ `*StateView` form; only `CometChatNotificationFeed` uses
72
+ `emptyStateView`/`loadingStateView`/`errorStateView`)
66
73
  - Message template overrides (`CometChatMessageTemplate.type`,
67
74
  `category`, `contentView`, `headerView`, `footerView`)
68
75
  - Request builders for filtering data: `ConversationsRequestBuilder`,
@@ -77,21 +84,30 @@ for this skill. It's the source of truth for:
77
84
 
78
85
  **Hard rules:**
79
86
 
80
- 1. **Always query the docs MCP first** before generating any
81
- customization code. Never invent prop names, builder methods, event
82
- topics, or CSS classes from training-data memory.
83
- 2. **If the docs MCP is not installed**, STOP. Tell the user:
84
- "Customization needs the CometChat docs MCP because every prop +
85
- builder + event signature is canonical. Install it with
86
- `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp`
87
- and re-run."
87
+ 1. **Look up the docs before generating any customization code.** Never
88
+ invent prop names, builder methods, event topics, or CSS classes from
89
+ training-data memory. Use whichever lookup path is available, in order:
90
+ - **(a) docs MCP** query the `cometchat-docs` MCP tool if your agent
91
+ has it. Richest path.
92
+ - **(b) install the MCP, if your agent supports it** — Claude Code:
93
+ `claude mcp add --transport http cometchat-docs
94
+ https://www.cometchat.com/docs/mcp`. Other agents (Cursor, Codex,
95
+ Cline, …) configure MCP their own way, or not at all — do NOT block.
96
+ - **(c) fetch/search the public docs** — same content at the canonical
97
+ URLs below, or web-search `site:cometchat.com/docs`. Universal
98
+ fallback; never STOP and dead-end the user when the MCP isn't
99
+ installed — fall through to (c).
88
100
  3. **Prefer composition (custom view props) over CSS overrides** when
89
101
  both are options — composition is more stable across SDK versions.
90
102
  4. **Canonical reference URLs:**
91
103
  - Components overview: https://www.cometchat.com/docs/ui-kit/react/components-overview
104
+ - Guides index: https://www.cometchat.com/docs/ui-kit/react/guide-overview — the 7 maintained task recipes (prefer these over hand-rolling): [Block/Unblock](https://www.cometchat.com/docs/ui-kit/react/guide-block-unblock-user) · [Call Log Details](https://www.cometchat.com/docs/ui-kit/react/guide-call-log-details) · [Group Management](https://www.cometchat.com/docs/ui-kit/react/guide-group-chat) · [Message Privately](https://www.cometchat.com/docs/ui-kit/react/guide-message-privately) · [New Chat](https://www.cometchat.com/docs/ui-kit/react/guide-new-chat) · [Search Messages](https://www.cometchat.com/docs/ui-kit/react/guide-search-messages) · [Threaded Messages](https://www.cometchat.com/docs/ui-kit/react/guide-threaded-messages)
105
+ - **Custom message recipes** (verified, copy-ready): custom message TYPES, overriding an existing type's bubble (`bubbleView`/`contentView`), adding a Message Composer attachment option, and adding a message action like Forward — all live in **`cometchat-features` §Type 5** (append-not-replace via `CometChatUIKit.getDataSource()`). Route there for the actual code; this skill covers the custom-VIEW-slot props.
92
106
  - Theming + styling: https://www.cometchat.com/docs/ui-kit/react/theme
93
107
  - Events: https://www.cometchat.com/docs/ui-kit/react/events
94
108
  - Methods: https://www.cometchat.com/docs/ui-kit/react/methods
109
+ - **Text formatters** (inline mention/URL/markdown/custom-token styling — `CometChatTextFormatter`): the four formatter guides `custom-text-formatter-guide`, `mentions-formatter-guide`, `url-formatter-guide`, `shortcut-formatter-guide` under `ui-kit/react/`. Recipe + the append-not-replace `getAllTextFormatters({})` pattern live in **`cometchat-features` §Type 5 → Text formatters**.
110
+ - **Localization** (languages, custom strings, date/time formatting): handled by the dedicated **`cometchat-i18n`** skill (`CometChatLocalize`) — route there for any locale/string work; docs https://www.cometchat.com/docs/ui-kit/react/localize
95
111
 
96
112
  ## Steps
97
113
 
@@ -188,9 +204,9 @@ prop, not a new component or custom code.
188
204
  | Filter conversations | `conversationsRequestBuilder` on `CometChatConversations` |
189
205
  | Filter messages | `messagesRequestBuilder` on `CometChatMessageList` |
190
206
  | Filter users / groups | `usersRequestBuilder` / `groupsRequestBuilder` |
191
- | Custom empty state | `emptyStateView` on most list components |
192
- | Custom error UI | `errorStateView` |
193
- | Custom loading UI | `loadingStateView` |
207
+ | Custom empty state | `emptyView` on the list components (`Conversations`/`MessageList`/`Users`/`Groups`); `emptyStateView` only on `CometChatNotificationFeed` |
208
+ | Custom error UI | `errorView` (list components); `errorStateView` on `CometChatNotificationFeed` |
209
+ | Custom loading UI | `loadingView` (list components); `loadingStateView` on `CometChatNotificationFeed` |
194
210
  | Custom header above the list | `headerView` |
195
211
  | Custom message bubble | `templates` prop on `CometChatMessageList` (not a custom bubble component) |
196
212
  | Click handler on item / message / search bar / back button | `onItemClick`, `onMessageClick`, `onBack`, `onSearchBarClicked` |
@@ -231,6 +247,8 @@ If 2a turns up nothing, proceed to 2b.
231
247
  | Reactions on messages | Already built into `CometChatMessageList` — check if it's just disabled |
232
248
  | Message bubble customization | Use the `templates` prop on `CometChatMessageList`, not a custom bubble component |
233
249
 
250
+ > ⚠️ **Not every row above is a kit export.** `CometChatAddMembers`, `CometChatTransferOwnership`, `CometChatBannedMembers`, `CometChatBlockedUsers`, `CometChatNewChat`, `CometChatCreateGroup`, and `CometChatDetails` are **sample-app components, NOT `@cometchat/chat-uikit-react` v6 exports** — importing `<CometChatTransferOwnership/>` etc. is an unresolved-import build error. Build these by copying the sample-app implementation (§2d), do not import them from the package. The genuinely package-exported entries in this table are: `CometChatThreadHeader`, `CometChatGroupMembers`, `CometChatMentionsFormatter`, `CometChatCallButtons`, `CometChatOutgoingCall`, `CometChatIncomingCall`, `CometChatOngoingCall`, `CometChatCallLogs`. **Always grep the installed package's exports (next step) before emitting any of these.**
251
+
234
252
  **Search strategies, in this order:**
235
253
 
236
254
  1. **Query the docs MCP** with the user's intent in plain English.
@@ -393,13 +411,15 @@ right approach is different per bucket:
393
411
 
394
412
  | Bucket | Examples | Approach |
395
413
  |---|---|---|
396
- | **A. Custom view slot** | "add a custom header above the conversation list", "show a custom empty state", "render messages with my own bubble" | Use the corresponding `*View` prop (`headerView`, `emptyStateView`, `bubbleView`, etc.) — query the MCP for which prop the target component supports |
414
+ | **A. Custom view slot** | "add a custom header above the conversation list", "show a custom empty state", "render messages with my own bubble" | Use the corresponding `*View` prop (`headerView`, `emptyView`, `bubbleView`, etc.) — look up which prop the target component supports (list components use `emptyView`/`loadingView`/`errorView`; `CometChatNotificationFeed` uses the `*StateView` form) |
397
415
  | **B. Filter / pagination** | "only show conversations with VIP users", "load 10 messages at a time", "show only joined groups" | Use the corresponding RequestBuilder (`ConversationsRequestBuilder.setTags`, `setLimit`, `setUserAndGroupTags`, etc.) — query the MCP for the builder methods |
398
416
  | **C. Action / callback** | "do X when a user clicks a conversation", "intercept message send", "log every search" | Use the corresponding `on*` callback prop (`onItemClick`, `onSendButtonClick`, `onSearch`, etc.) — query the MCP for the callback signature |
399
417
  | **D. Event subscription** | "show a toast when a new message arrives", "update my unread count when someone reads a message", "track typing indicators" | Subscribe to the corresponding `CometChat*Events` topic (`CometChatMessageEvents.ccMessageSent`, `ccMessageRead`, `CometChatUserEvents.ccUserOnline`, etc.) — query the MCP for the event topic |
400
418
  | **E. Component-level CSS** | "make incoming bubbles green", "hide the conversation timestamps", "compact the message list spacing" | Add a CSS rule under `.cometchat <selector>` in the integration's global stylesheet — query the MCP for the right selector class. NEVER invent class names; the SDK's selectors are namespaced and prefix-protected. |
401
419
  | **F. Component composition** | "wrap CometChatConversations with my own search bar", "render two CometChatGroups side by side", "embed CometChatMessageList inside my own card layout" | Standard React composition. The CometChat components are React components — use them like any other component. Query the MCP for which props are required vs optional. |
402
420
 
421
+ > **Message templates / options / composer attachments → use the verified recipes in `cometchat-features` §Type 5**, not a hand-rolled `bubbleView`. Sending a custom message TYPE, overriding an existing type's bubble, adding a Forward-style message action, or adding a composer attachment all require the **append-not-replace** `CometChatUIKit.getDataSource()` merge (a bare `templates=`/`attachmentOptions=` array silently wipes the built-ins — ENG-35706). §Type 5 has the copy-ready, tsc-verified code.
422
+
403
423
  If the user's request doesn't fit any bucket, **ask them to clarify** —
404
424
  don't guess. Customization is the place where ambiguous requests
405
425
  produce wrong code most often.
@@ -531,11 +551,13 @@ skill's Phase B menu.
531
551
  show up in `cometchat info` as modified. That's correct.
532
552
  - **Prefer composition over CSS overrides** when both are options —
533
553
  composition is stable across SDK versions; CSS selectors are not.
534
- - **Never invent CSS class names** — query the MCP. The SDK's class
535
- prefix is `.cometchat-` but the leaf names (`-message-bubble-incoming`,
554
+ - **Never invent CSS class names** — look them up in the docs. The SDK's
555
+ class prefix is `.cometchat-` but the leaf names (`-message-bubble-incoming`,
536
556
  `-conversations-header`, etc.) MUST come from the docs.
537
- - **If the docs MCP is not installed**, refuse to continue and tell
538
- the user how to install it.
557
+ - **Look up the docs via the best available path** (see §2's lookup
558
+ contract): docs MCP if your agent has it → else fetch/web-search the
559
+ public docs at cometchat.com/docs. Never STOP just because the MCP
560
+ isn't installed — fall through to the public docs.
539
561
  - **Always use `npx @cometchat/skills-cli`** for any CLI commands.
540
562
 
541
563
  ## What this skill does NOT do
@@ -543,8 +565,8 @@ skill's Phase B menu.
543
565
  - It does not write **template** files (that's `cometchat init`)
544
566
  - It does not **enable packaged features** (that's `cometchat-features`
545
567
  + `cometchat apply-feature`)
546
- - It does not **change theme tokens** (that's `cometchat-theming` +
547
- `cometchat apply-theme`)
568
+ - It does not **change theme tokens** (that's `cometchat-theming`
569
+ CSS-variable overrides, no CLI)
548
570
  - It does not **fix broken integrations** (that's
549
571
  `cometchat-troubleshooting` + `cometchat doctor`)
550
572
  - It does not **add new components from scratch** — it customizes
@@ -553,3 +575,6 @@ skill's Phase B menu.
553
575
  For anything in the "does not" list, route the user to the right
554
576
  skill/command instead of attempting it here.
555
577
 
578
+ ## Sound (in-app message + call sounds)
579
+
580
+ Sound is a customization sub-dimension. The UI Kit plays incoming/outgoing message + call sounds via `CometChatSoundManager` — mute it, swap custom audio, or play a specific sound. The full API + recipe lives in **`cometchat-theming`** (Sound section). Verify the access path against the installed kit before relying on it.