Vercel AI SDK 5 patterns. An agent skill from Gentleman-Programming/Gentleman-Skills.

Apache-2.0Auto-check passedAI & LLM Engineering

Install AI SDK 5

skills CLI
$ npx skills add Gentleman-Programming/Gentleman-Skills --skill ai-sdk-5 -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Gentleman-Programming/Gentleman-Skills ai-sdk-5 --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Gentleman-Programming/Gentleman-Skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/curated/ai-sdk-5 .claude/skills/ai-sdk-5 && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
ai-sdk-5
GitHub stars
658
Token cost
~1.4k tokens
SKILL.md length
34 words
Files
1
Skills in repo
24
Repo updated
First seen
Licence
Apache-2.0

At a glance

Vercel AI SDK 5 patterns. An agent skill from Gentleman-Programming/Gentleman-Skills.

  • AI & LLM Engineering work in your project
  • SKILL.md covers Breaking Changes from AI SDK 4, Client Setup, UIMessage Structure (v5) and Server-Side (Route Handler), plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

AI SDK 5 is an agent skill from Gentleman-Programming/Gentleman-Skills. Vercel AI SDK 5 patterns. Trigger: When building AI chat features - breaking changes from v4.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering. It works with Vercel AI SDK. The repository describes itself as: Community-driven AI agent skills for Claude Code, OpenCode, and other AI assistants. Curated patterns and community contributions. The licence is Apache-2.0.

When your agent uses it

  • AI & LLM Engineering work in your project

Example prompts

  • “/ai-sdk-5”

What it can do on your machine

Read from SKILL.md and the folder at commit c8036a3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

AI SDK 5 loads about 1.4k tokens when it runs. Until then it costs about 26 tokens; SKILL.md has 34 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~26
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Gentleman-Programming/Gentleman-Skills at commit c8036a3, republished under its Apache-2.0 licence (© Gentleman-Programming). 34 words, ~1,370 tokens.

