caching-strategies

caching-strategies is a skill for Claude Code, Codex from KraitDev/skiLL.Md. It costs 15 tokens per session (1,898 once invoked), scanned A, original, MIT.

A guide for using a cache such as Redis or Memcached to keep frequently read data in fast storage before requests reach the database.

In plain words
What is it for?
Use it to investigate read-heavy API endpoints, choose what to cache, set an acceptable time for stale data, and reduce database load after checking query performance.
Why use it?
It helps reduce slow responses and repeated database queries when many users read data that changes infrequently.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/kraitdev/skill.md/caching-strategies
Any agent
npx skills add KraitDev/skiLL.Md --skill caching-strategies
Clone the repo
git clone --depth 1 https://github.com/KraitDev/skiLL.Md

Made for: Claude Code, Codex.

Per session 15 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,898 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00015 $0.01898
Opus 5 $0.00008 $0.00949
Sonnet 5 $0.00003 $0.00380
Haiku 4.5 $0.00002 $0.00190

Measured 3d ago against content hash a4e433ceaed1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 3d 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/architecture/caching-strategies/SKILL.md · 201 lines

How it starts

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

Caching Strategies

Purpose

Databases are slow; caches are fast. This skill teaches teams to strategically cache frequently accessed data in fast storage (Redis, Memcached) to intercept requests before they hit the database, dramatically reducing latency and database load. Caching is NOT a substitute for proper database optimization.

When to use

  • System is experiencing high latency on read-heavy API endpoints
  • Database CPU/Memory usage is constantly peaking due to repeated queries
  • Designing a new system expecting massive read throughput
  • Content rarely changes but reads happen constantly

When NOT to use

  • Before optimizing database queries (optimize first, cache second)
  • For data that changes frequently or is highly personalized
  • When consistency is more important than performance
  • As a quick fix for poor application architecture

Inputs required

  • Slow query logs or endpoint metrics
  • Cache infrastructure (Redis, Memcached)
  • Read/write patterns of the data
  • Acceptable staleness window (TTL)

Workflow

  1. Identify Bottlenecks: Profile APIs to find read-heavy, slow-changing data (user profiles, static config, product catalogs)
  2. Measure Access Patterns: How often is data read vs. written? How large? How old can it be?
  3. Select Strategy:
    • Cache-Aside: App checks cache; on miss, fetches DB, writes cache
    • Write-Through: App writes to cache and DB simultaneously
    • Write-Behind: App writes to cache only; batch updates to DB later (use cautiously)
  4. Set Eviction Policy: Assign Time-To-Live (TTL) values based on business tolerance for stale data
  5. Handle Invalidation: Implement cache invalidation logic on mutations (UPDATE/DELETE)
  6. Prevent Stampedes: Implement caching locks or staggered TTLs to prevent multiple clients fetching from DB simultaneously when a key expires
  7. Add Monitoring: Track cache hit rates, eviction rates, and staleness

Rules

  • MUST treat cache as ephemeral (can disappear at any time)
  • MUST NOT cache highly personalized or sensitive data (PII) in shared caches
  • MUST ALWAYS implement fallback to primary data store on cache failure
  • MUST set TTL values (no infinite cache)
  • MUST invalidate cache on mutations (UPDATE, DELETE operations)
  • MUST use separate caches for different data types/sensitivity levels
  • MUST NOT use cache as source of truth

Read the full file on GitHub · 201 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. 3d ago First seen · 201 lines · 15 tokens per session scan A a4e433ceaed1

Subscribe to this mod's changes

caching-strategies is a skill published in the GitHub repository KraitDev/skiLL.Md (7 stars, last pushed 2mo ago), licensed MIT. It adds 15 tokens to every session and 1,898 once invoked, about $0.0001 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-08-31.

Related

Other skills, from other repositories

sql-query-optimization

Diagnoses and optimises slow SQL queries using EXPLAIN ANALYZE. Covers identifying bottlenecks (sequential scans, bad estimates, heap fetches), index strategy, query rewrites, and verification. Invoked when the user asks to optimize a query, fix a slow database query, or improve database performance.

soulcodex/agentic · 70 tokens

cache_patterns

Instruction set for enabling and operating the Spring Cache abstraction in Spring Boot when implementing application-level caching for performance-sensitive workloads.

vuralserhat86/antigravity-agentic-skills · 26 tokens

cache_patterns

Instruction set for enabling and operating the Spring Cache abstraction in Spring Boot when implementing application-level caching for performance-sensitive workloads.

DonggangChen/antigravity-agentic-skills · 26 tokens

jira-operations

JIRA cache and performance operations. TRIGGERS: 'warm the cache', 'warm cache', 'cache status', 'clear cache', 'cache warm', 'cache for project', 'discover project', 'project discovery', 'cache hit rate', 'optimize performance', 'rate limit'. Use for JIRA API performance optimization and project context discovery.…

grandcamel/JIRA-Assistant-Skills · 104 tokens

nosql-database-design

Designs a NoSQL data model by leading with access pattern analysis. Covers DynamoDB single-table design (PK/SK/GSI) and MongoDB embedding vs referencing, consistency models, and capacity planning. Invoked when the user asks to design a DynamoDB schema, MongoDB data model, or NoSQL data model.

soulcodex/agentic · 71 tokens

relational-database-design

Designs or reviews a relational database schema for a given domain. Covers table structure, normalization, indexes, constraints, and migration strategy. Invoked when the user asks to design a schema, review a database structure, or optimize a data model.

soulcodex/agentic · 55 tokens