@cometchat/skills 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CometChat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,15 +1,23 @@
1
1
  # cometchat-skills
2
2
 
3
- **Add CometChat to any React project through your AI coding agent.** Works with Claude Code, Cursor, Codex, VS Code Copilot, Windsurf, Cline, Kiro, and [30+ more agents](https://github.com/vercel-labs/skills).
3
+ **Add CometChat to any React or React Native project through your AI coding agent.** Works with Claude Code, Cursor, Codex, VS Code Copilot, Windsurf, Cline, Kiro, and [30+ more agents](https://github.com/vercel-labs/skills).
4
4
 
5
- v3 takes an AI-first approach: your agent has a short conversation with you to understand your project and chat requirements, then writes production-grade integration code tailored to the files you already have.
5
+ v3 takes an AI-first approach: your agent has a short conversation with you to understand your project and chat requirements, then writes production-grade integration code tailored to the files you already have. One slash — `/cometchat` — works for every supported framework, web or React Native.
6
6
 
7
7
  ## Install
8
8
 
9
+ **Web (React, Next.js, React Router, Astro):**
9
10
  ```bash
10
11
  npx @cometchat/skills add
11
12
  ```
12
13
 
14
+ **React Native (Expo, bare RN):**
15
+ ```bash
16
+ npx @cometchat/skills-native add
17
+ ```
18
+
19
+ Both packages ship the same `cometchat` dispatcher — install whichever matches your project, or both for a monorepo with web + native.
20
+
13
21
  Supported IDEs: Claude Code (default), Cursor, Kiro, VS Code Copilot. Use `--ide <name>` to target a specific one, or `--ide all`.
14
22
 
15
23
  Then in your IDE:
@@ -20,12 +28,12 @@ Then in your IDE:
20
28
 
21
29
  ## What happens
22
30
 
23
- 1. **Detects** your framework (React / Next.js / React Router / Astro), router, env prefix, existing auth system
31
+ 1. **Detects** your framework (React / Next.js / React Router / Astro / Expo / bare React Native), router, env prefix, existing auth system
24
32
  2. **Onboards** you to CometChat in the terminal — no browser round-trip. Signup, login, app creation all via the CLI.
25
- 3. **Asks** what you're building (marketplace, SaaS, messaging, support, social, or just exploring) and **where** chat should live in your project — it reads your routes, nav, and components before proposing a placement
33
+ 3. **Asks** what you're building (marketplace, SaaS, messaging, support, social, or just exploring) and **where** chat should live in your project — it reads your routes/screens, nav, and components before proposing a placement that fits (route+drawer for web, stack/tab/modal/bottom-sheet for RN)
26
34
  4. **Shows the plan** — exactly which files it will create, which it will modify, and which it will not touch — and waits for your approval
27
- 5. **Writes** the provider, integration components, and route/trigger wiring
28
- 6. **Saves** `.env` with the correct framework prefix (`VITE_` / `NEXT_PUBLIC_` / `PUBLIC_`) and records your choices in `.cometchat/config.json`
35
+ 5. **Writes** the provider, integration components, and route/screen/trigger wiring
36
+ 6. **Saves** `.env` with the correct framework prefix (`VITE_` / `NEXT_PUBLIC_` / `PUBLIC_` / `EXPO_PUBLIC_` / bare for `react-native`) and records your choices in `.cometchat/config.json`
29
37
 
30
38
  No templates, no experiences to pick — the agent writes real code that fits your app.
31
39
 
@@ -33,11 +41,12 @@ No templates, no experiences to pick — the agent writes real code that fits yo
33
41
 
34
42
  | Framework | Status |
35
43
  |---|---|
36
- | React.js / Vite / CRA | ✅ |
37
- | Next.js (App Router + Pages Router) | ✅ |
38
- | React Router v6 / v7 | ✅ |
39
- | Astro (React islands) | ✅ |
40
- | React Native | 🔜 Coming soon |
44
+ | React.js / Vite / CRA | ✅ (`@cometchat/skills`) |
45
+ | Next.js (App Router + Pages Router) | ✅ (`@cometchat/skills`) |
46
+ | React Router v6 / v7 | ✅ (`@cometchat/skills`) |
47
+ | Astro (React islands) | ✅ (`@cometchat/skills`) |
48
+ | Expo (managed + Expo Router) | (`@cometchat/skills-native`) |
49
+ | Bare React Native (CLI) | ✅ (`@cometchat/skills-native`) |
41
50
  | Flutter | 🔜 Coming soon |
42
51
  | Android / iOS | 🔜 Coming soon |
43
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/skills",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -20,21 +20,22 @@
20
20
  "license": "MIT",
21
21
  "repository": {
22
22
  "type": "git",
23
- "url": "https://github.com/cometchat/cometchat-skills.git"
23
+ "url": "git+https://github.com/cometchat/cometchat-skills.git"
24
24
  },
25
25
  "homepage": "https://github.com/cometchat/cometchat-skills#readme",
26
26
  "bugs": {
27
27
  "url": "https://github.com/cometchat/cometchat-skills/issues"
28
28
  },
29
29
  "bin": {
30
- "cometchat-skills": "./bin/install.js"
30
+ "cometchat-skills": "bin/install.js"
31
31
  },
32
32
  "files": [
33
33
  "bin/",
34
- "skills/"
34
+ "skills/",
35
+ "!skills/cometchat-native-*/"
35
36
  ],
36
37
  "engines": {
37
- "node": ">=16"
38
+ "node": ">=18"
38
39
  },
39
40
  "scripts": {
40
41
  "setup": "node bin/install.js add",
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: cometchat
3
- description: Entry-point for CometChat integration. Guides a multi-step interactive conversation to understand the project, gather requirements, and write production-quality integration code.
3
+ description: Entry-point for CometChat integration in any React project — web (React/Next.js/React Router/Astro) and React Native (Expo/bare). Detects the framework, gathers requirements through an interactive conversation, and writes production-quality integration code.
4
4
  license: "MIT"
5
5
  allowed-tools: "executeBash, readFile, fileSearch, listDirectory, AskUserQuestion"
6
6
  metadata:
7
7
  author: "CometChat"
8
8
  version: "3.0.0"
9
- tags: "cometchat dispatcher entry react chat"
9
+ tags: "cometchat dispatcher entry react nextjs react-router astro expo react-native chat"
10
10
  ---
11
11
 
12
12
  ## Use this skill when
@@ -15,10 +15,20 @@ The user wants to add CometChat to any kind of project. Trigger phrases:
15
15
 
16
16
  - `/cometchat`
17
17
  - "add cometchat", "integrate cometchat", "add chat to my app"
18
- - "add messaging", "add chat ui"
18
+ - "add messaging", "add chat ui", "add in-app chat"
19
19
 
20
- This is the **entry point**. Do not invoke framework-specific skills
21
- directly — this dispatcher will route to the right ones.
20
+ This is the **entry point for every framework**. Do NOT invoke
21
+ framework-specific skills directly — this dispatcher detects the
22
+ framework first and routes to the right ones.
23
+
24
+ **Supported frameworks:**
25
+
26
+ | Family | Frameworks |
27
+ |---|---|
28
+ | **Web** | React (Vite/CRA), Next.js, React Router v6/v7, Astro |
29
+ | **React Native** | Expo (managed + Expo Router), bare RN CLI |
30
+
31
+ The web family loads `@cometchat/chat-uikit-react` + `@cometchat/chat-sdk-javascript`. The RN family loads `@cometchat/chat-uikit-react-native` + `@cometchat/chat-sdk-react-native`. The dispatcher decides which set after Step 1's detection.
22
32
 
23
33
  ## How v3 works
24
34
 
@@ -27,11 +37,11 @@ the framework and dump code. You have a conversation with the developer
27
37
  to understand their project, their use case, and exactly where chat
28
38
  should go — THEN you write code that fits.
29
39
 
30
- The pattern skills teach you:
31
- - `cometchat-core` — initialization, login, CSS, env vars, provider pattern
32
- - `cometchat-components` — every component name, props, composition patterns
33
- - `cometchat-placement` — WHERE to put chat (route, modal, drawer, embed, widget)
34
- - `cometchat-{framework}-patterns` — framework-specific integration patterns
40
+ Pattern skills (loaded from your context, not via `Skill()`):
41
+ - `cometchat-core` (web) / `cometchat-native-core` (RN) init, login, provider chain, env vars, anti-patterns
42
+ - `cometchat-components` (web) / `cometchat-native-components` (RN) — component catalog, props, composition
43
+ - `cometchat-placement` (web) / `cometchat-native-placement` (RN) — WHERE to put chat
44
+ - One per-framework skill (`cometchat-{react,nextjs,react-router,astro}-patterns` or `cometchat-native-{expo,bare}-patterns`) — framework-specific details
35
45
 
36
46
  **Key principle: ask, don't assume.** Every piece of information you need
37
47
  from the user should be asked explicitly. Don't guess the route path,
@@ -56,24 +66,61 @@ If no config, run detection:
56
66
  npx @cometchat/skills-cli detect --json
57
67
  ```
58
68
 
59
- **Then read the project yourself this is critical:**
69
+ The JSON output includes `framework` (one of `reactjs`, `nextjs`, `react-router`, `astro`, `expo`, `react-native`, or `null`), framework-specific fields (`router`, `expo_mode`, `react_native_version`, `env_prefix`), and a `compatibility.supported` flag. If `supported` is `false`, stop and surface the warnings.
70
+
71
+ **Then read the project yourself — this is critical.**
72
+
73
+ **For web frameworks (`reactjs`, `nextjs`, `react-router`, `astro`):**
60
74
  - `package.json` — name, dependencies, scripts
61
75
  - The source directory structure — list all directories under `src/` or `app/`
62
- - Find the router: look for `createBrowserRouter`, `app/` directory, `pages/`,
63
- `react-router.config.ts`, `astro.config.*`
76
+ - Find the router: `createBrowserRouter`, `app/` directory, `pages/`, `react-router.config.ts`, `astro.config.*`
64
77
  - Find the layout: `App.tsx`, `layout.tsx`, `root.tsx`, `Layout.astro`
65
- - Find the nav: look for components with "nav", "header", "sidebar" in name
78
+ - Find the nav: components with "nav", "header", "sidebar" in name
66
79
  - Find existing pages/routes: list them so you can reference them later
67
80
 
81
+ **For React Native (`expo`, `react-native`):**
82
+ - `package.json` — name, RN version, all dependencies, scripts
83
+ - Entry file — `index.js` or `App.{tsx,jsx}` or `app/_layout.tsx` (Expo Router)
84
+ - Navigation — look for `@react-navigation/native`, `@react-navigation/stack`, `@react-navigation/bottom-tabs`, or `expo-router`
85
+ - Existing screens — list all files under `screens/`, `src/screens/`, `app/`, or wherever routes live
86
+ - Existing nav structure — read the root navigator to see stack vs tab vs drawer layout
87
+
68
88
  Store this mental map — you'll use it throughout the conversation.
69
89
 
70
- If `compatibility.supported` is `false`, stop and surface the warnings.
90
+ **Compatibility baselines (the CLI enforces these):**
91
+ - Web: react@<18 → upgrade required; nextjs@<13 → warning; astro@<4 → warning
92
+ - RN: react-native@<0.70 → upgrade required; expo@<49 → upgrade required
93
+
94
+ #### Pattern skills not installed?
95
+
96
+ The dispatcher routes to either web pattern skills (`cometchat-{core,components,placement,*-patterns}`) or RN pattern skills (`cometchat-native-{core,components,placement,*-patterns}`) based on the detected framework. If the matching set isn't loaded in your context — i.e. the user installed only one of `@cometchat/skills` (web) or `@cometchat/skills-native` (RN) and the framework doesn't match — stop and tell them which package to install:
97
+
98
+ **If `framework` is `expo` or `react-native` AND `cometchat-native-core` is NOT loaded:**
99
+ > "This is a React Native / Expo project, but the React Native pattern
100
+ > skills aren't installed in this workspace. Install them with:
101
+ > ```
102
+ > npx @cometchat/skills-native add
103
+ > ```
104
+ > then run `/cometchat` again."
105
+
106
+ **If `framework` is `reactjs`, `nextjs`, `react-router`, or `astro` AND `cometchat-core` is NOT loaded:**
107
+ > "This is a {framework} project, but the web pattern skills aren't
108
+ > installed in this workspace. Install them with:
109
+ > ```
110
+ > npx @cometchat/skills add
111
+ > ```
112
+ > then run `/cometchat` again."
113
+
114
+ To check, attempt to read `cometchat-core/SKILL.md` (web) or `cometchat-native-core/SKILL.md` (RN) from your loaded skills context. If the read fails, the package isn't installed.
115
+
116
+ Do NOT attempt to write web UI Kit code into an RN project (CSS imports + `<a href>` + `document.*` will fail at runtime) or RN UI Kit code into a web project (`react-native-gesture-handler`, `@gorhom/bottom-sheet`, native bubble components have no browser equivalents).
71
117
 
72
118
  ### Step 2 — Set up credentials (onboarding)
73
119
 
74
120
  **CRITICAL: All onboarding happens via CLI commands. NEVER send the user
75
- to a browser or dashboard. The CLI handles signup, login, app creation,
76
- and credential writing — all from the terminal.**
121
+ to a browser or dashboard for credential copy-pasting. The CLI handles
122
+ signup, login, app creation, and credential writing — all from the
123
+ terminal — for every framework.**
77
124
 
78
125
  If config has `appId` set, verify credentials are in `.env` and skip to Step 3.
79
126
 
@@ -107,12 +154,10 @@ This command:
107
154
  1. Generates a short-lived session via the CLI auth API.
108
155
  2. Opens `https://app.cometchat.com/login?sessionId=<hex>` in the user's default browser.
109
156
  3. Polls the auth API every 5 seconds for up to 15 minutes.
110
- 4. When the user finishes signing in (email+password, Google, or GitHub — whatever their account uses), the dashboard marks the session authenticated. The next poll receives the bearer token and stores it in the OS keychain.
157
+ 4. When the user finishes signing in, the dashboard marks the session authenticated. The next poll receives the bearer token and stores it in the OS keychain.
111
158
  5. Prints `✓ Logged in as <email> (backend: keychain-macos).`
112
159
 
113
- Let the CLI block — do NOT background it, do NOT race it with other
114
- prompts. The user completes sign-in in the browser tab; the terminal
115
- waits.
160
+ Let the CLI block — do NOT background it, do NOT race it with other prompts.
116
161
 
117
162
  Terminal error handling (surface verbatim, stop, do not retry silently):
118
163
  - `ACCESS_DENIED` — user clicked Deny in the dashboard.
@@ -120,15 +165,9 @@ Terminal error handling (surface verbatim, stop, do not retry silently):
120
165
  - `TIMEOUT` — max polls exhausted before user authorized.
121
166
  - `ABORTED` — user Ctrl-C'd the CLI.
122
167
  - `NETWORK` — couldn't reach the auth host.
123
- - `ALREADY_AUTHENTICATED` — this session was already consumed. Re-run
124
- `auth login` to mint a fresh session.
125
-
126
- After success, verify:
127
- ```bash
128
- npx @cometchat/skills-cli auth status --json
129
- ```
168
+ - `ALREADY_AUTHENTICATED` — this session was already consumed. Re-run `auth login` to mint a fresh session.
130
169
 
131
- If `status` is `"logged-in"`, proceed to **Step 2c**.
170
+ After success, verify via `auth status --json` and proceed to **Step 2c**.
132
171
 
133
172
  #### Step 2b — Sign up (new account, browser flow)
134
173
 
@@ -136,26 +175,11 @@ If `status` is `"logged-in"`, proceed to **Step 2c**.
136
175
  npx @cometchat/skills-cli auth signup
137
176
  ```
138
177
 
139
- Same polling flow as Step 2a, but the CLI opens
140
- `https://app.cometchat.com/signup?sessionId=<hex>`. The browser
141
- handles everything — email, name, password, verification email, role,
142
- industry. The CLI never sees any of those values. When the user
143
- finishes signup in the browser, the next poll stores the bearer token
144
- in the OS keychain and the CLI prints `✓ Logged in as <email>`.
145
-
146
- No role / name / verification-code questions in the chat. The dashboard
147
- owns that flow now; skipping it keeps the user's password and verification
148
- code out of the transcript.
149
-
150
- Error codes match Step 2a (ACCESS_DENIED, EXPIRED, TIMEOUT, ABORTED,
151
- NETWORK, ALREADY_AUTHENTICATED). Surface verbatim and stop.
178
+ Same polling flow as Step 2a, but the CLI opens the signup URL. The browser handles email, name, password, verification email, role, industry. The CLI never sees any of those values.
152
179
 
153
- After success, verify:
154
- ```bash
155
- npx @cometchat/skills-cli auth status --json
156
- ```
180
+ No role / name / verification-code questions in the chat. The dashboard owns that flow now; skipping it keeps the user's password and verification code out of the transcript.
157
181
 
158
- If `status` is `"logged-in"`, proceed to **Step 2c**.
182
+ Error codes match Step 2a. After success, verify via `auth status --json` and proceed to **Step 2c**.
159
183
 
160
184
  #### Step 2c — Pick or create an app
161
185
 
@@ -171,28 +195,20 @@ npx @cometchat/skills-cli provision list --json
171
195
  >
172
196
  > Which one should I use, or should I create a new one?"
173
197
 
174
- **For an existing app**, fetch credentials and wire everything in one call
175
- (pass `--framework` from Step 1 detection — one of `reactjs`, `nextjs`,
176
- `react-router`, `astro`):
198
+ **For an existing app**, fetch credentials and wire everything in one call. Pass `--framework` from Step 1 detection (one of `reactjs`, `nextjs`, `react-router`, `astro`, `expo`, `react-native`):
177
199
  ```bash
178
200
  npx @cometchat/skills-cli provision setup \
179
201
  --app-id "<selected-appId>" --framework "<framework>" --json
180
202
  ```
181
203
 
182
- This creates/updates `.env` with the correct prefix AND writes
183
- `.cometchat/config.json` in one step. Output is compact:
184
- `{ appId, region, framework, envFile, configPath }` — no authKey echoed
185
- back, no multi-command chain. Skip ahead to "Tell the user" below.
204
+ This creates/updates the env file with the correct prefix AND writes `.cometchat/config.json` in one step. Output is compact: `{ appId, region, framework, envFile, configPath }` — no authKey echoed back.
186
205
 
187
206
  **If no apps exist** (or user wants new), collect:
188
207
  1. App name — suggest `<project-name>-chat` from package.json `name`
189
- 2. Region — use `AskUserQuestion`:
208
+ 2. Region — `AskUserQuestion`:
190
209
  - **question:** "Which region for your CometChat app?"
191
210
  - **header:** "Region"
192
- - **options:**
193
- 1. label: "US", description: "United States (recommended)"
194
- 2. label: "EU", description: "Europe"
195
- 3. label: "India", description: "India"
211
+ - **options:** US (recommended), EU, India
196
212
 
197
213
  **Region key mapping** (CLI expects lowercase):
198
214
  | Label | `--region` value |
@@ -200,18 +216,12 @@ back, no multi-command chain. Skip ahead to "Tell the user" below.
200
216
  | US | `us` |
201
217
  | EU | `eu` |
202
218
  | India | `in` |
203
- 3. Industry — use `AskUserQuestion`:
204
- - **question:** "What's your app's industry?"
205
- - **header:** "Industry"
206
- - **options:**
207
- 1. label: "SaaS / Business", description: ""
208
- 2. label: "Marketplace", description: ""
209
- 3. label: "Social / Community", description: ""
210
- 4. label: "Other", description: ""
219
+ 3. Industry — `AskUserQuestion`:
220
+ - **options:** SaaS / Business, Marketplace, Social / Community, Other (or finer-grained from the table below)
211
221
 
212
222
  **Industry key mapping:**
213
223
 
214
- | Label | --industry value |
224
+ | Label | `--industry` value |
215
225
  |---|---|
216
226
  | SaaS / Business | `saas_businesses` |
217
227
  | Marketplace | `online_marketplaces` |
@@ -225,30 +235,16 @@ back, no multi-command chain. Skip ahead to "Tell the user" below.
225
235
  | On-demand Services | `on_demand_services` |
226
236
  | Other | `other` |
227
237
 
228
- **Confirm before creating:**
229
- > "I'll create a CometChat app:
230
- > - Name: test-cometchat-vite-chat
231
- > - Region: US
232
- > - Industry: SaaS / Business
233
- >
234
- > Go ahead?"
235
-
236
- Then create the app AND wire `.env` AND save config in one step. Pass
237
- `--framework` from Step 1 detection (one of `reactjs`, `nextjs`,
238
- `react-router`, `astro`):
238
+ **Confirm before creating, then:**
239
239
  ```bash
240
240
  npx @cometchat/skills-cli provision setup \
241
241
  --name "<name>" --region "<region>" --industry "<industry_key>" \
242
242
  --framework "<framework>" --json
243
243
  ```
244
244
 
245
- Output is compact: `{ appId, region, framework, envFile, configPath }`.
246
- The authKey is written to the env file but is NOT echoed to stdout, so
247
- credentials don't appear multiple times in the transcript. This replaces
248
- the old `provision create` → `provision use` → `config init` chain.
245
+ The authKey is written to the env file but is NOT echoed to stdout, so credentials don't appear multiple times in the transcript.
249
246
 
250
- Tell the user: "Your CometChat account and app are ready. Credentials
251
- saved to `.env`. Let's set up the integration."
247
+ Tell the user: "Your CometChat account and app are ready. Credentials saved to `<envFile>`. Let's set up the integration."
252
248
 
253
249
  #### Step 2d — Paste keys manually
254
250
 
@@ -260,19 +256,37 @@ Tell the user which env vars to set based on the detected framework:
260
256
  | nextjs | `.env.local` | `NEXT_PUBLIC_COMETCHAT_APP_ID`, `NEXT_PUBLIC_COMETCHAT_REGION`, `NEXT_PUBLIC_COMETCHAT_AUTH_KEY` |
261
257
  | react-router | `.env` | `VITE_COMETCHAT_APP_ID`, `VITE_COMETCHAT_REGION`, `VITE_COMETCHAT_AUTH_KEY` |
262
258
  | astro | `.env` | `PUBLIC_COMETCHAT_APP_ID`, `PUBLIC_COMETCHAT_REGION`, `PUBLIC_COMETCHAT_AUTH_KEY` |
259
+ | expo (managed + Expo Router) | `.env` | `EXPO_PUBLIC_COMETCHAT_APP_ID`, `EXPO_PUBLIC_COMETCHAT_REGION`, `EXPO_PUBLIC_COMETCHAT_AUTH_KEY` |
260
+ | react-native (bare CLI) | `.env` | `COMETCHAT_APP_ID`, `COMETCHAT_REGION`, `COMETCHAT_AUTH_KEY` (paired with `react-native-dotenv`) |
263
261
 
264
262
  > "Grab your credentials from https://app.cometchat.com → Your App →
265
263
  > API & Auth Keys. Create the env file above and tell me when done."
266
264
 
265
+ **Bare RN extra step.** Bare RN doesn't ship a public-env-prefix convention — pair the env file with `react-native-dotenv`:
266
+ ```bash
267
+ npm install --save-dev react-native-dotenv
268
+ ```
269
+ and add the plugin to `babel.config.js`:
270
+ ```js
271
+ module.exports = {
272
+ presets: ["module:@react-native/babel-preset"],
273
+ plugins: [["module:react-native-dotenv"]],
274
+ };
275
+ ```
276
+ Then `import { COMETCHAT_APP_ID, COMETCHAT_REGION, COMETCHAT_AUTH_KEY } from "@env";` in the provider.
277
+
267
278
  After they confirm, verify:
268
279
  ```bash
269
280
  npx @cometchat/skills-cli config init --json
270
281
  ```
271
282
 
283
+ #### Never log the Auth Key
284
+
285
+ After writing credentials, don't echo the Auth Key back in the transcript. Confirm as `✓ Wrote <PREFIX>COMETCHAT_AUTH_KEY (hidden)`.
286
+
272
287
  ### Step 3 — Interactive requirements gathering
273
288
 
274
- This is the core of v3. A multi-step conversation that gathers everything
275
- you need before writing a single line of code.
289
+ This is the core of v3. A multi-step conversation that gathers everything you need before writing a single line of code.
276
290
 
277
291
  #### 3a. "What are you building?"
278
292
 
@@ -283,19 +297,20 @@ Otherwise, use `AskUserQuestion`:
283
297
  - **header:** "Your app"
284
298
  - **multiSelect:** false
285
299
  - **options:**
286
- 1. label: "Messaging app", description: "Chat is the main feature — like Slack, Discord, or WhatsApp."
287
- 2. label: "Marketplace or platform", description: "Buyers and sellers communicate — like Airbnb, eBay, or Fiverr."
288
- 3. label: "SaaS or dashboard", description: "Team chat or support chat inside a product — like Notion or Intercom."
289
- 4. label: "Social or community", description: "User profiles with messaging — like a dating app or forum."
300
+ 1. label: "Messaging app", description: "Chat is the main feature — like Slack, Discord, WhatsApp, or Telegram."
301
+ 2. label: "Marketplace or platform", description: "Buyers and sellers communicate — like Airbnb, eBay, OfferUp, or Depop."
302
+ 3. label: "SaaS or productivity", description: "Team chat or support chat inside a product — like Notion, Intercom, or Linear."
303
+ 4. label: "Social or community", description: "User profiles with messaging — like a dating app or community forum."
290
304
  5. label: "Support or helpdesk", description: "Customer-to-agent communication."
291
305
  6. label: "Just exploring", description: "Quick demo — fastest path to see chat working."
292
306
 
293
- **If "Just exploring":** skip the rest of Step 3. Use `cometchat apply`
294
- demo mode in Step 5.
307
+ **If "Just exploring":** skip the rest of Step 3 and scaffold the minimal integration in Step 5 — one route/screen showing `<CometChatConversations />` with `cometchat-uid-1` pre-logged-in.
295
308
 
296
309
  #### 3b. Show what you recommend and why
297
310
 
298
- Based on the intent, present the recommendation:
311
+ The recommendation table differs by family because the placement vocabulary is different (web has routes/drawers/widgets; RN has screens/tabs/sheets):
312
+
313
+ **Web family (reactjs, nextjs, react-router, astro):**
299
314
 
300
315
  | Intent | What you'll set up |
301
316
  |---|---|
@@ -305,18 +320,25 @@ Based on the intent, present the recommendation:
305
320
  | **Social / community** | A full messenger page with tabs: Chats, Calls, Users, Groups. |
306
321
  | **Support** | A floating widget bubble in the bottom-right corner. |
307
322
 
308
- When explaining, reference the ASCII art from `cometchat-placement`
309
- ("Visual reference — experience layouts") so the user can visualize it.
323
+ **React Native family (expo, react-native):**
324
+
325
+ | Intent | What you'll set up |
326
+ |---|---|
327
+ | **Messaging app** | A dedicated "Messages" bottom tab. Conversations list → tap a conversation → message thread. |
328
+ | **Marketplace** | A "Chat with seller" button on the product screen that opens a modal with the message thread. Plus an "Inbox" stack screen for all conversations. |
329
+ | **SaaS / productivity** | A "Chat" stack screen accessible from the nav or a header button. Optionally a bottom sheet for quick replies. |
330
+ | **Social / community** | A "Messages" bottom tab with conversations list + message thread. Plus a "Message" button on user profile screens that opens a modal. |
331
+ | **Support** | A modal triggered from a "Help" or "Support" button in the header or settings. |
332
+
333
+ When explaining, reference the ASCII diagrams from `cometchat-placement` (web) or `cometchat-native-placement` (RN) so the user can visualize.
310
334
 
311
- Ask: "Does this sound right, or do you want a different approach?"
312
- Let them override.
335
+ Ask: "Does this sound right, or do you want a different approach?" Let them override.
313
336
 
314
337
  #### 3c. Ask where things should go
315
338
 
316
- **Show the user their actual project structure** — list the pages/routes
317
- you found in Step 1. Then ask placement-specific questions:
339
+ **Show the user their actual project structure** — list the pages/routes/screens you found in Step 1. Then ask placement-specific questions appropriate to the family.
318
340
 
319
- **For Route placement (messaging, social):**
341
+ **Web Route placement (messaging, social):**
320
342
  > "I found these pages in your project:
321
343
  > - / (home)
322
344
  > - /about
@@ -325,59 +347,88 @@ you found in Step 1. Then ask placement-specific questions:
325
347
  >
326
348
  > Where should the messages page live?"
327
349
 
328
- Default suggestion: `/messages`. Let user type a custom path.
350
+ Default: `/messages`. Let user type a custom path.
329
351
 
330
- **For Drawer placement (marketplace):**
352
+ **Web Drawer placement (marketplace):**
331
353
  > "Which page should have the 'Chat' button that opens the drawer?
332
- > I found these pages:
333
- > - app/products/[id]/page.tsx
334
- > - app/listings/page.tsx
335
- > - app/profile/[id]/page.tsx
336
- >
337
- > Which one?"
354
+ > I found these pages: ..."
338
355
 
339
- After they pick, read that page file. Look for existing buttons,
340
- actions, or interactive elements. Ask:
341
- > "I see a 'Contact Seller' button in ProductDetail.tsx at line 45.
342
- > Should I wire the chat drawer to that button, or add a new one?"
356
+ Read the picked page. Look for existing buttons, actions, or interactive elements. Ask whether to wire to the existing button or add a new one.
343
357
 
344
- **For Modal placement (SaaS):**
358
+ **Web Modal placement (SaaS):**
345
359
  > "Where should the 'Open chat' button go? I found these components
346
- > that look like navigation:
347
- > - src/components/Navbar.tsx
348
- > - src/components/Sidebar.tsx
349
- >
350
- > Which one should have the chat trigger?"
360
+ > that look like navigation: ..."
351
361
 
352
- **For Widget placement (support):**
362
+ **Web Widget placement (support):**
353
363
  > "Should the widget appear on all pages, or only specific ones?"
354
364
 
355
- **For combinations (marketplace = drawer + route):**
356
- Ask both questions in sequence. The drawer and route are separate
357
- components wired into separate places.
365
+ **RN Bottom tab placement (messaging, social):**
366
+ > "I found these bottom tabs in your navigator at App.tsx:
367
+ > - Home
368
+ > - Profile
369
+ > - Settings
370
+ >
371
+ > Where should the 'Messages' tab go? (At the end, or pick a position.)"
372
+
373
+ **RN — Stack screen placement (saas, marketplace inbox):**
374
+ > "I found these stack screens in your root navigator: ...
375
+ >
376
+ > What should I call the chat screen? Default: MessagesScreen."
377
+
378
+ **RN — Modal placement (marketplace, support):**
379
+ > "Which screen should have the 'Chat' button that opens the modal?
380
+ > I found these screens: ..."
381
+
382
+ Read the picked screen. Look for existing buttons. Ask whether to wire to it or add a new one.
383
+
384
+ **RN — BottomSheet placement (quick reply, support):**
385
+ > "Bottom sheets slide up from below. Should the sheet be:
386
+ > 1. Draggable (user can dismiss by swiping down) — uses @gorhom/bottom-sheet
387
+ > 2. Fixed overlay — uses CometChat's built-in CometChatBottomSheet
388
+ >
389
+ > Which one?"
390
+
391
+ **Combinations** (marketplace = drawer/modal + inbox): ask both questions in sequence — they're separate components wired into separate places.
392
+
393
+ **Expo Router projects** — adapt screen names to file paths:
394
+ - Stack screen → `app/messages.tsx` (or the path the user picks)
395
+ - Bottom tab → file under `app/(tabs)/messages.tsx` + update `app/(tabs)/_layout.tsx`
396
+ - Modal → `app/(modals)/chat.tsx` with `presentation: "modal"` in the parent `_layout.tsx`
358
397
 
359
398
  #### 3d. Detect and ask about authentication
360
399
 
361
- Read the project's `package.json` and source files. Look for auth:
400
+ Read the project's `package.json` and source files. Look for auth.
362
401
 
402
+ **Web auth libraries:**
363
403
  - `next-auth` / `@auth/core` → NextAuth
364
404
  - `@clerk/nextjs` / `@clerk/clerk-react` → Clerk
365
405
  - `@supabase/supabase-js` + auth usage → Supabase Auth
366
406
  - `firebase` / `firebase/auth` → Firebase Auth
367
407
  - `passport` → Passport.js
368
408
  - `jsonwebtoken` / `jose` → Custom JWT
369
- - None detected → no auth
409
+
410
+ **RN auth libraries:**
411
+ - `firebase` / `@react-native-firebase/auth` → Firebase Auth
412
+ - `@clerk/clerk-expo` / `@clerk/clerk-react-native` → Clerk
413
+ - `@supabase/supabase-js` + auth usage → Supabase Auth
414
+ - `react-native-auth0` → Auth0
415
+ - `aws-amplify` + auth module → AWS Cognito
416
+ - `@react-native-google-signin/google-signin` → Google Sign-In (usually paired with something above)
417
+ - `expo-auth-session` / `expo-secure-store` → Expo Auth Session (custom)
418
+
419
+ **None detected** → no auth.
370
420
 
371
421
  Report what you found and ask:
372
422
 
373
423
  If auth detected:
374
- > "I see you're using [NextAuth / Clerk / etc.]. Here's how CometChat
375
- > will work with it:
424
+ > "I see you're using [NextAuth / Firebase Auth / etc.]. Here's how
425
+ > CometChat will work with it:
376
426
  >
377
427
  > - **Development (now):** I'll use CometChat's Auth Key for quick
378
- > testing with pre-seeded users (cometchat-uid-1, uid-2, etc.)
379
- > - **Production (later):** Your server will call CometChat's REST API
380
- > to generate per-user auth tokens. I can set this up now or later.
428
+ > testing with pre-seeded users (cometchat-uid-1 through uid-5).
429
+ > - **Production (later):** Your server will mint per-user auth tokens
430
+ > via the CometChat REST API. I can set this up now or later
431
+ > (see `cometchat-production` / `cometchat-native-production`).
381
432
  >
382
433
  > Start with dev mode for now? You can upgrade to production auth
383
434
  > anytime by choosing 'Set up production auth' from the menu."
@@ -396,148 +447,197 @@ If the user has auth AND wants to set up production mode now:
396
447
  > "How should your app's users map to CometChat users?
397
448
  >
398
449
  > 1. Use your existing user ID as the CometChat UID (simplest)
399
- > 2. Generate a separate CometChat UID and store it in your database
400
- > 3. Let me just set up dev mode for now
401
- >
402
- > Option 1 works if your user IDs are alphanumeric strings (no spaces,
403
- > no special characters). What does a typical user ID look like in
404
- > your system?"
450
+ > 2. Generate a separate CometChat UID and store it alongside your user record
451
+ > 3. Let me just set up dev mode for now"
405
452
 
406
- If they share an example, validate it's CometChat-compatible
407
- (alphanumeric, underscores, hyphens — no spaces or special chars).
453
+ If they share an example, validate it's CometChat-compatible (alphanumeric, underscores, hyphens — no spaces or special chars; max 100 chars). Firebase UIDs, Clerk user IDs, Supabase UUIDs, and Auth0 `sub` claims are all CometChat-compatible by default.
408
454
 
409
455
  #### 3f. Confirm the plan
410
456
 
411
- **This is critical. Show EXACTLY what you'll do before doing it.**
457
+ **This is critical. Show EXACTLY what you'll do before doing it.** The plan format differs by framework.
412
458
 
459
+ **Web example (Next.js, marketplace):**
413
460
  > "Here's what I'll create:
414
461
  >
415
462
  > **New files:**
416
- > - `app/providers/CometChatProvider.tsx` — initialization + login
417
- > - `app/messages/page.tsx` — inbox with conversation list + message view
418
- > - `app/components/ChatDrawer.tsx` — slide-out drawer for product page chat
419
- > - `.env.local` — CometChat credentials (already filled)
463
+ > - `app/providers/CometChatProvider.tsx`
464
+ > - `app/messages/page.tsx`
465
+ > - `app/components/ChatDrawer.tsx`
466
+ > - `.env.local`
420
467
  >
421
468
  > **Files I'll modify:**
422
- > - `app/products/[id]/page.tsx` — add ChatDrawer import + trigger button
423
- > - `app/layout.tsx` — wrap children with CometChatProvider
469
+ > - `app/products/[id]/page.tsx` — add ChatDrawer trigger
470
+ > - `app/layout.tsx` — wrap with CometChatProvider
424
471
  > - `app/components/Navbar.tsx` — add 'Messages' link
425
472
  >
426
- > **Files I will NOT touch:**
427
- > - `app/page.tsx` (your home page)
428
- > - Any other existing pages
473
+ > **Dependencies:** @cometchat/chat-sdk-javascript, @cometchat/chat-uikit-react
429
474
  >
430
- > **Dependencies to install:**
431
- > - @cometchat/chat-sdk-javascript
432
- > - @cometchat/chat-uikit-react
475
+ > **Auth mode:** Development (Auth Key).
476
+ > Proceed? [y/n]"
477
+
478
+ **RN example (Expo Router, messaging):**
479
+ > "Here's what I'll create:
433
480
  >
434
- > **Auth mode:** Development (Auth Key). Upgrade to production
435
- > with `/cometchat` → 'Set up production auth' when ready.
481
+ > **New files:**
482
+ > - `providers/CometChatProvider.tsx`
483
+ > - `app/(tabs)/messages.tsx`
484
+ > - `.env`
436
485
  >
486
+ > **Files I'll modify:**
487
+ > - `app/_layout.tsx` — wrap with the four-wrapper chain
488
+ > - `app/(tabs)/_layout.tsx` — add the Messages tab
489
+ > - `index.js` — `import 'react-native-gesture-handler'` at line 1 (if missing)
490
+ >
491
+ > **Dependencies (via `npx expo install`):**
492
+ > @cometchat/chat-uikit-react-native, @cometchat/chat-sdk-react-native,
493
+ > react-native-gesture-handler, react-native-reanimated,
494
+ > react-native-safe-area-context, react-native-screens,
495
+ > @react-native-async-storage/async-storage, @react-native-community/netinfo,
496
+ > react-native-video, react-native-image-picker, react-native-document-picker,
497
+ > react-native-vector-icons, react-native-fs
498
+ >
499
+ > **Auth mode:** Development (Auth Key).
437
500
  > Proceed? [y/n]"
438
501
 
439
- Wait for explicit confirmation. If the user says no or wants changes,
440
- go back to the relevant question and re-ask.
502
+ **Bare RN variant** same as Expo, except `npm install` instead of `npx expo install`, plus:
503
+ - Run `cd ios && pod install`
504
+ - Patch `ios/<Name>/Info.plist`, `android/app/src/main/AndroidManifest.xml` for permissions
505
+ - Add `ios/<Name>/PrivacyInfo.xcprivacy` (Apple Privacy Manifest)
506
+ - Patch `android/build.gradle` for the async-storage Maven repo (v3+)
507
+
508
+ Wait for explicit confirmation. If the user says no or wants changes, go back to the relevant question and re-ask.
441
509
 
442
510
  ### Step 4 — Reference pattern skills
443
511
 
444
- **All 13 skills are already loaded in your context** as `.claude/skills/`
445
- files. Do NOT use the `Skill()` tool — that's for a different system.
446
- Instead, simply read and follow the instructions in these skills:
512
+ **All skills are already loaded in your context** as `.claude/skills/` files. Do NOT use the `Skill()` tool. Read and follow them directly.
447
513
 
514
+ **For web frameworks:**
448
515
  1. `cometchat-core` — initialization, provider, CSS, anti-patterns
449
516
  2. `cometchat-components` — component catalog, composition patterns
450
- 3. Framework skill for the detected framework:
517
+ 3. Framework-specific:
451
518
  - `reactjs` → `cometchat-react-patterns`
452
519
  - `nextjs` → `cometchat-nextjs-patterns`
453
520
  - `react-router` → `cometchat-react-router-patterns`
454
521
  - `astro` → `cometchat-astro-patterns`
455
522
  4. `cometchat-placement` — placement pattern for the chosen approach
456
523
 
457
- These are reference documents in your context, not tool calls.
524
+ **For React Native:**
525
+ 1. `cometchat-native-core` — init, login, four-wrapper provider chain, env vars, anti-patterns
526
+ 2. `cometchat-native-components` — component catalog
527
+ 3. Framework-specific:
528
+ - `expo` (managed + Expo Router) → `cometchat-native-expo-patterns`
529
+ - `react-native` (bare CLI) → `cometchat-native-bare-patterns`
530
+ 4. `cometchat-native-placement` — placement pattern (stack/tab/modal/bottom-sheet/embed)
458
531
 
459
532
  ### Step 5 — Write the integration
460
533
 
461
- Execute the confirmed plan. For each file:
534
+ Execute the confirmed plan. The order of operations is the same for every framework, but the file names + provider shape differ.
462
535
 
463
- 1. **CometChatProvider**follow the framework skill's provider pattern.
464
- Use the correct env var prefix. Module-level `initialized` guard.
465
- Mount at the level agreed in Step 3f.
536
+ **Webcommon steps:**
466
537
 
538
+ 1. **CometChatProvider** — follow the framework skill's provider pattern. Use the correct env var prefix. Module-level `initialized` guard. Mount at the level agreed in Step 3f.
467
539
  2. **Chat component(s)** — follow the placement skill's pattern.
468
- Use the component compositions from the components skill.
469
- If drawer/modal: connect to the specific user/group the user specified.
470
-
471
- 3. **Wire into existing project** — READ each file before modifying:
472
- - Router: add the route entry. Show the user the diff.
473
- - Nav: add the link. Show the user the diff.
474
- - Trigger page: add the drawer/modal import + trigger button. Show diff.
475
-
540
+ 3. **Wire into existing project** — READ each file before modifying. Add the route, nav link, drawer/modal trigger.
476
541
  4. **CSS import** — add once at the root level per framework conventions.
477
-
478
- 5. **Environment variables** — write `.env` with the correct prefix.
479
- If auth key is already there from the wizard, don't duplicate.
480
-
542
+ 5. **Environment variables** — write the env file with the correct prefix.
481
543
  6. **Install dependencies:**
482
544
  ```bash
483
545
  npm install @cometchat/chat-sdk-javascript @cometchat/chat-uikit-react
484
546
  ```
485
547
 
486
- 7. **Update config.json**save all the choices in one call:
548
+ **React Nativecommon steps:**
549
+
550
+ 1. **Entry file** (`index.js` / `App.tsx` / `app/_layout.tsx`) — verify `import "react-native-gesture-handler";` is **line 1**. Not line 2, not after another import. Non-negotiable.
551
+ 2. **CometChatProvider** — follow `cometchat-native-core` § 6. Module-level `initialized` guard. Module-level `loginInFlight` promise for login concurrency.
552
+ 3. **Four-wrapper chain** — wrap the app's root in this exact order:
553
+ ```tsx
554
+ <GestureHandlerRootView style={{ flex: 1 }}>
555
+ <SafeAreaProvider>
556
+ <CometChatThemeProvider>
557
+ <CometChatProvider>
558
+ {/* navigator / Expo Router <Stack> */}
559
+ </CometChatProvider>
560
+ </CometChatThemeProvider>
561
+ </SafeAreaProvider>
562
+ </GestureHandlerRootView>
563
+ ```
564
+ 4. **Chat screen(s)** — follow `cometchat-native-placement`'s pattern.
565
+ 5. **Every `<CometChatMessageList>` MUST pass `hideReplyInThreadOption={true}`** (see hard rules).
566
+ 6. **Wire into existing project** — READ each file before modifying.
567
+ 7. **Environment variables** — write `.env` with the correct prefix (`EXPO_PUBLIC_` for Expo, bare for `react-native`).
568
+ 8. **Install dependencies:**
569
+
570
+ **Expo managed:**
487
571
  ```bash
488
- npx @cometchat/skills-cli config save \
489
- --intent "<intent>" \
490
- --experience <n> \
491
- --placement "<type>" \
492
- --placement-path "<path>" \
493
- --auth-mode "<mode>" --json
572
+ npx expo install @cometchat/chat-uikit-react-native @cometchat/chat-sdk-react-native \
573
+ react-native-gesture-handler react-native-reanimated react-native-safe-area-context \
574
+ react-native-screens @react-native-async-storage/async-storage \
575
+ @react-native-community/netinfo react-native-video react-native-image-picker \
576
+ react-native-document-picker react-native-vector-icons react-native-fs
494
577
  ```
495
- Pass only the fields you have — `config save` accepts any subset.
496
- This replaces the old 5-command `config set k v` chain. Omit
497
- `--experience` in the AI-written path (it only applies to CLI-
498
- generated experiences 1/2/3).
499
-
500
- 8. **Record state so Phase B commands work — DO NOT SKIP.** Every
501
- Phase B command (`info`, `status`, `doctor`, `verify`, `uninstall`,
502
- `apply-theme`, `apply-feature`, `add-widget`, `add-user-mgmt`,
503
- `production-auth`) reads `.cometchat/state.json` to know what the
504
- integration looks like. Without this step, every one of them reports
505
- "not integrated in this project" even though the code is there, and
506
- the user can't iterate on their integration at all.
507
-
508
- Pass every file you wrote (owned) and every existing file you patched:
578
+
579
+ **Bare RN:**
509
580
  ```bash
510
- npx @cometchat/skills-cli state record \
511
- --framework "<framework>" \
512
- --placement "<type>" \
513
- --placement-path "<path>" \
514
- --auth-mode "<mode>" \
515
- --files-owned "src/providers/CometChatProvider.tsx,src/components/ChatDrawer.tsx,src/pages/MessagesPage.tsx" \
516
- --files-patched "src/main.tsx:v3/main.tsx,src/App.tsx:v3/App.tsx,src/components/Layout.tsx:v3/Layout.tsx" \
517
- --json
581
+ npm install @cometchat/chat-uikit-react-native @cometchat/chat-sdk-react-native \
582
+ react-native-gesture-handler react-native-reanimated react-native-safe-area-context \
583
+ react-native-screens @react-native-async-storage/async-storage \
584
+ @react-native-community/netinfo react-native-video react-native-image-picker \
585
+ react-native-document-picker react-native-vector-icons react-native-fs
586
+ cd ios && pod install && cd ..
518
587
  ```
519
588
 
520
- - `--files-owned` comma-separated list of every NEW file you wrote
521
- (the provider, drawer, inbox page, etc.). The CLI computes SHA-256
522
- checksums for each so it can detect drift later.
523
- - `--files-patched` — comma-separated `path:patch_id` pairs for every
524
- EXISTING file you modified (main.tsx, App.tsx, Layout.tsx, nav, the
525
- trigger page). `patch_id` can be any stable label `v3/<filename>`
526
- is a reasonable default.
527
-
528
- If this call errors (CLI flag mismatch, missing --framework, etc.),
529
- surface the error and retry with the correct flags rather than moving
530
- on. A completed Phase A with a missing state.json is worse than a
531
- visible error — the user discovers the breakage later when they try
532
- to add a feature or run diagnostics.
533
-
534
- **Exception"Just exploring" / demo mode:**
589
+ **Reanimated plugin (both):** verify `react-native-reanimated/plugin` is the LAST entry in `babel.config.js` `plugins` array. Metro cache is sensitive to plugin order.
590
+
591
+ 9. **Native config (bare RN only):**
592
+ - `ios/<Name>/Info.plist`add `NSCameraUsageDescription`, `NSPhotoLibraryUsageDescription`, `NSMicrophoneUsageDescription`
593
+ - `android/app/src/main/AndroidManifest.xml` add `CAMERA`, `RECORD_AUDIO`, `READ_MEDIA_IMAGES`, `READ_EXTERNAL_STORAGE` permissions
594
+ - `ios/<Name>/PrivacyInfo.xcprivacy` add the 4 required API codes (C617.1, CA92.1, 35F9.1, E174.1). See `cometchat-native-bare-patterns`.
595
+ - `android/build.gradle` async-storage Maven repo if v3+
596
+
597
+ **Expo managed** — all of this goes in `app.json` under `plugins` and `ios.infoPlist` / `android.permissions`. See `cometchat-native-expo-patterns`.
598
+
599
+ #### Step 5 common to ALL frameworks
600
+
601
+ After the framework-specific work above, every integration ends the same way:
602
+
603
+ 10. **Update config.json** save all the choices in one call:
604
+ ```bash
605
+ npx @cometchat/skills-cli config save \
606
+ --intent "<intent>" \
607
+ --placement "<type>" \
608
+ --placement-path "<path>" \
609
+ --auth-mode "<mode>" --json
610
+ ```
611
+ Pass only the fields you have — `config save` accepts any subset.
612
+
613
+ 11. **Record state so Phase B commands work — DO NOT SKIP.** Every Phase B command (`info`, `status`, `doctor`, `verify`, `uninstall`, `apply-theme`, `apply-feature`, `add-widget`, `add-user-mgmt`, `production-auth`) reads `.cometchat/state.json` to know what the integration looks like. Without this step, every one of them reports "not integrated in this project" even though the code is there.
614
+
615
+ Pass every file you wrote (owned) and every existing file you patched:
616
+ ```bash
617
+ npx @cometchat/skills-cli state record \
618
+ --framework "<framework>" \
619
+ --placement "<type>" \
620
+ --placement-path "<path>" \
621
+ --auth-mode "<mode>" \
622
+ --files-owned "<comma-list of new files>" \
623
+ --files-patched "<comma-list of path:patch_id pairs>" \
624
+ --json
625
+ ```
626
+
627
+ - `--files-owned` — comma-separated list of every NEW file you wrote (provider, drawer, inbox page, screen). The CLI computes SHA-256 checksums for each so it can detect drift later.
628
+ - `--files-patched` — comma-separated `path:patch_id` pairs for every EXISTING file you modified. `patch_id` can be any stable label — `v3/<filename>` is a reasonable default.
629
+
630
+ If this call errors (CLI flag mismatch, missing `--framework`, etc.), surface the error and retry. A completed Phase A with a missing state.json is worse than a visible error — the user discovers the breakage later when they try to add a feature or run diagnostics.
631
+
632
+ **Exception — "Just exploring" / demo mode (web only):**
535
633
  ```bash
536
634
  npx @cometchat/skills-cli apply --experience 1 --framework <detected>
537
635
  npx @cometchat/skills-cli verify --json
538
636
  npx @cometchat/skills-cli install
539
637
  ```
540
638
 
639
+ For RN demo mode, scaffold the minimal integration directly — there's no `apply` template path for RN.
640
+
541
641
  ### Step 6 — Verify + show result
542
642
 
543
643
  Run a TypeScript check to verify the code compiles:
@@ -545,27 +645,85 @@ Run a TypeScript check to verify the code compiles:
545
645
  npx tsc --noEmit
546
646
  ```
547
647
 
548
- **Do NOT run `npx @cometchat/skills-cli verify`** — it checks for
549
- CLI-generated `.cometchat/state.json` which doesn't exist in v3
550
- (AI writes code directly, not via `cometchat apply`). Use `tsc` instead.
648
+ **Do NOT run `npx @cometchat/skills-cli verify`** — it checks for CLI-generated `.cometchat/state.json` that's authored by `cometchat apply`, not by AI integration. Use `tsc` instead.
649
+
650
+ **RN extra: do not start Metro automatically** — let the user do that in their own terminal. Metro blocks the terminal and cannot be meaningfully observed from here.
551
651
 
552
- Surface any issues. Then:
652
+ Surface any common issues:
553
653
 
654
+ **Web:**
655
+ - `Module not found: @cometchat/chat-uikit-react` → install didn't complete
656
+ - CSS variable warnings → CSS import not at root or wrong path
657
+
658
+ **RN:**
659
+ - `Cannot find module '@cometchat/chat-uikit-react-native'` → install didn't complete
660
+ - `JSX element 'GestureHandlerRootView' has no corresponding closing tag` → wrapper chain partially applied
661
+ - `Property 'hideReplyInThreadOption' does not exist on type '...'` → v3 types installed; user needs v5 (`^5.0.0`)
662
+
663
+ Then:
664
+
665
+ **Web result message:**
554
666
  > "CometChat is integrated! Here's what was set up:
555
667
  >
556
- > - Messages page at /messages
557
- > - Chat drawer on product page ✓
668
+ > - <list of new + patched files>
558
669
  > - Provider + CSS wired ✓
559
670
  > - Dependencies installed ✓
560
671
  >
561
- > Run `npm run dev` and try it out. Pre-seeded test users
562
- > (cometchat-uid-1 through uid-5) are ready to chat.
672
+ > Run `npm run dev` and open the app:
673
+ > - **Vite (reactjs)**: http://localhost:5173
674
+ > - **Next.js**: http://localhost:3000/chat
675
+ > - **React Router v7**: http://localhost:5173/chat
676
+ > - **Astro**: http://localhost:4321/chat"
677
+
678
+ **RN result message:**
679
+ > "CometChat is integrated! Here's what was set up:
680
+ >
681
+ > - <list of new + patched files> ✓
682
+ > - Provider + four-wrapper chain ✓
683
+ > - `import 'react-native-gesture-handler'` verified at line 1 ✓
684
+ > - Dependencies installed ✓
685
+ > - `hideReplyInThreadOption={true}` on MessageList ✓
686
+ >
687
+ > Next steps:
688
+ >
689
+ > **Expo managed:**
690
+ > 1. `npx expo start --clear`
691
+ > 2. Open the app in Expo Go (if no native modules) or a dev build
692
+ >
693
+ > **Bare RN:**
694
+ > 1. `npm start -- --reset-cache`
695
+ > 2. In another terminal: `npm run ios` or `npm run android`"
696
+
697
+ **Common ending — empty conversation list explanation (every framework):**
698
+
699
+ > ---
700
+ >
701
+ > **About the empty conversation list you'll see:**
702
+ >
703
+ > Every CometChat app ships with **5 pre-created test users**:
704
+ > `cometchat-uid-1` through `cometchat-uid-5`. Your integration is
705
+ > logged in as `cometchat-uid-1` by default, and a brand-new app has
706
+ > no messages yet — so the conversation list will be empty when you
707
+ > first load the page. **This is normal, not a bug.**
708
+ >
709
+ > **To see chat actually working** (60 seconds, no code changes):
710
+ > 1. Open `https://app.cometchat.com` → your app → **Users** tab
711
+ > 2. Click `cometchat-uid-2` → **Send Message** button
712
+ > 3. Pick `cometchat-uid-1` as the recipient, type "hello", send
713
+ > 4. Refresh the dev URL (web) or reload the app (RN: shake → Reload, or press `r` in Metro)
714
+ > 5. A conversation will appear — open it to see the message and reply
715
+ >
716
+ > The 5 test users (`cometchat-uid-1` through `uid-5`) can also chat
717
+ > with each other from the dashboard, so you can seed multiple
718
+ > conversations the same way.
563
719
  >
564
720
  > What would you like to do next?"
565
721
 
566
722
  ### Step 7 — Iteration menu
567
723
 
568
- Use `AskUserQuestion`:
724
+ Use `AskUserQuestion`. The option set differs by family — RN has two extra options (push notifications + testing) that don't apply to web.
725
+
726
+ **Web — 8 canonical options:**
569
727
  - **question:** "What would you like to do next?"
570
728
  - **header:** "Next step"
571
729
  - **multiSelect:** false
@@ -579,62 +737,82 @@ Use `AskUserQuestion`:
579
737
  7. label: "Run diagnostics", description: "Check for drift, missing env vars, broken imports."
580
738
  8. label: "I'm done", description: "Exit."
581
739
 
582
- For **component customization**: read `cometchat-components` + docs MCP,
583
- then write the customization code directly. This is pure AI work — no
584
- CLI command. Ask the user what they want to customize, read the relevant
585
- component's props from the catalog, and propose changes.
740
+ **RN 10 canonical options:**
741
+ - **question:** "What would you like to do next?"
742
+ - **header:** "Next step"
743
+ - **multiSelect:** false
744
+ - **options:**
745
+ 1. label: "Customize look and feel (themes)", description: "Colors, typography, dark mode — edit CometChatThemeProvider."
746
+ 2. label: "Add a feature", description: "Calls, reactions, polls, extensions, AI agent — browse the catalog."
747
+ 3. label: "Customize a component", description: "Custom bubbles, headers, message composer actions, empty states."
748
+ 4. label: "Add another placement", description: "Add a modal chat, a bottom sheet, or another tab — without touching the existing integration."
749
+ 5. label: "Set up push notifications", description: "APNs + FCM setup, CometChat dashboard config, client registration, tap-to-deep-link. Required for production."
750
+ 6. label: "Set up production auth", description: "Replace the dev Auth Key with a server-minted auth token. Read `cometchat-native-production` skill."
751
+ 7. label: "Set up user management", description: "Server endpoints for creating, updating, deleting CometChat users."
752
+ 8. label: "Set up testing", description: "Jest + React Native Testing Library setup, mocks for the UI Kit / SDK, E2E with Detox or Maestro."
753
+ 9. label: "Troubleshoot an issue", description: "Metro cache, pod install, iOS privacy manifest, push notifications, native module linking."
754
+ 10. label: "I'm done", description: "Exit."
755
+
756
+ For **theme customization**: read the framework-appropriate theming skill and write the customization code.
757
+
758
+ For **adding features**: read the framework-appropriate features skill. Features fall into buckets (Default, Dashboard-toggle, Package-install, Component-swap). Ask which feature, then follow the right bucket's recipe.
759
+
760
+ For **component customization**: read the customization + components skills, then write the customization code directly. Ask the user what they want to customize, read the relevant component's props from the catalog, propose changes.
761
+
762
+ For **production auth**: read the framework-appropriate production skill. It's interactive — ask the user about their auth system and generate the server-side token endpoint for their backend.
586
763
 
587
- For **production auth**: read the `cometchat-production` skill (already
588
- in your context). It's interactive — ask the user about their auth
589
- system and generate the server-side token endpoint for their framework.
764
+ For **push notifications (RN only)**: read `cometchat-native-push`. Structured 12-section walkthrough.
765
+
766
+ For **testing (RN only)**: read `cometchat-native-testing`. Ask the user whether they want unit tests (Jest + RNTL), E2E (Detox vs Maestro), or both.
767
+
768
+ For **troubleshooting (RN)**: read `cometchat-native-troubleshooting` and match the symptom to a triage table. (Web: option 7 "Run diagnostics" runs `cometchat doctor` against `.cometchat/state.json`.)
590
769
 
591
770
  ### Re-rendering the menu after each action
592
771
 
593
- After every Phase B action completes, you **MUST** re-invoke
594
- `AskUserQuestion` with the **exact same 8 options** listed above
595
- (same `question`, `header`, `multiSelect: false`, same option labels
596
- and descriptions — verbatim). This gives the user arrow-key selection
597
- in their terminal.
772
+ After every Phase B action completes, you **MUST** re-invoke `AskUserQuestion` with the **exact same option set** (web: 8 options, RN: 10) — same `question`, `header`, `multiSelect: false`, same labels and descriptions, verbatim. This gives the user arrow-key selection in their terminal.
598
773
 
599
774
  **Do NOT:**
600
- - Present the options as a prose bullet list (`"What would you like to
601
- do next?\n - Customize the theme...\n - Add calls..."`) this
602
- forces the user to type their answer, which is a worse UX.
603
- - Invent new options based on what the user just did (e.g. "Customize
604
- theme to match Nestly's brand", "Swap the drawer header for a custom
605
- view"). The 8 options above are the canonical set and don't change
606
- between iterations.
607
- - Skip the menu and ask a freeform "What's next?" — always route
608
- through `AskUserQuestion`.
609
- - Drop options or add new ones. The user expects the same 8 choices
610
- every time, even if some are redundant with what they just did
611
- (they may want to do the same kind of action twice, e.g. add two
612
- features).
613
-
614
- The iteration loop is the whole point of Phase B. Re-rendering the
615
- canonical menu via `AskUserQuestion` after every action is how the
616
- user controls the session.
775
+ - Present the options as a prose bullet list forces typed answers, worse UX.
776
+ - Invent new options based on what the user just did. The canonical set doesn't change between iterations.
777
+ - Skip the menu and ask freeform "What's next?" always route through `AskUserQuestion`.
778
+ - Drop options or add new ones. The user expects the same choices every time, even if some are redundant with what they just did (they may want to do the same kind of action twice).
779
+
780
+ The iteration loop is the whole point of Phase B. Re-rendering the canonical menu via `AskUserQuestion` after every action is how the user controls the session.
617
781
 
618
782
  ## Hard rules
619
783
 
784
+ ### Always (every framework)
785
+
620
786
  - **Ask, don't assume.** Every integration decision should be confirmed.
621
- - Always run `detect` first. Do not assume the framework.
787
+ - **Always run `detect` first.** Do not assume the framework.
622
788
  - Always use `npx @cometchat/skills-cli` for CLI commands.
623
789
  - NEVER replace existing project files unless the user chose demo mode.
624
790
  - ALWAYS read existing files before modifying them.
625
791
  - ALWAYS show the plan (Step 3f) and get confirmation before writing.
626
- - For component names and props, use the `cometchat-components` skill
627
- or docs MCPnever invent from training data.
628
- - After writing code, update `.cometchat/config.json` with the choices made.
629
- - **NEVER use the `Skill()` tool** to load CometChat skills. All 13
630
- skills are already in your context as `.claude/skills/` files. Just
631
- read and follow them directly.
792
+ - **Every `<CometChatMessageList>` must pass `hideReplyInThreadOption={true}`** unless the user has explicitly opted into thread support and you've built the thread screen too. Without it, tapping a message shows a "Reply in Thread" action that leads to a broken (undefined) thread view.
793
+ - **NEVER build a custom search UI.** The UI Kit ships `<CometChatSearch>` full dual-scope search across conversations + messages with built-in filter chips, pagination, and result highlighting. Any request involving "search", "find messages", "search conversations" MUST use the built-in component (and `showSearchBar` / `onSearchBarClicked` on `CometChatConversations` for web; `hideSearch={false}` for RN). Do NOT create custom search bars, hand-rolled result lists, or filter UIs.
794
+ - For component names and props, use the framework-appropriate `*-components` skill or docs MCP — never invent from training data.
795
+ - After writing code, record state in `.cometchat/state.json` (Step 5 step 11) so the iteration menu can detect the integration in a future session.
796
+ - **NEVER use the `Skill()` tool** to load CometChat skills. They're already in your context as `.claude/skills/` files. Just read and follow them directly.
797
+
798
+ ### Web only
799
+
800
+ - **CSS import goes once at the root level** per framework conventions. The framework skill (cometchat-{react,nextjs,react-router,astro}-patterns) tells you exactly where.
801
+ - **For drawer / widget animations, animate `right` / `left`, NEVER `transform` / `translate-*`.** A `transform` on a CometChat-containing element creates a new containing block that re-anchors absolutely-positioned overlays (emoji picker, action sheet, reactions, thread panel) to the transformed element instead of the viewport. Tailwind utilities `translate-x-*`, `-translate-x-*`, `scale-*`, `rotate-*`, `transform-*` are also banned for this reason. See `cometchat-placement` § 10.
802
+
803
+ ### React Native only
804
+
805
+ - **`import "react-native-gesture-handler"` must be line 1 of the entry file.** Not line 2. Not after another import. This is non-negotiable.
806
+ - **All four wrappers are required, in this order:** `GestureHandlerRootView → SafeAreaProvider → CometChatThemeProvider → CometChatProvider`. Omitting any of them breaks gestures, safe areas, theming, or login state — and it fails silently in dev.
807
+ - **Login API is `CometChatUIKit.login({ uid })` or `CometChatUIKit.login({ authToken })`** — same method, different object key. There is no `loginWithAuthToken`. Passing a bare string like `login("cometchat-uid-1")` silently fails on RN.
632
808
 
633
809
  ## Error handling
634
810
 
635
- If the CLI's `--json` output includes `human_message` / `suggestion` fields,
636
- show those to the user. Then show the raw `error` in parentheses for
637
- debuggability. If `retryable: false`, do NOT offer a retry.
811
+ If the CLI's `--json` output includes `human_message` / `suggestion` fields, show those to the user. Then show the raw `error` in parentheses for debuggability. If `retryable: false`, do NOT offer a retry.
812
+
813
+ For RN: if a command errors (e.g., `pod install` fails, `npx expo install` fails), surface the raw error output and consult `cometchat-native-troubleshooting` for the relevant triage table before retrying. Don't loop silently.
814
+
815
+ If the user's project is bare RN with `ios/` and `android/` but no `package.json` scripts for `ios`/`android` (common when React Native was added incrementally to an existing native app), flag that and pause. Writing integration code won't help if the app can't build.
638
816
 
639
817
  ## Optional: docs MCP
640
818
 
@@ -647,6 +825,8 @@ Not required for integration or Phase B CLI flows.
647
825
 
648
826
  ## Skill routing reference
649
827
 
828
+ ### Web family
829
+
650
830
  | Skill | When to load |
651
831
  |---|---|
652
832
  | `cometchat-core` | Always — before any integration code |
@@ -658,5 +838,23 @@ Not required for integration or Phase B CLI flows.
658
838
  | `cometchat-astro-patterns` | framework = astro |
659
839
  | `cometchat-theming` | When customizing themes |
660
840
  | `cometchat-features` | When adding features |
841
+ | `cometchat-customization` | When writing custom formatters, events, request-builder filters |
661
842
  | `cometchat-production` | When setting up production auth |
662
843
  | `cometchat-troubleshooting` | When diagnosing problems |
844
+
845
+ ### React Native family
846
+
847
+ | Skill | When to load |
848
+ |---|---|
849
+ | `cometchat-native-core` | Always — before any integration code |
850
+ | `cometchat-native-components` | Always — before writing component code |
851
+ | `cometchat-native-placement` | When integrating — for placement patterns |
852
+ | `cometchat-native-expo-patterns` | framework = expo (managed + Expo Router) |
853
+ | `cometchat-native-bare-patterns` | framework = react-native (bare CLI) |
854
+ | `cometchat-native-theming` | When customizing themes |
855
+ | `cometchat-native-features` | When adding features |
856
+ | `cometchat-native-customization` | When writing custom text formatters, events, request-builder filters, or DataSource decorators |
857
+ | `cometchat-native-production` | When setting up production auth or user management |
858
+ | `cometchat-native-push` | When setting up push notifications |
859
+ | `cometchat-native-testing` | When adding tests |
860
+ | `cometchat-native-troubleshooting` | When diagnosing problems |
@@ -192,6 +192,15 @@ Full-featured dual-scope search: searches across conversations AND messages with
192
192
 
193
193
  **Works with:** CometChatConversations (replaces the list when search is active)
194
194
 
195
+ > **Hard rule — never roll your own search.** Any request involving
196
+ > "search", "find messages", "search conversations", or "search across
197
+ > conversations" MUST use `<CometChatSearch>` (or `showSearchBar={true}`
198
+ > + `onSearchBarClicked` on `CometChatConversations` to swap into
199
+ > `<CometChatSearch>` on click). Do NOT build custom `<input type="search">`
200
+ > bars, hand-rolled result lists, or filter UIs — they bypass the SDK's
201
+ > pagination, highlighting, and dual-scope (conversations + messages)
202
+ > matching that ship with the built-in component.
203
+
195
204
  ---
196
205
 
197
206
  ### CometChatThreadHeader
@@ -539,6 +539,66 @@ A simpler approach: if any CometChat operation returns a 401 or auth error, re-f
539
539
 
540
540
  **Guard refresh calls with the same concurrency pattern.** If two components both see a 401 at the same time, two `loginWithAuthToken` calls race and the SDK throws *"Please wait until the previous login request ends."* Route token refresh through the same `ensureLoggedIn(uid, authToken)` helper defined in `cometchat-core`'s provider pattern — the module-level `loginInFlight` promise dedupes concurrent refreshes automatically.
541
541
 
542
+ Concrete refresh handler — pair the helper from `cometchat-core` with the connection listener and a token-refetch path:
543
+
544
+ ```typescript
545
+ import { CometChat } from "@cometchat/chat-sdk-javascript";
546
+ import { CometChatUIKit } from "@cometchat/chat-uikit-react";
547
+
548
+ // Module-level — shared across every refresh attempt.
549
+ // Identical shape to the one in cometchat-core § 2.
550
+ let refreshInFlight: Promise<unknown> | null = null;
551
+
552
+ async function refreshSession(uid: string): Promise<void> {
553
+ if (refreshInFlight) {
554
+ // Another component already triggered a refresh — wait for it,
555
+ // don't fire a second loginWithAuthToken.
556
+ await refreshInFlight;
557
+ return;
558
+ }
559
+
560
+ refreshInFlight = (async () => {
561
+ // 1. Fetch a fresh token from your server endpoint.
562
+ // Your existing useCometChatToken hook (Step 1) calls /api/cometchat-token.
563
+ // Extract that fetch into a helper so the refresh path can reuse it.
564
+ const res = await fetch("/api/cometchat-token", {
565
+ method: "POST",
566
+ headers: { "Content-Type": "application/json" },
567
+ body: JSON.stringify({ uid }),
568
+ });
569
+ if (!res.ok) throw new Error(`Token refresh failed: ${res.status}`);
570
+ const { token } = (await res.json()) as { token: string };
571
+
572
+ // 2. Re-authenticate with the new token. SDK swaps the in-memory
573
+ // session — no full reload needed.
574
+ await CometChatUIKit.loginWithAuthToken(token);
575
+ })();
576
+
577
+ try {
578
+ await refreshInFlight;
579
+ } finally {
580
+ refreshInFlight = null;
581
+ }
582
+ }
583
+
584
+ // Wire it into the connection listener so a disconnect triggers refresh.
585
+ CometChat.addConnectionListener(
586
+ "auth-refresh-listener",
587
+ new CometChat.ConnectionListener({
588
+ onDisconnected: () => {
589
+ const uid = CometChatUIKit.getLoggedInUser()?.getUid();
590
+ if (uid) {
591
+ refreshSession(uid).catch((e) => {
592
+ console.error("CometChat refresh failed; user may need to re-login", e);
593
+ });
594
+ }
595
+ },
596
+ }),
597
+ );
598
+ ```
599
+
600
+ `refreshInFlight` mirrors `loginInFlight` from `cometchat-core` § 2 — same dedup pattern, separate promise so the initial-login and refresh paths don't accidentally serialize against each other. If the same component renders in StrictMode AND a 401 arrives during the second mount, the listener and the provider effect can both touch the SDK without colliding.
601
+
542
602
  ---
543
603
 
544
604
  ## 5. User management patterns