Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
Claude Skills Maintainers avatar

Ai Sdk Ui

  • 196 repo stars
  • Updated July 25, 2026
  • secondsky/claude-skills

Build React/Next.js AI chat UIs with Vercel AI SDK v5 hooks (useChat, useCompletion, useObject) and debug streaming issues.

About

Skill covering Vercel AI SDK v5 React hooks (useChat, useCompletion, useObject) for building AI chat interfaces. A developer uses it when constructing React or Next.js AI front-ends and troubleshooting parse-stream, no-response, or streaming errors.

  • useChat / useCompletion / useObject
  • Streaming chat UIs
  • Vercel AI SDK v5
  • React/Next.js debugging

Ai Sdk Ui by the numbers

  • Data as of Jul 28, 2026 (Skillselion catalog sync)
/plugin marketplace add secondsky/claude-skills
/plugin install ai-sdk-ui@claude-skills

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
repo stars196
Last updatedJuly 25, 2026
Repositorysecondsky/claude-skills

What it does

Build React/Next.js AI chat UIs with Vercel AI SDK v5 hooks (useChat, useCompletion, useObject) and debug streaming issues.

README.md

AI SDK UI - Frontend React Hooks

Version: AI SDK v5.0.76+ Status: Production-Ready ✅ Framework: React 18+, Next.js 14+ Last Updated: 2025-10-22


What This Skill Does

Provides complete implementation patterns for Vercel AI SDK v5 frontend React hooks:

  • useChat - Chat interfaces with streaming
  • useCompletion - Text completions
  • useObject - Streaming structured data

Focus: React UI layer for AI-powered applications.


Auto-Trigger Keywords

This skill should be automatically discovered when working with any of the following:

Primary Keywords (Highest Priority)

  • ai sdk ui
  • useChat hook
  • useCompletion hook
  • useObject hook
  • react ai chat
  • ai chat interface
  • chat ui react
  • ai sdk react
  • vercel ai ui
  • ai react hooks
  • streaming ai ui
  • react streaming chat
  • nextjs ai chat
  • nextjs ai
  • next.js chat
  • ai chat component
  • react ai components

Secondary Keywords (Medium Priority)

  • nextjs app router ai
  • nextjs pages router ai
  • chat message state
  • message persistence ai
  • ai file attachments
  • file upload ai chat
  • streaming chat react
  • real-time ai chat
  • tool calling ui
  • ai tools react
  • ai completion react
  • text completion ui
  • structured data streaming
  • useObject streaming
  • react chat app
  • react ai application

Error-Based Keywords (Trigger on Errors)

  • useChat failed to parse stream
  • parse stream error
  • useChat no response
  • chat hook no response
  • unclosed streams ai
  • stream not closing
  • streaming not working deployed
  • vercel streaming issue
  • streaming not working proxied
  • proxy buffering
  • strange stream output
  • 0: characters stream
  • stale body values useChat
  • body not updating
  • custom headers not working useChat
  • react maximum update depth
  • infinite loop useChat
  • repeated assistant messages
  • duplicate messages
  • onFinish not called
  • stream aborted
  • v5 migration useChat
  • useChat breaking changes
  • input handleInputChange removed
  • sendMessage v5

Framework Integration Keywords

  • nextjs ai integration
  • next.js ai sdk
  • vite react ai
  • remix ai chat
  • vercel ai deployment

Provider Keywords

  • openai react chat
  • anthropic react chat
  • claude chat ui
  • gpt chat interface

Quick Start

bun add ai @ai-sdk/openai  # preferred
# or: npm install ai @ai-sdk/openai

5-minute chat interface:

// app/chat/page.tsx
'use client';
import { useChat } from 'ai/react';
import { useState } from 'react';

export default function Chat() {
  const { messages, sendMessage, isLoading } = useChat({ api: '/api/chat' });
  const [input, setInput] = useState('');

  return (
    <div>
      {messages.map(m => (
        <div key={m.id}>{m.role}: {m.content}</div>
      ))}
      <form onSubmit={(e) => {
        e.preventDefault();
        sendMessage({ content: input });
        setInput('');
      }}>
        <input value={input} onChange={(e) => setInput(e.target.value)} />
      </form>
    </div>
  );
}
// app/api/chat/route.ts
import { streamText } from 'ai';
import { openai } from '@ai-sdk/openai';

