Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

caching

Skill by trpc

Sets HTTP cache headers on tRPC query responses through the responseMeta callback. Intended for CDN and browser caching of public, successful queries.

  • Score 91
  • 41k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install caching

Built from the published package, never by AI.

git clone --depth 1 https://github.com/trpc/trpc /tmp/trpc && mkdir -p ~/.claude/skills && cp -r /tmp/trpc/packages/server/skills/caching ~/.claude/skills/caching

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install caching in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

This skill explains how to set HTTP cache headers on tRPC query responses using the responseMeta callback. It shows how to send Cache-Control headers with s-maxage and stale-while-revalidate so CDNs and browsers can cache results. The examples name public routes with a public prefix and check the path, errors and request type before adding headers.

It also covers authenticated requests. It warns that with batching on by default, a cached response with personal data could reach other users, so it skips caching when a user is in context, when errors occur, or for mutations. It also notes that Next.js App Router overrides these headers. It is aimed at developers who run tRPC servers and want CDN or browser caching for public queries. It assumes the server-setup skill.

Written from the project's SKILL.md and checked against it.

What it can do

  • Path-based public route cachingAdds cache headers only to query paths that start with public.
  • Cache-Control configurationSets s-maxage and stale-while-revalidate values in the cache-control header.
  • Skip caching for authenticated requestsReturns no cache headers when a user is present in the context.
  • Skip caching errors and mutationsReturns no cache headers when errors occur or the request is not a query.

What you need

  • tRPC library version 11.16.0
  • The server-setup skill for initTRPC and createContext

Try asking

  • Add cache headers to my public tRPC queries using responseMeta
  • Make sure my authenticated tRPC responses are never cached
  • Set s-maxage and stale-while-revalidate for my public.* procedures

Good to know

  • Next.js App Router overrides Cache-Control headers set through responseMeta
  • With batching on by default, caching must check auth context to avoid sharing personal data

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: packages/server/skills/caching/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Alternatives to caching

All alternatives →

Compare with antigravity-workflows, e2e-testing-patterns or upgrade-browser

caching: common questions

Does this skill cache tRPC responses on the server?

It sets HTTP cache-control headers through responseMeta so CDNs and browsers can cache responses. The source does not describe server-side caching.

Can I cache authenticated tRPC requests with this approach?

The source says to avoid caching authenticated responses. The examples return no cache headers when ctx.user is set.

Why does caching not work in Next.js App Router?

The source states that Next.js App Router overrides Cache-Control headers set by tRPC via responseMeta. It recommends Next.js native mechanisms such as revalidate and unstable_cache instead.

How do I install caching?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is caching free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is caching safe to use?

It scores 91 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to caching?

Similar skills: antigravity-workflows, e2e-testing-patterns, upgrade-browser, browser-automation.

caching Install

Add to stack

Loading.