nextjs-ai-sdk

nextjs-ai-sdk is a skill for Claude Code from johnku2011/boilerplates-with-ai-skills. It costs 35 tokens per session (431 once invoked), scanned A, original, MIT.

A development guide for adding AI chat and model features to a Next.js application with the Vercel AI SDK, including streaming replies and validated tools.

In plain words
What is it for?
Use it to build chat API routes, AI tools, structured model responses, and streaming chat interfaces, then check the app with type checking and a production build.
Why use it?
It keeps model calls and secret keys on the server and helps ensure that data passed between the interface and server has a known, checked shape.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions AGENTS.md.

Good fit Use it to build chat API routes, AI tools, structured model responses, and streaming chat interfaces, then check the app with type checking and a production build.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/johnku2011/boilerplates-with-ai-skills/nextjs-ai-sdk
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 johnku2011/boilerplates-with-ai-skills --skill nextjs-ai-sdk
Clone the repo
git clone --depth 1 https://github.com/johnku2011/boilerplates-with-ai-skills

Made for: Claude Code.

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 nextjs-ai-sdk

README.md
[![agentmods](https://agentmods.dev/badge/skills/johnku2011/boilerplates-with-ai-skills/nextjs-ai-sdk/github.svg)](https://agentmods.dev/skills/johnku2011/boilerplates-with-ai-skills/nextjs-ai-sdk)
Your own site
<a href="https://agentmods.dev/skills/johnku2011/boilerplates-with-ai-skills/nextjs-ai-sdk"><img src="https://agentmods.dev/badge/skills/johnku2011/boilerplates-with-ai-skills/nextjs-ai-sdk/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 nextjs-ai-sdk

Your own site · 80×15
<a href="https://agentmods.dev/skills/johnku2011/boilerplates-with-ai-skills/nextjs-ai-sdk"><img src="https://agentmods.dev/badge/skills/johnku2011/boilerplates-with-ai-skills/nextjs-ai-sdk.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 431 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.00035 $0.00431
Opus 5 $0.00017 $0.00216
Sonnet 5 $0.00007 $0.00086
Haiku 4.5 $0.00003 $0.00043

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

Security

Grade A, and why

nextjs-ai-sdk 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 12d 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.

boilerplates/nextjs-ai-app/skills/nextjs-ai-sdk/SKILL.md · 46 lines

What it actually says

Next.js AI SDK

Overview

Build AI product features with the Vercel AI SDK: server route handlers for streaming, Zod-validated tool schemas, and thin client UI. Keep secrets and model calls on the server.

Process

  1. Add or extend app/api/chat/route.ts with streamText (or equivalent) — never call providers from client components with secret keys.
  2. Define tools with Zod schemas in lib/tools.ts (or colocated modules); return typed, small results agents/UI can render.
  3. Prefer structured outputs (generateObject / schema) when the UI needs a known shape instead of free-form prose.
  4. Keep app/page.tsx (or chat UI) as a client leaf; pass messages to the API route only.
  5. Verify with npm run typecheck and npm run build. Smoke the chat UI with npm run dev when changing streaming behavior.

Guidelines

  • Read OPENAI_API_KEY (or provider env) only on the server.
  • Validate all tool arguments with Zod; reject unknown keys.
  • Document model id and provider choice in code comments when non-default.
  • For browser QA of the chat UI, use the project Playwright MCP (see AGENTS.md).
  • Re-check secrets and data exposure with project-security before shipping.

Anti-patterns

  • Exposing API keys via NEXT_PUBLIC_*.
  • Untyped tool arguments or free-form JSON without a schema.
  • Doing privileged tool work in the browser.
  • Giant route handlers mixing UI strings, prompts, and business logic.
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. 12d ago First seen · 46 lines · 35 tokens per session scan A c7676103215e

Subscribe to this mod's changes

nextjs-ai-sdk is a skill published in the GitHub repository johnku2011/boilerplates-with-ai-skills (240 stars, last pushed 19d ago), licensed MIT. It adds 35 tokens to every session and 431 once invoked, about $0.0002 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.