ai-sdk-6

ai-sdk-6 is a skill for Claude Code from laguagu/claude-code-nextjs-skills. It costs 67 tokens per session (1,274 once invoked), scanned A, original, MIT.

A development guide for Vercel AI SDK v6, a JavaScript and TypeScript library for building applications that use AI models. It covers chat interfaces, streaming responses, tool calls, approvals, integrations, and structured results.

In plain words
What is it for?
Use it when building AI agents, chatbots, tool integrations, streaming applications, or responses that must follow a defined data shape.
Why use it?
It helps you use the current SDK patterns correctly instead of relying on outdated functions or guessing how different AI features fit together.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the claude-code-nextjs-skills plugin — 24 skills, 2 agents, 2 MCP servers shipped together

Good fit Use it when building AI agents, chatbots, tool integrations, streaming applications, or responses that must follow a defined data shape.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/laguagu/claude-code-nextjs-skills/ai-sdk-6
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add laguagu/claude-code-nextjs-skills --skill ai-sdk-6
Clone the repo
git clone --depth 1 https://github.com/laguagu/claude-code-nextjs-skills

Made for: Claude Code.

Or install claude-code-nextjs-skills, the plugin that ships this one along with the rest of its 24 skills, 2 agents, 2 MCP servers.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ai-sdk-6

README.md
[![agentmods](https://agentmods.dev/badge/skills/laguagu/claude-code-nextjs-skills/ai-sdk-6/github.svg)](https://agentmods.dev/skills/laguagu/claude-code-nextjs-skills/ai-sdk-6)
Your own site
<a href="https://agentmods.dev/skills/laguagu/claude-code-nextjs-skills/ai-sdk-6"><img src="https://agentmods.dev/badge/skills/laguagu/claude-code-nextjs-skills/ai-sdk-6/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ai-sdk-6

Your own site · 80×15
<a href="https://agentmods.dev/skills/laguagu/claude-code-nextjs-skills/ai-sdk-6"><img src="https://agentmods.dev/badge/skills/laguagu/claude-code-nextjs-skills/ai-sdk-6.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,274 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00067 $0.01274
Opus 5 $0.00034 $0.00637
Sonnet 5 $0.00013 $0.00255
Haiku 4.5 $0.00007 $0.00127

Measured 11d ago against content hash feb9676d4a29, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

ai-sdk-6 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/ai-sdk-6/SKILL.md · 178 lines

How it starts

The opening of the file, as written. The whole thing — 178 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Vercel AI SDK v6 Development Guide

Use this skill when developing AI-powered features using Vercel AI SDK v6 (ai package).

Docs location: bundled in node_modules/ai/docs/. In Bun/pnpm/Yarn workspace monorepos deps aren't hoisted — use apps/*/node_modules/ai/docs/ or packages/*/node_modules/ai/docs/ instead.

Quick Reference

Installation

bun add ai @ai-sdk/openai zod    # or @ai-sdk/anthropic, @ai-sdk/google, etc.

Core Functions

Function Purpose
generateText Non-streaming text generation (+ structured output with Output)
streamText Streaming text generation (+ structured output with Output)

v6 Note: generateObject/streamObject are deprecated. Use generateText/streamText with output: Output.object({ schema }) instead.

Structured Output (v6)

import { generateText, Output } from "ai";
import { z } from "zod";

const { output } = await generateText({
  model: anthropic("claude-sonnet-5"),
  output: Output.object({
    schema: z.object({
      sentiment: z.enum(["positive", "neutral", "negative"]),
      topics: z.array(z.string()),
    }),
  }),
  prompt: "Analyze this feedback...",
});

Output types: Output.object(), Output.array(), Output.choice(), Output.json(), Output.text() (default)

Agent Class (v6 Key Feature)

import { ToolLoopAgent, tool, stepCountIs } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
import { z } from "zod";

const myAgent = new ToolLoopAgent({
  model: anthropic("claude-sonnet-5"),
  instructions: "You are a helpful assistant.",
  tools: {
    getData: tool({
      description: "Fetch data from API",
      inputSchema: z.object({
        query: z.string(),
      }),
      execute: async ({ query }) => {
        return { result: "data" };
      },
    }),
  },
  stopWhen: stepCountIs(20),
});

// Usage
const { text } = await myAgent.generate({ prompt: "Hello" });
const stream = await myAgent.stream({ prompt: "Hello" });

Read the full file on GitHub · 178 lines

Files

What ships with it

8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 178 lines · 67 tokens per session scan A feb9676d4a29

Subscribe to this mod's changes

ai-sdk-6 is a skill published in the GitHub repository laguagu/claude-code-nextjs-skills (62 stars, last pushed 8d ago), licensed MIT. It adds 67 tokens to every session and 1,274 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

migrate-radix-to-base

Migrates React projects and components from Radix UI to Base UI. Use when asked to migrate from radix, move to base-ui, convert radix primitives, or switch a shadcn project's base library. Handles single components ("migrate accordion") and whole projects.

shadcn-ui/ui · 61 tokens

non-json-content-types

Handle FormData, file uploads, Blob, Uint8Array, and ReadableStream inputs in tRPC mutations. Use octetInputParser from @trpc/server/http for binary data. Route non-JSON requests with splitLink and isNonJsonSerializable() from @trpc/client. FormData and binary inputs only work with mutations (POST).

trpc/trpc · 75 tokens

trigger-authoring-tasks

Covers writing backend Trigger.dev tasks with @trigger.dev/sdk: defining task() and schemaTask(), the run function and its ctx, retries, waits, queues and concurrency, idempotency keys, run metadata, logging, triggering other tasks (and the Result shape), scheduled/cron tasks, and the essentials of trigger.config.ts.…

triggerdotdev/trigger.dev · 115 tokens

saas-builder

Clone, verify, map, and build on top of ixartz/SaaS-Boilerplate for a user's SaaS idea. Use when a user wants to reuse SaaS Boilerplate, evaluate how their product fits it, or build product-specific pages, database schema, roles, permissions, MVP features, and launch scope on top of the boilerplate.

ixartz/SaaS-Boilerplate · 75 tokens

arcgis-to-portaljs

Migrate a whole ArcGIS Hub site into a PortalJS Arc portal end-to-end. Harvests the Hub /data.json (DCAT-US) inventory, exports every FeatureService layer through the ArcGIS REST query API with resultOffset paging, converts each to the serverless dual tier (PMTiles render + GeoParquet query) with tabular items to…

datopian/portaljs · 134 tokens

fast-typescript-check

Keep www-sacred's TypeScript fast to type-check and fast to run. Use when touching the ASCII/canvas animation components (the only real per-frame code here), tightening type-check wall-clock, or auditing a change for runtime or compiler regressions. Scoped to this repo — a React 19 / Next.js 16 component library plus…

internet-development/www-sacred · 84 tokens