Integrates CometChat into various Angular project architectures including Nx monorepos, NgModules, and SSR environments.
- GitHub stars
- 171
- Files
- 1
- Last commit
- Oct 15, 2026
- License
- MIT
- Allowed tools
- —
What does the cometchat-angular-v5-patterns skill do?
cometchat-angular-v5-patterns integrates CometChat into various Angular project architectures including Nx monorepos, NgModules, and SSR environments.
Summary generated from the skill's SKILL.md.
About the cometchat-angular-v5-patterns skill
Developers building chat interfaces in Angular can use this skill to resolve architectural integration issues that arise from specific project structures. It provides guidance for configuring CometChat within Nx monorepos, traditional Angular CLI projects, NgModule-based applications, and SSR or Angular Universal environments. Instead of focusing on the chat API itself, this tool addresses how to wire up environment files, register stylesheets in Nx, and manage component imports to avoid common Angular errors.
When an agent loads this skill, it can help troubleshoot errors like "window is not defined" by implementing browser-only guards using isPlatformBrowser. It also provides patterns for managing state using either RxJS or Signals to prevent UI drift. The skill is specifically designed for projects using @cometchat/chat-uikit-angular versions 5.1.0 through 5.2.0 and Angular versions 17 through 21. It ensures that initialization happens correctly during bootstrap rather than inside lazy-loaded chunks, which prevents redundant execution.
What an agent can do with it
- 1Integrate with NgModulesExplain how to add CometChat components to an application that does not use standalone components.
Written from the skill's SKILL.md. Every use case is checked against a quote from it.
How to install the cometchat-angular-v5-patterns skill
Each command copies the skill folder into the client's skills directory. Restart the client or start a new session to load it.Install the cometchat-angular-v5-patterns skill in Plugin
/plugin marketplace add cometchat/cometchat-skills /plugin install cometchat-skills@cometchat
Install the cometchat-angular-v5-patterns skill in Claude Code
~/.claude/skills/cometchat-angular-v5-patterns/SKILL.md
$ npx degit cometchat/cometchat-skills/skills/cometchat-angular-v5-patterns ~/.claude/skills/cometchat-angular-v5-patternsInstall the cometchat-angular-v5-patterns skill in Claude Code (project)
.claude/skills/cometchat-angular-v5-patterns/SKILL.md
$ npx degit cometchat/cometchat-skills/skills/cometchat-angular-v5-patterns .claude/skills/cometchat-angular-v5-patternsInstall the cometchat-angular-v5-patterns skill in Codex
~/.agents/skills/cometchat-angular-v5-patterns/SKILL.md
$ npx degit cometchat/cometchat-skills/skills/cometchat-angular-v5-patterns ~/.agents/skills/cometchat-angular-v5-patternsInstall the cometchat-angular-v5-patterns skill in Gemini CLI
~/.gemini/skills/cometchat-angular-v5-patterns/SKILL.md
$ npx degit cometchat/cometchat-skills/skills/cometchat-angular-v5-patterns ~/.gemini/skills/cometchat-angular-v5-patternsInstall the cometchat-angular-v5-patterns skill in Claude.ai
npx degit cometchat/cometchat-skills/skills/cometchat-angular-v5-patterns cometchat-angular-v5-patterns && zip -r cometchat-angular-v5-patterns.zip cometchat-angular-v5-patterns # claude.ai → Customize → Skills → + → Create skill → Upload a skill → cometchat-angular-v5-patterns.zip
Automated checks
Ran Nov 14, 2026Full report →Passed our automated checks. That is not a security audit: read the scripts before you let an agent run them. How checks work · What to fix for more points
- Source repository linked and reachablecometchat/cometchat-skills/skills/cometchat-angular-v5-patterns is public and reachablegithub.com/cometchat/cometchat-skills/tree/HEAD/skills/comet ↗Pass
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit 2026-10-15github.com/cometchat/cometchat-skills/commits ↗Pass
- No download-and-run or credential theft in scriptsNo scripts in the skill folderPass
- No hidden instructions in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/cometchat/cometchat-skills/blob/HEAD/skills/comet ↗Pass
- Pre-approved tools are scopedNo pre-approved tools; the agent asks before using onegithub.com/cometchat/cometchat-skills/blob/HEAD/skills/comet ↗Pass
- SKILL.md follows the Agent Skills formatthe description does not say when to use the skillgithub.com/cometchat/cometchat-skills/blob/HEAD/skills/comet ↗Finding
SKILL.md
View on GitHubGround truth: this skill is Angular PROJECT-SHAPE glue — CLI vs Nx, standalone vs NgModule,
environment.ts, SSR, lazy routes. CometChat API surface belongs tocometchat-angular-v5-core; fetch any symbol viacometchat-angular-v5-core/references/docs-map.md. Where the Angular UI Kit docs genuinely do not cover a shape (SSR / Angular Universal), this file says so explicitly and marks the guidance as the pack's own — absence from the guide is never silently presented as documented.
Companion skills (read first)
cometchat-angular-v5-core— install, credentials,init→login→render. Assumed.cometchat-angular-v5-placement— routing a chat page.
Use this skill when
The blocker is the project shape, not CometChat: a monorepo, NgModules, SSR, or where config lives.
Detect the shape first
| Signal | Shape | Deltas |
|---|---|---|
nx.json present |
Nx workspace | env files, project-level styles, path aliases |
angular.json + src/main.ts |
Angular CLI | the default; core's recipe applies as-is |
app.module.ts present |
NgModule app | components go in imports: of the module |
server.ts / @angular/ssr |
SSR / Universal | browser-only guards, see below |
NgModule instead of standalone
The kit's components are standalone, which means an NgModule app imports them into the module's imports array — the same array, a different file:
// app.module.ts
import { NgModule } from '@angular/core';
import { CometChatConversationsComponent, CometChatMessageListComponent } from '@cometchat/chat-uikit-angular';
import { ChatComponent } from './chat/chat.component'; // YOUR (non-standalone) component
@NgModule({
declarations: [ChatComponent],
imports: [CometChatConversationsComponent, CometChatMessageListComponent],
})
export class AppModule {}
Do not add them to declarations — they are not yours to declare, and Angular will error. Init moves from main.ts into an APP_INITIALIZER provider on the module.
Nx workspaces
Three things move:
- Environment files live under the app project, e.g.
apps/<app>/src/environments/environment.ts.fileReplacementsgo in that project'sproject.json, not a rootangular.json. - The kit stylesheet is registered in the app project's build
stylesarray with a workspace-root-relative path:node_modules/@cometchat/chat-uikit-angular/styles/css-variables.css. - Shared wrapper libs may re-export the kit's components; a lib that re-exports must also list them in its own
imports, or consumers get the silent no-render.
Nx does not change the CometChat API at all — only where config lives.
SSR / Angular Universal
The kit is a browser client. The SDK touches window, localStorage and WebSockets, none of which exist on the server.
import { Component, inject, PLATFORM_ID } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
import { CometChatUIKit } from '@cometchat/chat-uikit-angular';
import { environment } from '../environments/environment';
@Component({ selector: 'app-root', standalone: true, template: '<router-outlet />' })
export class AppComponent {
constructor() {
if (isPlatformBrowser(inject(PLATFORM_ID))) {
const { appId, region, authKey } = environment.cometchat;
// init only in the browser — on the server this throws "window is not defined"
CometChatUIKit.initFromSettings({
appId, region,
credentials: { authKey },
chatSDK: { presenceSubscription: { type: 'ALL_USERS' } },
});
}
}
}
Rules:
- Guard every init/login call with
isPlatformBrowser. - Render chat components client-side only (
@deferon hydration, or an*ngIfon a browser flag). Server-rendering them produces markup that immediately mismatches. ThemeServiceis already SSR-safe — it writesdata-themethrough theDOCUMENTtoken rather than touchingdocumentdirectly.- Do not attempt to prerender a chat route; there is nothing meaningful to prerender.
Not in the docs. The Angular UI Kit docs do not cover SSR / Angular Universal. The guards above are derived from what the SDK touches (
window,localStorage, WebSockets) and are the pack's own guidance — absence from the guide is not a signal that they are unnecessary.
Lazy-loading the chat route
{ path: 'chat', loadComponent: () => import('./chat/chat.component').then(m => m.ChatComponent) }
Lazy loading the route is fine and recommended — the kit is large. Init still happens once at bootstrap, not in the lazy chunk, or the first navigation pays for it and a second navigation re-runs it.
State — signals or RxJS, one of them
ChatStateService exposes both (activeUser signal, activeUser$ observable). Pick one style per component and stay in it; mixing produces two update paths for the same value.
- Signals in templates: no subscription, no teardown, no
asyncpipe. - Observables when composing with other streams: always
takeUntil(destroy$)inngOnDestroy.
Never mirror either into your own field — see placement's "two sources of truth" pitfall.
Common pitfalls
- Kit components in
declarations→ Angular error; they belong inimports. - Unguarded init under SSR →
window is not definedat build or first request. - Init inside a lazy chunk → runs late, or twice.
- Nx: env/styles edited at the workspace root → silently no effect; they belong to the app project.
- Signals and observables for the same value → two update paths, drifting UI.
Verify it works
ng build (and ng build --ssr where applicable) passes · chat renders in the browser · no window is not defined on the server · navigating to the lazy route once initialises once · config resolves in every configuration you build.
Files in this skill
1cometchat-angular-v5-patterns skill questions
How do I install the cometchat-angular-v5-patterns skill in Claude Code?
Run npx degit cometchat/cometchat-skills/skills/cometchat-angular-v5-patterns ~/.claude/skills/cometchat-angular-v5-patterns. Claude Code loads skills from ~/.claude/skills (all projects) or .claude/skills (one project) and uses a skill when its description matches the task.
Which clients can use the cometchat-angular-v5-patterns skill?
Any client that reads the Agent Skills format: Claude Code, Codex, Gemini CLI and claude.ai (upload as a ZIP). Scripts in the skill run only where the client allows code execution.
How do I use CometChat components in an NgModule-based Angular app?
Import the standalone kit components directly into the imports array of your NgModule. Do not add them to the declarations array.
How can I prevent 'window is not defined' errors when using Angular SSR?
You must guard every initialization and login call with isPlatformBrowser to ensure they only execute on the client side.
Where should I configure environment files and styles in an Nx workspace?
Environment files should live under the specific app project, and the kit stylesheet must be registered in that app project's build styles array using a workspace-root-relative path.
Should I use Signals or RxJS for state management with CometChat?
You can use either, but you should pick one style per component and avoid mixing them to prevent having two different update paths for the same value.