К основному содержанию
скилл CX Codex

nextjs-chatbot — скилл для Claude Code: чат-бот на Next.js

Скилл nextjs-chatbot помогает собрать веб-чат на Next.js: подтверждение вызовов инструментов, сохранённая история, отрисовка результатов, подсказки и встраиваемый виджет.

MIT 161 установок ★ 74 обновлён 2026-10-18

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add laguagu/claude-code-nextjs-skills --skill nextjs-chatbot -a claude-code
Открыть на GitHub

Что делает nextjs-chatbot

Скилл ведёт интеграцию веб-чата на Next.js: подтверждение вызова инструментов, сохранённые диалоги, отрисовка результатов инструментов, поиск с опорой на данные, подсказки следующего шага и встраиваемый виджет. Под каждый блок в комплекте свой файл: hitl.md, persistence.md, tool-rendering.md, popup-widget.md, search.md, suggestions.md, web-search.md, testing.md. Скилл открывает нужный, когда берётся за фичу.

Стек он не навязывает, но для нового проекта, который ещё не определился, по умолчанию называет Bun, паттерны AI Elements из shadcn/ui, Drizzle с PostgreSQL для истории на сервере и быструю модель с низким reasoning. Версии ai, @ai-sdk/react и провайдера надо свести до того, как писать вызовы API: для v7 берётся ai-sdk-7, для v6 — ai-sdk-6, а переименования колбэков в ядре не означают переименование useChat.onFinish.

Доступ к диалогу аутентифицируется, данные запроса валидируются, инструменты авторизуются на сервере, потому что история из браузера и ID модели недоверенные. Ещё скилл просит проверить, как прокси на самом деле стримит и буферизует: поток NDJSON или SSE, собранный своими руками, без нужных заголовков до браузера не доедет.

Какие задачи решает

  • добавить подтверждение вызова инструмента перед выполнением
  • восстановить историю диалога после перезагрузки страницы
  • показать результат работы инструмента в чате, а не сырой JSON
  • встроить чат виджетом в чужую страницу
  • убедиться, что прокси не буферизует поток ответа

Примеры запросов агенту

  • Сделай подтверждение вызова инструмента перед выполнением и покажи результат отдельным блоком.
  • Сохрани историю чата в PostgreSQL и восстанови её после перезагрузки.
  • Собери виджет чата, который встраивается в стороннюю страницу.

Как установить nextjs-chatbot

1Через Skills CLI (Vercel)

npx skills add laguagu/claude-code-nextjs-skills --skill nextjs-chatbot -a claude-code

2Вручную: положить файлы

~/.claude/skills/nextjs-chatbot/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/nextjs-chatbot/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о nextjs-chatbot

Как установить nextjs-chatbot в Claude Code?

Выполните npx skills add laguagu/claude-code-nextjs-skills --skill nextjs-chatbot -a claude-code. Скилл окажется по пути ~/.claude/skills/nextjs-chatbot/SKILL.md.

Что делает nextjs-chatbot?

Проводит через интеграцию веб-чата на Next.js: подтверждение инструментов, хранение диалогов, отрисовка их результатов, поиск, подсказки и встраиваемый виджет.

Что нужно сверить до написания вызовов API?

Версии ai, @ai-sdk/react и провайдера. Для v7 скилл отсылает к ai-sdk-7, для v6 к ai-sdk-6.

Исходный текст

SKILL.md · MIT
---
name: nextjs-chatbot
description: "Production Next.js web-chat integration: tool approval, persisted conversations, tool result UI, grounded retrieval, follow-up suggestions and embedded widgets. Use when building or debugging a web chatbot that needs these features. Use nextjs-shadcn for scaffolding and ai-sdk for general SDK APIs; multi-platform bots use Chat SDK."
---

# Production Next.js chatbots

