Open History to see the last commit
1---
2title: Agent Skills (TanStack Intent)
3id: agent-skills
4order: 6
5description: "Teach your coding agent to write correct TanStack AI code. Install the Agent Skills as a Claude Code or Cursor plugin, with npx skills, or with TanStack Intent."
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
22Install the TanStack AI agent skill so your coding agent writes current TanStack AI code.
23
24TanStack AI ships Agent Skills: `SKILL.md` files that teach your coding agent how the library works. They come with the package version you install, so the agent reads guidance that matches your code. This takes about 5 minutes.
25
26> [!NOTE]
27> This page is about your coding assistant. For other features with a similar name, see:
28>
29> - [Portable Agent Skills](../skills/agent-skills): the model inside your app loads `SKILL.md` skills at runtime.
30> - [Code Mode with Snippets](../code-mode/code-mode-with-snippets): runtime snippets inside Code Mode.
31
32## 1. Install the discovery skills
33
34Install these once. Every project that you open then has them.
35
36In Claude Code or Cursor, add the repo as a plugin marketplace:
37
38```bash
39/plugin marketplace add TanStack/ai
40/plugin install tanstack-ai
41```
42
43With any agent, use the Agent Skills CLI:
44
45```bash
46npx skills add TanStack/ai -g --skill tanstack-ai tanstack-ai-migration
47```
48
49## 2. Install TanStack AI
50
51Install `@tanstack/ai` in your project, plus the adapters you need. The [Quick Start](./quick-start) shows the full setup.
52
53<!-- ::start:tabs variant="package-manager" mode="install" -->
54
55react: @tanstack/ai
56vue: @tanstack/ai
57solid: @tanstack/ai
58svelte: @tanstack/ai
59preact: @tanstack/ai
60angular: @tanstack/ai
61vanilla: @tanstack/ai
62octane: @tanstack/ai
63
64<!-- ::end:tabs -->
65
66## 3. Run `intent install`
67
68From the root of your project, run:
69
70```bash
71npx @tanstack/intent@latest install
72```
73
74This adds an `intent-skills` block to your agent config file. It tells the agent which skill to load for which task. Commit it, and your whole team gets the same setup.
75
76## 4. Try it
77
78Open a new session in your coding agent. Ask it to build something with TanStack AI, for example: _"Add a streaming chat endpoint using `@tanstack/ai` and the OpenAI adapter."_
79
80The agent now writes TanStack AI code:
81
82- It uses `chat()`, not `streamText()`.
83- It imports `openaiText()` from `@tanstack/ai-openai`, not `createOpenAI()`.
84- It returns the stream with `toServerSentEventsResponse()`, not with hand-written SSE.
85- It uses middleware for lifecycle events. `chat()` has no `onFinish` callback.
86
87If the agent still writes code for another SDK, open its config file. Make sure that the `intent-skills` block is there, and that the `task:` descriptions cover the area you asked about.
88
89## How it works
90
91There are two kinds of skills:
92
93- **Discovery skills** (step 1) live at the user level. They tell the agent when to use TanStack AI, which package covers a task, and how to install it. They hold no API guidance.
94- **Package skills** ship inside each npm package. After a package is installed, the discovery skills hand off to `npx @tanstack/intent@latest load <package>#<skill>`. So the agent reads the guidance for the version you installed.
95
96Agent Skills are an open standard. Claude Code, Cursor, GitHub Copilot, Codex, and other agents support it. The guidance updates with `npm update`, so you do not copy it into `CLAUDE.md` by hand.
97
98## Advanced
99
100### Discovery skills
101
102| Skill | Answers |
103| --- | --- |
104| `tanstack-ai` | Whether to use TanStack AI, which package covers a task, how to install and wire it |
105| `tanstack-ai-migration` | Porting from the Vercel AI SDK, upgrading from 0.x to 1.0 |
106
107### Package skills
108
109The discovery skills route into these. Each one teaches the version that the app has installed.
110
111| Package | Skill | What it teaches |
112| --- | --- | --- |
113| `@tanstack/ai` | `ai-core` | Chat experience, browser persistence on `useChat`, tool calling, adapters, middleware, locks, structured outputs, media generation, AG-UI protocol, custom backends |
114| `@tanstack/ai-persistence` | `ai-persistence` | Server chat state (`withPersistence`), the store contracts, and recipes for each stack that write a `chat-persistence.ts` into your app against your Drizzle, Prisma, or Cloudflare D1 setup |
115| `@tanstack/ai-memory` | `tanstack-ai-memory` | `memoryMiddleware`, the recall/save adapter contract, and the in-memory, Redis, Hindsight, Mem0, and Honcho adapters |
116| `@tanstack/ai-mcp` | `ai-mcp` | Connecting to MCP servers, running their tools inside `chat()`, resources, prompts, and the CLI that generates types |
117| `@tanstack/ai-sandbox` | `ai-sandbox` | Running harness adapters inside isolated sandboxes with `defineSandbox` / `withSandbox` |
118| `@tanstack/ai-code-mode` | `ai-code-mode` | Setting up Code Mode with a sandbox driver and registering server tools |
119| `@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 |
120
121After you install a package, its skills are at `node_modules/<package>/skills/<skill-name>/SKILL.md`.
122
123Skills route to each other:
124
125- `ai-core` points at the skills of the companion packages.
126- `ai-persistence` is an entry point. It routes to its own sub-skills under `skills/ai-persistence/`: `server`, `stores`, and the `build-{drizzle,prisma,cloudflare,custom}-adapter` recipes. This is the same nesting as `ai-core`.
127
128Each skill ships with the code it teaches:
129
130- Locks for many instances are in `@tanstack/ai`, next to `withLocks`. So `ai-core/locks` is in `@tanstack/ai`.
131- Browser persistence is in the framework packages. So `ai-core/client-persistence` is in `@tanstack/ai`, not in `@tanstack/ai-persistence`. An app that persists only in the browser never installs the server package.
132
133### The generated mappings
134
135`intent install` adds an `intent-skills` block to your agent config file, or creates the file. It looks like this:
136
137```yaml
138<!-- intent-skills:start -->
139# Skill mappings: when working in these areas, load the linked skill file into context.
140skills:
141 - task: "Building chat, tool calling, adapters, or streaming with TanStack AI"
142 load: "node_modules/@tanstack/ai/skills/ai-core/SKILL.md"
143 - task: "Persisting chat state or building a persistence adapter"
144 load: "node_modules/@tanstack/ai-persistence/skills/ai-persistence/SKILL.md"
145 - task: "Setting up Code Mode with TanStack AI"
146 load: "node_modules/@tanstack/ai-code-mode/skills/ai-code-mode/SKILL.md"
147<!-- intent-skills:end -->
148```
149
150The agent uses the `task:` descriptions to decide when to load a skill. Make sure that they match the areas you work in. Edit them if they do not.
151
152### Keep skills current
153
154Skills have the same version as the package. When you update `@tanstack/ai`, the `SKILL.md` files under `node_modules` update too. You do not run the CLI again.
155
156Run `npx @tanstack/intent@latest install` again only when:
157
158- You add a new package with skills, for example `@tanstack/ai-code-mode`.
159- You want to refresh the task mappings.
160
161### Use skills without the CLI
162
163You can point your agent config file at the skill files yourself. The agent needs at least a pointer to the file:
164
165```markdown
166When working on TanStack AI code, read and follow:
167node_modules/@tanstack/ai/skills/ai-core/SKILL.md
168```
169
170The file paths are stable. The CLI is still the better choice: it finds packages for you and follows the Agent Skills standard.
171
172### Learn more
173
174- [TanStack Intent documentation](https://tanstack.com/intent/latest/docs/overview): the full CLI reference, with `scaffold`, `validate`, and CI setup for library maintainers.
175- [Agent Skills registry](https://tanstack.com/intent/registry): other packages that ship skills.