.claude/skills/ts-ai-sdk/SKILL.md
You are an expert in the Vercel AI SDK, the TypeScript toolkit for building AI-powered applications. You help developers integrate LLMs (OpenAI, Anthropic, Google, Mistral, Ollama) with React Server Components, streaming UI, tool calling, structured output with Zod schemas, RAG pipelines, multi-step agents, and edge-compatible AI features — the standard way to add AI to Next.js, Nuxt, SvelteKit, and any Node.js app.
npx skillsauth add eliferjunior/Claude ai-sdkInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an expert in the Vercel AI SDK, the TypeScript toolkit for building AI-powered applications. You help developers integrate LLMs (OpenAI, Anthropic, Google, Mistral, Ollama) with React Server Components, streaming UI, tool calling, structured output with Zod schemas, RAG pipelines, multi-step agents, and edge-compatible AI features — the standard way to add AI to Next.js, Nuxt, SvelteKit, and any Node.js app.
// AI SDK Core — works in any Node.js/Edge environment
import { generateText, generateObject, streamText, streamObject, tool } from "ai";
import { openai } from "@ai-sdk/openai";
import { anthropic } from "@ai-sdk/anthropic";
import { z } from "zod";
// Simple text generation
const { text } = await generateText({
model: openai("gpt-4o"),
prompt: "Explain quantum computing in 3 sentences",
});
// Structured output with Zod schema
const { object: analysis } = await generateObject({
model: anthropic("claude-sonnet-4-20250514"),
schema: z.object({
sentiment: z.enum(["positive", "negative", "neutral"]),
topics: z.array(z.string()),
summary: z.string(),
confidence: z.number().min(0).max(1),
}),
prompt: `Analyze this review: "${reviewText}"`,
});
// analysis.sentiment → "positive" (fully typed)
// Streaming text
const result = streamText({
model: openai("gpt-4o"),
messages: [{ role: "user", content: "Write a poem about TypeScript" }],
});
for await (const chunk of result.textStream) {
process.stdout.write(chunk);
}
// Tool calling (agents)
const { text: answer, toolResults } = await generateText({
model: openai("gpt-4o"),
tools: {
getWeather: tool({
description: "Get weather for a city",
parameters: z.object({ city: z.string() }),
execute: async ({ city }) => {
const res = await fetch(`https://wttr.in/${city}?format=j1`);
return res.json();
},
}),
searchDatabase: tool({
description: "Search products database",
parameters: z.object({ query: z.string(), limit: z.number().default(5) }),
execute: async ({ query, limit }) => db.products.search(query, limit),
}),
},
maxSteps: 5, // Multi-step agent loop
prompt: "What's the weather in Tokyo and find related travel products?",
});
// app/api/chat/route.ts — API route with streaming
import { streamText } from "ai";
import { openai } from "@ai-sdk/openai";
export async function POST(req: Request) {
const { messages } = await req.json();
const result = streamText({
model: openai("gpt-4o"),
system: "You are a helpful assistant.",
messages,
});
return result.toDataStreamResponse();
}
// app/chat/page.tsx — Client component
"use client";
import { useChat } from "ai/react";
export default function Chat() {
const { messages, input, handleInputChange, handleSubmit, isLoading } = useChat();
return (
<div>
{messages.map(m => (
<div key={m.id} className={m.role === "user" ? "text-right" : "text-left"}>
<p>{m.content}</p>
</div>
))}
<form onSubmit={handleSubmit}>
<input value={input} onChange={handleInputChange} placeholder="Ask anything..." />
<button type="submit" disabled={isLoading}>Send</button>
</form>
</div>
);
}
// Streaming UI with RSC
import { streamUI } from "ai/rsc";
async function submitMessage(input: string) {
"use server";
const result = await streamUI({
model: openai("gpt-4o"),
messages: [{ role: "user", content: input }],
tools: {
showStockPrice: {
description: "Show stock price chart",
parameters: z.object({ symbol: z.string() }),
generate: async function* ({ symbol }) {
yield <Spinner />;
const data = await getStockData(symbol);
return <StockChart data={data} />; // Stream React components!
},
},
},
});
return result.value;
}
import { openai } from "@ai-sdk/openai";
import { anthropic } from "@ai-sdk/anthropic";
import { google } from "@ai-sdk/google";
import { createOllama } from "ollama-ai-provider";
const ollama = createOllama({ baseURL: "http://localhost:11434/api" });
// Same code, different providers
const models = {
fast: openai("gpt-4o-mini"),
smart: anthropic("claude-sonnet-4-20250514"),
vision: google("gemini-2.0-flash"),
local: ollama("llama3"),
};
const { text } = await generateText({
model: models[selectedModel], // Switch provider with zero code changes
prompt: userQuery,
});
npm install ai @ai-sdk/openai @ai-sdk/anthropic
# Provider packages: @ai-sdk/google, @ai-sdk/mistral, ollama-ai-provider
maxSteps: 5-10 for agent loops; AI calls tools, gets results, reasons, repeatsexperimental_telemetry for OpenTelemetry traces; track token usage, latency, errorsdevelopment
Expert guidance for Fireworks AI, the platform for running open-source LLMs (Llama, Mixtral, Qwen, etc.) with enterprise-grade speed and reliability. Helps developers integrate Fireworks' inference API, fine-tune models, and deploy custom model endpoints with function calling and structured output support.
development
Convert any website into clean, structured data with Firecrawl — API-first web scraping service. Use when someone asks to "turn a website into markdown", "scrape website for LLM", "Firecrawl", "extract website content as clean text", "crawl and convert to structured data", or "scrape website for RAG". Covers single-page scraping, full-site crawling, structured extraction, and LLM-ready output.
tools
Expert guidance for Firebase, Google's platform for building and scaling web and mobile applications. Helps developers set up authentication, Firestore/Realtime Database, Cloud Functions, hosting, storage, and analytics using Firebase's SDK and CLI.
development
When the user needs to build file upload functionality for a web application. Use when the user mentions "file upload," "image upload," "upload endpoint," "multipart upload," "presigned URL," "S3 upload," "file validation," "upload to cloud storage," or "accept user files." Handles upload endpoints, file validation (type, size, magic bytes), cloud storage integration, and upload status tracking. For image/video processing after upload, see media-transcoder.