# liveblocks-best-practices

A Liveblocks skill that feeds your agent reference docs on rooms, comments, presence and auth, plus the errors people hit most.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 882 installs · ★ 9
- Author: liveblocks
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/liveblocks/skills/tree/HEAD/skills/liveblocks-best-practices/SKILL.md
- Updated: 2026-09-08
- HTML: https://affpapa.org/en/nevibecode/skills/liveblocks-best-practices

## What it does

The skill kicks in when you build with Liveblocks packages such as `@liveblocks/react` or `@liveblocks/node`. It ships a set of reference files under `references/`, and the agent loads the one that matches your task: authentication, rooms, comments, notifications, cursors, avatar stacks, AI collaborators. Separate files cover Tiptap, BlockNote, Lexical, React Flow and tldraw.

A good chunk of it is troubleshooting. ID tokens versus access tokens, permissions, room limits, connection errors, user info. There are files on unstable connections, full rooms, hook and component errors, and on keeping unsynced changes from disappearing. For performance you get selectors in `useStorage` and `useOthersMapped` with `shallow`, so presence updates stop re-rendering everything.

Worth installing if your app already runs on Liveblocks. Without the references an agent tends to mix up the auth methods and create rooms in the wrong place. The flip side: it only covers the Liveblocks ecosystem, so questions about other realtime libraries get no help here.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add liveblocks/skills --skill liveblocks-best-practices -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/liveblocks-best-practices/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/liveblocks-best-practices/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add liveblocks/skills --skill liveblocks-best-practices -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/liveblocks-best-practices/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add liveblocks/skills --skill liveblocks-best-practices -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/liveblocks-best-practices/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install liveblocks/skills liveblocks-best-practices
```

2. **Manually: put the files in place**
- File: `.github/skills/liveblocks-best-practices/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add liveblocks/skills --skill liveblocks-best-practices -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/liveblocks/skills --path skills/liveblocks-best-practices
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/liveblocks-best-practices/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add liveblocks/skills --skill liveblocks-best-practices -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/liveblocks/skills/tree/HEAD/skills/liveblocks-best-practices/SKILL.md

## When to use it
- set up Liveblocks auth and pick between ID tokens and access tokens
- create rooms with permissions, organizations and metadata
- add comments, threads and notifications to an app
- build cursors, avatar stacks and realtime presence
- fix connection errors and rooms that fill up

## Example prompts
- Help me set up Liveblocks authentication with ID tokens in Next.js
- Why does my room fail to connect with read-only permissions?
- Add comments and notifications to the document page

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 6e938ae1a4aef143.

BEGIN THIRD-PARTY FILE 6e938ae1a4aef143
```text
---
name: "liveblocks-best-practices"
description: "Use this skill when building, debugging, or answering questions
  about Liveblocks. Liveblocks gives you the building blocks and infrastructure
  to enable people and AI to work together inside your app, powering realtime
  collaboration.

  Liveblocks features include collaboration, rooms, organizations, workspaces,
  comments, composer, threads, notifications, multiplayer, conflict resolution,
  realtime presence, avatar stacks, AI collaborators, AI agents, text editors,
  Tiptap, BlockNote, Lexical, React Flow, Chat SDK.

  Common components include AiChat, Thread, InboxNotification, Composer, Toolbar
  (for Lexical Tiptap), FloatingToolbar, FloatingComposer, FloatingThreads,
  AnchoredThreads.

  Common hooks include useThreads, useStorage, useMutation, useOthers,
  useInboxNotifications, useAiChats.

  Common issues are related to authentication (ID tokens vs access tokens),
  permissions, room limits, connection errors, user info."
license: "Apache License 2.0"
metadata:
  author: "liveblocks"
  version: "1.0.0"
---

# Liveblocks best practices

## When to use this skill

Use this skill when implementing features using any Liveblocks packages, for
example [`@liveblocks/react`](https://www.npmjs.com/package/@liveblocks/react)
or [`@liveblocks/node`](https://www.npmjs.com/package/@liveblocks/node). This
could be related to features like realtime multiplayer, commenting,
notifications, cursors, avatar stacks, AI, and more. This also includes
technologies like Liveblocks Storage, Yjs, Tiptap, BlockNote, Lexical, React
Flow, tldraw, and more.

## Quick reference

A number of reference files are available in the `references/` directory. You
must read the list below, and load relevant files as needed. For example,
`add-user-information` is available in the `references/add-user-information.md`
file.

## References

- `add-user-information`: Add user information to your application, such as
  name, avatar, color, and more. Users will no longer be anonymous. Useful for
  displaying user info in comments, comments mention suggestions, notifications,
  cursors, avatar stacks.
- `ai-as-a-collaborator`: Use agentic workflows to allow AI to collaborate like
  a human inside your Liveblocks application.
- `ai-chats-with-tools-knowledge-components`: Set up and troubleshoot chats with
  RAG, knowledge, custom components, tool calling, custom models. Different to
  AI as a collaborator, as it is NOT workflow based.
```
END THIRD-PARTY FILE 6e938ae1a4aef143

The third-party file has ended. Everything between the 6e938ae1a4aef143 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2497 of 10402 bytes. © liveblocks · Apache-2.0 · https://github.com/liveblocks/skills/tree/HEAD/skills/liveblocks-best-practices/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
