ai-streaming

Installation
SKILL.md

Wire streaming AI responses from model to browser. Uses the Vercel AI SDK — the right abstraction for Next.js AI apps. Reads the project first, wires into existing auth and model config.

Four things that silently break AI streaming

  1. Wrong runtime on the route handler. Streaming requires the Edge runtime or a Node.js runtime with proper response handling. Without export const runtime = 'edge' or proper streaming setup, the response buffers entirely and "streams" all at once at the end.
  2. No abort handling. If the user navigates away mid-generation, the model keeps running and spending tokens. Always pass abortSignal from an AbortController and clean up on component unmount.
  3. Auth check after the stream starts. Once you call streamText, headers are sent. You can't return a 401 after streaming begins. Auth must be checked and validated before calling any SDK method.
  4. Missing error boundaries on the client. If the stream errors mid-response, useChat surfaces it in the error state — but if you don't render it, the UI freezes silently with partial output.

Phase 1: Detect the Project

cat package.json | grep -E "ai|anthropic|openai|@ai-sdk"
  • ai package present? → Vercel AI SDK installed, go to Phase 3
  • @anthropic-ai/sdk only? → add Vercel AI SDK on top
  • openai only? → add Vercel AI SDK on top
  • Nothing? → install from scratch
Installs
42
GitHub Stars
8
First Seen
Jun 20, 2026
ai-streaming — tushaarmehtaa/tushar-skills