start-core/middleware

Create and attach request and function middleware for TanStack Start server functions.

4|1|Updated Feb 3, 2026
One-click install
npx skills add https://github.com/lespaceman/athena-workflow-marketplace --skill start-core-middleware-lespaceman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: start-core/middleware
Source: https://github.com/lespaceman/athena-workflow-marketplace/tree/main/plugins/tanstack-start/skills/upstream/%40tanstack/start-client-core/skills/start-core/middleware
Command: npx skills add https://github.com/lespaceman/athena-workflow-marketplace --skill start-core-middleware-lespaceman

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Streamlines the creation, attachment, and management of middleware for TanStack Start server functions and routes, enabling consistent behavior and predictable execution order across an application.

Core Features & Use Cases

  • Create request middleware that runs on all requests and function middleware that runs on TanStack Start server functions, with client and server phases.
  • Attach middleware to server functions using .middleware(...), .client(...), and .server(...), supporting context passing and next() composition.
  • Define global middleware in src/start.ts to apply cross-cutting logic across the entire application.

Quick Start

Create middleware with createMiddleware() and attach it to a TanStack Start server function using .server() or .client() as needed.

Frequently Asked Questions about start-core/middleware

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create middleware for TanStack Start server functions?

Apply global middleware across all TanStack Start requests by defining it in your src/start.ts file. This configuration applies cross-cutting logic globally, ensuring consistent behavior and predictable execution order across the entire application.

How does context passing work in TanStack Start middleware?

Context passing in TanStack Start middleware works by transferring data between client and server phases using next() composition. This mechanism allows chained middleware to share request context and input validation results across server functions.

Can I run middleware on all requests in TanStack Start?

Yes, you can run middleware on every request in TanStack Start by defining global middleware in src/start.ts. This applies cross-cutting logic across the entire application, ensuring consistent behavior for all incoming requests.

What is the difference between request middleware and function middleware in TanStack Start?

Request middleware runs on all incoming TanStack Start requests, while function middleware executes specifically on designated server functions. Both support client and server phases with context passing for predictable execution order.

Does TanStack Start middleware support input validation?

Yes, TanStack Start middleware supports input validation within its composition pipeline. You validate inputs during middleware phases and transfer the validated data through the context to downstream server functions.