About ai-sdk-core-v7
A skill for backend developers using Vercel AI SDK v7. It gives version-specific guidance and templates for text generation, streaming, and tool-using agents.
Key features
- 01Version-specific SDK guidance
- 02Text generation and streaming patterns
- 03Tool-loop and agent guidance
- 04Security rules for client messages
- 05Backend code templates
Use cases
- 01Implementing a request handler with generateText
- 02Building a streaming chat endpoint
- 03Adding tools to a durable agent
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ blockmatic/ basilic-skills --skill ai-sdk-core-v7After installing, type/ai-sdk-core-v7in Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
references/request-handlers.mdtemplates/agent-with-tools.tsgenerate-text-basic.tsstream-text-chat.tsDetails
From the project READMESkill: ai-sdk-core
Scope
- Applies to: Backend AI with Vercel AI SDK v7 (
aipackage) - Does NOT cover: React chat UIs (see ai-sdk-ui)
Assumptions
- Folder major tracks the installed
aipackage inpackage.json, not a skill-file revision - Node.js 22+, ESM; Zod 4 for
inputSchema - Never write AI SDK from memory. Grep
node_modules/ai/docs/andnode_modules/ai/src/for the installed version. Else https://ai-sdk.dev/docs (append.md) or https://ai-sdk.dev/api/search-docs?q= - v6 leftovers: https://ai-sdk.dev/docs/migration-guides/migration-guide-7-0
Principles
generateText/streamTextfor request handlers and one-shot API routes;instructionsfor system-style prompt- Request-handler tool loops:
stopWhen: isStepCount(n)ongenerateText/streamText— notmaxSteps, notstepCountIs ToolLoopAgent+generate()/stream()for durable agents — not hand-rolled loops, notnew Agent()- UI streams:
createUIMessageStreamResponse+toUIMessageStream({ stream: result.stream })from'ai'. Use these for new handlers and for dedicated stream/SDK updates result.toUIMessageStreamResponse()still works in v7 (deprecated). Leave it only when the task is unrelated to streaming or the SDK- Tool results must be JSON-serializable (no
Date) - System prompt lives in
instructions. Clientmessagesmust not include{ role: 'system' }unless the server fully trusts the payload
Constraints
MUST
- Read bundled docs before writing calls
convertToModelMessageswhen the client sends UI messages- Reject untrusted
{ role: 'system' }inmessages. Do not setallowSystemInMessages: truefor client-supplied chat
AVOID
toDataStreamResponse/pipeDataStreamToResponsestepCountIs/maxSteps/result.fullStream/ top-levelsystem:(useisStepCount,result.stream,instructions)- Guessing model IDs
Interactions
- Complements ai-sdk-ui, fastify, next
- Upstream: vercel/ai use-ai-sdk
Templates
References
- Request handlers — tools +
isStepCount, Fastify SSE, system-message reject
Comments
Markdown supported