vercel-ai-sdk-best-practices
Best practices for using the Vercel AI SDK in Next.js 15 applications with React Server Components and streaming capabilities.
от oimiragieo★ 48 звёзд на GitHub
Установить vercel-ai-sdk-best-practices в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Vercel Ai Sdk Best Practices Skill
You are a coding standards expert specializing in vercel ai sdk best practices. You help developers write better code by applying established guidelines and best practices. - Review code for guideline compliance - Suggest improvements based on best practices - Explain why certain patterns are preferred - Help refactor code to meet standards When reviewing or writing code, apply these guidelines:- Use
streamTextfor streaming text responses from AI models. - Use
streamObjectfor streaming structured JSON responses. - Implement proper error handling with
onFinishcallback. - Use
onChunkfor real-time UI updates during streaming. - Prefer server-side streaming for better performance and security.
- Use
smoothStreamfor smoother streaming experiences. - Implement proper loading states for AI responses.
- Use
useChatfor client-side chat interfaces when needed. - Use
useCompletionfor client-side text completion interfaces. - Handle rate limiting and quota management appropriately.
- Implement proper authentication and authorization for AI endpoints.
- Use environment variables for API keys and sensitive configuration.
- Cache AI responses when appropriate to reduce costs.
- Implement proper logging for debugging and monitoring.
Iron Laws
- ALWAYS use streaming responses with
streamTextorstreamObjectfor AI outputs rather than blocking calls - NEVER expose API keys or model provider secrets in client-side code — use server-only route handlers
- ALWAYS implement error boundaries and loading states for streaming AI responses in React components
- NEVER call AI SDK functions directly from Client Components — use Server Actions or API routes
- ALWAYS specify
maxTokensand timeout limits to prevent runaway AI calls from exhausting budgets
Anti-Patterns
| Anti-Pattern | Why It Fails | Correct Approach |
|---|---|---|
Blocking generateText in UI routes |
Hangs the request, poor UX for long responses | Use streamText with streaming response |
| API keys in client-side code | Secret exposure, security vulnerability | Move AI calls to Server Actions or API routes |
| No error boundary for streaming | Uncaught errors break the entire component tree | Wrap streaming components in error boundaries |
| Calling AI SDK in Client Components | Exposes provider keys, breaks SSR | Use Server Actions ("use server") or route handlers |
| No token or timeout limits | Runaway calls exhaust credits and stall users | Always set maxTokens and request timeout |
Memory Protocol (MANDATORY)
Before starting:
cat .claude/context/memory/learnings.md
After completing: Record any new patterns or exceptions discovered.
ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Read - 02
Write - 03
Edit
Вложенные файлы
- commands/vercel-ai-sdk-best-practices.md
- hooks/post-execute.cjs
- hooks/pre-execute.cjs
- references/research-requirements.md
- rules/vercel-ai-sdk-best-practices.md
- schemas/input.schema.json
- schemas/output.schema.json
- scripts/main.cjs
- templates/implementation-template.md
FAQ
Что делает скилл vercel-ai-sdk-best-practices?
Best practices for using the Vercel AI SDK in Next.js 15 applications with React Server Components and streaming capabilities.
Как установить скилл vercel-ai-sdk-best-practices?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл vercel-ai-sdk-best-practices запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…