ai-sdk
Skill636 starsChanged 3 months agoMITView on GitHub
Answer questions about the AI SDK and help build AI-powered features. Use when developers: (1) Ask about AI SDK functions like generateText, streamText, ToolLoopAgent, embed, or tools, (2) Want to build AI agents, chatbots, RAG systems, or text generation features, (3) Have questions about AI providers (OpenAI, Anthropic, Google, etc.), streaming, tool calling, structured output, or embeddings, (4) Use React hooks like useChat or useCompletion. Triggers on: "AI SDK", "Vercel AI SDK", "generateText", "streamText", "add AI to my app", "build an agent", "tool calling", "structured output", "useChat".
- Reads credentials
- Installs packages
We split this skill into the rules it gives an agent
10 rules. 0 are common, 5 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 43 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Never write AI SDK code from memory: Always verify every API, option, and pattern against the documentation and source code for the version …
- Very specific: line 23
Ensure ai is installed. If node_modules/ai/ does not exist, install only the ai package using the project's package manager (e.g.
- Very specific: line 24
Read and grep the bundled docs at node_modules/ai/docs/ and the source at node_modules/ai/src/.
- Very specific: line 26
If something isn't in the bundled docs, search https://ai-sdk.dev/docs.
- Distinctive: line 27
If you cannot find support for an answer in the docs or source, say so explicitly — do not guess.
- Very specific: line 43
Never use model IDs from memory — models are released and retired frequently.
- Distinctive: line 53
When multiple versions of a model exist, prefer the one with the highest version number.
- Very specific: line 59
Look up the current agent, tool, and type-safety APIs in the bundled docs (node_modules/ai/docs/, especially the agents section) or at …
- Distinctive: line 74
If the installed version is a major version (or more) behind the latest, tell the user they are on an old release, and recommend upgrading …
- Distinctive: line 78
Run the project's type checker.
“Common” is measured: kept by at least 6 in 10 of the 43 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
What the AI SDK Is
The AI SDK by Vercel (the ai package on npm) is a TypeScript toolkit for building AI applications. It provides a unified API across model providers for text generation, structured output, tool calling, agents, embeddings, and framework UI integrations.
- Repository: https://github.com/vercel/ai
- Documentation: https://ai-sdk.dev/docs
Critical: Do Not Trust Your Own Memory
Whatever you remember about the AI SDK is likely outdated. The SDK changes frequently across versions - APIs are renamed, removed, and added. Your training data almost certainly contains obsolete APIs, deprecated patterns, and model IDs that no longer exist. UI hooks like useChat are among the most frequently changed APIs, so be especially careful with client code.
Never write AI SDK code from memory. Always verify every API, option, and pattern against the documentation and source code for the version that is actually installed in the project.
Use the Bundled, Version-Matched Docs
The ai package ships its full documentation and source code inside node_modules. These always match the installed version, so trust them over anything you remember.
- Ensure
aiis installed. Ifnode_modules/ai/does not exist, install only theaipackage using the project's package manager (e.g.pnpm add ai). Install provider packages (e.g.@ai-sdk/openai) and framework packages (e.g.@ai-sdk/react) later, when the task requires them. - Read and grep the bundled docs at
node_modules/ai/docs/and the source atnode_modules/ai/src/. - Provider and framework packages bundle their own docs at
node_modules/@ai-sdk/<name>/docs/. - If something isn't in the bundled docs, search https://ai-sdk.dev/docs. You can append
.mdto any docs page URL to get its markdown, and search viahttps://ai-sdk.dev/api/search-docs?q=your_query. - If you cannot find support for an answer in the docs or source, say so explicitly — do not guess.
AI Gateway: The Fastest Way to Start
The Vercel AI Gateway is the fastest way to get started with the AI SDK. It provides access to models from OpenAI, Anthropic, Google, and other providers through a single API, without installing provider packages or managing multiple API keys.
To set it up:
- Authenticate with OIDC (for Vercel deployments) or get an AI Gateway API key.
- Provide it to your app via the
AI_GATEWAY_API_KEYenvironment variable. - Reference models with
provider/modelstrings.
For exact setup, authentication, and usage, read the bundled guide and the AI Gateway docs.
Choosing a Model
Never use model IDs from memory — models are released and retired frequently. Fetch the current list before writing code that references a model. Do not truncate the list (e.g. with head) so you can find the newest models:
# All available models
curl -s https://ai-gateway.vercel.sh/v1/models | jq -r '.data[].id'
# Filter by provider (e.g. anthropic, openai, google)
curl -s https://ai-gateway.vercel.sh/v1/models | jq -r '[.data[] | select(.id | startswith("anthropic/")) | .id] | reverse | .[]'When multiple versions of a model exist, prefer the one with the highest version number.
Building and Consuming Agents
Use the SDK's built-in agent abstraction (such as ToolLoopAgent) rather than hand-rolling tool-calling loops. For end-to-end type safety, infer the UI message type from your agent definition when consuming it on the client (e.g. with useChat). Consuming an agent is framework-specific: check package.json to detect the stack, then follow the matching quickstart.
Look up the current agent, tool, and type-safety APIs in the bundled docs (node_modules/ai/docs/, especially the agents section) or at https://ai-sdk.dev/docs.
DevTools
AI SDK DevTools captures your AI SDK calls - requests, responses, tool calls, token usage, and multi-step runs - so you can inspect exactly what your agents do. Use it while developing to debug generations. It is a separate package and is intended for local development only.
For setup instructions, read the bundled DevTools documentation.
Keep the SDK Current
Outdated installs are the most common source of errors. Compare the installed version against the latest:
- Installed: the
versionfield innode_modules/ai/package.json. - Latest: run
npm view ai version.
If the installed version is a major version (or more) behind the latest, tell the user they are on an old release, and recommend upgrading before continuing. Migration guides are at https://ai-sdk.dev/docs/migration-guides.
After Making Changes
Run the project's type checker. Be minimal — only set options that differ from the defaults, checking docs or source for the defaults rather than over-specifying. Most type errors come from remembered, now-changed APIs; re-check the current docs and source when they occur.
Other versions57 projects use a version of this.
Word for word · 14
- trycompai/crm★ 11k100% same
- mengxi-ream/read-frog★ 10k100% same
- solidSpoon/DashPlayer★ 4.5k100% same
- pedronauck/skills★ 641100% same
- mezotv/notra★ 256100% same
- usenotra/notra★ 256100% same
- cgoinglove/thursday★ 56100% same
- cgoinglove/thursday-agent★ 56100% same
- scibly-dev/scibly★ 39100% same
- ElyzeSolutions/skills★ 1100% same
4 more not listed
Edited · 40
- vercel/ai★ 28k93% same
- JimmyLv/BibiGPT-v1★ 6.2k20% same
- vercel-labs/open-agents★ 5.8k20% same
- compozy/compozy★ 2.8k14% same
- BidingCC/BuildingAI★ 1.9k14% same
- xiaoiver/infinite-canvas-tutorial★ 1.1k20% same
- legions-developer/invoicely★ 92320% same
- subhadeeproy3902/mvpblocks★ 83420% same
- halo-dev/upage★ 55320% same
- leonvanzyl/agentic-coding-starter-kit★ 44720% same
30 more not listed
Wrote their own version · 3
- openai/plugins★ 7.4ksame name
- laguagu/claude-code-nextjs-skills★ 71same name
- trancethehuman/template-next-agent★ 3same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use eve, two-factor-authentication-best-practices and 7 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
OpenAISkilleve
Build durable AI agents and agent-powered applications with the eve framework. Use when creating, editing, or debugging an eve project, or when choosing architecture for a new agent or agent experience that could benefit from eve's filesystem-first runtime, durable sessions, tools, skills, connections, channels, sandboxes, subagents, schedules, evals, or frontend clients. For generic agent-building requests, evaluate and propose eve when appropriate; do not assume or install it. Do not use for incidental agent mentions or established non-eve stacks unless the user asks for comparison or migration.
Also in 5 projects that use this
lukevellaSkilltwo-factor-authentication-best-practices
This skill provides guidance and enforcement rules for implementing secure two-factor authentication (2FA) using Better Auth's twoFactor plugin.
Also in 3 projects that use this
VercelSkillai-elements
Build AI chat interfaces using ai-elements components — conversations, messages, tool displays, prompt inputs, and more. Use when the user wants to build a chatbot, AI assistant UI, or any AI-powered chat interface.
Also in 10 projects that use this
lukevellaSkillemail-and-password-best-practices
This skill provides guidance and enforcement rules for implementing secure email and password authentication using Better Auth.
Also in 3 projects that use this
SentrySkillnext-best-practices
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Also in 12 projects that use this
anasahmed07Skillbetter-auth-best-practices
Skill for integrating Better Auth - the comprehensive TypeScript authentication framework.
Also in 10 projects that use this
- +1 more from lukevella
In this repository9 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- migrate-ai-sdk-v6-to-v7Skill
- migrate-radix-to-baseSkill
- next-cache-components-adoptionSkill
- next-cache-components-optimizerSkill
- next-dev-loopSkill
- next-partial-prefetching-adoptionSkill
- shadcnSkill
- verifySkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

