Agent SkillsTanStack/ai › ai-core

ai-core

GitHub

TanStack AI核心技能入口,提供类型安全、提供商无关的AI SDK。涵盖聊天体验、工具调用、媒体生成、结构化输出及适配器配置等子技能,并集成持久化与代码模式扩展包,指导开发者正确导入和使用API。

packages/ai/skills/ai-core/SKILL.md TanStack/ai

触发场景

需要构建基于TanStack AI的聊天界面或应用 询问TanStack AI的核心概念、架构或子技能索引 查找特定功能(如工具调用、媒体生成)对应的文档路径

安装

npx skills add TanStack/ai --skill ai-core -g -y
更多选项

非标准路径

npx skills add https://github.com/TanStack/ai/tree/main/packages/ai/skills/ai-core -g -y

不安装直接使用

npx skills use TanStack/ai@ai-core

指定 Agent (Claude Code)

npx skills add TanStack/ai --skill ai-core -a claude-code -g -y

安装 repo 全部 skill

npx skills add TanStack/ai --all -g -y

预览 repo 内 skill

npx skills add TanStack/ai --list

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, locks, custom-backend-integration, and debug-logging, plus the skills shipped by companion packages (@tanstack\/ai-persistence, @tanstack\/ai-code-mode). 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
Survive a browser reload (no extra package) ai-core/client-persistence/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
Coordinate multi-instance work with locks ai-core/locks/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
Persist chats server-side (history, runs) See @tanstack/ai-persistence package skills
Set up Code Mode (LLM code execution) See @tanstack/ai-code-mode package skills

Companion packages

Some capabilities live in their own package and ship their own skills. Install the package, then read its skills — do not guess the API from this file.

@tanstack/ai-persistence — durable chat state

Makes a conversation survive a reload, a server restart, a second device, or a paused tool approval. It ships the store contracts (MessageStore, RunStore, InterruptStore, MetadataStore), the withPersistence / withGenerationPersistence middleware, reconstructChat for server-side hydrate, an in-memory reference backend, and a conformance testkit. Multi-instance locks are not in this package — LockStore / withLocks ship in @tanstack/ai/locks; see ai-core/locks.

It does not ship a backend for your database — you implement the stores against Postgres, SQLite, D1, Mongo, or whatever you run, and the package's skills walk you through it (including Drizzle, Prisma, and Cloudflare recipes).

pnpm add @tanstack/ai-persistence
npx @tanstack/intent@latest install

The skills ship inside the package, so they only exist on disk once it is installed — the second command re-scans node_modules and wires them into the agent config. Until then the paths below resolve to nothing.

Entry point: node_modules/@tanstack/ai-persistence/skills/ai-persistence/SKILL.md

Need to... Read
Wire server-side chat history, runs, interrupts ai-persistence/server/SKILL.md
Implement the store interfaces for your DB ai-persistence/stores/SKILL.md
Write the adapter for the DB your app runs ai-persistence/build-*-adapter/SKILL.md

Browser-side persistence is not in this package — it ships with the framework packages, so read ai-core/client-persistence instead.

@tanstack/ai-code-mode — LLM code execution

See the ai-code-mode skill in that package.

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
  • Surviving reloads / multi-device / durable approvals? → @tanstack/ai-persistence skills
  • 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

  1. This is NOT the Vercel AI SDK. Use chat() not streamText(). Use openaiText() not createOpenAI(). Import from @tanstack/ai, not ai.
  2. Import from framework package on client. Use @tanstack/ai-react (or solid/vue/svelte/preact), not @tanstack/ai-client.
  3. Use toServerSentEventsResponse() to convert streams to HTTP responses. Never implement SSE manually.
  4. Use middleware for lifecycle events. No onEnd/onFinish callbacks on chat() — use middleware: [{ onFinish: ... }].
  5. Ask the user which adapter and model they want. Suggest the latest model. Also ask if they want Code Mode.
  6. Tools must be passed to both server and client. Server gets the tool in chat({ tools }), client gets the definition in useChat({ clientTools }).

Version

Targets TanStack AI v0.10.0.

版本历史

  • 05280a5 当前 2026-07-30 23:53

    新增@tanstack/ai-persistence包,支持服务端聊天持久化(消息、运行记录、中断)及客户端浏览器刷新状态恢复;将锁机制移至该包并优化中断恢复逻辑;增加SQLite/Drizzle/Prisma等后端适配示例。

  • 5deda27 2026-07-05 10:52

同 Skill 集合

.claude/skills/gap-analysis/SKILL.md
packages/ai-code-mode/skills/ai-code-mode/SKILL.md
packages/ai-mcp/skills/ai-mcp/SKILL.md
packages/ai-memory/skills/tanstack-ai-memory-hindsight/SKILL.md
packages/ai-memory/skills/tanstack-ai-memory-honcho/SKILL.md
packages/ai-memory/skills/tanstack-ai-memory-in-memory/SKILL.md
packages/ai-memory/skills/tanstack-ai-memory-mem0/SKILL.md
packages/ai-memory/skills/tanstack-ai-memory-redis/SKILL.md
packages/ai-memory/skills/tanstack-ai-memory/SKILL.md
packages/ai-persistence/skills/ai-persistence/build-cloudflare-adapter/SKILL.md
packages/ai-persistence/skills/ai-persistence/build-cloudflare-artifact-store/SKILL.md
packages/ai-persistence/skills/ai-persistence/build-custom-adapter/SKILL.md
packages/ai-persistence/skills/ai-persistence/build-drizzle-adapter/SKILL.md
packages/ai-persistence/skills/ai-persistence/build-prisma-adapter/SKILL.md
packages/ai-persistence/skills/ai-persistence/server/SKILL.md
packages/ai-persistence/skills/ai-persistence/SKILL.md
packages/ai-persistence/skills/ai-persistence/stores/SKILL.md
packages/ai/skills/ai-core/ag-ui-protocol/SKILL.md
packages/ai/skills/ai-core/chat-experience/SKILL.md
packages/ai/skills/ai-core/custom-backend-integration/SKILL.md
packages/ai/skills/ai-core/debug-logging/SKILL.md
packages/ai/skills/ai-core/locks/SKILL.md
packages/ai/skills/ai-core/middleware/SKILL.md
packages/ai/skills/ai-core/tool-calling/SKILL.md
.claude/skills/triage-github/SKILL.md
packages/ai-sandbox/skills/ai-sandbox/SKILL.md
packages/ai/skills/ai-core/adapter-configuration/SKILL.md
packages/ai/skills/ai-core/client-persistence/SKILL.md
packages/ai/skills/ai-core/media-generation/SKILL.md
packages/ai/skills/ai-core/structured-outputs/SKILL.md

元信息

文件数
0
版本
1cb04d5
Hash
3ef8beff
收录时间
2026-07-05 10:52

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-01 08:25
浙ICP备14020137号-1 $访客地图$