caching-strategies

caching-strategies is a skill for Claude Code from claude-dev-suite/claude-dev-suite. It costs 111 tokens per session (1,139 once invoked), scanned A, original, MIT.

A guide to caching application data in fast temporary storage, including Redis, memory, HTTP caches, and content delivery networks. It covers several ways to keep cached data aligned with the database.

In plain words
What is it for?
Use it to add cache-aside or write-through caching, set expiry times, cache HTTP responses, use conditional requests, and remove cached entries after updates.
Why use it?
Caching can reduce repeated database work and make responses faster, while its invalidation patterns help prevent users from seeing outdated data.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it to add cache-aside or write-through caching, set expiry times, cache HTTP responses, use conditional requests, and remove cached entries after updates.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/claude-dev-suite/claude-dev-suite/caching-strategies
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 claude-dev-suite/claude-dev-suite --skill caching-strategies
Clone the repo
git clone --depth 1 https://github.com/claude-dev-suite/claude-dev-suite

Made for: Claude Code.

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 caching-strategies

README.md
[![agentmods](https://agentmods.dev/badge/skills/claude-dev-suite/claude-dev-suite/caching-strategies/github.svg)](https://agentmods.dev/skills/claude-dev-suite/claude-dev-suite/caching-strategies)
Your own site
<a href="https://agentmods.dev/skills/claude-dev-suite/claude-dev-suite/caching-strategies"><img src="https://agentmods.dev/badge/skills/claude-dev-suite/claude-dev-suite/caching-strategies/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 caching-strategies

Your own site · 80×15
<a href="https://agentmods.dev/skills/claude-dev-suite/claude-dev-suite/caching-strategies"><img src="https://agentmods.dev/badge/skills/claude-dev-suite/claude-dev-suite/caching-strategies.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 111 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,139 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00111 $0.01139
Opus 5 $0.00056 $0.00570
Sonnet 5 $0.00022 $0.00228
Haiku 4.5 $0.00011 $0.00114

Measured 5d ago against content hash 5b631778a650, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

caching-strategies scanned grade A with 0 findings 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 5d ago.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/best-practices/caching-strategies/SKILL.md · 142 lines

How it starts

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

Caching Strategies

Cache-Aside (Lazy Loading) — Most Common

async function getUser(id: string): Promise<User> {
  const cached = await redis.get(`user:${id}`);
  if (cached) return JSON.parse(cached);

  const user = await db.user.findUnique({ where: { id } });
  if (user) {
    await redis.set(`user:${id}`, JSON.stringify(user), 'EX', 3600); // 1h TTL
  }
  return user;
}

// Invalidate on update
async function updateUser(id: string, data: UpdateUserDto): Promise<User> {
  const user = await db.user.update({ where: { id }, data });
  await redis.del(`user:${id}`);
  return user;
}

Write-Through

async function updateProduct(id: string, data: UpdateDto): Promise<Product> {
  const product = await db.product.update({ where: { id }, data });
  await redis.set(`product:${id}`, JSON.stringify(product), 'EX', 3600);
  return product;
}

HTTP Caching

// Express middleware
app.get('/api/products', (req, res) => {
  res.set({
    'Cache-Control': 'public, max-age=60, stale-while-revalidate=300',
    'ETag': generateETag(products),
  });
  res.json(products);
});

// Conditional requests
app.get('/api/products/:id', (req, res) => {
  const product = getProduct(req.params.id);
  const etag = generateETag(product);

  if (req.headers['if-none-match'] === etag) {
    return res.status(304).end();
  }

  res.set({ ETag: etag, 'Cache-Control': 'private, max-age=0, must-revalidate' });
  res.json(product);
});

Cache-Control Cheat Sheet

Directive Use Case
public, max-age=3600 Static assets, CDN-cacheable
private, max-age=60 User-specific data
no-cache Always revalidate (ETag/Last-Modified)
no-store Sensitive data (banking, health)
stale-while-revalidate=300 Serve stale, refresh in background

Redis Caching Patterns

// Hash for structured data
await redis.hset(`user:${id}`, { name, email, plan });
const user = await redis.hgetall(`user:${id}`);

// Sorted set for leaderboards
await redis.zadd('leaderboard', score, `user:${id}`);
const top10 = await redis.zrevrange('leaderboard', 0, 9, 'WITHSCORES');

// Cache with refresh-ahead
async function getWithRefresh<T>(key: string, ttl: number, fetcher: () => Promise<T>): Promise<T> {
  const cached = await redis.get(key);
  if (cached) {
    const { data, expiresAt } = JSON.parse(cached);
    // Refresh in background if nearing expiry
    if (Date.now() > expiresAt - ttl * 200) {
      fetcher().then((fresh) =>
        redis.set(key, JSON.stringify({ data: fresh, expiresAt: Date.now() + ttl * 1000 }), 'EX', ttl)
      );
    }
    return data;
  }
  const data = await fetcher();
  await redis.set(key, JSON.stringify({ data, expiresAt: Date.now() + ttl * 1000 }), 'EX', ttl);
  return data;
}

Read the full file on GitHub · 142 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. 5d ago First seen · 142 lines · 111 tokens per session scan A 5b631778a650

Subscribe to this mod's changes

caching-strategies is a skill published in the GitHub repository claude-dev-suite/claude-dev-suite (32 stars, last pushed today), licensed MIT. It adds 111 tokens to every session and 1,139 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

redis-patterns

Redis patterns — caching (cache-aside, write-through), sessions, pub/sub, work queues, distributed locks, data structures (sorted sets, streams, hashes). Covers ioredis, node-redis, Redis 7+. Use when designing Redis usage in Node.js or Python apps.

RaNDoM6913/claude-code-superkit · 61 tokens

cache

Design caching strategies with Redis.

barnburner121/claude-plugin-marketplace · 7 tokens

spring-data-redis

Use when implementing caching, session storage, rate limiting, or any Redis integration. Covers cache-aside pattern, key naming, TTL strategy, and serialization config.

rrezartprebreza/spring-boot-skills · 37 tokens

redis-cache-strategy

Redis caching strategy designer and reviewer. ALWAYS use when designing, reviewing, or troubleshooting Redis caching layers — cache pattern selection (cache-aside, write-through, write-behind), TTL strategy, cache stampede/penetration/avalanche prevention, hot key handling, cache-DB consistency, distributed locking…

johnqtcg/awesome-skills · 113 tokens

caching-strategy

Stratégie de cache adaptée à chaque cas d'usage (Redis, Memcached, in-memory, CDN) — quoi cacher, durée de vie, invalidation et cohérence. Se déclenche avec "cache", "Redis", "caching", "mise en cache", "cache invalidation", "CDN", "distributed cache", "réduire les appels à la base". Also triggers on "caching…

khalilbenaz/claude-skills-collection · 103 tokens

redis-patterns

Patterns d'utilisation Redis pour le cache, pub/sub, streams et sessions. Se déclenche avec "Redis", "cache distribué", "pub/sub Redis", "Redis streams", "session store. Also triggers on "Redis cache", "Redis pub/sub".

khalilbenaz/claude-skills-collection · 56 tokens