chat-sdk

Write chat bots once, deploy across Slack, Teams, Google Chat, Discord, GitHub, and Linear.

vercel/chatUpdated Apr 8, 2026

Works with

Claude CodeCursorClineWindsurfCodexGooseGitHub CopilotZed

0

total installs

0

this week

1.6K

GitHub stars

0

upvotes

Install Skill

Run in your terminal

$npx skills add https://github.com/vercel/chat --skill chat-sdk

0

installs

0

this week

1.6K

stars

What it does

  • Unified TypeScript SDK with platform-agnostic event handlers (mentions, messages, reactions, slash commands, actions) and normalized message format across all platforms

  • Built-in streaming support for AI responses via AI SDK integration, plus JSX-based interactive cards with buttons, dropdowns, and form modals

  • Pluggable state adapters for Redis, PostgreSQL, or in-memory persistence; webhook han

Category

Productivity

Repository

vercel/chat

Last updated

Apr 8, 2026

Installation Guide

How to use chat-sdk on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your machine
  • Node.js 16+ with npm — verify with node --version
  • Active project directory where you want to add chat-sdk
2

Run the install command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/vercel/chat --skill chat-sdk

Fetches chat-sdk from vercel/chat and configures it for Cursor.

3

Select Cursor when prompted

The CLI shows a list of agents. Use arrow keys and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ────────────────
│ · Cline · Codex · Goose · Windsurf
│ ●Cursor(selected)
│ · Cursor · Aider · Continue
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/chat-sdk

Restart Cursor to activate chat-sdk. Access via /chat-sdk in your agent's command palette.

Security Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.

Documentation

Chat SDK

Unified TypeScript SDK for building chat bots across Slack, Teams, Google Chat, Discord, Telegram, GitHub, Linear, and WhatsApp. Write bot logic once, deploy everywhere.

Start with published sources

When Chat SDK is installed in a user project, inspect the published files that ship in node_modules:

node_modules/chat/docs/                    # bundled docs
node_modules/chat/dist/index.d.ts          # core API types
node_modules/chat/dist/jsx-runtime.d.ts    # JSX runtime types
node_modules/chat/docs/contributing/       # adapter-authoring docs
node_modules/chat/docs/guides/             # framework/platform guides

If one of the paths below does not exist, that package is not installed in the project yet.

Read these before writing code:

  • node_modules/chat/docs/getting-started.mdx — install and setup
  • node_modules/chat/docs/usage.mdxChat config and lifecycle
  • node_modules/chat/docs/handling-events.mdx — event routing and handlers
  • node_modules/chat/docs/threads-messages-channels.mdx — thread/channel/message model
  • node_modules/chat/docs/posting-messages.mdx — post, edit, delete, schedule
  • node_modules/chat/docs/streaming.mdx — AI SDK integration and streaming semantics
  • node_modules/chat/docs/cards.mdx — JSX cards
  • node_modules/chat/docs/actions.mdx — button/select interactions
  • node_modules/chat/docs/modals.mdx — modal submit/close flows
  • node_modules/chat/docs/slash-commands.mdx — slash command routing
  • node_modules/chat/docs/direct-messages.mdx — DM behavior and openDM()
  • node_modules/chat/docs/files.mdx — attachments/uploads
  • node_modules/chat/docs/state.mdx — persistence, locking, dedupe
  • node_modules/chat/docs/adapters.mdx — cross-platform feature matrix
  • node_modules/chat/docs/api/chat.mdx — exact Chat API
  • node_modules/chat/docs/api/thread.mdx — exact Thread API
  • node_modules/chat/docs/api/message.mdx — exact Message API
  • node_modules/chat/docs/api/modals.mdx — modal element and event details

For the specific adapter or state package you are using, inspect that installed package's dist/index.d.ts export surface in node_modules.

Quick start

import { Chat } from "chat";
import { createSlackAdapter } from "@chat-adapter/slack";
import { createRedisState } from "@chat-adapter/state-redis";

const bot = new Chat({
  userName: "mybot",
  adapters: {
    slack: createSlackAdapter(),
  },
  state: createRedisState(),
  dedupeTtlMs: 600_000,
});

bot.onNewMention(async (thread) => {
  await thread.subscribe();
  await thread.post("Hello! I'm listening to this thread.");
});

bot.onSubscribedMessage(async (thread, message) => {
  await thread.post(`You said: ${message.text}`);
});

Core concepts

  • Chat — main entry point; coordinates adapters, routing, locks, and state
  • Adapters — platform-specific integrations for Slack, Teams, Google Chat, Discord, Telegram, GitHub, Linear, and WhatsApp
  • State adapters — persistence for subscriptions, locks, dedupe, and thread state
  • Thread — conversation context with post(), stream(), subscribe(), setState(), startTyping()
  • Message — normalized content with text, formatted, attachments, author info, and platform raw
  • Channel — container for threads and top-level posts

Event handlers

Handler Trigger
onNewMention Bot @-mentioned in an unsubscribed thread
onDirectMessage New DM in an unsubscribed DM thread
onSubscribedMessage Any message in a subscribed thread
onNewMessage(regex) Regex match in an unsubscribed thread
onReaction(emojis?) Emoji added or removed
onAction(actionIds?) Button clicks and select/radio interactions
onModalSubmit(callbackId?) Modal form submitted
onModalClose(callbackId?) Modal dismissed/cancelled
onSlashCommand(commands?) Slash command invocation
onAssistantThreadStarted Slack assistant thread opened
onAssistantContextChanged Slack assistant context changed
onAppHomeOpened Slack App Home opened
onMemberJoinedChannel Slack member joined channel event

