/cometchat-skills:cometchat-react-v7-corefrom cometchat-skills
Adds CometChat chat to a React app end-to-end: detects project setup, fetches/verifies dashboard credentials, initializes SDK, logs in, and renders conversation UI via CometChatProvider.
Ships in cometchat-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Ground truth:
@cometchat/chat-uikit-react@7+@cometchat/chat-sdk-javascript@^4.1.9. Symbols sourced from live v7 docs. This file is the THIN map loaded every run; deep detail is inreferences/*loaded ONLY when the task needs it. Anything marked [v7-verify] is a v6 carry-over to confirm against v7 docs/catalog before shipping.
"add chat to my React app", "set up CometChat credentials", "integrate CometChat in React", "show a conversations + messages UI", "build a full chat app". An unscoped "add chat" means a production-ready core chat surface (a CometChatConversations list ↔ a message pane, wrapped in CometChatErrorBoundary, sized, affordances wired-or-hidden, mobile collapse) — NOT a bare two-pane demo, and NOT the whole combined app. See the golden path below. It grows on request (users/groups/calls tabs, a details/thread/search side panel, calls) to the full combined app — that recipe lives in cometchat-react-v7-placement.
npm i @cometchat/chat-uikit-react@7 @cometchat/chat-sdk-javascript@4 dompurify (keep the @7/@4 major pins — a bare install resolves to latest and can pull the wrong major). dompurify is required by the kit — the docs install includes it. Voice/video calling also needs @cometchat/calls-sdk-javascript (see cometchat-react-v7-features).
references/setup-credentials.md)VITE_, CRA→REACT_APP_, Next→NEXT_PUBLIC_/.env.local). Reuse existing .cometchat/env if present (skip re-setup).RULES.md)..cometchat/env if present (skip). Else offer both, defaulting to fetch: (a) account fetch (recommended) through the CometChat MCP — cometchat_whoami, pick an EXISTING app (cometchat_list_apps; never auto-create), cometchat_get_app_credentials returns the creds plus ready env lines (it writes no file); (b) manual paste — Dashboard → Credentials (dev-only Auth Key). Then the SKILL writes the framework env (§4) — the MCP only returns values; framework detection, env-writing, and codegen are the SKILL's job (AUDIT-059). Ask & wait if the user must choose or the MCP isn't connected. Full flow: references/setup-credentials.md.init() + login() resolve; auth error usually means wrong Region.init() once at startup → login(UID) after init resolves (guard with the sync CometChatUIKit.getLoggedInUser()) → render inside CometChatProvider.
import { CometChatUIKit } from "@cometchat/chat-uikit-react";
// initFromSettings (NOT the classic UIKitSettingsBuilder init) sets integrationSource="ai-agent"
// for telemetry attribution — and routes the Calls SDK through initFromSettings too (AUDIT-084).
await CometChatUIKit.initFromSettings({
appId: import.meta.env.VITE_COMETCHAT_APP_ID,
region: import.meta.env.VITE_COMETCHAT_REGION,
credentials: { authKey: import.meta.env.VITE_COMETCHAT_AUTH_KEY }, // dev only; prod → server-minted auth token
chatSDK: { presenceSubscription: { type: "ALL_USERS" } }, // = the classic subscribePresenceForAllUsers()
}); // must resolve first
if (!CometChatUIKit.getLoggedInUser()) await CometChatUIKit.login(UID); // sync getter — capital "In"
Init once + StrictMode double-init, concurrent-login guard, and the reusable provider:
references/lifecycle.md. Which UID?login()needs a user that ALREADY EXISTS — never invent/hardcode a guessed one. ASK, or take one from Dashboard → Users (fresh apps seedcometchat-uid-1...). Never suggestsuperhero1..5or any remembered "classic sample" UID (not seeded in modern apps); don't fabricate UIDs from memory — the only tentative suggestion iscometchat-uid-1, labelled "if this is a fresh app." Prod → per-user auth token +loginWithAuthToken. Detail:references/setup-credentials.md§6.
Init/provider: CometChatUIKit, UIKitSettingsBuilder, CometChatProvider, CometChatErrorBoundary (wraps the surface — production must-have). Core-surface drop-ins: CometChatConversations, CometChatMessageHeader, CometChatMessageList, CometChatMessageComposer; wired affordances CometChatThreadHeader, CometChatSearch. Grow set (added on request): CometChatUsers, CometChatGroups, CometChatCallLogs, CometChatGroupMembers, CometChatIncomingCall.
The ~12 props you actually wire for "add chat". Do NOT fetch docs for these; do NOT read .d.ts.
CometChatConversations: onItemClick(conversation) (select → drives the message pane) · activeConversation · showSearchBar (default true; wire onSearchBarClicked→CometChatSearch or set false) · selectionMode (default "none") · conversationsRequestBuilder — scope the list to the REQUEST: a 1:1/DM-only ask → new CometChat.ConversationsRequestBuilder().setLimit(30).setConversationType("user") so the app's seeded groups don't show ("group" for groups-only); pass the builder INSTANCE, not .build(). .setLimit(n) is REQUIRED on a custom builder — without it the list renders the kit's "something went wrong" state (verified 7.2.0, AUDIT-245; STOPGAP: the docs' filter-recipe table omits it — remove this note once that docs recipe is fixed). See the data-scope note below.CometChatMessageHeader: onItemClick (open profile) · showSearchOption (default true) + onSearchOptionClicked → open a SCOPED CometChatSearch (uid/guid of the current chat) in the side panel (in-chat message search, default-on; opt-out via showSearchOption={false}) · hideBackButton (default false) + onBack (mobile → pop to list).CometChatMessageList: onThreadRepliesClick(message) → open the thread panel (DEFAULT — threaded replies ship with a first-time "add chat"); hideReplyInThreadOption ONLY if the user explicitly opts out of threads.CometChatMessageComposer: placeholder (default "Type a message..."); a plain send needs no props.CometChatProvider: theme ("light" default — no OS-follow; sync to prefers-color-scheme, see references/theming.md).Stable props + view slots for the 4 drop-ins are BAKED in
references/component-props.md— use them: custom UI goes IN the component's slot (search → ConversationsheaderView/ MessageHeadertrailingView), NEVER as a sibling on top. Exhaustive/rare props or any OTHER component → fetch its.mdtwin viareferences/docs-map.md; NEVER readnode_modules/.d.ts. Full catalog:cometchat-react-v7-components.
Setup → guarded init/login → wrap the app in CometChatProvider inside CometChatErrorBoundary → build the core surface: a CometChatConversations LIST ↔ a MESSAGE pane (CometChatMessageHeader + CometChatMessageList + CometChatMessageComposer) for the selected conversation, a small host state object coordinating {selected conversation, side view: thread | in-chat-search | none}, collapsing to one pane on mobile. Complete and wired but LEAN — NOT a bare two-pane demo, NOT the whole combined app. Reuse existing routing/layout/auth; add files + wiring only, never rewrite. Least-code = reach for the drop-ins/slots (HOW). The compile-verified TSX + the required column CSS live in references/layout.md (sizing) and cometchat-react-v7-placement/references/recipes.md (the Core-surface recipe) — build from those; this entry stays the thin map.
Wire every default-on affordance so nothing dead-ends, and keep these INVARIANTS:
CometChatMessageList onThreadRepliesClick(m) → a thread panel (CometChatThreadHeader + a thread CometChatMessageList + CometChatMessageComposer) with a close/back round-trip. The thread list AND composer take BOTH the current target (user OR group, same as the main pane) AND parentMessageId; passing parentMessageId ALONE silently NEVER SENDS (AUDIT-060). Set hideReplyInThreadOption only on explicit opt-out. Differentiate the thread MESSAGE LIST (not just the wrapper): scope --cometchat-message-list-bg: var(--cometchat-background-color-01) on the thread wrapper — the list paints its own opaque bg so a wrapper bg can't reach it (verified vs 7.1.0; recipe in cometchat-react-v7-customization).CometChatConversations onSearchBarClicked → CometChatSearch, no uid/guid — or showSearchBar={false}); IN-CHAT scoped search in the SIDE PANEL (CometChatMessageHeader showSearchOption default true → onSearchOptionClicked → CometChatSearch with the current uid/guid, mutually exclusive with the thread). Each renders a back button (onBack) you MUST wire to close + return, PLUS onConversationClicked/onMessageClicked to select the hit — a companion you open, you must also close. (Real server-side search may also need a Dashboard toggle — VERIFY.)references/layout.md. The kit fills its parent and ships its own loadingView/emptyView, so a broken-looking surface is a HOST container-sizing defect (a content-driven box), not a kit bug — two modes: static collapse (~0px sliver) and load-transition reflow (grows into place as content loads). Satisfy the 5 invariants: prepare/RESET the ancestor chain (html,body,#root{height:100%;margin:0} + undo the Vite/CRA/Next scaffold center+cap+pad, AUDIT-019/035) · pin the surface to a content-INDEPENDENT 100dvh (never min-height/auto) · size COLUMNS with min-height:0/overflow:hidden (scroll, don't grow the parent) · let the kit loading state fill the pinned box · no transform/filter ancestors. The 2-column CSS is in layout.md; the 3-column/embedded/popup/sidebar recipes in cometchat-react-v7-placement. Keep CometChatProvider WRAPPING .cc-app, not inside it (the .cometchat wrapper breaks the row — AUDIT-036).conversationsRequestBuilder prop (pass the CometChat.ConversationsRequestBuilder INSTANCE, .setLimit(30).setConversationType("user") — setLimit required; "group" for groups-only; reuse the prop, don't hand-roll a client-side filter), and scope the selector to match (no Groups tab on a 1:1-only app). A generic unscoped "add chat" keeps BOTH. Example in references/component-props.md.light and does NOT follow the OS (no theme="system") — sync CometChatProvider theme= to prefers-color-scheme by default (references/theming.md, AUDIT-004).headerView / MessageHeader trailingView), NEVER a sibling on top (slot map: references/component-props.md). Unclear prop → fetch its .md twin (references/docs-map.md), never the .d.ts.CometChatErrorBoundary wraps the surface (children required; optional onError/fallbackView/componentName) — a render error then shows a localized fallback + retry, not a blank white screen. It is NOT the initializer (init/login still happen first). Leave header call buttons + composer attach/emoji/voice as built-in defaults; do NOT turn on gated extensions/AI/plugins; do NOT add selector tabs / a details or scoped-search side panel / call logs / incoming call (those are the GROWTHS) unless asked — but the thread panel IS part of the default. Prod auth: loginWithAuthToken with a per-user server-minted token; the Auth Key is dev-only (references/lifecycle.md).Grows on request → the full combined app (users/groups/calls tabs, a details/thread/scoped-search side panel, CometChatIncomingCall at root, calls, individual features) — the UNION of these growths. The compile-verified combined-app recipe (with the required column CSS + CometChatErrorBoundary) is baked in cometchat-react-v7-placement; build the grown app from it. A user who scopes DOWN (embed/popup/sidebar) → the matching cometchat-react-v7-placement variant.
references/setup-credentials.md — detect, config reuse, version_conflict, dashboard creds, env, authorize.references/lifecycle.md — init-once + StrictMode, concurrent-login guard (ensureLoggedIn), get-current-UID (sync vs async), prod auth-token, logout, the full CometChatProvider.references/layout.md — the ONE reflow-free-surface sizing standard (the 5 invariants: prepared ancestor chain · pinned content-independent height · min-height:0 columns · kit loading state inside the pinned box = NO load-transition reflow · no transform/filter ancestors). placement + calls reference it too — change sizing rules HERE.references/ssr.md — Next.js / Astro / React Router SSR safety ("use client", ssr:false, client:only).references/theming.md — CSS import-once + --cometchat-* variables (depth: cometchat-react-v7-customization).cometchat-i18n + cometchat-a11y skills. Don't render a raw key (group_info) — the provider auto-wires localization. React theme tokens: references/theming.md.references/anti-patterns.md — the 15 real-bug anti-patterns (incl. transform/Tailwind overlay bug, container dimensions, scaffold-boilerplate = centered/capped/gutter-boxed chat (#15), global-CSS-leak = centered names / expanding header, raw-i18n-key rendering).references/dependencies.md — packages, major pins, CometChat.* SDK types, bundle-size cost transparency.references/component-props.md — BAKED stable props + view slots for the 4 drop-ins (where custom UI goes IN each component — search → Conversations headerView, MessageHeader trailingView, etc.).references/docs-map.md — intent → the exact docs .md twin to fetch (replaces reading .d.ts); for a whole feature/task, its "Task guides (recipes)" section says to BUILD FROM the official guide + COMPARE your implementation against it (docs-maximal), then apply the hardening deltas.window is not defined, ~0px collapse, kit error state, empty lists, events not firing, version_conflict) → the cometchat-react-v7-troubleshooting skill.Visual Builder (VCB) is out of scope. If asked to integrate a VCB export, point to the CometChat Visual Builder docs (via
references/docs-map.md); don't hand-roll a builder-export flow.
references/anti-patterns.md)version_conflict (v6 installed) · wrong Region or env prefix · Auth Key shipped to prod client · rendering/login before init resolves.
Start the app → confirm init() then login() resolve → the CometChatConversations list renders inside CometChatProvider (itself inside CometChatErrorBoundary) at full size (not a collapsed sliver); open a conversation → the message pane loads and messages send/receive; clicking "reply in thread" opens the thread panel (default) and its back/close returns to the list (hidden only if the user opted out), and the thread's MESSAGE LIST reads as a distinct surface matching its own header/composer (not the same shade as the main list — the --cometchat-message-list-bg override is scoped on the thread wrapper); clicking the message-header search icon opens an in-chat search in the side panel scoped to THAT conversation (default), with back to close; the conversations search bar is wired-or-hidden (no dead-ends); on a narrow viewport it collapses to one pane at a time (list → message → thread/search → back). Blank white screen ⇒ something rendered before init() resolved, the Region / env prefix is wrong, or an unbounded render error escaped (add CometChatErrorBoundary). A list + message pane with no sizing / no error boundary / dead-ending affordances ⇒ under-delivery (see the golden path). Growing to the full app (tabs + side panel + incoming call) ⇒ verify per cometchat-react-v7-placement.
After it builds + verifies, don't dump silently — tell the user briefly: (1) what I wired (3–5 bullets, NAME the files); (2) decisions & why, flagging dev-only AS dev-only (dev Auth Key → server auth token for prod; the <uid>; OS-follow theme); (3) what I did NOT touch (additive — routing/auth/styles intact). Then (4) offer these THREE options as a SELECTABLE choice and WAIT for the user's pick — do NOT auto-continue:
reactions or mentions — they are ON BY DEFAULT in v7 (core messaging; their dashboard extensions are "(Legacy)", already in core — AUDIT-077); if the user asks, say they're already on and offer to customize them. Then build the chosen one (→ cometchat-react-v7-features / cometchat-react-v7-calls).cometchat-react-v7-customization).A PARKED capability (push · migration · SDK-only) → isn't in this pack yet: say so honestly + link CometChat's docs. This 3-option close runs after EVERY implementation (RULES.md §19 / AUDIT-040).
references/anti-patterns.md (opens in a new tab)references/component-props.md (opens in a new tab)references/dependencies.md (opens in a new tab)references/docs-map.md (opens in a new tab)references/layout.md (opens in a new tab)references/lifecycle.md (opens in a new tab)references/setup-credentials.md (opens in a new tab)references/ssr.md (opens in a new tab)references/theming.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub cometchat/cometchat-skills --plugin cometchat-skills98 skills in this plugin
/cometchatEntry point for any CometChat task on any platform. Detects the framework + UI Kit version (React, Angular, iOS, Android, React Native, Flutter), then routes to that family's skills — for a NEW integration or a change to an existing one. Triggers: 'add chat', 'add cometchat', 'add chat to my app', 'add calling', 'change something in my chat', 'my chat is already set up', 'add a feature to the chat', 'add chat to my android app', 'integrate cometchat android', 'add chat to my ios app', 'integrate cometchat ios', 'add chat to my swift app', 'migrate my app to cometchat', 'migrate from sendbird', 'migrate from getstream / stream', 'replace sendbird / stream chat with cometchat', 'build a <app> clone', 'make a chat app like <app>', 'make it look and work like <app>'./cometchat-a11yKeep a CometChat integration accessible — the UI Kit is designed targeting WCAG 2.1 AA with keyboard navigation (verify per component in its docs; full conformance still needs manual testing), and this skill makes sure the HOST app doesn't break that, covering contrast, focus, screen-reader context, reduced motion, RTL, and calls accessibility. Cross-family. Triggers: 'is cometchat accessible', 'WCAG / 508 / ADA compliance', 'screen reader support', 'keyboard navigation', 'a11y audit', 'accessible chat', 'contrast/focus issues in chat'.Other plugins' skills for the same job