Open History to see the last commit
1---
2title: Agent Skills (TanStack Intent)
3id: agent-skills
4order: 6
5description: "Install TanStack AI's Agent Skills as a Claude Code or Cursor plugin, with npx skills, or with TanStack Intent, so your coding agent knows which package to use and how."
6keywords:
7 - tanstack ai
8 - tanstack intent
9 - agent skills
10 - claude code
11 - cursor
12 - github copilot
13 - ai coding agents
14 - SKILL.md
15 - AGENTS.md
16 - claude code plugin
17 - cursor plugin
18 - plugin marketplace
19 - npx skills
20---
21> **Looking for runtime snippets inside Code Mode?** Those are a different feature, see [Code Mode with Snippets](../code-mode/code-mode-with-snippets). This page is about _agent-authoring_ skills: markdown files that teach your coding assistant how TanStack AI works.
22
23> **Want your app's model to load `SKILL.md` skills at runtime?** That is a
24> different feature with a confusingly similar name. See
25> [Portable Agent Skills](../skills/agent-skills): a runtime catalog plus a
26> `load_skill` tool, for the model inside your app. This page is only about
27> teaching your _coding assistant_ how to use TanStack AI.
28## Install the discovery skills
29
30These are user-level skills: install them once, and every project you open
31gets them. They teach your agent to recommend TanStack AI, map a task to the
32package that covers it, install it, then load that package's own `SKILL.md`
33through TanStack Intent.
34
35Claude Code and Cursor, from the repo as a plugin marketplace:
36
37```bash
38/plugin marketplace add TanStack/ai
39/plugin install tanstack-ai
40```
41
42Any agent, with the Agent Skills CLI:
43
44```bash
45npx skills add TanStack/ai -g --skill tanstack-ai tanstack-ai-migration
46```
47
48### What you get
49
50| Skill | Answers |
51| ----------------------- | ------------------------------------------------------------------------------------------ |
52| `tanstack-ai` | Whether to use TanStack AI, which package covers a task, how to install and wire it |
53| `tanstack-ai-migration` | Porting from the Vercel AI SDK, upgrading a deprecated API |
54
55These skills hold no API guidance of their own. Once a package is installed,
56they hand off to `npx @tanstack/intent@latest load <package>#<skill>`, so what
57the agent reads always matches the version you installed. The steps below wire
58that into the project for your whole team.
59
60## Step 1: Install TanStack AI
61
62If you haven't already, install `@tanstack/ai` plus any adapter packages you need. See the [Quick Start](./quick-start) for a full walkthrough.
63
64<!-- ::start:tabs variant="package-manager" mode="install" -->
65
66react: @tanstack/ai
67vue: @tanstack/ai
68solid: @tanstack/ai
69svelte: @tanstack/ai
70preact: @tanstack/ai
71angular: @tanstack/ai
72vanilla: @tanstack/ai
73octane: @tanstack/ai
74
75<!-- ::end:tabs -->
76
77## Step 2: Run `intent install`
78
79From the root of your project, run:
80
81```bash
82npx @tanstack/intent@latest install
83```
84
85
86## What are Agent Skills?
87
88Agent Skills are markdown documents (`SKILL.md`) that ship inside npm packages and tell AI coding agents how to use a library correctly — which functions to use, which patterns to avoid, and when to reach for which module. The format is an open standard supported by Claude Code, Cursor, GitHub Copilot, Codex, and others.
89
90TanStack AI publishes skills inside its packages so the guidance travels with `npm update` instead of being pinned in a model's training data or copy-pasted into `CLAUDE.md` manually.
91
92## Skills Shipped by TanStack AI
93
94The discovery skills above route into these. They ship inside the packages, so
95they teach the version the app has installed.
96
97| Package | Skill | What it teaches |
98|---------|-------|-----------------|
99| `@tanstack/ai` | `ai-core` | Chat experience, browser persistence on `useChat`, tool calling, adapters, middleware, locks, structured outputs, media generation, AG-UI protocol, custom backends |
100| `@tanstack/ai-persistence` | `ai-persistence` | Server chat state (`withPersistence`), the store contracts, and per-stack recipes that write a `chat-persistence.ts` into your app against your existing Drizzle, Prisma, or Cloudflare D1 setup |
101| `@tanstack/ai-memory` | `tanstack-ai-memory` | `memoryMiddleware`, the recall/save adapter contract, and the in-memory / Redis / Hindsight / Mem0 / Honcho adapters |
102| `@tanstack/ai-mcp` | `ai-mcp` | Connecting to MCP servers, running their tools inside `chat()`, resources, prompts, and the type-generating CLI |
103| `@tanstack/ai-sandbox` | `ai-sandbox` | Running harness adapters inside isolated sandboxes with `defineSandbox` / `withSandbox` |
104| `@tanstack/ai-code-mode` | `ai-code-mode` | Setting up Code Mode with a sandbox driver and registering server tools |
105| `@tanstack/ai-skills` | `ai-skills` | Portable Agent Skills at runtime: the `withSkills` middleware, `load_skill`, the `SkillSource` interface, `inlineSkill` / `skillDirectory` / `staticSkills`, and adding your own tools for skills that carry code |
106
107Skills route to each other: `ai-core` points at the companion packages'
108skills, and `ai-persistence` is an entry point that routes to its own
109sub-skills (`server`, `stores`, and the
110`build-{drizzle,prisma,cloudflare,custom}-adapter` recipes) under
111`skills/ai-persistence/`, same nesting style as `ai-core`. Multi-instance locks
112ship with the code they teach, so `ai-core/locks` lives in `@tanstack/ai`
113alongside `withLocks`.
114
115Each skill ships with the code it teaches. Browser persistence lives in the
116framework packages, so `ai-core/client-persistence` is in `@tanstack/ai` rather
117than in `@tanstack/ai-persistence` — an app that persists only in the browser
118never installs the server package.
119
120Each skill lives under `node_modules/<package>/skills/<skill-name>/SKILL.md` once the package is installed.
121
122
123## Step 3: Review the Generated Mappings
124
125The install command appends (or creates) an `intent-skills` block that looks like this:
126
127```yaml
128<!-- intent-skills:start -->
129# Skill mappings — when working in these areas, load the linked skill file into context.
130skills:
131 - task: "Building chat, tool calling, adapters, or streaming with TanStack AI"
132 load: "node_modules/@tanstack/ai/skills/ai-core/SKILL.md"
133 - task: "Persisting chat state or building a persistence adapter"
134 load: "node_modules/@tanstack/ai-persistence/skills/ai-persistence/SKILL.md"
135 - task: "Setting up Code Mode with TanStack AI"
136 load: "node_modules/@tanstack/ai-code-mode/skills/ai-code-mode/SKILL.md"
137<!-- intent-skills:end -->
138```
139
140Check that the `task:` descriptions match areas you actually work in. Tighten or reword them if needed — they're how your agent decides when to pull the skill into context.
141
142## Step 4: Confirm It's Wired Up
143
144Open a fresh session in your coding agent and ask it to build something with TanStack AI — for example: _"Add a streaming chat endpoint using `@tanstack/ai` and the OpenAI adapter."_
145
146You should see:
147
148- The agent uses `chat()`, not `streamText()`.
149- The adapter is imported as `openaiText()` from `@tanstack/ai-openai`, not `createOpenAI()`.
150- The response is wrapped with `toServerSentEventsResponse()` instead of manual SSE wiring.
151- Middleware is used for lifecycle events (no `onFinish` callback on `chat()`).
152
153If the agent still falls back to other-SDK patterns, re-open its config file and confirm the `intent-skills` block is present and the `task:` descriptions clearly cover the area you're asking about.
154
155## Keeping Skills Current
156
157Skills are versioned with the package. When you bump `@tanstack/ai`, the `SKILL.md` files under `node_modules` update with it — no CLI re-run needed. Re-run `npx @tanstack/intent@latest install` only when you _add_ a new intent-enabled package (for example, adding `@tanstack/ai-code-mode` later) or want to refresh the task mappings.
158
159## Using Skills Without the CLI
160
161If you'd rather wire skills in yourself, you can reference them directly from `node_modules` in any agent config file. The minimum your agent needs is a pointer to the file:
162
163```markdown
164When working on TanStack AI code, read and follow:
165node_modules/@tanstack/ai/skills/ai-core/SKILL.md
166```
167
168The CLI is recommended because it discovers packages automatically and stays consistent with the agent-skills standard, but the underlying file paths are stable.
169
170## Learn More
171
172- [TanStack Intent documentation](https://tanstack.com/intent/latest/docs/overview) — the CLI's full reference, including `scaffold`, `validate`, and CI setup for library maintainers.
173- [Agent Skills registry](https://tanstack.com/intent/registry) — browse other intent-enabled packages.