export async function POST(req: Request) {
  const { messages } = await req.json();
  const result = streamText({ model: openai('gpt-4-turbo'), messages });
  return result.toDataStreamResponse();
}

What's Included

Templates (11)

  1. use-chat-basic.tsx - Basic chat with v5 input management
  2. use-chat-tools.tsx - Chat with tool calling UI
  3. use-chat-attachments.tsx - File attachments support
  4. use-completion-basic.tsx - Text completion streaming
  5. use-object-streaming.tsx - Structured data streaming
  6. nextjs-chat-app-router.tsx - Next.js App Router complete example
  7. nextjs-chat-pages-router.tsx - Next.js Pages Router complete example
  8. nextjs-api-route.ts - API route for both routers
  9. message-persistence.tsx - localStorage persistence
  10. custom-message-renderer.tsx - Markdown & code highlighting
  11. package.json - Dependencies template

References (5)

  1. use-chat-migration.md - Complete v4→v5 migration guide
  2. streaming-patterns.md - UI streaming best practices
  3. top-ui-errors.md - 12 common UI errors with solutions
  4. nextjs-integration.md - Next.js setup patterns
  5. links-to-official-docs.md - Official docs organization

Scripts (1)

  1. check-versions.sh - Verify package versions

Critical v5 Changes

BREAKING: useChat no longer manages input state!

v4 (OLD):

const { input, handleInputChange, handleSubmit } = useChat();
<input value={input} onChange={handleInputChange} />

v5 (NEW):

const { sendMessage } = useChat();
const [input, setInput] = useState('');
<input value={input} onChange={(e) => setInput(e.target.value)} />

Other changes:

  • append()sendMessage()
  • onResponse removed → use onFinish
  • initialMessages → controlled mode with messages prop
  • maxSteps removed (handle server-side)

See references/use-chat-migration.md for complete migration guide.


Token Savings

Without skill: ~15,500 tokens (research, trial-and-error, debugging) With skill: ~7,000 tokens (templates, references, examples)

Savings: ~55% (8,500 tokens)


Errors Prevented

This skill documents and prevents 12 common UI errors:

  1. useChat failed to parse stream
  2. useChat no response
  3. Unclosed streams
  4. Streaming not working when deployed
  5. Streaming not working when proxied
  6. Strange stream output (0:... characters)
  7. Stale body values
  8. Custom headers not working
  9. React maximum update depth
  10. Repeated assistant messages
  11. onFinish not called when aborted
  12. Type errors with message parts

When to Use This Skill

Use ai-sdk-ui when:

  • Building React chat interfaces
  • Implementing AI completions in UI
  • Streaming AI responses to frontend
  • Building Next.js AI applications
  • Handling chat message state
  • Displaying tool calls in UI
  • Managing file attachments with AI
  • Migrating from v4 to v5
  • Encountering useChat/useCompletion errors

Don't use when:

  • Need backend AI (use ai-sdk-core instead)
  • Building non-React frontends (check official docs)
  • Need Generative UI / RSC (advanced topic)

Related Skills

  • ai-sdk-core - Backend text generation, structured output, tools, agents
  • Compose both for full-stack AI applications

Package Versions

Required:

  • ai: ^5.0.76
  • @ai-sdk/openai: ^2.0.53
  • react: ^18.2.0
  • zod: ^3.23.8

Next.js:

  • next: ^14.0.0
  • react: ^18.2.0
  • react-dom: ^18.2.0

Official Documentation

Core UI Hooks:

Next.js:

Migration:


Production Validation

Tested In: WordPress Auditor (https://wordpress-auditor.webfonts.workers.dev)

Verified:

  • ✅ All 11 templates work copy-paste
  • ✅ v5 breaking changes documented
  • ✅ 12 common errors prevented
  • ✅ Package versions current (2025-10-22)
  • ✅ Next.js App Router & Pages Router examples
  • ✅ Token savings: 55%

License: MIT

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.