К основному содержанию
скилл Claude Code CX Codex Cursor GitHub Copilot

ai-sdk · vercel — скилл для Claude Code: что делает и как установить

Скилл помогает писать код на базе Vercel AI SDK и не допускать устаревших API. Он проверяет локальную документацию пакета перед генерацией.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add vercel/ai --skill ai-sdk -a claude-code
npx skills add vercel/ai --skill use-ai-sdk -a claude-code
Открыть на GitHub

Что делает ai-sdk

Пакет ai часто обновляется. Из-за этого языковые модели регулярно путают названия функций и сигнатуры методов. Скилл заставляет агента смотреть в файлы node_modules/ai/docs/ и исходники внутри проекта, а не писать код по памяти.

Инструмент помогает вызывать generateText, настраивать стриминг через streamText и подключать хук useChat к клиентским компонентам. Также он учитывает настройку AI Gateway и ключа AI_GATEWAY_API_KEY.

Если вы пишете чат-ботов или агентные сценарии на TypeScript, скилл защитит от ошибок типизации. Для проектов без стека AI SDK он не нужен.

Какие задачи решает

  • настроить стриминг ответов через streamText
  • подключить хук useChat в клиентских компонентах
  • собрать агента с вызовом инструментов через ToolLoopAgent
  • проверить актуальные сигнатуры API в node_modules

Примеры запросов агенту

  • Помоги настроить streamText для чата с моделью OpenAI
  • Сделай агента через ToolLoopAgent с поддержкой вызова инструментов
  • Как подключить useChat в React-компоненте?

Как установить ai-sdk

1Через Skills CLI (Vercel)

npx skills add vercel/ai --skill ai-sdk -a claude-code
npx skills add vercel/ai --skill use-ai-sdk -a claude-code

2Вручную: положить файлы

~/.claude/skills/use-ai-sdk/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/use-ai-sdk/

Из того же набора2

Весь набор →

Другие версии ai-sdk

Похожие

academy-guide официальный anthropics Подбирает материалы Claude Academy к вопросам об использовании Claude и его функций. Пригодится для онбординга, обучения команды и поиска туториалов. Claude Code Claude.ai 11 893установок ai-seo coreyhaines31 Помогает готовить контент к цитированию в ответах ИИ и разбираться, почему бренд появляется или не появляется в AI-поиске. Claude Code CX Codex Cursor +1 150 100установок context-engineering addyosmani Помогает настроить контекст ИИ-агента: какие правила, спецификации и файлы отдать агенту и когда. Пригодится в начале сессии, при падении качества ответов и при смене задач. Claude Code CX Codex Cursor +1 60 900установок image coreyhaines31 Скилл для маркетинговых изображений: генерация через ИИ, правка готовых картинок, подбор инструмента и оптимизация под веб. Claude Code CX Codex Cursor +1 86 800установок video coreyhaines31 Скилл помогает создавать демо продуктов, эксплейнеры и ролики через Remotion, Hyperframes или нейросети вроде Veo и Runway прямо из терминала агента. Claude Code CX Codex Cursor +1 85 400установок browser-act BrowserAct Скилл подключает к агенту браузерный CLI: открыть страницу, дождаться JavaScript, вытащить данные, заполнить форму, снять скриншот. Пригодится там, где обычного fetch не хватает. Claude Code CX Codex Cursor +1 108 300установок skill-creator официальный anthropics Помогает создать новый скилл, доработать существующий и проверить результат через тестовые промпты и оценки. Claude Code Claude.ai 414 180установок writing-for-agents Matt Pocock Помогает писать скиллы и документы с инструкциями для агентов. Пригодится при правках AGENTS.md, CLAUDE.md и связанных справочных файлов. Claude Code 466 719установок

Вопросы о ai-sdk

Как установить ai-sdk в Claude Code?

Выполните команду npx skills add vercel/ai --skill ai-sdk -a claude-code в терминале. Скилл сразу добавится в окружение агента.

Что делает скилл ai-sdk?

Он направляет агента при написании кода для Vercel AI SDK. Ассистент проверяет сигнатуры в каталоге node_modules проекта, избегая устаревших методов.

Зачем проверять документацию в node_modules?

Интерфейсы пакета ai быстро меняются между релизами. Чтение локальных файлов гарантирует совпадение кода с установленной в проекте версией.

Исходный текст

SKILL.md · Apache-2.0
---
name: ai-sdk
description: 'Answer questions about the AI SDK and help build AI-powered features. Use when developers: (1) Ask about AI SDK functions like generateText, streamText, ToolLoopAgent, embed, or tools, (2) Want to build AI agents, chatbots, RAG systems, or text generation features, (3) Have questions about AI providers (OpenAI, Anthropic, Google, etc.), streaming, tool calling, structured output, or embeddings, (4) Use React hooks like useChat or useCompletion. Triggers on: "AI SDK", "Vercel AI SDK", "generateText", "streamText", "add AI to my app", "build an agent", "tool calling", "structured output", "useChat".'
---

