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…
от skilld-dev★ 188 звёзд на GitHubОб этом скилле
@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 `connect
Установить tanstack-ai-vue-skilld в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл 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.
Как установить скилл tanstack-ai-vue-skilld?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл tanstack-ai-vue-skilld запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic