Agent skill
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.
Stars
163
Forks
31
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/vercel-ai-sdk-best-practices
SKILL.md
Vercel Ai Sdk Best Practices Skill
- 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.
Memory Protocol (MANDATORY)
Before starting:
bash
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.
Didn't find tool you were looking for?