TanStack AI Patterns (Alpha)

TanStack AI Patterns (Alpha) is a skill for Claude Code from smicolon/ai-kit. It costs 41 tokens per session (2,054 once invoked), scanned A, original, MIT.

A set of patterns for connecting React applications to AI services through TanStack AI, including chat and streamed responses.

In plain words
What is it for?
It helps build chat interfaces, text completion features, provider configuration, streaming responses, and React hooks for AI interactions.
Why use it?
It provides one structure for sending messages and displaying responses that arrive progressively from services such as OpenAI or Anthropic.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the tanstack-router plugin — 12 skills shipped together

Good fit It helps build chat interfaces, text completion features, provider configuration, streaming responses, and React hooks for AI interactions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/smicolon/ai-kit/ai-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add smicolon/ai-kit --skill ai-patterns
Clone the repo
git clone --depth 1 https://github.com/smicolon/ai-kit

Made for: Claude Code.

Or install tanstack-router, the plugin that ships this one along with the rest of its 12 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for TanStack AI Patterns (Alpha)

README.md
[![agentmods](https://agentmods.dev/badge/skills/smicolon/ai-kit/ai-patterns/github.svg)](https://agentmods.dev/skills/smicolon/ai-kit/ai-patterns)
Your own site
<a href="https://agentmods.dev/skills/smicolon/ai-kit/ai-patterns"><img src="https://agentmods.dev/badge/skills/smicolon/ai-kit/ai-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for TanStack AI Patterns (Alpha)

Your own site · 80×15
<a href="https://agentmods.dev/skills/smicolon/ai-kit/ai-patterns"><img src="https://agentmods.dev/badge/skills/smicolon/ai-kit/ai-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,054 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00041 $0.02054
Opus 5 $0.00020 $0.01027
Sonnet 5 $0.00008 $0.00411
Haiku 4.5 $0.00004 $0.00205

Measured 5d ago against content hash 5276db3b875d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

TanStack AI Patterns (Alpha) scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packs/tanstack-router/skills/ai-patterns/SKILL.md · 371 lines

How it starts

The opening of the file, as written. The whole thing — 371 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TanStack AI Patterns (Alpha)

Alpha Library: TanStack AI is in alpha. APIs may change between versions.

TanStack AI provides a unified SDK for integrating AI capabilities into React applications.

Core Concepts

  • Providers: Backend AI providers (OpenAI, Anthropic, etc.)
  • Streams: Real-time streaming responses
  • Chat: Conversational interfaces
  • Completion: Text completion
  • Hooks: React hooks for AI interactions

Basic Setup

// lib/ai.ts
import { createAI } from '@tanstack/ai'

export const ai = createAI({
  provider: 'openai',
  apiKey: import.meta.env.VITE_OPENAI_API_KEY,
  // Or use server-side proxy
  baseUrl: '/api/ai',
})

Chat Interface

import { useChat } from '@tanstack/ai-react'
import { ai } from '@/lib/ai'

function ChatInterface() {
  const {
    messages,
    input,
    setInput,
    sendMessage,
    isLoading,
    error,
  } = useChat({
    ai,
    model: 'gpt-4',
    systemPrompt: 'You are a helpful assistant.',
  })

  const handleSubmit = (e: React.FormEvent) => {
    e.preventDefault()
    if (input.trim()) {
      sendMessage(input)
      setInput('')
    }
  }

  return (
    <div className="chat-container">
      <div className="messages">
        {messages.map((message) => (
          <div
            key={message.id}
            className={`message ${message.role}`}
          >
            {message.content}
          </div>
        ))}
        {isLoading && <div className="loading">Thinking...</div>}
      </div>

      <form onSubmit={handleSubmit}>
        <input
          value={input}
          onChange={(e) => setInput(e.target.value)}
          placeholder="Type a message..."
          disabled={isLoading}
        />
        <button type="submit" disabled={isLoading || !input.trim()}>
          Send
        </button>
      </form>

      {error && <div className="error">{error.message}</div>}
    </div>
  )
}

Streaming Responses

import { useCompletion } from '@tanstack/ai-react'
import { ai } from '@/lib/ai'

function StreamingCompletion() {
  const {
    completion,
    complete,
    isLoading,
    stop,
  } = useCompletion({
    ai,
    model: 'gpt-4',
  })

  const handleGenerate = () => {
    complete('Write a short story about a robot learning to paint.')
  }

  return (
    <div>
      <button onClick={handleGenerate} disabled={isLoading}>
        Generate Story
      </button>
      {isLoading && (
        <button onClick={stop}>Stop</button>
      )}
      <div className="completion">
        {completion}
        {isLoading && <span className="cursor">|</span>}
      </div>
    </div>
  )
}

Read the full file on GitHub · 371 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 371 lines · 41 tokens per session scan A 5276db3b875d

Subscribe to this mod's changes

TanStack AI Patterns (Alpha) is a skill published in the GitHub repository smicolon/ai-kit (6 stars, last pushed 5d ago), licensed MIT. It adds 41 tokens to every session and 2,054 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

deepseek-helper

A guide for using the DeepSeek API, a service that lets programs send requests to DeepSeek language models. It covers model choice, example requests, prompt improvements, cost estimates, and common API errors.

dongsheng123132/u-claw · 25 tokens

opik-optimizer

Optimize LLM prompts, tools, and agents in Opik using standardized optimizer workflows (prompt optimization, tool optimization, and parameter tuning), dataset/metric wiring, and result interpretation.

vincentkoc/dotskills · 41 tokens

proxy-local-ai-subscriptions

A guide for exposing your local Codex, ChatGPT Codex, or Claude Code subscription through a protected local OpenAI-compatible endpoint, then connecting it to NextClaw as a custom provider.

Peiiii/nextclaw · 126 tokens

building-agent-systems

AI agent and LLM system engineering reference covering single-agent dev (ReAct, tool calling, plan-execute), multi-agent coordination (swarm, role decomposition, file locking), LLM security (prompt injection, jailbreak defense, output filtering), RAG architecture (chunking, hybrid retrieval, rerank), and prompt…

telagod/code-abyss · 110 tokens

ml

Machine learning and LLM engineering judgment, distilled from a stronger model - invoke when DECIDING whether/how to use ML or an LLM for a task (prompt vs RAG vs fine-tune vs classical); working with training/eval data or labels; building or reviewing evals for models and LLM features; designing RAG, structured…

telagod/code-abyss · 114 tokens

joule-strategy

You are a Joule and SAP AI strategy expert. Joule is SAP's generative AI copilot embedded across SAP applications. Your job is to help organizations plan, govern, and execute Joule adoption in a way that accelerates value without creating compliance risk, shadow AI behavior, or unrealistic expectations about what…

vigneshbarani24/sap-superpowers · 0 tokens