Read node_modules/chat/docs/handling-events.mdx, node_modules/chat/docs/actions.mdx, node_modules/chat/docs/modals.mdx, and node_modules/chat/docs/slash-commands.mdx before wiring handlers. onDirectMessage behavior is documented in node_modules/chat/docs/direct-messages.mdx.

Streaming

Pass any AsyncIterable<string> to thread.post() or thread.stream(). For AI SDK, prefer result.fullStream over result.textStream when available so step boundaries are preserved.

import { ToolLoopAgent } from "ai";

const agent = new ToolLoopAgent({ model: "anthropic/claude-4.5-sonnet" });

bot.onNewMention(async (thread, message) => {
  const result = await agent.stream({ prompt: message.text });
  await thread.post(result.fullStream);
});

Key details:

  • streamingUpdateIntervalMs controls post+edit fallback cadence
  • fallbackStreamingPlaceholderText defaults to "..."; set null to disable
  • Structured StreamChunk support is Slack-only; other adapters ignore non-text chunks

Cards and modals (JSX)

Set jsxImportSource: "chat" in tsconfig.json.

Card components:

  • Card, CardText, Section, Fields, Field, Button, CardLink, LinkButton, Actions, Select, SelectOption, RadioSelect, Table, Image, Divider

Modal components:

  • Modal, TextInput, Select, SelectOption, RadioSelect
await thread.post(
  <Card title="Order #1234">
    <CardText>Your order has been received.</CardText>
    <Actions>
      <Button id="approve" style="primary">Approve</Button>
      <Button id="reject" style="danger">Reject</Button>
    </Actions>
  </Card>
);

Adapter inventory

Official platform adapters

Platform Package Factory
Slack @chat-adapter/slack createSlackAdapter
Microsoft Teams @chat-adapter/teams createTeamsAdapter
Google Chat @chat-adapter/gchat createGoogleChatAdapter
Discord @chat-adapter/discord createDiscordAdapter
GitHub @chat-adapter/github createGitHubAdapter
Linear @chat-adapter/linear createLinearAdapter
Telegram @chat-adapter/telegram createTelegramAdapter
WhatsApp Business Cloud @chat-adapter/whatsapp createWhatsAppAdapter

Official state adapters

State backend Package Factory
Redis @chat-adapter/state-redis createRedisState
ioredis @chat-adapter/state-ioredis createIoRedisState
PostgreSQL @chat-adapter/state-pg createPostgresState
Memory @chat-adapter/state-memory createMemoryState

Community adapters

  • chat-state-cloudflare-do
  • @beeper/chat-adapter-matrix
  • chat-adapter-imessage
  • @bitbasti/chat-adapter-webex
  • @resend/chat-sdk-adapter
  • @zernio/chat-sdk-adapter
  • chat-adapter-baileys
  • @liveblocks/chat-sdk-adapter
  • chat-adapter-sendblue
  • chat-adapter-zalo

Coming-soon platform entries

  • Instagram
  • Signal
  • X
  • Messenger

Building a custom adapter

Read these published docs first:

  • node_modules/chat/docs/contributing/building.mdx
  • node_modules/chat/docs/contributing/testing.mdx
  • node_modules/chat/docs/contributing/publishing.mdx

Also inspect:

  • node_modules/chat/dist/index.d.tsAdapter and related interfaces
  • node_modules/@chat-adapter/shared/dist/index.d.ts — shared errors and utilities
  • Installed official adapter dist/index.d.ts files — reference implementations for config and APIs

A custom adapter needs request verification, webhook parsing, message/thread/channel operations, ID encoding/decoding, and a format converter. Use BaseFormatConverter from chat and shared utilities from @chat-adapter/shared.

Webhook setup

Each registered adapter exposes bot.webhooks.<name>. Wire those directly to your HTTP framework routes. See node_modules/chat/docs/guides/slack-nextjs.mdx and node_modules/chat/docs/guides/discord-nuxt.mdx for framework-specific route patterns.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

Get started →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Steps

  1. 1Install product management skill
  2. 2Start with user story generation for known feature
  3. 3Progress to competitive analysis: research 2-3 competitors
  4. 4Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5Draft stakeholder communications and refine based on feedback
  6. 6Build template library for recurring PM tasks
  7. 7Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use when

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid when

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Related Skills

Reviews

4.773 reviews
  • O
    Olivia HaddadDec 28, 2024

    I recommend chat-sdk for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • H
    Henry YangDec 28, 2024

    chat-sdk has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • T
    Tariq ThompsonDec 24, 2024

    Useful defaults in chat-sdk — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • C
    Charlotte MehtaDec 16, 2024

    We added chat-sdk from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • K
    Kaira RobinsonDec 4, 2024

    Solid pick for teams standardizing on skills: chat-sdk is focused, and the summary matches what you get after install.

  • L
    Luis GonzalezDec 4, 2024

    chat-sdk reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • J
    Jin MartinezNov 23, 2024

    chat-sdk has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • I
    Ishan AgarwalNov 23, 2024

    Registry listing for chat-sdk matched our evaluation — installs cleanly and behaves as described in the markdown.

  • J
    Jin LiNov 19, 2024

    chat-sdk fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • C
    Charlotte MenonNov 19, 2024

    Solid pick for teams standardizing on skills: chat-sdk is focused, and the summary matches what you get after install.

showing 1-10 of 73

1 / 8

Discussion

Comments — not star reviews
  • No comments yet — start the thread.