ai-ui-patterns

Implements React design patterns for streaming AI chat interfaces using the Vercel AI SDK.

1|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/TierOne-Studio/spa-velocity --skill ai-ui-patterns-tierone-studio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-ui-patterns
Source: https://github.com/TierOne-Studio/spa-velocity/tree/main/.ruler/skills/ai-ui-patterns
Command: npx skills add https://github.com/TierOne-Studio/spa-velocity --skill ai-ui-patterns-tierone-studio

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building conversational AI interfaces in React involves tricky concerns like streaming LLM responses, managing conversation state, securing API keys, and handling errors gracefully. This Skill provides proven design patterns and code examples for these challenges in both Next.js and Vite projects. ## Core Features & Use Cases - Streaming Chat UIs: Set up server endpoints (Next.js route handlers or Express backends) that stream OpenAI responses to the client in real time. - Conversation State Management: Use the Vercel AI SDK's useChat and useCompletion hooks to manage messages, input, and submission logic. - Reusable Components: Build decoupled ChatMessage and InputBox components, or adopt Vercel AI Elements for pre-built chat UI. - Use Case: You are adding a docs-aware chatbot to a React app. Use this Skill to wire up a streaming /api/chat endpoint, debounce input, handle errors with retry UI, and render messages with TailwindCSS styling. ## Quick Start Use the ai-ui-patterns skill to scaffold a streaming chat interface in my React app with the Vercel AI SDK.

Frequently Asked Questions about ai-ui-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a streaming chat UI in React?

Use the Vercel AI SDK's useChat hook to manage messages and streaming state, paired with a server endpoint that calls the LLM with stream: true. The SDK reads response chunks and updates the UI incrementally as tokens arrive.

How to call OpenAI API from a Vite React app securely?

Never expose the API key in client code. Create a separate Node/Express backend with an /api/chat endpoint holding the key, then configure the Vite dev server proxy to forward /api requests to that backend.

Next.js vs Vite for building AI chat applications?

Next.js offers built-in API route handlers and native streaming via the Edge Runtime, making it simpler for chat apps. Vite requires a separate Node backend and manual stream handling with res.write(), but gives full control over the stack.

Does the Vercel AI SDK support providers other than OpenAI?

Yes, the Vercel AI SDK supports multiple model providers including Anthropic, Gemini, and OpenAI through a unified interface. You can swap providers without changing the React hooks or streaming logic.

Why debounce input in AI autocomplete features?

Calling the LLM API on every keystroke is costly and slow. Debouncing delays the request until the user pauses typing, typically around 500ms, reducing API calls while keeping suggestions responsive.