ai-core/middleware

Official

Track chat lifecycle hooks and guard tools.

AuthorTanStack
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill ensures every chat lifecycle hook in TanStack AI emits telemetry, enforces tool behavior, and surfaces errors without manually weaving instrumentation into each run.

Core Features & Use Cases

  • Lifecycle hook coverage: onConfig, onStart, onChunk, tool call, usage, and terminal hooks provide observability at every phase of a chat.
  • Tool management and caching: onBeforeToolCall and onAfterToolCall empower guards, argument transforms, and caching decisions before the conversation continues.
  • Resilient analytics: ctx.defer and explicit error handling let logging, tracking, and deferred side effects run without blocking or aborting the stream, ideal for SaaS observability pipelines.

Quick Start

Add middleware entries that log request IDs, cache tool results, and report errors before passing the configuration to chat.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: ai-core/middleware
Download link: https://github.com/TanStack/ai/archive/main.zip#ai-core-middleware

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.