## What the AI SDK Is

The AI SDK by Vercel (the `ai` package on npm) is a TypeScript toolkit for building AI applications. It provides a unified API across model providers for text generation, structured output, tool calling, agents, embeddings, and framework UI integrations.

- Repository: https://github.com/vercel/ai
- Documentation: https://ai-sdk.dev/docs

## Critical: Do Not Trust Your Own Memory

Whatever you remember about the AI SDK is likely outdated. The SDK changes frequently across versions - APIs are renamed, removed, and added. Your training data almost certainly contains obsolete APIs, deprecated patterns, and model IDs that no longer exist. UI hooks like `useChat` are among the most frequently changed APIs, so be especially careful with client code.

**Never write AI SDK code from memory.** Always verify every API, option, and pattern against the documentation and source code for the version that is actually installed in the project.

## Use the Bundled, Version-Matched Docs

The `ai` package ships its full documentation and source code inside `node_modules`. These always match the installed version, so trust them over anything you remember.

1. Ensure `ai` is installed. Check `node_modules/ai/` or locate the workspace package in a monorepo that depends on `ai` (e.g. `apps/<name>/node_modules/ai/`). If `ai` is not installed anywhere in the project, install **only** the `ai` package into the target package using the project's package manager (e.g. `pnpm add ai --filter <pkg>` or `npm install ai`). Install provider packages (e.g. `@ai-sdk/openai`) and framework packages (e.g. `@ai-sdk/react`) later, when the task requires them.
2. Read and grep the bundled docs at `node_modules/ai/docs/` (or `<package>/node_modules/ai/docs/`) and the source at `node_modules/ai/src/`.
3. Provider and framework packages bundle their own docs at `node_modules/@ai-sdk/<name>/docs/` (or `<package>/node_modules/@ai-sdk/<name>/docs/`).
4. If something isn't in the bundled docs, search https://ai-sdk.dev/docs. You can append `.md` to any docs page URL to get its markdown, and search via `https://ai-sdk.dev/api/search-docs?q=your_query`.
5. If you cannot find support for an answer in the docs or source, say so explicitly — do not guess.

## AI Gateway: The Fastest Way to Start

The Vercel AI Gateway is the fastest way to get started with the AI SDK. It provides access to models from OpenAI, Anthropic, Google, and other providers through a single API, without installing provider packages or managing multiple API keys.

To set it up:

1. Authenticate with OIDC (for Vercel deployments) or get an AI Gateway API key.
2. Provide it to your app via the `AI_GATEWAY_API_KEY` environment variable.
3. Reference models with `provider/model` strings.

For exact setup, authentication, and usage, read the bundled guide and the AI Gateway docs.

### Choosing a Model

Never use model IDs from memory — models are released and retired frequently. Fetch the current list before writing code that references a model. Do not truncate the list (e.g. with `head`) so you can find the newest models:

```bash
# All available models
curl -s https://ai-gateway.vercel.sh/v1/models | jq -r '.data[].id'

# Filter by provider (e.g. anthropic, openai, google)
curl -s https://ai-gateway.vercel.sh/v1/models | jq -r '[.data[] | select(.id | startswith("anthropic/")) | .id] | reverse | .[]'
```

When multiple versions of a model exist, prefer the one with the highest version number.

## Building and Consuming Agents

Use the SDK's built-in agent abstraction (such as `ToolLoopAgent`) rather than hand-rolling tool-calling loops. For end-to-end type safety, infer the UI message type from your agent definition when consuming it on the client (e.g. with `useChat`). Consuming an agent is framework-specific: check `package.json` to detect the stack, then follow the matching quickstart.

Look up the current agent, tool, and type-safety APIs in the bundled docs (`node_modules/ai/docs/`, especially the agents section) or at https://ai-sdk.dev/docs.

## DevTools

AI SDK DevTools captures your AI SDK calls - requests, responses, tool calls, token usage, and multi-step runs - so you can inspect exactly what your agents do. Use it while developing to debug generations. It is a separate package and is intended for local development only.

For setup instructions, read the bundled DevTools documentation.

## Keep the SDK Current

Outdated installs are the most common source of errors. Compare the installed version against the latest:

- **Installed:** the `version` field in `node_modules/ai/package.json`.
- **Latest:** run `npm view ai version`.

If the installed version is a major version (or more) behind the latest, tell the user they are on an old release, and recommend upgrading before continuing. Migration guides are at https://ai-sdk.dev/docs/migration-guides.

## After Making Changes

Run the project's type checker. Be minimal — only set options that differ from the defaults, checking docs or source for the defaults rather than over-specifying. Most type errors come from remembered, now-changed APIs; re-check the current docs and source when they occur.

© vercel · Apache-2.0 · vercel/ai

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой