caching

Configure HTTP cache headers on tRPC query responses via responseMeta.

2|Updated Apr 11, 2026
One-click install
npx skills add https://github.com/PlazaCC/antes-da-tela --skill caching-plazacc
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: caching
Source: https://github.com/PlazaCC/antes-da-tela/tree/main/.agents/skills/caching
Command: npx skills add https://github.com/PlazaCC/antes-da-tela --skill caching-plazacc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Public tRPC query endpoints often lack proper caching, leading to increased server load and slower response times for users.

Core Features & Use Cases

  • ResponseMeta Caching: Sets Cache‑Control headers for CDN and browser caching on successful public queries.
  • Authentication Safety: Skips caching for authenticated requests, errors, and mutations to prevent data leakage.
  • Flexible Integration: Works with @trpc/server standalone and fetch adapters, configurable per route.

Quick Start

Enable caching for all public tRPC queries by configuring responseMeta in the server setup.

Frequently Asked Questions about caching

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

FAQPage Schema
How do I cache tRPC query responses for faster CDN and browser loading?▼

Configure responseMeta callbacks in your tRPC server setup to apply Cache-Control, s-maxage, and stale-while-revalidate headers on successful public query routes, enabling CDN and browser caching.

What is the safest way to prevent caching authenticated tRPC requests?▼

The safest way to prevent caching authenticated tRPC requests is to configure responseMeta to explicitly skip applying Cache-Control headers for authenticated requests, errors, and mutations, preventing sensitive data leakage.

Can I use responseMeta to set Cache-Control headers with tRPC fetch adapters?▼

Yes, you can use responseMeta to set Cache-Control headers with tRPC fetch adapters. The caching configuration works flexibly with both @trpc/server standalone and fetch adapters for public query routes.

How does stale-while-revalidate work for tRPC query caching?▼

Stale-while-revalidate allows a CDN to serve a cached tRPC response immediately while fetching a fresh version in the background. You configure this via responseMeta callbacks alongside s-maxage directives for public queries.

When should I not use HTTP caching on tRPC endpoints?▼

You should not use HTTP caching on tRPC endpoints handling mutations, returning errors, or serving authenticated user data. Skipping Cache-Control headers on these routes prevents stale data and data leakage issues.