NE

nextjs-chatbot

Provides an opinionated, production-ready framework for building web chatbots with tool calling and database session storage.

Install

mkdir -p .claude/skills/nextjs-chatbot && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16946" && unzip -o skill.zip -d .claude/skills/nextjs-chatbot && rm skill.zip

Installs to .claude/skills/nextjs-chatbot

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Advanced patterns for production Next.js web chatbots built with AI SDK 6 + ai-elements. Covers tool calling with human-in-the-loop (HITL) approval, PostgreSQL session persistence, GDPR consent gating, SQL-first search, per-tool UI rendering, popup widget embedding, message feedback, follow-up suggestions, scope enforcement, and evals. Use when building a customer support bot, conversational interface, or any web chatbot needing tool approval, database sessions, or custom tool output components. Not a scaffolding tool — use `/ai-app` to scaffold from scratch, `/ai-sdk-6` for general SDK questions, `/ai-elements` for chat UI components, `/vercel:chat-sdk` for multi-platform (Slack/Teams/Discord) bots.
709 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Advanced

Key capabilities

  • →Implement human-in-the-loop (HITL) approval for tool calls
  • →Manage PostgreSQL session persistence for chatbot conversations
  • →Enforce GDPR consent gating for chatbot interactions
  • →Perform SQL-first search within the chatbot context
  • →Render custom UI components per tool state

How it works

The skill provides advanced patterns for production Next.js web chatbots, focusing on features like HITL approval, PostgreSQL session persistence, GDPR consent, and custom tool UI rendering.

Inputs & outputs

You give it
user messages, chat ID, and consent status
You get back
streaming text responses from the assistant, rendered tool UIs, and persistent chat sessions

When to use nextjs-chatbot

  • →Build customer support bots
  • →Implement tool approval flows
  • →Set up PostgreSQL session persistence
  • →Create conversational interfaces

About this skill

Production Next.js chatbots

Use this skill for web-chat integration: persisted conversations, tool approval, tool result UI and an embedded widget. Use ai-app for scaffolding, ai-sdk to resolve the SDK version, and ai-elements for component contracts. For multi-platform messaging, consult Chat SDK.

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, ai-elements on shadcn/ui, 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 is one option; anchor on the user's message so the reply streams below it. Render Markdown through the application's renderer (shadcn Typeset by default, see nextjs-shadcn) and 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

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.

When not to use it

  • →When scaffolding a chatbot from scratch (use `/ai-app` instead)
  • →When general AI SDK questions arise (use `/ai-sdk-6` instead)
  • →When only chat UI components are needed (use `/ai-elements` instead)

Limitations

  • →Not a scaffolding tool
  • →Focuses on web chatbots, not multi-platform bots
  • →Requires specific AI SDK 6 and ai-elements patterns

How it compares

This skill offers opinionated blueprints for production web chatbots with specific patterns for HITL approval, database sessions, and custom tool output components, unlike general SDKs or UI libraries.

Compared to similar skills

nextjs-chatbot side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
nextjs-chatbot (this skill)03moNo flagsAdvanced
add-feature06moNo flagsIntermediate
nextjs-supabase-auth128moNo flagsIntermediate
app-specific-patterns44moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

add-feature

jujunjun110

新しい機能を追加する。ユーザーが機能の説明をしたとき、DDD4層に従って全レイヤーのファイルを生成する

00

nextjs-supabase-auth

davila7

Expert integration of Supabase Auth with Next.js App Router Use when: supabase auth next, authentication next.js, login supabase, auth middleware, protected route.

1259

app-specific-patterns

growilabs

GROWI main application (apps/app) specific patterns for Next.js, Jotai, SWR, and testing. Auto-invoked when working in apps/app.

46

javascript-typescript-typescript-scaffold

sickn33

You are a TypeScript project architecture expert specializing in scaffolding production-ready Node.js and frontend applications. Generate complete project structures with modern tooling (pnpm, Vite, N

31

server-actions

davepoon

This skill should be used when the user asks about "Server Actions", "form handling in Next.js", "mutations", "useFormState", "useFormStatus", "revalidatePath", "revalidateTag", or needs guidance on data mutations and form submissions in Next.js App Router.

11

web-frameworks

mrgoonie

Build modern full-stack web applications with Next.js (App Router, Server Components, RSC, PPR, SSR, SSG, ISR), Turborepo (monorepo management, task pipelines, remote caching, parallel execution), and RemixIcon (3100+ SVG icons in outlined/filled styles). Use when creating React applications, implementing server-side rendering, setting up monorepos with multiple packages, optimizing build performance and caching strategies, adding icon libraries, managing shared dependencies, or working with TypeScript full-stack projects.

10

Search skills

Search the agent skills registry