Confirm successful installation by checking the skill directory location:
.cursor/skills/vercel-ai-sdk
Restart Cursor to activate vercel-ai-sdk. Access via /vercel-ai-sdk in your agent's command palette.
โ
Security Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Creating API routes that generate or stream AI responses
Building agentic applications with ToolLoopAgent
Adding tool calling / function calling capabilities
Generating structured output with Output.object(), Output.array(), etc.
Generating text embeddings for semantic search or RAG
Migrating from AI SDK v5 to v6
Integrating Model Context Protocol (MCP) servers
Implementing middleware for caching, logging, or guardrails
Building workflow patterns (sequential, parallel, routing, etc.)
Working with streaming responses or message persistence
Structured Implementation Workflow
NEVER accept "Module not found" errors as environment issues
YOU must install the required packages with the CORRECT package manager
Common packages needed:
- ai (core AI SDK)
- @ai-sdk/openai (OpenAI provider)
- @ai-sdk/anthropic (Anthropic provider)
- @ai-sdk/mcp (MCP integration)
- @modelcontextprotocol/sdk (MCP client SDK)
- zod (for tool schemas)
</critical>
"Code is correct" is NOT enough
You must achieve FULL PASSING status
This is what it means to be an autonomous agent
</critical>
โ ๏ธ AUTONOMOUS AGENT MINDSET
You are not just writing code - you are COMPLETING TASKS AUTONOMOUSLY.
This means:
โ Write correct implementation
โ Install any required dependencies
โ Run build and fix ALL errors
โ Run tests and debug ALL failures
โ Iterate until EVERYTHING passes
โ Never make excuses or give up
Common Failure Patterns to AVOID
โ WRONG: "The code is correct, but the package isn't installed - that's an environment issue"
โ CORRECT: "Build failed due to missing package - installing it now with npm install [package]"
โ WRONG: "Tests pass but build fails - not my problem"
โ CORRECT: "Build is failing - debugging the error and fixing it now"
โ WRONG: "There's a framework bug, can't fix it"
โ CORRECT: "Framework error detected - researching the issue, trying workarounds, debugging until I find a solution"
โ WRONG: "The implementation is complete" (with failing tests)
โ CORRECT: "Tests are failing - debugging and fixing until they all pass"
Dependency Installation Workflow
When you encounter "Module not found" errors:
Detect the package manager FIRST - Check for lockfiles:
# If pnpm-lock.yaml exists (MOST COMMON for Next.js evals):pnpminstall @ai-sdk/anthropic
# orpnpmadd @ai-sdk/anthropic
# If package-lock.json exists:npminstall @ai-sdk/anthropic
# If yarn.lock exists:yarnadd @ai-sdk/anthropic
# If bun.lockb exists:bun install @ai-sdk/anthropic
Re-run build to verify
npm run build
# or pnpm run build, yarn build, bun run build
Fix any new errors that appear
โ ๏ธ CRITICAL WARNING:
Using the WRONG package manager (e.g., npm when the project uses pnpm) will:
Create a second conflicting lockfile
Install different versions of dependencies
Cause dependency version mismatches
Break the build with cryptic errors like "Cannot read properties of null"
Build Error Debugging Workflow
When build fails:
Read the FULL error message - don't skim it
Identify the root cause:
Module not found โ Install package
Type error โ Fix types
Config error โ Check config files
Next.js error โ Research, try different approaches
Apply the fix
Re-run build
Repeat until build passes
Test Failure Debugging Workflow
When tests fail:
Read the FULL test error - understand what's expected
Compare expected vs actual behavior
Check your implementation against test assertions
Fix the issue in your code
Re-run tests
Repeat until all tests pass
Success Criteria
Task is ONLY complete when:
โ Build passes (npm run build succeeds)
โ Lint passes (npm run lint succeeds)
โ Tests pass (npm run test succeeds)
NEVER stop at "code is correct" - achieve FULL PASSING status!
โ ๏ธ CRITICAL v6 CHANGES: Structured Output
In v6, generateObject and streamObject are DEPRECATED. Use generateText/streamText with Output helpers instead.
โ WRONG - Deprecated v5 Pattern
// DO NOT USE - DEPRECATED in v6import{ generateObject }from"ai";const result =awaitgenerateObject({ model:anthropic("claude-sonnet-4-5"), schema: z.object({ sentiment: z.enum(["positive","neutral","negative"]),}), prompt:"Analyze sentiment",});
โ ๏ธ CRITICAL: Tool Calling API - MUST USE tool() Helper
When implementing tool calling, you MUST use the tool() helper function from the 'ai' package.
โ WRONG - Plain Object (WILL CAUSE BUILD ERROR)
// DO NOT DO THIS - This pattern is INCORRECTimport{ z }from'zod';tools:{ myTool:{ description:'My tool', parameters: z.object({...}),// โ WRONG - "parameters" doesn't exist in v6execute:async({...})=>{...},}}
This will fail with:Type '{ description: string; parameters: ... }' is not assignable to type '{ inputSchema: FlexibleSchema<any>; ... }'
โ CORRECT - Use tool() Helper (REQUIRED)
// ALWAYS DO THIS - This is the ONLY correct patternimport{ tool }from'ai';// โ ๏ธ MUST import toolimport{ z }from'zod';tools:{ myTool:tool({// โ ๏ธ MUST wrap with tool() description:'My tool', inputSchema: z.object({...}),// โ ๏ธ MUST use "inputSchema" (not "parameters")execute:async({...})=>{...},}),}
Tool Calling Checklist
Before implementing any tool, verify:
[ ] Imported tool from 'ai' package: import { tool } from 'ai';
[ ] Wrapped tool definition with tool({ ... })
[ ] Used inputSchema property (NOT parameters)
[ ] Used zod schema: z.object({ ... })
[ ] Defined execute function with async callback
[ ] Added description string for the tool
โ ๏ธ NEW in v6: ToolLoopAgent for Agentic Applications
Agent Definition
import{ ToolLoopAgent, tool, stepCountIs }from"ai";import{ anthropic }from"@ai-sdk/anthropic";import{ z }from"zod";const myAgent =newToolLoopAgent({ model:anthropic("claude-sonnet-4-5"), instructions:"You are a helpful assistant that can search and analyze data.", tools:{
Implementation Guide
Prerequisites
โบClaude Desktop or compatible AI client with skill support
โบClear understanding of task or problem to solve
โบWillingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Steps
1Install skill using provided installation command
2Test with simple use case relevant to your work
3Evaluate output quality and relevance
4Iterate on prompts to improve results
5Integrate into regular workflow if valuable
Common Pitfalls
โ Expecting perfect results without iteration
โ Not providing enough context in prompts
โ Using skill for tasks outside its intended scope
โ Accepting outputs without review and validation
Best Practices
โ Do
+Start with clear, specific prompts
+Provide relevant context and constraints
+Review and refine all outputs before using
+Iterate to improve output quality
+Document successful prompt patterns
โ Don't
โDon't use without understanding skill limitations
โDon't skip validation of outputs
โDon't share sensitive information in prompts
โDon't expect skill to replace human judgment
๐ก Pro Tips
โ Be specific about desired format and style
โ Ask for multiple options to choose from
โ Request explanations to understand reasoning
โ Combine AI efficiency with human expertise
When to Use This
โ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
โ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path
1Familiarize yourself with skill capabilities and limitations
2Start with low-risk, non-critical tasks
3Progress to more complex and valuable use cases
4Build expertise through regular use and experimentation