
tanstack-ai-vue-skilld
Use when writing or debugging Vue code that imports @tanstack/ai-vue. Covers useChat, createChatHook, the generation composables (image, audio, speech, video, transcription, summarize), useAudioRecorder, useByok, useWebMCPTools, and the @tanstack/ai-vue/ui and /byok subpaths. Provides current API shapes, reactive-state rules, and version limits for @tanstack/ai-vue 0.24.x.
- Installs
- 110
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/skilld-dev/vue-ecosystem-skills --skill tanstack-ai-vue-skilld- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads tanstack-ai-vue-skilld automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
@tanstack/ai-vue
Vue 3 composables for TanStack AI streaming chat, structured outputs, and media generation. Wraps the headless @tanstack/ai-client classes (ChatClient, GenerationClient, VideoGenerationClient) in reactive state.
- Version documented:
0.24.3(source:package.json:3) - Peer deps:
vue >=3.5.0,@tanstack/ai ^0.58.0; runtime deps:@tanstack/ai-client ^0.33.2,@tanstack/markdown ^0.0.13(source:package.json:55-62) - Entry points:
.(main),./ui(headless chat UI factory),./byok(bring-your-own-key) (source:package.json:23-36) - Official docs: https://tanstack.com/ai/latest/docs/api/ai-vue and https://tanstack.com/ai/latest/docs/getting-started/quick-start-vue
- Install:
pnpm add @tanstack/ai @tanstack/ai-vue @tanstack/ai-openai(plus a provider adapter; server-side chat comes from@tanstack/ai)
Core rules
- Every composable must run inside a component setup or effect scope. Cleanup is automatic via
onScopeDispose; the scope owns the connection (source:src/use-chat.ts:259-269). - All reactive state is
DeepReadonly<ShallowRef<T>>. Read with.valuein script AND template. Never reassign; use the returned methods (setMessages,clear,reset) (source:src/use-chat.ts:425-457). - Pass a
connectionadapter (for examplefetchServerSentEvents('/api/chat'), re-exported from this package) or afetcher. Generation hooks throwuseGeneration requires either a connection or fetcher optionwithout one (source:src/use-generation.ts:272-274). useChatbuilds oneChatClientper call. Changingconnection(or other transport identity) requires a remount or a changedkeyprop;body,forwardedProps,context, andqueueare watched and synced live (source:src/types.ts:77-79,src/use-chat.ts:212-230).- Callback options (
onChunk,onFinish,onError, ...) are read through the options object at call time, so reactive or mutated options propagate without recreating the client (source:src/use-chat.ts:85-91). - Prefer
forwardedPropsoverbody;bodyis deprecated but still merged into the same wire payload (source:src/use-chat.ts:207-209).
Quick start: streaming chat
Server (Express or any backend returning TanStack AI SSE):
import { chat, toServerSentEventsResponse } from '@tanstack/ai'
import { openaiText } from '@tanstack/ai-openai'
app.post('/api/chat', async (req, res) => {
const stream = chat({ adapter: openaiText('gpt-4o'), messages: req.body.messages })
const response = toServerSentEventsResponse(stream)
// pipe response.body to res
})
Client component:
<script setup lang="ts">
import { ref } from 'vue'
import { useChat, fetchServerSentEvents } from '@tanstack/ai-vue'
const input = ref('')
const { messages, sendMessage, isLoading } = useChat({
connection: fetchServerSentEvents('/api/chat'),
})
function handleSubmit() {
if (input.value.trim() && !isLoading.value) {
sendMessage(input.value)
input.value = ''
}
}
</script>
<template>
<div v-for="message in messages.value" :key="message.id">
<div v-for="(part, idx) in message.parts" :key="idx">
<p v-if="part.type === 'text'">{{ part.content }}</p>
</div>
</div>
<form @submit.prevent="handleSubmit">
<input v-model="input" :disabled="isLoading.value" />
<button type="submit">Send</button>
</form>
</template>
Source: official quick start, https://tanstack.com/ai/latest/docs/getting-started/quick-start-vue
Typed tools
Define tools once with toolDefinition() from @tanstack/ai, implement .client(fn) in components, and wrap them in clientTools() (re-exported here from @tanstack/ai-client) so part.name, part.input, and part.output narrow without as const. Client tools execute automatically; there is no onToolCall option. Derive message types with createChatClientOptions + InferChatMessages (both re-exported). Source: https://tanstack.com/ai/latest/docs/api/ai-vue
<script setup lang="ts">
import { useChat, fetchServerSentEvents, clientTools } from '@tanstack/ai-vue'
import { updateUIDef } from './tool-definitions'
const updateUI = updateUIDef.client((input) => {
notification.value = input.message
return { success: true }
})
const { messages, sendMessage } = useChat({
connection: fetchServerSentEvents('/api/chat'),
tools: clientTools(updateUI),
})
</script>
Shared chat hook
createChatHook(options) (root entry) binds options at module scope and returns a useChat composable. Override only threadId, live, forwardedProps, body, and initialMessages per instance; tools, interrupts, and outputSchema stay on the factory options. Rename at the call site if it clashes with the imported useChat (source: src/create-chat-hook.ts:28-45).
const { useChat: useAppChat } = createChatHook(chatOptions)
const chat = useAppChat({ threadId: 'support-1' })
Generation composables
All follow one pattern: pass connection or fetcher, call generate(input), read reactive state.
| Composable | Input type | Result type | Extras |
|---|---|---|---|
useGeneration | custom TInput | custom TResult | base composable for custom types |
useGenerateImage | ImageGenerateInput | ImageGenerationResult | |
useGenerateAudio | AudioGenerateInput | AudioGenerationResult | |
useGenerateSpeech | SpeechGenerateInput | TTSResult | |
useTranscription | TranscriptionGenerateInput | TranscriptionResult | |
useSummarize | SummarizeGenerateInput | SummarizationResult | |
useGenerateVideo | VideoGenerateInput | VideoGenerateResult | jobId, videoStatus, onJobCreated, onStatusUpdate |
Common return: generate, result, isLoading, error, status, stop, reset, runId. Details, transforms, and persistence: references/generation-composables.md
stop() only aborts the local stream. It does not stop work already running on the provider; use runId against your own endpoint to cancel or poll (source: src/use-generation.ts:124-131).
Chat UI (@tanstack/ai-vue/ui)
Build chat interfaces with createChatHook from the /ui subpath (not the deprecated prebuilt components Chat, ChatInput, ChatMessage, ChatMessages, ToolApproval, deprecated since 0.3.0, removal planned for 1.0.0). The subpath also exports renderless UIChat, UIProvider, UIMessages, UIMessage, UIPart, UIInterrupts, UIQueue, and createChatUI / createChatHookContexts. This subpath ships as raw .ts/.vue source, so it is type-checked against your tsconfig (source: package.json:28-31, src/ui.ts:2-33, src/chat-ui/types.ts:5).
Guide: references/chat-ui.md
BYOK and WebMCP
useByok(client)turns aByokClientinto a reactiveByokSnapshot; build the client withdefineByok,ByokClient,passkeyStorage, and friends from the/byoksubpath. Keys travel inx-byok-*headers, never the request body (source:src/use-byok.ts:5-14,src/use-generation.ts:35-38).useWebMCPTools([searchProducts])registers executable client tools with WebMCP for the current scope; disposal unregisters them (source:src/use-web-mcp-tools.ts:27-55).
Guide: references/byok-and-webmcp.md
Troubleshooting
- State not updating in templates: these are
ShallowRefs. UseisLoading.valueinside templates too. useChatignored an option change: transport identity (connection,threadIdpersistence shape) is fixed per instance. Remount or change the componentkey(source:src/types.ts:77-79).- Approval response rejected:
addToolApprovalResponsetakes the approval id (part.approval.id), not the tool call id (source:src/types.ts:193-199). - Hydrated nothing on reload: persistence requires a stable
threadId; without one the client mints an id after mount and the chat stays ephemeral (source:src/use-chat.ts:101-103).
References
- useChat API: options, full return shape, structured outputs, interrupts, queue, live mode, resume.
- Generation composables:
useGenerationand the six specialized hooks,onResulttransforms, persistence,useAudioRecorder. - Chat UI: the
/uisubpath, factory config, renderless components, migration off deprecated components. - BYOK and WebMCP: the
/byoksubpath,useByok,useWebMCPTools.
FAQ
What does the tanstack-ai-vue-skilld skill do?
Use when writing or debugging Vue code that imports @tanstack/ai-vue. Covers useChat, createChatHook, the generation composables (image, audio, speech, video, transcription, summarize), useAudioRecorder, useByok, useWebMCPTools, and the @tanstack/ai-vue/ui and /byok subpaths. Provides current API shapes, reactive-state rules, and version limits for @tanstack/ai-vue 0.24.x.
How do I install tanstack-ai-vue-skilld?
Run npx skills add https://github.com/skilld-dev/vue-ecosystem-skills --skill tanstack-ai-vue-skilld in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/tanstack-ai-vue-skilld/ (personal) or .claude/skills/tanstack-ai-vue-skilld/ (project).
Which AI agents can use tanstack-ai-vue-skilld?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is tanstack-ai-vue-skilld safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains tanstack-ai-vue-skilld?
It is published by skilld-dev in skilld-dev/vue-ecosystem-skills. It has 110 recorded installs.
More from skilld-dev/vue-ecosystem-skills
quasar-skilld
skilld-dev/vue-ecosystem-skills
Build, configure, and debug apps with the Quasar framework (quasar npm package, v2.33.1). Use when writing, reviewing, or debugging code that imports "quasar" or "quasar/wrappers", configuring Quasar with Vite, Vitest, Storybook, UMD, or Quasar CLI, styling with Quasar Sass variables, or upgrading between Quasar v2 releases.
vue-i18n-skilld
skilld-dev/vue-ecosystem-skills
Open the skill to read its SKILL.md instructions.
vue-skilld
skilld-dev/vue-ecosystem-skills
Open the skill to read its SKILL.md instructions.
vuetify-skilld
skilld-dev/vue-ecosystem-skills
Vue Material Component Framework. Use when writing, debugging, or configuring code that imports vuetify v4.x. Covers createVuetify setup, components and labs, composables, theming, icons, dates and locale, styles and SASS variables, treeshaking, and v3 to v4 migration.
pinia-skilld
skilld-dev/vue-ecosystem-skills
Open the skill to read its SKILL.md instructions.
vue-router-skilld
skilld-dev/vue-ecosystem-skills
Open the skill to read its SKILL.md instructions.
Popular frontend & design skills
setup-matt-pocock-skills
mattpocock/skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
frontend-design
anthropics/skills
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
hyperframes-animation
heygen-com/hyperframes
All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.
prototype
mattpocock/skills
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
hyperframes-core
heygen-com/hyperframes
The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.
vercel-react-best-practices
vercel-labs/agent-skills
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.