Agent Skills
› TanStack/ai
› ai-core
ai-core
GitHubTanStack AI 核心入口,路由至聊天、工具调用、媒体生成等子技能。强调使用 chat() 而非 streamText(),客户端从框架包导入,通过 middleware 处理生命周期,禁止手动实现 SSE。
触发场景
询问 TanStack AI 基础用法或最佳实践
需要配置 TanStack AI 适配器或中间件
构建基于 TanStack AI 的聊天界面
解决 Vercel AI SDK 与 TanStack AI 的混淆问题
安装
npx skills add TanStack/ai --skill ai-core -g -y
SKILL.md
Frontmatter
{
"name": "ai-core",
"type": "core",
"library": "tanstack-ai",
"description": "Entry point for TanStack AI skills. Routes to chat-experience, tool-calling, media-generation, structured-outputs, adapter-configuration, ag-ui-protocol, middleware, custom-backend-integration, and debug-logging. Use chat() not streamText(), openaiText() not createOpenAI(), toServerSentEventsResponse() not manual SSE, middleware hooks not onEnd callbacks.\n",
"library_version": "0.10.0"
}
TanStack AI — Core Concepts
TanStack AI is a type-safe, provider-agnostic AI SDK. Server-side functions
live in @tanstack/ai and provider adapter packages. Client-side hooks live
in framework packages (@tanstack/ai-react, @tanstack/ai-solid, etc.).
Always import from the framework package on the client — never from
@tanstack/ai-client directly (unless vanilla JS).
Sub-Skills
| Need to... | Read |
|---|---|
| Build a chat UI with streaming | ai-core/chat-experience/SKILL.md |
| Add tool calling (server, client, or both) | ai-core/tool-calling/SKILL.md |
| Generate images, video, speech, or transcriptions | ai-core/media-generation/SKILL.md |
| Get typed JSON responses from the LLM | ai-core/structured-outputs/SKILL.md |
| Choose and configure a provider adapter | ai-core/adapter-configuration/SKILL.md |
| Implement AG-UI streaming protocol server-side | ai-core/ag-ui-protocol/SKILL.md |
| Add analytics, logging, or lifecycle hooks | ai-core/middleware/SKILL.md |
| Connect to a non-TanStack-AI backend | ai-core/custom-backend-integration/SKILL.md |
| Turn on/off debug logging, pipe into pino/winston | ai-core/debug-logging/SKILL.md |
| Set up Code Mode (LLM code execution) | See @tanstack/ai-code-mode package skills |
Quick Decision Tree
- Setting up a chatbot? → ai-core/chat-experience
- Adding function calling? → ai-core/tool-calling
- Generating media (images, audio, video)? → ai-core/media-generation
- Need structured JSON output? → ai-core/structured-outputs
- Choosing/configuring a provider? → ai-core/adapter-configuration
- Building a server-only AG-UI backend? → ai-core/ag-ui-protocol
- Adding analytics or post-stream events? → ai-core/middleware
- Connecting to a custom backend? → ai-core/custom-backend-integration
- Turning on debug logging to trace chunks/tools/middleware? → ai-core/debug-logging
- Debugging mistakes? → Check Common Mistakes in the relevant sub-skill
Critical Rules
- This is NOT the Vercel AI SDK. Use
chat()notstreamText(). UseopenaiText()notcreateOpenAI(). Import from@tanstack/ai, notai. - Import from framework package on client. Use
@tanstack/ai-react(or solid/vue/svelte/preact), not@tanstack/ai-client. - Use
toServerSentEventsResponse()to convert streams to HTTP responses. Never implement SSE manually. - Use middleware for lifecycle events. No
onEnd/onFinishcallbacks onchat()— usemiddleware: [{ onFinish: ... }]. - Ask the user which adapter and model they want. Suggest the latest model. Also ask if they want Code Mode.
- Tools must be passed to both server and client. Server gets the tool in
chat({ tools }), client gets the definition inuseChat({ clientTools }).
Version
Targets TanStack AI v0.10.0.
版本历史
- 5deda27 当前 2026-07-05 10:52


