跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 ai-sdk

Ai Sdk

回答AI SDK的问题,帮助构建AI的动力特性. 当开发者使用时:(1) 询问AI SDK的功能, 如生成Text, streamText, ToolLoop Agent, 嵌入或工具, (2) 想要构建AI代理, 聊天机, RAG系统, 或文本生成特性, (3) 询问关于AI提供者( OpenAI, Anthropic, Google等), 流化, 工具调用, 有结构的输出, 或嵌入, (4) 使用像使用那样的回击钩 聊天或使用"完成". 触发:"AI SDK","Vercel AI SDK","基因Text","streamText","添加AI到我的应用","构建一个代理","工具呼叫","结构输出","useChat".

73567 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

回答关于AI SDK的问题,并帮助构建AI的动力特性

何时用

开发者 : (1)询问AI SDK的功能,如生成Text,流出Text,TolleopAgent,嵌入,或工具,(2)想要构建AI代理,聊天机,RAG系统,或文本生成功能,(3)有关于AI提供者(OpenAI,Anthropic,Google等),流出,工具调用的问题

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:What the AI SDK Is、Critical: Do Not Trust Your Own Memory、Use the Bundled, Version-Matched Docs、AI Gateway: The Fastest Way to Start、Choosing a Model、All available models。

文件分析

文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。

官方 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 IsCritical: Do Not Trust Your Own MemoryUse the Bundled, Version-Matched DocsAI Gateway: The Fastest Way to StartChoosing a ModelAll available modelsFilter by provider (e.g. anthropic, openai, google)Building and Consuming AgentsDevToolsKeep the SDK CurrentAfter Making Changes

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
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".
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「ai-sdk」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-b139c6d65f937f0c-Ai-Sdk.html
请存为 .cursor/skills/ai-sdk/SKILL.md 或 .claude/skills/ai-sdk/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/vercel/ai' --list

npx skills add 'https://github.com/vercel/ai' --skill 'ai-sdk'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- 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//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 ` 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 `/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//docs/` (or `/node_modules/@ai-sdk//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.

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…