/migrate-ai-sdk-v6-to-v7
Migrate applications from AI SDK 6.x to AI SDK 7.0. Use when upgrading Vercel AI SDK packages, fixing v7 migration errors, or when the user mentions AI SDK v6, v7, upgrade, migration, breaking changes, system to instructions, fullStream, telemetry, tool context, or finalStep.
$ npx -y skills add vercel-labs/ai --skill migrate-ai-sdk-v6-to-v7 --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/migrate-ai-sdk-v6-to-v7
Context preview
The summary Claude sees to decide when to auto-load this skill.
Migrate applications from AI SDK 6.x to AI SDK 7.0. Use when upgrading Vercel AI SDK packages, fixing v7 migration errors, or when the user mentions AI SDK v6, v7, upgrade, migration, breaking changes, system to instructions, fullStream, telemetry, tool context, or finalStep.
SKILL.md
migrate-ai-sdk-v6-to-v7.SKILL.mdname: migrate-ai-sdk-v6-to-v7
description: Migrate applications from AI SDK 6.x to AI SDK 7.0. Use when upgrading Vercel AI SDK packages, fixing v7 migration errors, or when the user mentions AI SDK v6, v7, upgrade, migration, breaking changes, system to instructions, fullStream, telemetry, tool context, or finalStep.
AI SDK 6 to 7 Migration
Use `content/docs/08-migration-guides/23-migration-guide-7-0.mdx` from the AI SDK repo as the source of truth. This skill is the working checklist; read the guide for exact examples or when behavior is unclear.
Migration Workflow
1. Ensure the user has a clean backup or committed baseline before editing. 2. Inspect `package.json` and lockfiles to identify installed `ai`, `@ai-sdk/*`, provider, UI, MCP, and telemetry packages. 3. Upgrade AI SDK packages to latest versions, and add `@ai-sdk/otel` only if the project uses OpenTelemetry spans. 4. Update runtime and module assumptions: Node.js must be `>=22`, and AI SDK packages are ESM-only. Replace `require()` imports with ESM imports and add `"type": "module"` or use `.mjs` where needed. 5. Search for the v6 patterns below, migrate only the code that exists, then run typecheck and targeted tests.
Prefer behavior-preserving changes. When v7 changes semantics, decide whether the app wants the new all-steps behavior or the previous final-step-only behavior.
Core API Changes
- `experimental_customProvider` -> `customProvider`.
- `experimental_generateImage` -> `generateImage`; `Experimental_GenerateImageResult` -> `GenerateImageResult`.
- `experimental_transcribe` -> `transcribe`; `Experimental_TranscriptionResult` -> `TranscriptionResult`.
- `experimental_generateSpeech` -> `generateSpeech`; `Experimental_SpeechResult` -> `SpeechResult`.
- `experimental_output` option/result -> `output` option/result.
- `CallSettings` -> `LanguageModelCallOptions & Omit<RequestOptions, 'timeout'>`; `prepareCallSettings` -> `prepareLanguageModelCallOptions`.
- `stepCountIs` -> `isStepCount`.
Prompts and Steps
- Rename top-level `system` to `instructions` for `generateText`, `streamText`, `generateObject`, `streamObject`, and `streamUI`.
- Move `{ role: 'system' }` messages from `prompt` or `messages` into top-level `instructions`. Only use `allowSystemInMessages: true` for trusted persisted messages.
- Rename `experimental_prepareStep` to `prepareStep`.
- In `prepareStep`, rename returned `system` to `instructions`.
- In `experimental_repairToolCall`, use `{ instructions }` instead of `{ system }`.
- Audit `prepareStep` behavior: returned `instructions` and `messages` now carry forward into later steps. If code depended on one-step-only overrides, rebuild from `initialInstructions`, `initialMessages`, and `responseMessages` explicitly.
Lifecycle Callbacks
- `experimental_onStart` -> `onStart`.
- `experimental_onStepStart` -> `onStepStart`.
- `onFinish` -> `onEnd`.
- `onStepFinish` -> `onStepEnd`.
- For `embed`, `embedMany`, and `rerank`, `experimental_onFinish` -> `onEnd`.
- Callback event fields use `instructions` instead of `system`.
Usage, Telemetry, and Include Options
- `usage.cachedInputTokens` -> `usage.inputTokenDetails.cacheReadTokens`.
- `usage.reasoningTokens` -> `usage.outputTokenDetails.reasoningTokens`.
- OpenTelemetry moved out of `ai`; install `@ai-sdk/otel` and call `registerTelemetry(new OpenTelemetry(...))` at app startup.
- Telemetry is enabled by default once an integration is registered. Remove redundant `isEnabled: true`; use `isEnabled: false` to opt out per call.
- Move `experimental_telemetry.tracer` into the `OpenTelemetry` constructor.
- `experimental_telemetry` -> `telemetry`.
- Telemetry integration callbacks: `onRerankFinish` -> `onRerankEnd`, `onEmbedFinish` -> `onEmbedEnd`. Update tracing-channel subscribers for the same event type names.
- `experimental_include` -> `include`.
- `includeRawChunks` -> `include.rawChunks`.
- Request and response bodies are excluded by default. If code reads `request.body` or `response.body`, opt in with `include.requestBody` and, for `generateText`, `include.responseBody`.
Streaming, Messages, and Tools
- `StreamTextResult.fullStream` -> `stream`.
- `streamText` `onChunk` now receives all stream parts, including lifecycle, boundary, finish, abort, and error parts. Guard by `chunk.type` before assuming text/tool/raw content.
- `step.response.messages` is no longer accumulated across previous steps. Use `result.responseMessages` for the full response message history, or flatten `result.steps`.
- Tool execution callbacks: `experimental_onToolCallStart` -> `onToolExecutionStart`, `experimental_onToolCallFinish` -> `onToolExecutionEnd`.
- Tool callback `experimental_context` -> `context`.
- Split shared runtime data from tool-specific data: use top-level `runtimeContext` for orchestration state, declare per-tool `contextSchema`, and pass per-tool values through `toolsContext`.
- Move `needsApproval` from `tool()` / `dynamicTool()` into per-call or agent `toolApproval`.
- `experimental_activeTools` -> `activeTools`.
- `ToolCallOptions` -> `ToolExecutionOptions`.
- `isToolOrDynamicToolUIPart` -> `isToolUIPart`.
Content Parts and Reasoning
- Tool result `{ type: 'media' }` is removed; use `{ type: 'file-data' }`.
- Migrate `toModelOutput` `image-*`, `file-*`, `file-id`, and `image-file-id` variants to canonical `{ type: 'file', mediaType, data: { type: 'data' | 'url' | 'reference', ... } }`.
- User message `{ type: 'image', image, mediaType? }` is deprecated; use `{ type: 'file', mediaType: 'image' | 'image/*', data }`.
- Add support for the new `reasoning-file` content type in exhaustive switches, renderers, serializers, and validators.
- When adopting top-level `reasoning`, remove overlapping provider-specific reasoning settings from `providerOptions` unless provider-specific settings intentionally take precedence.
Multi-Step Result Shape
- `result.usage` now includes all steps; `result.totalUsage` is deprecated
Read more
name: migrate-ai-sdk-v6-to-v7 description: Migrate applications from AI SDK 6.x to AI SDK 7.0. Use when upgrading Vercel AI SDK packages, fixing v7 migration errors, or when the user mentions AI SDK v6, v7, upgrade, migration, breaking changes, system to instructions, fullStream, telemetry, tool context, or finalStep.
AI SDK 6 to 7 Migration
Use `content/docs/08-migration-guides/23-migration-guide-7-0.mdx` from the AI SDK repo as the source of truth. This skill is the working checklist; read the guide for exact examples or when behavior is unclear.
Migration Workflow
1. Ensure the user has a clean backup or committed baseline before editing. 2. Inspect `package.json` and lockfiles to identify installed `ai`, `@ai-sdk/*`, provider, UI, MCP, and telemetry packages. 3. Upgrade AI SDK packages to latest versions, and add `@ai-sdk/otel` only if the project uses OpenTelemetry spans. 4. Update runtime and module assumptions: Node.js must be `>=22`, and AI SDK packages are ESM-only. Replace `require()` imports with ESM imports and add `"type": "module"` or use `.mjs` where needed. 5. Search for the v6 patterns below, migrate only the code that exists, then run typecheck and targeted tests.
Prefer behavior-preserving changes. When v7 changes semantics, decide whether the app wants the new all-steps behavior or the previous final-step-only behavior.
Core API Changes
- `experimental_customProvider` -> `customProvider`.
- `experimental_generateImage` -> `generateImage`; `Experimental_GenerateImageResult` -> `GenerateImageResult`.
- `experimental_transcribe` -> `transcribe`; `Experimental_TranscriptionResult` -> `TranscriptionResult`.
- `experimental_generateSpeech` -> `generateSpeech`; `Experimental_SpeechResult` -> `SpeechResult`.
- `experimental_output` option/result -> `output` option/result.
- `CallSettings` -> `LanguageModelCallOptions & Omit<RequestOptions, 'timeout'>`; `prepareCallSettings` -> `prepareLanguageModelCallOptions`.
- `stepCountIs` -> `isStepCount`.
Prompts and Steps
- Rename top-level `system` to `instructions` for `generateText`, `streamText`, `generateObject`, `streamObject`, and `streamUI`.
- Move `{ role: 'system' }` messages from `prompt` or `messages` into top-level `instructions`. Only use `allowSystemInMessages: true` for trusted persisted messages.
- Rename `experimental_prepareStep` to `prepareStep`.
- In `prepareStep`, rename returned `system` to `instructions`.
- In `experimental_repairToolCall`, use `{ instructions }` instead of `{ system }`.
- Audit `prepareStep` behavior: returned `instructions` and `messages` now carry forward into later steps. If code depended on one-step-only overrides, rebuild from `initialInstructions`, `initialMessages`, and `responseMessages` explicitly.
Lifecycle Callbacks
- `experimental_onStart` -> `onStart`.
- `experimental_onStepStart` -> `onStepStart`.
- `onFinish` -> `onEnd`.
- `onStepFinish` -> `onStepEnd`.
- For `embed`, `embedMany`, and `rerank`, `experimental_onFinish` -> `onEnd`.
- Callback event fields use `instructions` instead of `system`.
Usage, Telemetry, and Include Options
- `usage.cachedInputTokens` -> `usage.inputTokenDetails.cacheReadTokens`.
- `usage.reasoningTokens` -> `usage.outputTokenDetails.reasoningTokens`.
- OpenTelemetry moved out of `ai`; install `@ai-sdk/otel` and call `registerTelemetry(new OpenTelemetry(...))` at app startup.
- Telemetry is enabled by default once an integration is registered. Remove redundant `isEnabled: true`; use `isEnabled: false` to opt out per call.
- Move `experimental_telemetry.tracer` into the `OpenTelemetry` constructor.
- `experimental_telemetry` -> `telemetry`.
- Telemetry integration callbacks: `onRerankFinish` -> `onRerankEnd`, `onEmbedFinish` -> `onEmbedEnd`. Update tracing-channel subscribers for the same event type names.
- `experimental_include` -> `include`.
- `includeRawChunks` -> `include.rawChunks`.
- Request and response bodies are excluded by default. If code reads `request.body` or `response.body`, opt in with `include.requestBody` and, for `generateText`, `include.responseBody`.
Streaming, Messages, and Tools
- `StreamTextResult.fullStream` -> `stream`.
- `streamText` `onChunk` now receives all stream parts, including lifecycle, boundary, finish, abort, and error parts. Guard by `chunk.type` before assuming text/tool/raw content.
- `step.response.messages` is no longer accumulated across previous steps. Use `result.responseMessages` for the full response message history, or flatten `result.steps`.
- Tool execution callbacks: `experimental_onToolCallStart` -> `onToolExecutionStart`, `experimental_onToolCallFinish` -> `onToolExecutionEnd`.
- Tool callback `experimental_context` -> `context`.
- Split shared runtime data from tool-specific data: use top-level `runtimeContext` for orchestration state, declare per-tool `contextSchema`, and pass per-tool values through `toolsContext`.
- Move `needsApproval` from `tool()` / `dynamicTool()` into per-call or agent `toolApproval`.
- `experimental_activeTools` -> `activeTools`.
- `ToolCallOptions` -> `ToolExecutionOptions`.
- `isToolOrDynamicToolUIPart` -> `isToolUIPart`.
Content Parts and Reasoning
- Tool result `{ type: 'media' }` is removed; use `{ type: 'file-data' }`.
- Migrate `toModelOutput` `image-*`, `file-*`, `file-id`, and `image-file-id` variants to canonical `{ type: 'file', mediaType, data: { type: 'data' | 'url' | 'reference', ... } }`.
- User message `{ type: 'image', image, mediaType? }` is deprecated; use `{ type: 'file', mediaType: 'image' | 'image/*', data }`.
- Add support for the new `reasoning-file` content type in exhaustive switches, renderers, serializers, and validators.
- When adopting top-level `reasoning`, remove overlapping provider-specific reasoning settings from `providerOptions` unless provider-specific settings intentionally take precedence.
Multi-Step Result Shape
- `result.usage` now includes all steps; `result.totalUsage` is deprecated
The AI Toolkit for TypeScript. From the creators of Next.js, the AI SDK is a free open-source library for building AI-powered applications and agents
Repo: vercel-labs/ai
Other skills on vercel-ai.
- /add-function-examples
Guide for adding new AI function examples, for testing specific features against the actual provider APIs.
Open skill - /add-harness-package
Guide for adding new AI SDK harness packages. Use when creating a new @ai-sdk/harness-<name> package that adapts a coding-agent runtime to HarnessV1.
Open skill - /add-provider-package
Guide for adding new AI provider packages to the AI SDK. Use when creating a new @ai-sdk/<provider> package to integrate an AI service into the SDK.
Open skill - /adr-skill
Create and maintain Architecture Decision Records (ADRs) optimized for agentic coding workflows. Use when you need to propose, write, update, accept/reject, deprecate, or supersede an ADR; bootstrap an adr folder and index; consult existing ADRs before implementing changes; or
Open skill - /capture-api-response-test-fixture
Capture API response test fixture.
Open skill - /develop-ai-functions-example
Develop examples for AI SDK functions. Use when creating, running, or modifying examples under examples/ai-functions/src to validate provider support, demonstrate features, or create test fixtures.
Open skill

