Vercel AI SDK Guidelines
SkillDocs & knowledgeVercel AI SDK best practices and patterns. Use when building AI applications with React/Next.js and `@ai-sdk/react`, `@ai-sdk/core`, or `@ai-sdk/ui`. Covers `useChat`, `streamText`, `generateObject`, tool calling, and streaming architectures. SECURITY: Never pass raw user inputs to executable tools without strict Zod schema validation.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Vercel AI SDK Guidelines skill
What this skill tells your AI
The instructions your AI receives, as published by neverinfamous/memory-journal-mcp in skills/vercel-ai-sdk/SKILL.md and read by ahel’s review.
The Vercel AI SDK is the de facto standard for building streaming AI applications in TypeScript and React.
1. Core API (@ai-sdk/core)
- Text Generation: Use
streamTextfor any user-facing chat or text response to minimize perceived latency. Only usegenerateTextfor background tasks where the user is not waiting for a real-time response. - Structured Outputs: Use
streamObjectorgenerateObjectpaired with Zod schemas to guarantee type-safe JSON outputs. Never prompt the model manually to "return JSON". - Tool Calling: Define tools using the
tool()helper with strict Zod schemas.
import { streamText, tool } from 'ai'
import { z } from 'zod'
const result = streamText({
model: myModel,
messages,
tools: {
weather: tool({
description: 'Get the weather in a location',
parameters: z.object({ location: z.string() }),
execute: async ({ location }) => fetchWeather(location),
}),
},
})
2. UI Hooks (@ai-sdk/react)
useChat: The primary hook for conversational interfaces. It automatically manages message history, streaming state, and tool invocations.- Error Handling: Implement the
onErrorcallback inuseChatto gracefully handle API rate limits or network failures. - Data Streaming: Use the
dataproperty exported fromuseChatto stream auxiliary data (like tool execution metadata or citations) alongside the main text stream.
3. Server Actions & Next.js Integration
- App Router: When using Next.js App Router, implement Route Handlers (
app/api/chat/route.ts) that returnresult.toDataStreamResponse()for seamless streaming touseChat. - RSC (React Server Components): For generative UI, use the
ai/rscmodule to stream React components directly from the server to the client.
4. Security & Safety
- Rate Limiting: Always apply rate limiting to your chat endpoints, as LLM APIs are expensive and vulnerable to abuse.
- Provider API Keys: Ensure
OPENAI_API_KEY(or equivalent) is strictly kept server-side. Never expose these keys to the client.
Signals
- GitHub stars
- 20
- Forks
- 5
- Last commit
- Jul 2026
Advanced
- Catalog kind
- skill
- Gateway key
vercel-ai-sdk-neverinfamous- Source
- github.com/neverinfamous/memory-journal-mcp