@cometchat/skills 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,555 @@
1
+ ---
2
+ name: cometchat-customization
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
+ license: "MIT"
5
+ compatibility: "Node.js >=18; @cometchat/chat-uikit-react ^6"
6
+ allowed-tools: "executeBash, readFile, fileSearch, listDirectory, grepSearch"
7
+ metadata:
8
+ author: "CometChat"
9
+ version: "3.0.0"
10
+ tags: "cometchat react customization custom-view message-bubble header-view subtitle-view request-builder events"
11
+ ---
12
+
13
+ > **Companion skills:** `cometchat-components` provides the component
14
+ > catalog (what exists); this skill provides the customization workflow
15
+ > (how to modify what exists). Use `cometchat-components` to look up
16
+ > component names and props, then use this skill to plan and execute
17
+ > the customization. For any pattern not covered below, the docs MCP
18
+ > at `cometchat-docs` is the source of truth — query it before
19
+ > generating any code.
20
+
21
+ ## Use this skill when
22
+
23
+ The user has already run `/cometchat` (Phase A complete — there's a
24
+ working integration with `.cometchat/state.json`) and wants to **change
25
+ how a component looks or behaves** beyond what the CLI's deterministic
26
+ commands handle.
27
+
28
+ Trigger phrases:
29
+ - "customize the message list"
30
+ - "filter the conversations to only show X"
31
+ - "change the message bubble color/shape/layout"
32
+ - "add a custom header above the chat"
33
+ - "subscribe to message-received events"
34
+ - "show a custom loading state"
35
+ - "add a custom action to the message options menu"
36
+ - "I want to inject my own UI into CometChatX"
37
+ - `/cometchat customize`
38
+
39
+ ## Do not use this skill when
40
+
41
+ - The user wants to enable a **packaged feature** (calls, polls, AI smart
42
+ replies, etc.) → use `cometchat-features` instead
43
+ - 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
46
+ - The user wants to **start a new integration** → use the `cometchat`
47
+ dispatcher skill to run Phase A first
48
+ - The user wants to **fix something broken** → use
49
+ `cometchat-troubleshooting` and run `cometchat doctor`
50
+
51
+ ## Docs MCP contract
52
+
53
+ This skill is **fundamentally docs-driven** — every customization
54
+ question requires a fact (prop name, callback signature, builder method,
55
+ event topic, CSS selector) that lives in the canonical CometChat docs,
56
+ not in this skill's text. Embedding examples here would create drift
57
+ the moment the SDK changes.
58
+
59
+ The CometChat docs MCP at `cometchat-docs` is a **hard requirement**
60
+ for this skill. It's the source of truth for:
61
+
62
+ - Component prop tables (every component, every prop, every default)
63
+ - Custom view slots: `headerView`, `subtitleView`, `tailView`,
64
+ `optionsView`, `bubbleView`, `emptyStateView`, `loadingStateView`,
65
+ `errorStateView` (which components support which slots)
66
+ - Message template overrides (`CometChatMessageTemplate.type`,
67
+ `category`, `contentView`, `headerView`, `footerView`)
68
+ - Request builders for filtering data: `ConversationsRequestBuilder`,
69
+ `MessagesRequestBuilder`, `UsersRequestBuilder`, `GroupsRequestBuilder`,
70
+ `CallLogsRequestBuilder` and their methods
71
+ - SDK events: `CometChatMessageEvents`, `CometChatUserEvents`,
72
+ `CometChatGroupEvents`, `CometChatCallEvents`, `CometChatUIEvents`
73
+ and the topic names
74
+ - CSS selectors for component-level styling overrides
75
+ (`.cometchat-message-bubble-incoming`, `.cometchat-conversations-header`,
76
+ etc.)
77
+
78
+ **Hard rules:**
79
+
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."
88
+ 3. **Prefer composition (custom view props) over CSS overrides** when
89
+ both are options — composition is more stable across SDK versions.
90
+ 4. **Canonical reference URLs:**
91
+ - Components overview: https://www.cometchat.com/docs/ui-kit/react/components-overview
92
+ - Theming + styling: https://www.cometchat.com/docs/ui-kit/react/theme
93
+ - Events: https://www.cometchat.com/docs/ui-kit/react/events
94
+ - Methods: https://www.cometchat.com/docs/ui-kit/react/methods
95
+
96
+ ## Steps
97
+
98
+ ### Step 1 — Verify Phase A is done
99
+
100
+ ```bash
101
+ npx @cometchat/skills-cli info --json
102
+ ```
103
+
104
+ If `integrated` is `false`, **stop** and tell the user to run
105
+ `/cometchat` first to create the base integration. Customization
106
+ modifies an existing integration; it doesn't create one.
107
+
108
+ Note the `framework`, `experience`, `files_owned`, and `applied_features`
109
+ from the response — you'll need them in the next steps.
110
+
111
+ ### Step 2 — Four-tier discovery: existing-component prop, new component, stylesheet, sample app
112
+
113
+ > **START HERE:** Read the **component catalog** at
114
+ > `references/component-catalog.md` (in this skill's directory). It has
115
+ > the canonical list of all 88 exported symbols, all 14 sample-app
116
+ > patterns, and a 40-row task→component lookup table. If the user's
117
+ > request maps to an entry in the catalog, use that entry directly —
118
+ > skip the rest of this step.
119
+
120
+ **If the catalog doesn't have a match (or you need prop-level detail),
121
+ walk these FOUR discovery checks in this exact order:**
122
+
123
+ 1. **Existing-component prop check (2a):** does a component the
124
+ integration ALREADY mounts have a prop that does what the user is
125
+ asking for? **The kit follows a "props over components" philosophy
126
+ — most additions are props on existing components, not new
127
+ components.** This check goes FIRST.
128
+ 2. **New-component check (2b):** if 2a turned up nothing, is there a
129
+ built-in `CometChat<X>` component in `@cometchat/chat-uikit-react`'s
130
+ exports?
131
+ 3. **Stylesheet check (2c):** is there a `--cometchat-<x>` CSS
132
+ variable for any styling you'd write?
133
+ 4. **Sample app check (2d):** is there a reference implementation in
134
+ the sample app at
135
+ `github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app/src/components`
136
+ for the user's pattern?
137
+
138
+ The CometChat React UI Kit ships FOUR things, not one:
139
+ - A "props over components" API where most features (search bar,
140
+ filters, custom views, click handlers, disable flags) are PROPS on
141
+ existing components — NOT new components
142
+ - 60+ named React components in the npm package
143
+ - A 200+ CSS variable system at
144
+ `@cometchat/chat-uikit-react/css-variables.css`
145
+ - A reference sample app on GitHub with implementations for common
146
+ chat UX patterns (user/group details, threaded messages layout,
147
+ top-level home layout, multi-tab chat, notifications, new chat
148
+ dialog, etc.) that combine multiple kit components but aren't
149
+ shipped as single named exports
150
+
151
+ **Critical:** the docs MCP does NOT index the sample app. When the MCP
152
+ says *"no `CometChat<X>` component exists"*, that only covers the npm
153
+ package — you must still check the sample app via GitHub before
154
+ concluding the user needs hand-rolled code.
155
+
156
+ Hand-rolling something the kit, the variable system, OR the sample
157
+ app already provides means missing the kit's theming, accessibility,
158
+ i18n, error handling, and every future SDK update.
159
+
160
+ #### 2a. Existing-component prop check (do this FIRST)
161
+
162
+ **Most chat features are already props on the components you have.**
163
+ A user asking for "add search", "filter conversations", "custom empty
164
+ state", or "click handler on a message" is almost always asking for a
165
+ prop, not a new component or custom code.
166
+
167
+ **Process:**
168
+
169
+ 1. **List the CometChat components currently mounted in the
170
+ integration.** Read the integration's owned files (from
171
+ `state.json`) and grep for `<CometChat` JSX usage:
172
+ ```bash
173
+ grep -hoE '<CometChat[A-Z][a-zA-Z]*' \
174
+ $(jq -r '.files_owned[]' .cometchat/state.json 2>/dev/null) \
175
+ 2>/dev/null | sort -u
176
+ ```
177
+ 2. **Query the docs MCP for the props of each mounted component:**
178
+ - `"CometChatConversations props"`
179
+ - `"CometChatMessageList props"`
180
+ - `"CometChatMessageHeader props"`
181
+ - `"CometChatMessageComposer props"`
182
+ 3. **Look for a prop that maps to the user's intent.** Common
183
+ mappings:
184
+
185
+ | User asks for | Likely prop on which component |
186
+ |---|---|
187
+ | Search bar / "add search" | `showSearchBar` on `CometChatConversations` (or `onSearchBarClicked` to swap in `<CometChatSearch>` for advanced dual-scope search) |
188
+ | Filter conversations | `conversationsRequestBuilder` on `CometChatConversations` |
189
+ | Filter messages | `messagesRequestBuilder` on `CometChatMessageList` |
190
+ | Filter users / groups | `usersRequestBuilder` / `groupsRequestBuilder` |
191
+ | Custom empty state | `emptyStateView` on most list components |
192
+ | Custom error UI | `errorStateView` |
193
+ | Custom loading UI | `loadingStateView` |
194
+ | Custom header above the list | `headerView` |
195
+ | Custom message bubble | `templates` prop on `CometChatMessageList` (not a custom bubble component) |
196
+ | Click handler on item / message / search bar / back button | `onItemClick`, `onMessageClick`, `onBack`, `onSearchBarClicked` |
197
+ | Hide / disable a sub-feature | `disable*` boolean props (e.g. `disableTyping`, `disableReactions`) |
198
+ | Custom subtitle / status / timestamp | `subtitleView`, `statusView`, `timestampView` |
199
+ | Show / hide receipts | `hideReceipts` |
200
+ | Selection mode | `selectionMode` on list components |
201
+
202
+ If you find a matching prop, **just add the prop and stop**. No new
203
+ components. No custom CSS. No new files. Surface to the user: *"The
204
+ `<X>` you already have supports this via the `<propName>` prop. Adding
205
+ that single prop."*
206
+
207
+ If 2a turns up nothing, proceed to 2b.
208
+
209
+ #### 2b. New-component check (do this only if 2a turned up nothing)
210
+
211
+ **Common requests that look like "customization" but are actually
212
+ "use the existing component":**
213
+
214
+ | User asks for | Use this built-in component |
215
+ |---|---|
216
+ | Threaded replies / "wire up threads" | `CometChatThreadHeader` + scope a `CometChatMessageList` and `CometChatMessageComposer` with `parentMessageId` |
217
+ | Group members panel / "list group members" | `CometChatGroupMembers` |
218
+ | Add members to a group | `CometChatAddMembers` |
219
+ | Transfer group ownership | `CometChatTransferOwnership` |
220
+ | Banned users management | `CometChatBannedMembers` |
221
+ | Block/unblock users panel | `CometChatBlockedUsers` |
222
+ | New chat / "start a new conversation" dialog | `CometChatNewChat` |
223
+ | Create new group dialog | `CometChatCreateGroup` |
224
+ | User / group details panel | `CometChatDetails` |
225
+ | Mentions popover in composer | `CometChatMentionsFormatter` (already wired into the composer) |
226
+ | Voice / video call buttons in header | `CometChatCallButtons` |
227
+ | Outgoing call screen | `CometChatOutgoingCall` |
228
+ | Incoming call notification | `CometChatIncomingCall` |
229
+ | Ongoing call UI | `CometChatOngoingCall` |
230
+ | Call logs list | `CometChatCallLogs` |
231
+ | Reactions on messages | Already built into `CometChatMessageList` — check if it's just disabled |
232
+ | Message bubble customization | Use the `templates` prop on `CometChatMessageList`, not a custom bubble component |
233
+
234
+ **Search strategies, in this order:**
235
+
236
+ 1. **Query the docs MCP** with the user's intent in plain English.
237
+ Examples:
238
+ - `"thread reply UI react ui kit"` → finds `CometChatThreadHeader`
239
+ - `"new chat dialog"` → finds `CometChatNewChat`
240
+ - `"group transfer ownership"` → finds `CometChatTransferOwnership`
241
+ - `"block user list"` → finds `CometChatBlockedUsers`
242
+ 2. **Grep the user's installed package** for matching exports:
243
+ ```bash
244
+ grep -E "^export.*CometChat[A-Z][a-zA-Z]+" \
245
+ node_modules/@cometchat/chat-uikit-react/dist/index.d.ts \
246
+ 2>/dev/null | head -50
247
+ ```
248
+ 3. **Browse the v6 components reference** at
249
+ https://www.cometchat.com/docs/ui-kit/react/components-overview
250
+
251
+ If you find a built-in component that matches, **use it as-is**.
252
+ Surface to the user: *"The kit already ships `CometChat<X>` for this.
253
+ I'll wire it up directly."*
254
+
255
+ #### 2c. Stylesheet check (do this even when you DO need custom layout glue)
256
+
257
+ Even when you have to write some CSS for layout glue (positioning a
258
+ panel, sizing a container, wiring up the height chain that
259
+ `.cometchat-message-list` requires), **never hand-pick colors, fonts,
260
+ borders, spacings, or radii from your head**. The kit ships a
261
+ canonical CSS variable system. Use it.
262
+
263
+ **The rule:**
264
+ - ✅ **OK:** custom CSS for layout glue (positioning, sizing, flex
265
+ containers, the height chain). Example: `.thread-wrapper { width:
266
+ 400px; height: 100vh; display: flex; flex-direction: column; }`
267
+ - ✅ **OK:** custom CSS that consumes kit variables. Example:
268
+ `.thread-wrapper { border-left: 1px solid var(--cometchat-border-color-light); background: var(--cometchat-background-color-01); }`
269
+ - ❌ **NOT OK:** custom CSS for any header / button / icon / panel /
270
+ badge / divider that the kit already provides as a component.
271
+ Example: a hand-rolled `.thread-header` + `.thread-close` button when
272
+ `CometChatThreadHeader` exists.
273
+ - ❌ **NOT OK:** hardcoded colors / fonts / borders / radii / spacings
274
+ that don't reference the `--cometchat-*` variables. Example:
275
+ `border: 1px solid #E8E8E8` instead of
276
+ `border: 1px solid var(--cometchat-border-color-light)`.
277
+
278
+ **Discovery commands for the variable system:**
279
+ ```bash
280
+ # List every --cometchat-* variable the kit defines
281
+ grep -oE '\-\-cometchat-[a-z0-9-]+' \
282
+ node_modules/@cometchat/chat-uikit-react/css-variables.css \
283
+ 2>/dev/null | sort -u | head -60
284
+
285
+ # Or search for a specific token category
286
+ grep -E '\-\-cometchat-(border|background|text|primary|font)' \
287
+ node_modules/@cometchat/chat-uikit-react/css-variables.css \
288
+ 2>/dev/null | head -40
289
+ ```
290
+
291
+ **Common variable categories** (query the docs MCP for the canonical
292
+ list — these change between SDK versions):
293
+
294
+ | Category | Example variables |
295
+ |---|---|
296
+ | Brand colors | `--cometchat-primary-color`, `--cometchat-error-color`, `--cometchat-success-color` |
297
+ | Backgrounds | `--cometchat-background-color-01` (white), `--cometchat-background-color-02`, `--cometchat-background-color-03` (light grey) |
298
+ | Text | `--cometchat-text-color-primary`, `--cometchat-text-color-secondary`, `--cometchat-text-color-tertiary` |
299
+ | Borders | `--cometchat-border-color-light`, `--cometchat-border-color-default`, `--cometchat-border-color-dark` |
300
+ | Radii | `--cometchat-radius-1`, `--cometchat-radius-2`, `--cometchat-radius-3`, `--cometchat-radius-max` |
301
+ | Fonts | `--cometchat-font-heading1-bold`, `--cometchat-font-heading4-medium`, `--cometchat-font-body-regular`, `--cometchat-font-caption2-regular` |
302
+ | Spacing | `--cometchat-spacing-1` through `--cometchat-spacing-10` |
303
+ | Shadows | `--cometchat-shadow-1`, `--cometchat-shadow-2`, `--cometchat-shadow-3` |
304
+
305
+ #### 2d. Sample app reference check (do this when 2a + 2b turned up nothing)
306
+
307
+ If 2b didn't find a `CometChat<X>` component for the user's request,
308
+ **don't immediately conclude they need custom code**. The kit ships a
309
+ **reference sample app** at:
310
+
311
+ > https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app/src/components
312
+
313
+ with implementations for common chat UX patterns that combine multiple
314
+ kit components but aren't shipped as single named exports. Examples
315
+ that look like "missing components" but are in the sample app:
316
+
317
+ | User asks for | Sample app reference path |
318
+ |---|---|
319
+ | User / group details panel | `sample-app/src/components/CometChatDetails/CometChatUserDetails.tsx` (group details is inline in `CometChatHome.tsx`'s `SideComponentGroup`) |
320
+ | Threaded messages panel layout | `sample-app/src/components/CometChatDetails/CometChatThreadedMessages.tsx` |
321
+ | Top-level chat layout (left pane + main + side rail) | `sample-app/src/components/CometChatHome/CometChatHome.tsx` |
322
+ | Multi-tab chat (Chats / Calls / Users / Groups) | `sample-app/src/components/CometChatSelector/CometChatTabs.tsx` |
323
+ | New conversation dialog with user/group picker | Inline in `CometChatHome.tsx` as `CometChatNewChatView` (CSS: `sample-app/src/styles/CometChatNewChat/CometChatNewChatView.css`) |
324
+ | Search view (conversations + messages) | `sample-app/src/components/CometChatSearchView/` |
325
+ | Call log details / history / recordings | `sample-app/src/components/CometChatCallLog/` (5 sub-files: Details, History, Info, Participants, Recordings) |
326
+ | App state / active-chat React context | `sample-app/src/context/AppContext.jsx` + `appReducer.ts` |
327
+ | Group ownership transfer modal | `sample-app/src/components/CometChatTransferOwnership/` |
328
+
329
+ These patterns include matching CSS at
330
+ `sample-app/src/styles/<ComponentName>/` using BEM-style class names
331
+ that are already wired to the kit's CSS variable system.
332
+
333
+ **Discovery commands:**
334
+
335
+ ```bash
336
+ # List the sample app's components directory via the GitHub API
337
+ curl -s "https://api.github.com/repos/cometchat/cometchat-uikit-react/contents/sample-app/src/components?ref=v6" \
338
+ | grep -oE '"name":\s*"[^"]+"' | head -30
339
+
340
+ # Fetch a specific component file directly
341
+ curl -s "https://raw.githubusercontent.com/cometchat/cometchat-uikit-react/v6/sample-app/src/components/CometChatDetails/CometChatUserDetails.tsx"
342
+
343
+ # Fetch its matching stylesheet
344
+ curl -s "https://raw.githubusercontent.com/cometchat/cometchat-uikit-react/v6/sample-app/src/styles/CometChatDetails/CometChatUserDetails.css"
345
+ ```
346
+
347
+ You can also use WebFetch on the URLs above. The docs MCP does NOT
348
+ index the sample app — you must fetch it from GitHub directly.
349
+
350
+ **If you find a matching reference implementation:**
351
+
352
+ 1. Read BOTH the `.tsx` file AND its matching `.css` file (at
353
+ `sample-app/src/styles/<ComponentName>/`)
354
+ 2. Mirror the sample app's file/folder structure in the user's project,
355
+ e.g. `src/cometchat/CometChatDetails/CometChatUserDetails.tsx` plus
356
+ `src/cometchat/CometChatDetails/CometChatDetails.css`
357
+ 3. Match the **exact BEM class names** from the sample
358
+ (`.cometchat-user-details__header`,
359
+ `.cometchat-user-details__content-avatar`, etc.) — they're already
360
+ integrated with the kit's CSS variable system
361
+ 4. Strip the sample app's local dependencies that the user's project
362
+ doesn't have:
363
+ - `useContext(AppContext)` → inline the values
364
+ - `getLocalizedString(...)` → inline the English strings
365
+ - `cometchat-resources/` SVG icons → use Unicode equivalents or
366
+ strip them
367
+ 5. Tell the user: *"The kit doesn't export this as a single component,
368
+ but the official sample app has the reference implementation at
369
+ `cometchat/cometchat-uikit-react/v6/sample-app/.../CometChat<X>`.
370
+ I'm adapting it to your project."*
371
+
372
+ #### 2e. After discovery — decide what to do
373
+
374
+ In strict order, take the FIRST option that applies:
375
+
376
+ 1. **An existing component prop matches (2a):** add the prop. Done.
377
+ No new files. Most chat features land here.
378
+ 2. **A new component matches (2b) AND has its own styling:** use the
379
+ component as-is. Zero custom CSS.
380
+ 3. **A new component matches (2b) but you need layout glue:** use the
381
+ component; write minimal layout-only CSS that consumes
382
+ `--cometchat-*` variables (per 2c).
383
+ 4. **Sample app has a reference implementation (2d):** adapt the
384
+ sample app pattern, mirroring its file structure and BEM class
385
+ names.
386
+ 5. **None of the above:** then (and only then) proceed to Step 3 to
387
+ classify the request as a true customization.
388
+
389
+ ### Step 3 — Classify the customization
390
+
391
+ Read the user's request and place it into one of these buckets. The
392
+ right approach is different per bucket:
393
+
394
+ | Bucket | Examples | Approach |
395
+ |---|---|---|
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 |
397
+ | **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
+ | **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
+ | **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
+ | **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
+ | **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
+
403
+ If the user's request doesn't fit any bucket, **ask them to clarify** —
404
+ don't guess. Customization is the place where ambiguous requests
405
+ produce wrong code most often.
406
+
407
+ ### Step 4 — Query the docs MCP for the canonical pattern (only if Step 2 turned up nothing)
408
+
409
+ Once you've classified the request, query the docs MCP with a specific
410
+ search:
411
+
412
+ | Bucket | MCP query example |
413
+ |---|---|
414
+ | A. Custom view slot | "headerView prop CometChatConversations" |
415
+ | B. Filter / pagination | "ConversationsRequestBuilder methods setTags" |
416
+ | C. Action / callback | "CometChatMessageList onMessageClick callback signature" |
417
+ | D. Event subscription | "CometChatMessageEvents ccMessageSent subscribe" |
418
+ | E. Component-level CSS | "CSS selector cometchat-message-bubble-incoming" |
419
+ | F. Component composition | "CometChatConversations props required" |
420
+
421
+ The MCP returns canonical, current docs. Read them BEFORE writing any
422
+ code. If multiple results come back, prefer the React UI Kit v6 result
423
+ over older versions.
424
+
425
+ ### Step 5 — Identify the file to modify
426
+
427
+ Use the framework + experience you noted in Step 1 to find the right
428
+ file. The integration's primary client file is conventional per
429
+ framework:
430
+
431
+ | Framework | Primary client file |
432
+ |---|---|
433
+ | reactjs (Vite) | `src/App.tsx` (renders the conversation list / messages) + `src/cometchat/CometChatSelector.tsx` (the selector) |
434
+ | nextjs (App Router) | `src/app/cometchat/CometChatNoSSR.tsx` (renders the chat) + `src/app/cometchat/CometChatSelector.tsx` (the selector) |
435
+ | nextjs (Pages Router) | `src/cometchat/CometChatNoSSR.tsx` + `src/cometchat/CometChatSelector.tsx` |
436
+ | react-router (v6 + v7) | `app/cometchat/CometChatNoSSR.tsx` + `app/cometchat/CometChatSelector.tsx` |
437
+ | astro | `src/cometchat/ChatApp.tsx` (the React island) + `src/cometchat/CometChatSelector.tsx` |
438
+
439
+ For CSS overrides (bucket E), the global stylesheet is:
440
+ - reactjs → `src/index.css`
441
+ - nextjs (App Router) → `src/app/globals.css`
442
+ - nextjs (Pages Router) → `src/styles/globals.css`
443
+ - react-router → `app/app.css`
444
+ - astro → inside `src/cometchat/ChatApp.tsx` (NOT a global stylesheet)
445
+
446
+ These are also in `state.json` under `files_owned` if you need to verify.
447
+
448
+ ### Step 6 — Write the customization
449
+
450
+ Generate the code based on the docs MCP response from Step 4. Show the
451
+ user:
452
+
453
+ 1. **What you're going to change** (which file, which lines, the new
454
+ code)
455
+ 2. **Why** (which prop/builder/event the docs say to use)
456
+ 3. **A preview of the diff** (just the changed region, not the whole
457
+ file)
458
+
459
+ **Wait for the user to confirm** before writing. Customization edits
460
+ the integration's owned files — drift detection will show this on the
461
+ next `cometchat info`. The user should know.
462
+
463
+ If the user confirms, write the change. If they don't, surface what
464
+ they'd want to change and stop.
465
+
466
+ ### Step 7 — Verify
467
+
468
+ ```bash
469
+ npx @cometchat/skills-cli verify --json
470
+ ```
471
+
472
+ The 5 AST checks still apply to customized files. If anything fails,
473
+ surface verbatim and offer to revert.
474
+
475
+ ```bash
476
+ npx @cometchat/skills-cli info --json
477
+ ```
478
+
479
+ The customized file will now show as drifted (its checksum no longer
480
+ matches the original template). This is expected — it's the
481
+ **explicit** drift the user just asked for. Not a bug.
482
+
483
+ ### Step 8 — Tell the user what to do next
484
+
485
+ The dev server picks up React changes via HMR. Tell the user:
486
+ 1. Save the file (if their editor doesn't auto-save)
487
+ 2. Refresh the browser tab
488
+ 3. Test the customization
489
+
490
+ Then offer to do another customization OR to return to the framework
491
+ skill's Phase B menu.
492
+
493
+ ## Hard rules
494
+
495
+ - **Always do the FOUR-tier discovery before adding any new component
496
+ or hand-rolled UI.** The kit follows a "props over components"
497
+ philosophy and ships FOUR things, not one:
498
+ (0) **props** on already-mounted components for most features
499
+ (search bar, filters, custom views, click handlers, disable
500
+ flags) — check this FIRST,
501
+ (1) 60+ named React components in `@cometchat/chat-uikit-react`,
502
+ (2) a 200+ CSS variable system in `css-variables.css`,
503
+ (3) a reference sample app at
504
+ `github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app/src/components`
505
+ with implementations for common chat UX patterns that combine
506
+ multiple kit components but aren't shipped as single named
507
+ exports (user/group details panels, thread layouts, top-level
508
+ home layout, notifications, new chat dialog, etc.).
509
+ The docs MCP does NOT index the sample app — fetch it from GitHub
510
+ directly. Adding a new component when an existing one's prop would
511
+ do, or hand-rolling something the kit, the variable system, or the
512
+ sample app already provides, means missing the kit's theming, i18n,
513
+ accessibility, and every future SDK update. Step 2 (subsections 2a
514
+ + 2b + 2c + 2d) is mandatory — do NOT skip it. **2a
515
+ (existing-component prop check) goes FIRST** because most features
516
+ are props on already-mounted components, not new components.
517
+ - **Custom CSS is allowed ONLY for layout glue** (positioning,
518
+ sizing, flex/grid containers, the height chain). Even there, never
519
+ hardcode colors / fonts / borders / radii / spacings — always
520
+ reference `--cometchat-*` variables. Hand-rolled headers, buttons,
521
+ icons, panels, badges, dividers, etc. are NEVER OK if the kit
522
+ already provides them.
523
+ - **Always query the docs MCP first** for any prop, builder, event, or
524
+ CSS selector. Never invent SDK API from memory.
525
+ - **Verify Phase A is done** before customizing. This skill modifies
526
+ existing integration files; it does not create new ones.
527
+ - **Show the user the change before writing**. Customization is
528
+ user-side intent — they need visibility.
529
+ - **Drift detection is expected after customization**, not a bug.
530
+ The user's customizations live in `state.files_owned` and will
531
+ show up in `cometchat info` as modified. That's correct.
532
+ - **Prefer composition over CSS overrides** when both are options —
533
+ 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`,
536
+ `-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.
539
+ - **Always use `npx @cometchat/skills-cli`** for any CLI commands.
540
+
541
+ ## What this skill does NOT do
542
+
543
+ - It does not write **template** files (that's `cometchat init`)
544
+ - It does not **enable packaged features** (that's `cometchat-features`
545
+ + `cometchat apply-feature`)
546
+ - It does not **change theme tokens** (that's `cometchat-theming` +
547
+ `cometchat apply-theme`)
548
+ - It does not **fix broken integrations** (that's
549
+ `cometchat-troubleshooting` + `cometchat doctor`)
550
+ - It does not **add new components from scratch** — it customizes
551
+ components that the integration already uses
552
+
553
+ For anything in the "does not" list, route the user to the right
554
+ skill/command instead of attempting it here.
555
+