Download SKILL.mdSave it as .claude/skills/ai-sdk-5/SKILL.md (or your agent's skills folder).
name
ai-sdk-5
description
Vercel AI SDK 5 patterns. Trigger: When building AI chat features - breaking changes from v4.
license
Apache-2.0
metadata.author
gentleman-programming
metadata.version
1.0

Breaking Changes from AI SDK 4

typescript
// ❌ AI SDK 4 (OLD)
import { useChat } from "ai";
const { messages, handleSubmit, input, handleInputChange } = useChat({
  api: "/api/chat",
});

// ✅ AI SDK 5 (NEW)
import { useChat } from "@ai-sdk/react";
import { DefaultChatTransport } from "ai";

const { messages, sendMessage } = useChat({
  transport: new DefaultChatTransport({ api: "/api/chat" }),
});

Client Setup

typescript
import { useChat } from "@ai-sdk/react";
import { DefaultChatTransport } from "ai";
import { useState } from "react";

export function Chat() {
  const [input, setInput] = useState("");

  const { messages, sendMessage, isLoading, error } = useChat({
    transport: new DefaultChatTransport({ api: "/api/chat" }),
  });

  const handleSubmit = (e: React.FormEvent) => {
    e.preventDefault();
    if (!input.trim()) return;
    sendMessage({ text: input });
    setInput("");
  };

  return (
    <div>
      <div>
        {messages.map((message) => (
          <Message key={message.id} message={message} />
        ))}
      </div>

      <form onSubmit={handleSubmit}>
        <input
          value={input}
          onChange={(e) => setInput(e.target.value)}
          placeholder="Type a message..."
          disabled={isLoading}
        />
        <button type="submit" disabled={isLoading}>
          Send
        </button>
      </form>

      {error && <div>Error: {error.message}</div>}
    </div>
  );
}

UIMessage Structure (v5)

typescript
// ❌ Old: message.content was a string
// ✅ New: message.parts is an array

interface UIMessage {
  id: string;
  role: "user" | "assistant" | "system";
  parts: MessagePart[];
}

type MessagePart =
  | { type: "text"; text: string }
  | { type: "image"; image: string }
  | { type: "tool-call"; toolCallId: string; toolName: string; args: unknown }
  | { type: "tool-result"; toolCallId: string; result: unknown };

// Extract text from parts
function getMessageText(message: UIMessage): string {
  return message.parts
    .filter((part): part is { type: "text"; text: string } => part.type === "text")
    .map((part) => part.text)
    .join("");
}

// Render message
function Message({ message }: { message: UIMessage }) {
  return (
    <div className={message.role === "user" ? "user" : "assistant"}>
      {message.parts.map((part, index) => {
        if (part.type === "text") {
          return <p key={index}>{part.text}</p>;
        }
        if (part.type === "image") {
          return <img key={index} src={part.image} alt="" />;
        }
        return null;
      })}
    </div>
  );
}

Server-Side (Route Handler)

typescript
// app/api/chat/route.ts
import { openai } from "@ai-sdk/openai";
import { streamText } from "ai";

export async function POST(req: Request) {
  const { messages } = await req.json();

  const result = await streamText({
    model: openai("gpt-4o"),
    messages,
    system: "You are a helpful assistant.",
  });

  return result.toDataStreamResponse();
}

With LangChain

typescript
// app/api/chat/route.ts
import { toUIMessageStream } from "@ai-sdk/langchain";
import { ChatOpenAI } from "@langchain/openai";
import { HumanMessage, AIMessage } from "@langchain/core/messages";

export async function POST(req: Request) {
  const { messages } = await req.json();

  const model = new ChatOpenAI({
    modelName: "gpt-4o",
    streaming: true,
  });

  // Convert UI messages to LangChain format
  const langchainMessages = messages.map((m) => {
    const text = m.parts
      .filter((p) => p.type === "text")
      .map((p) => p.text)
      .join("");
    return m.role === "user"
      ? new HumanMessage(text)
      : new AIMessage(text);
  });

  const stream = await model.stream(langchainMessages);

  return toUIMessageStream(stream).toDataStreamResponse();
}

Streaming with Tools

typescript
import { openai } from "@ai-sdk/openai";
import { streamText, tool } from "ai";
import { z } from "zod";

const result = await streamText({
  model: openai("gpt-4o"),
  messages,
  tools: {
    getWeather: tool({
      description: "Get weather for a location",
      parameters: z.object({
        location: z.string().describe("City name"),
      }),
      execute: async ({ location }) => {
        // Fetch weather data
        return { temperature: 72, condition: "sunny" };
      },
    }),
  },
});

useCompletion (Text Generation)

typescript
import { useCompletion } from "@ai-sdk/react";
import { DefaultCompletionTransport } from "ai";

const { completion, complete, isLoading } = useCompletion({
  transport: new DefaultCompletionTransport({ api: "/api/complete" }),
});

// Trigger completion
await complete("Write a haiku about");

Error Handling

typescript
const { error, messages, sendMessage } = useChat({
  transport: new DefaultChatTransport({ api: "/api/chat" }),
  onError: (error) => {
    console.error("Chat error:", error);
    toast.error("Failed to send message");
  },
});

// Display error
{error && (
  <div className="error">
    {error.message}
    <button onClick={() => sendMessage({ text: lastInput })}>
      Retry
    </button>
  </div>
)}

Keywords

ai sdk, vercel ai, chat, streaming, langchain, openai, llm

© Gentleman-Programming, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in curated/ai-sdk-5 of Gentleman-Programming/Gentleman-Skills.

Open the folder on GitHubat commit c8036a3

Compare with similar skills

AI SDK 5 next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

AI SDK 5 compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
AI SDK 5 this skillGentleman-Programming/Gentleman-Skills658—~1.4kAutomated safety check: PassApache-2.0
Building With Typesafe Jevaaddrick/building-with-typesafe-jev136—~3kAutomated safety check: NotesMIT
Qv Agent Stack Synctetherto/qvac683—~2kAutomated safety check: PassApache-2.0
AI SDKvercel-labs/ai-facts16820 repos~1.2kAutomated safety check: PassNone
Mem0 Provider for Vercel AI SDKmem0ai/mem067k—~2.3kAutomated safety check: PassApache-2.0
Failproof AI SDK IntegrationFailproofAI/failproofai5.3k—~6kAutomated safety check: PassCustom licence

Similar skills

  • Building With Typesafe Jev

    aaddrick/building-with-typesafe-jev

    A skill your agent uses when code needs a judgment about natural language that rules or regex cannot make (classify, route, triage, moderate, score, rank, match, dedupe, filter, extract, verify, or…

    136 GitHub stars~3k tokensUpdated 7 days ago
    AI & LLM EngineeringAuto-check: notes
  • Qv Agent Stack Sync

    tetherto/qvac

    Plan and prepare the QVAC agent-stack release cascade across @qvac/inference, @qvac/sdk, @qvac/cli, @qvac/ai-sdk-provider, @qvac/opencode-plugin, and @qvac/openclaw-plugin.

    683 GitHub stars~2k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • AI SDK

    vercel-labs/ai-facts

    Official

    Answer questions about the AI SDK and help build AI-powered features.

    168 GitHub starsUsed in 20 repos~1.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Adds persistent memory to Vercel AI SDK apps with the Mem0 provider, using a wrapped model or standalone retrieve and store utilities.

    67k GitHub stars~2.3k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Failproof AI SDK Integration

    FailproofAI/failproofai

    Helps instrument a custom Python or TypeScript agent to record events for Failproof AI, verify what gets written, and run an evaluator worker that scores the runs.

    5.3k GitHub stars~6k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed
  • Claude API

    Kocoro-lab/Kocoro

    Build apps with the Claude API or Anthropic SDK. An agent skill from Kocoro-lab/Kocoro.

    414 GitHub starsUsed in 7 repos~4.5k tokens
    AI & LLM EngineeringAuto-check passed

More from Gentleman-Programming/Gentleman-Skills

All 24 skills in this repo
  • Elixir Antipatterns

    Gentleman-Programming/Gentleman-Skills

    Core catalog of 8 critical Elixir/Phoenix anti-patterns covering error handling, separation of concerns, Ecto queries, and testing.

    658 GitHub stars~2.1k tokensUpdated 6 mo ago
    Auto-check passed
  • Skill Creator

    Gentleman-Programming/Gentleman-Skills

    Creates new AI agent skills following the Agent Skills spec.

    658 GitHub stars~1.1k tokensUpdated 6 mo ago
    Auto-check: notes
  • Angular Architecture

    Gentleman-Programming/Gentleman-Skills

    Angular architecture: Scope Rule, project structure, file naming, style guide.

    658 GitHub stars~823 tokensUpdated 6 mo ago
    Auto-check passed
  • Angular Core

    Gentleman-Programming/Gentleman-Skills

    Angular core patterns: standalone components, signals, inject, control flow, zoneless.

    658 GitHub stars~1.1k tokensUpdated 6 mo ago
    Auto-check passed
  • Angular Forms

    Gentleman-Programming/Gentleman-Skills

    Angular forms: Signal Forms (experimental) and Reactive Forms.

    658 GitHub stars~687 tokensUpdated 6 mo ago
    Auto-check passed
  • Angular Performance

    Gentleman-Programming/Gentleman-Skills

    Angular performance: NgOptimizedImage, @defer, lazy loading, SSR.

    658 GitHub stars~703 tokensUpdated 6 mo ago
    Auto-check passed

Works with

Questions about AI SDK 5

What does AI SDK 5 do?

Vercel AI SDK 5 patterns. An agent skill from Gentleman-Programming/Gentleman-Skills. AI SDK 5 is an agent skill from Gentleman-Programming/Gentleman-Skills. Vercel AI SDK 5 patterns.

When should I use AI SDK 5?

AI SDK 5 fits situations like: AI & LLM Engineering work in your project.

How do I install AI SDK 5 in Claude Code?

Run `npx skills add Gentleman-Programming/Gentleman-Skills --skill ai-sdk-5 -a claude-code`. Or copy the skill folder (curated/ai-sdk-5 in Gentleman-Programming/Gentleman-Skills) into .claude/skills/ai-sdk-5 in your project. Claude Code loads it when a task matches its description.

How do I install AI SDK 5 in Codex?

Run `npx skills add Gentleman-Programming/Gentleman-Skills --skill ai-sdk-5 -a codex`. Or copy the skill folder (curated/ai-sdk-5 in Gentleman-Programming/Gentleman-Skills) into .agents/skills/ai-sdk-5 in your project. Codex loads it when a task matches its description.

Can I use AI SDK 5 in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Gentleman-Programming/Gentleman-Skills --skill ai-sdk-5 -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ai-sdk-5, .gemini/skills/ai-sdk-5, .github/skills/ai-sdk-5 and .opencode/skills/ai-sdk-5 in your project.

What does AI SDK 5 need to run?

SKILL.md names no scripts, command-line tools or credentials: AI SDK 5 is instructions for the agent only.

Does AI SDK 5 access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is AI SDK 5 safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does AI SDK 5 use?

AI SDK 5 is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does AI SDK 5 use?

About 1.4k tokens (SKILL.md is roughly 5.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to AI SDK 5?

Skills that share tags, products or a category with AI SDK 5: Building With Typesafe Jev (aaddrick/building-with-typesafe-jev, 136 stars), Qv Agent Stack Sync (tetherto/qvac, 683 stars), AI SDK (vercel-labs/ai-facts, 168 stars) and Mem0 Provider for Vercel AI SDK (mem0ai/mem0, 67k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains AI SDK 5?

Gentleman-Programming (a GitHub organization) maintains it in Gentleman-Programming/Gentleman-Skills, which has 658 GitHub stars. The repository holds 24 skills in this directory. The repository was last updated on March 28, 2026.

Source: Gentleman-Programming/Gentleman-Skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.