/nextjs-ai-skills:ai-sdk-6from nextjs-ai-skills
Provides guidance for maintaining and building with Vercel AI SDK v6, covering ToolLoopAgent, useChat, generateText, streamText, tool approval, provider tools, MCP integration, and Output patterns.
Ships in nextjs-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Apply this skill only to ai@6 projects. Resolve compatible provider and UI
packages from the existing manifest/lockfile. Use ai-sdk when the major is
unknown and ai-sdk-7 for an authorized upgrade.
Read the resolved ai/docs/, provider docs and source/types for the exact minor
release. In a monorepo, resolve from the app using the dependency. Default web
docs and repository main can describe v7. ai bundles docs/ from 6.0.32; the
tree mirrors the website paths (mapping in ai-sdk). If installed docs are
unavailable, select the ai@<resolved-version> tag in vercel/ai and read
content/docs/.
Feature links here use a checked v6 documentation snapshot
as a fallback; match the project's release when available. This tag selects
documentation, not an application dependency version.
system; ToolLoopAgent uses instructions.stopWhen: stepCountIs(...). Text functions default to one
step (tool execution without a follow-up answer); ToolLoopAgent defaults
to 20.convertToModelMessages is async; await it.Output for new schema output; legacy object
functions are deprecated.inputSchema; SDK-executed approval is tool-level needsApproval.
V6 does not know v7's toolApproval: unless a typecheck rejects it, it is
ignored and the tool runs without approval.useChat owns messages and stream status, not form input. Use the
appropriate transport and UI-message response protocol.onFinish; result usage is final-step usage,
while totalUsage covers all steps.Use a configured model verified for the actual provider. Typecheck and test a multi-turn stream with relevant tool/approval/error states after integration changes.
Checked with [email protected], @ai-sdk/[email protected], [email protected], React 19 and
TypeScript 5.9: tsc --noEmit, plus a mock-model run through one tool step and
the follow-up answer. A string model resolves through the AI Gateway. In v7,
system, stepCountIs and result.toUIMessageStreamResponse() become
instructions, isStepCount and
createUIMessageStreamResponse({ stream: toUIMessageStream({ stream: result.stream }) }).
// app/api/chat/route.ts
import { convertToModelMessages, stepCountIs, streamText, tool, validateUIMessages,
type InferUITools, type UIDataTypes, type UIMessage } from 'ai';
import { z } from 'zod';
const tools = {
weather: tool({
inputSchema: z.object({ city: z.string() }),
execute: async ({ city }) => ({ city, celsius: 21 }),
}),
};
export type ChatMessage = UIMessage<never, UIDataTypes, InferUITools<typeof tools>>;
export async function POST(req: Request) {
const { messages } = await req.json();
const uiMessages = await validateUIMessages<ChatMessage>({ messages, tools });
const result = streamText({
model: 'provider/model-id', // configured gateway ID, or a provider instance
system: 'Answer briefly.',
messages: await convertToModelMessages(uiMessages),
tools,
stopWhen: stepCountIs(5),
});
return result.toUIMessageStreamResponse();
}
// app/page.tsx
'use client';
import { useChat } from '@ai-sdk/react';
import { DefaultChatTransport } from 'ai';
import type { ChatMessage } from './api/chat/route';
const transport = new DefaultChatTransport<ChatMessage>({ api: '/api/chat' });
export default function Chat() {
const { messages, sendMessage, status } = useChat<ChatMessage>({ transport });
return (
<form action={(form) => void sendMessage({ text: String(form.get('text')) })}>
{messages.map((m) => <div key={m.id}>{m.parts.map((part, i) =>
part.type === 'text' ? <p key={i}>{part.text}</p>
: part.type === 'tool-weather' && part.state === 'output-available'
? <p key={i}>{part.output.city}: {part.output.celsius} °C</p> : null)}</div>)}
<input name="text" disabled={status === 'submitted' || status === 'streaming'} />
</form>
);
}
references/agents.md (opens in a new tab)references/core-functions.md (opens in a new tab)references/examples.md (opens in a new tab)references/mcp.md (opens in a new tab)references/middleware.md (opens in a new tab)references/tools.md (opens in a new tab)references/ui-hooks.md (opens in a new tab)references/workflows.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
24 skills in this plugin
/agent-harness-reviewReviews an agent harness or agent design against Anthropic's agent and model prompting guidance (Opus 5.5, Fable 5.2), Cognition's context principles and 2026 research on skill routing and skill-induced failures. Covers when subagents or parallel agents pay off, how to brief them, how many skills, plugins, MCP servers and hooks load every session, tool design and proportionate verification. Use when auditing a Claude Code or Codex setup, deciding whether to add subagents or a multi-agent workflow, trimming a skill library, or designing an agent loop in an app. For writing a new skill or measuring a skill's trigger rate with evals, use skill-creator./ai-appBuilds full-stack Next.js AI applications with the AI SDK and the shadcn/ui AI Elements patterns. Use when creating a chatbot, agent dashboard or custom AI application./ai-elementsnpx claudepluginhub laguagu/claude-code-nextjs-skills --plugin nextjs-ai-skills2 plugins ship this exact skill · first indexed Oct 12, 2026
Other plugins' skills for the same job