cache
Skill2 starsChanged 4 months agoMITView on GitHub
Add a caching layer to an expensive function, query, or endpoint — in-memory, Redis, or HTTP — with correct keys, TTL, and invalidation. Use when the user says "add caching", "cache this result", "memoize this", "cache the API response", "add a Redis cache", or "this is recomputed too often".
2 other projects use a version of this.
Adopted by
Most recently taken up by
- zedarvates/frugal-skillstheir own version, first seen Nov 8, 2026
- zedarvates/botte-secretetheir own version, first seen Aug 8, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- zedarvates/botte-secrete★ 2same name
- zedarvates/frugal-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository68 other files it gives its agents.
- a11ySkill
- api-docsSkill
- audit-logSkill
- benchmarkSkill
- bisectSkill
- changelogSkill
- cherry-pickSkill
- ci-setupSkill
- codeownersSkill
- commit-messageSkill
- connection-poolSkill
- contributingSkill
- coverageSkill
- db-migrateSkill
- dead-codeSkill
- debugSkill
- depsSkill
- diagramSkill
- dockerizeSkill
- docstringSkill
- e2eSkill
- env-exampleSkill
- error-handlingSkill
- explainSkill
- feature-flagSkill
- flaky-testSkill
- gitignoreSkill
- graceful-shutdownSkill
- graphqlSkill
- healthcheckSkill
- i18nSkill
- idempotencySkill
- licenseSkill
- lint-fixSkill
- loggingSkill
- migrateSkill
- mockSkill
- onboardSkill
- optimizeSkill
- paginationSkill
- pr-descriptionSkill
- pre-commitSkill
- profileSkill
- prune-branchesSkill
- rate-limitSkill
- readmeSkill
- rebaseSkill
- refactorSkill
- regexSkill
- releaseSkill
- resolve-conflictsSkill
- retrySkill
- review-diffSkill
- scaffoldSkill
- secrets-scanSkill
- security-headersSkill
- seedSkill
- soft-deleteSkill
- sqlSkill
- squashSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Add caching for the target in $ARGUMENTS.
- Distinctive: line 34
After adding, summarize what's cached, the key, the TTL/invalidation, the layer, and the staleness trade-off.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Caching infrastructure signals
!grep -rilE "redis|ioredis|memcached|node-cache|lru-cache|functools\\.lru_cache|cachetools|@cache" --include='*.*' package.json pyproject.toml 2>/dev/null | grep -vE 'node_modules|\.git' | head -8
Instructions
Add caching for the target in $ARGUMENTS. If it's unclear what's expensive or how fresh the data must be, ask before adding a cache — a wrong TTL or key serves stale or leaked data. Reuse the project's existing cache client/library.
Method
- Confirm it's worth caching. Caching fits expensive, frequently-repeated, read-heavy work whose inputs repeat and whose result tolerates some staleness. If the data must be exact and real-time, or writes dominate, say caching is the wrong tool here.
- Pick the layer for the need, preferring infra the project already has:
- In-process (memoization,
lru-cache,functools.lru_cache) — single instance, small/hot data, fine to lose on restart. - Shared (Redis/Memcached) — multi-instance, larger data, must be consistent across processes.
- HTTP (
Cache-Control/ETag) — cacheable GET responses, push caching to client/CDN.
- In-process (memoization,
- Build a correct key. Include every input the result depends on — args, the user/tenant for per-user data, locale, version. A key that omits an input serves one caller's data to another (a real security bug for per-user responses). Namespace keys to avoid collisions.
- Set TTL and invalidation deliberately. Choose a TTL from how stale the data may acceptably be. Where correctness matters, invalidate or update the entry on the write that changes the underlying data (write-through / explicit delete on mutation) rather than relying on TTL alone. State the staleness window you're accepting.
- Handle the edges: cache misses and cache-store failures must fall back to the source (fail open — a down cache shouldn't take down the feature); avoid caching errors/empties unintentionally; and be aware of stampedes on hot keys (consider a lock/single-flight for very hot entries).
Rules
- Key on every input the value depends on — especially user/tenant for per-user data. A missing key dimension serves wrong or another user's data; treat that as a correctness/security risk, not a tuning detail.
- Have an invalidation story, not just a TTL, whenever a write can change the cached value — and state the accepted staleness window.
- Reuse the project's cache client/config; use a shared store when the app runs multiple instances rather than a per-process cache that fragments.
- Fail open on cache-store errors and on misses — fall back to recomputation; never let the cache layer become a new single point of failure. Don't change the function's observable result, only its speed/freshness.
- After adding, summarize what's cached, the key, the TTL/invalidation, the layer, and the staleness trade-off.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