Use this skill for web-chat integration: persisted conversations, tool approval,
tool result UI and an embedded widget. Use `nextjs-shadcn` for scaffolding,
`ai-sdk` to resolve the SDK version, and the `shadcn` skill for chat components.
An existing elements.ai-sdk.dev install keeps its copied source in
`components/ai-elements/` as the reference until it migrates (deprecated upstream
at the end of November 2026; see https://ui.shadcn.com/docs/ai-elements).
For multi-platform messaging, consult [Chat SDK](https://chat-sdk.dev/).

Keep the project's stack. Choose the model, reasoning setting, storage and
client state from the product's quality, latency and privacy requirements.
A chatbot does not inherently need PostgreSQL, Zustand, MCP servers or every
message action. When a new project has not decided, the defaults are Bun,
the AI Elements patterns from shadcn/ui (Message, Bubble, Message Scroller,
Trace; https://ui.shadcn.com/docs/ai-elements), Drizzle + PostgreSQL for
server-side history, and a
fast model with low or no reasoning effort, because chat latency is the product.

Read the installed `node_modules/ai/docs/04-ai-sdk-ui/` for persistence, tool
usage, errors and resume streams; use the package's types and `src/` when
shipped for exact contracts.
The linked ai-sdk.dev pages are the online fallback and describe the newest major.

## Integration contracts

- Match `ai`, `@ai-sdk/react` and provider versions before writing API calls.
  Use `ai-sdk-7` for v7 and `ai-sdk-6` for existing v6 projects; core callback
  renames do not imply renaming the separate `useChat.onFinish`.
- Authenticate conversation access, validate request data and authorize tools
  on the server. Client history, context, model IDs and consent flags are
  untrusted; prompts cannot enforce tenant isolation or permissions.
- Store validated UI messages with stable IDs when the full conversation UI
  must be restored. Convert model history through the installed SDK's helpers;
  keep required tool-call/result and provider reasoning relationships intact.
- Determine what happens on cancellation, disconnect, reload and retries.
  Consuming a stream after disconnect still depends on the hosting lifetime;
  durable execution needs a supported durable runtime.
- Log redacted diagnostics with a correlation ID. Return a safe public error
  for failed HTTP requests and in-stream failures; an error after headers have
  been sent cannot change the HTTP status. The UI stream masks ordinary errors
  by default; provider-executed tool errors can bypass `onError`, so check the
  tool error renderer too. A custom `onError` return value reaches the browser
  verbatim, and a non-2xx response reaches `useChat` `onError` with the raw
  response body as its message.
- Verify actual proxy streaming and buffering configuration. SDK UI-message
  responses already send `X-Accel-Buffering: no`; streams you build yourself
  (NDJSON/SSE progress) need it and `Cache-Control: no-store, no-transform`.
  The header helps supported nginx setups; it does not guarantee that every
  host streams without buffering.

## Chat surface

Keep the answer, relevant tool results and useful sources readable. Default
layout: user messages in a right-aligned `bg-muted` bubble, assistant messages
full width without a background, and the brand carried through to the
scrollbar. Add feedback, regenerate, delete or suggestions when the product
needs them; avoid a repeated “Answer” heading or an action toolbar on every
message by default. Use the `icons` skill for icon choice and `nextjs-shadcn`
for the surrounding interface.

Follow streamed output while the reader is at the bottom; preserve their place
when they scroll away or load earlier history. Use an existing compatible
scroll primitive when it fits; shadcn's
[Message Scroller](https://ui.shadcn.com/docs/react/message-scroller) is one option;
anchor on the user's message so the reply streams below it.
Render Markdown through the application's
renderer (Streamdown through the shadcn/ui Message pattern's `Markdown`
component in the default stack; `MessageResponse` in existing AI Elements
installs)
and style it with shadcn Typeset by default (CSS only, see `nextjs-shadcn`);
verify nested lists, long links and code blocks.

Derive turn completion from `useChat` status (`submitted`/`streaming`) rather
than a momentary gap between tools. Stop or isolate the generation before
switching conversations. Browser storage must not make the first client render disagree
with server-rendered consent or history.

## Read for the feature

- [Tool approval](hitl.md): policy, replay security and UI transitions.
- [Persistence](persistence.md): IDs, history replay, feedback and resumption.
- [Tool rendering](tool-rendering.md): typed states and safe output.
- [Popup/embedding](popup-widget.md): focus, scrolling and host boundaries.
- [Retrieval](search.md): structured filters and evaluated search choices.
- [Suggestions](suggestions.md): optional, grounded next actions.
- [Web search](web-search.md): source scope, freshness and provider capability.
- [Verification](testing.md): UI transitions and model/retrieval evals.

Exercise a second turn after restoring history, approval and denial, tool
failure, cancellation, fast conversation switching and the deployed stream
path. Report the behaviors actually checked.

© laguagu · MIT · laguagu/claude-code-nextjs-skills

Похожие скиллы

Все скиллы по теме «Фронтенд и UI» →
vercel-development Mindrally Скилл vercel-development для Claude Code: правила кода под Next.js App Router, React Server Components и Vercel AI SDK. Не даёт агенту писать клиентские компоненты там, где хватило бы серверных. CX Codex +1 756установок chatbot-analytics curiositech Скилл chatbot-analytics помогает внедрить мониторинг AI-чатов с подсчётом токенов и задержек без сохранения личных данных по стандарту HIPAA. CX Codex +1 221установок agent-elements 21st-dev Собирает интерфейсы чатов и агентов на React 19 и Tailwind v4 с помощью Agent Elements. Выводит карточки вызовов инструментов, планов и подтверждений. CX Codex +1 738установок ai-elements existential-birds Скилл ai-elements для Claude Code, Codex, Cursor, Copilot, Gemini CLI и OpenCode: помогает собирать интерфейсы чата, очереди задач, отображение инструментов и подтверждений. CX Codex +1 211установок inngest-realtime inngest Скилл inngest-realtime для Claude Code помогает передавать обновления Inngest workflow в интерфейс по мере выполнения. Используйте его для статуса заказов, потока токенов ИИ-агента или согласований с участием человека. CX Codex +1 881установок scaffold-nextjs mblode Скилл scaffold-nextjs для Claude Code пошагово разворачивает монорепозиторий Turborepo с Next.js, Blode UI и Ultracite, настраивая деплой на Vercel и GitHub. CX Codex +1 817установок

Из того же набора13

Весь набор →
next-best-practices Скилл next-best-practices для Claude Code подсказывает практики Next.js App Router при написании и проверке кода. Помогает разбирать ошибки гидратации, границы RSC и проблемы с данными. CX Codex +1 286установок postgres-semantic-search Скилл postgres-semantic-search для Claude Code настраивает поиск и извлечение данных в PostgreSQL. Помогает собрать семантический или гибридный поиск, оценить качество результатов и разобраться со слабыми совпадениями. CX Codex +1 227установок cache-components Скилл cache-components даёт экспертные советы по кэшированию компонентов и частичному предрендерингу в Next.js 16.4+. CX Codex +1 222установок ai-sdk-6 Скилл ai-sdk-6 для работы с проектами на Vercel AI SDK v6. Помогает строить агентов, чат-ботов, инструменты и потоки структурированного вывода, если кодовая база уже на версии 6. CX Codex +1 218установок ai-app Скилл ai-app для Claude Code настраивает фулстек-приложения на Next.js с AI SDK и shadcn/ui. Запускается при создании чат-ботов, панелей управления агентами и ИИ-интерфейсов. CX Codex +1 198установок ai-sdk Проверяет версию Vercel AI SDK в проекте и направляет агента к нужной документации. Включается при запросах о потоковом выводе, useChat, агентах и вызове инструментов. CX Codex +1 149установок hetzner-cloud Управляет ресурсами Hetzner Cloud через CLI hcloud. Он подключается к запросам о Hetzner, кодах локаций или VPS в проекте на Hetzner. CX Codex +1 125установок go Скилл go для Claude Code запускает веб-приложение и проверяет правки интерфейса в браузере. Выявляет неработающие элементы, ошибки консоли и сбои сетевых запросов. CX Codex +1 112установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой