nextjs-redis-cache

nextjs-redis-cache is a skill for Claude Code, Codex from leejpsd/nextjs-cache-handler. It costs 119 tokens per session (2,946 once invoked), scanned A, original, MIT.

A setup and troubleshooting guide for using Redis as the shared cache for self-hosted Next.js applications. Redis is a separate data store often used to share cached results between multiple application servers.

In plain words
What is it for?
Use it to configure Redis caching for incremental page updates, fetch results, and Next.js's "use cache" feature on self-hosted deployments.
Why use it?
It helps avoid stale or missing cached pages when several Next.js instances run behind a load balancer, and clarifies which cache interface matches the Next.js version.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to configure Redis caching for incremental page updates, fetch results, and Next.js's "use cache" feature on self-hosted deployments.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/leejpsd/nextjs-cache-handler/nextjs-redis-cache
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 leejpsd/nextjs-cache-handler --skill nextjs-redis-cache
Clone the repo
git clone --depth 1 https://github.com/leejpsd/nextjs-cache-handler

Made for: Claude Code, Codex.

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 nextjs-redis-cache

README.md
[![agentmods](https://agentmods.dev/badge/skills/leejpsd/nextjs-cache-handler/nextjs-redis-cache/github.svg)](https://agentmods.dev/skills/leejpsd/nextjs-cache-handler/nextjs-redis-cache)
Your own site
<a href="https://agentmods.dev/skills/leejpsd/nextjs-cache-handler/nextjs-redis-cache"><img src="https://agentmods.dev/badge/skills/leejpsd/nextjs-cache-handler/nextjs-redis-cache/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 nextjs-redis-cache

Your own site · 80×15
<a href="https://agentmods.dev/skills/leejpsd/nextjs-cache-handler/nextjs-redis-cache"><img src="https://agentmods.dev/badge/skills/leejpsd/nextjs-cache-handler/nextjs-redis-cache.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 119 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,946 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.00119 $0.02946
Opus 5.5 $0.00048 $0.01178
Sonnet 5.5 $0.00024 $0.00589
Haiku 4.5 $0.00012 $0.00295

Measured today against content hash 2dcb0ea3b9d6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

nextjs-redis-cache scanned grade A with 1 finding 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 today.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- **ISR round-trip**: `curl -D- <url>` twice → `x-nextjs-cache: MISS` then `HIT`;
skills/nextjs-redis-cache/SKILL.md · 194 lines

How it starts

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

Next.js Redis Cache Handler

@leejpsd/nextjs-cache-handler is a Redis cache handler for self-hosted Next.js 15/16. It is the only Redis-backed package shipping BOTH handler interfaces: cacheHandler (ISR / Pages Router / fetch cache) and cacheHandlers ('use cache', cacheComponents: true).

Do NOT use it on Vercel-hosted apps — Vercel provides its own managed cache. The target is multi-instance self-hosting: ECS/Fargate, Kubernetes, VMs behind a load balancer.

Version rule: always install >= 0.3.3. Earlier 0.3.x have an incomplete soft-invalidation path (issue #1).

1. Which handler(s) — decision table

Next.js version cacheHandler (ISR) cacheHandlers ('use cache')
15.x ✅ use it ❌ does not exist in Next 15
>= 16.1.5 ✅ use it ✅ use it (cacheComponents: true)
< 15 ❌ unsupported (peer next >=15.0.0 <17) ❌

Detect the version from the app's package.json (dependencies.next). Install: npm i @leejpsd/nextjs-cache-handler plus ONE client: redis (node-redis v5) or ioredis (required for Cluster/Sentinel).

2. Wiring recipe (exact files)

Create TWO CommonJS wrapper files in the project root (Next's require.resolve needs CJS):

// cache-components.cjs  (Next 16 only)
const { createCacheComponentsHandler } = require("@leejpsd/nextjs-cache-handler/cache-components");
module.exports = createCacheComponentsHandler({
  client: { type: "redis", url: process.env.REDIS_URL },
  buildNamespace: () => process.env.DEPLOYMENT_VERSION,
});
// cache-incremental.cjs  (Next 15 and 16)
const { createIncrementalCacheHandler } = require("@leejpsd/nextjs-cache-handler/incremental");
module.exports = createIncrementalCacheHandler({
  client: { type: "redis", url: process.env.REDIS_URL },
  buildNamespace: () => process.env.DEPLOYMENT_VERSION,
});
// next.config.ts — the four load-bearing keys
const nextConfig = {
  cacheComponents: true,                                   // Next 16 only
  cacheHandler: require.resolve("./cache-incremental.cjs"),
  cacheHandlers: { default: require.resolve("./cache-components.cjs") }, // Next 16 only
  cacheMaxMemorySize: 0,  // optional: Next keeps no ISR memory cache with a custom cacheHandler; this only sizes the built-in 'use cache' store
};

Read the full file on GitHub · 194 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. today Changed 2dcb0ea3b9d6
  2. 9d ago Changed 14703e1b85b4
  3. 14d ago Changed · +1 lines f38127262ac4
  4. 19d ago Changed · +10 lines 7b5ef311862e
  5. 3mo ago First seen · 183 lines · 119 tokens per session scan A d4d7a5f59d6a

Subscribe to this mod's changes

nextjs-redis-cache is a skill published in the GitHub repository leejpsd/nextjs-cache-handler (7 stars, last pushed today), licensed MIT. It adds 119 tokens to every session and 2,946 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

nextjs-redis-cache compared with skills from other repositories

nextjs-redis-cache next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
nextjs-redis-cacheleejpsd/nextjs-cache-handlerSkill7todayMITA119Claude Code, Codex
Cache Strategy Consistency Guards977043/river-reviewSkill8yesterdayMITA29Claude Code
trigger-convextriggerdotdev/trigger.devSkill17ktodayApache-2.0A93Claude Code, Codex
redisericrisco/rsc-harnessSkill701yesterdayMITA111Claude Code, Codex
using-redis-token-bucketsPostHog/posthog-fossSkill736todayMITA148Claude Code, Codex
using-redis-token-bucketsPostHog/posthogSkill41ktodaynoneA148Claude Code, Codex
background-job-orchestratorcuriositech/some_claude_skillsSkill2846d agoMITA95Claude Code