/superskills:cache-strategyfrom Superskills
Implements a permanent cache-first strategy with no TTL: read from cache, fall back to DB on miss, invalidate only on data mutation. Detects existing cache infrastructure and identifies high-value cache candidates.
Ships in Superskills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Implement a permanent cache-first strategy: read from cache, fall back to DB on miss, write to cache, invalidate only on data mutation. No expiry timers — the cache stays valid until the underlying data changes.
The goal is one DB read per data item, ever (until it changes):
READ: cache hit? → return cached value
cache miss? → query DB → write to cache → return value
WRITE: update DB → invalidate (or update) cache entry → done
This is the Play Framework model: no TTL, no polling, no background refresh. The cache is always warm and always correct because it is invalidated precisely when the source changes.
Why permanent over TTL?
# Check for Redis
grep -rn "redis\|Redis\|REDIS_URL" --include="*.json" --include="*.env*" --include="*.yml" --include="*.yaml" --include="*.rb" --include="*.py" --include="*.js" --include="*.ts" . 2>/dev/null | grep -v node_modules | head -10
# Check for Memcached
grep -rn "memcached\|Memcached\|MEMCACHE" --include="*.json" --include="*.env*" --include="*.yml" . 2>/dev/null | grep -v node_modules | head -5
# Check for in-process cache (node-cache, lru-cache, etc.)
grep -rn "lru-cache\|node-cache\|memory-cache\|caffeine\|guava.*cache" --include="*.json" --include="*.js" --include="*.ts" --include="*.java" . 2>/dev/null | grep -v node_modules | head -5
Report what's available. If no cache layer exists, recommend Redis as the default and offer to add the client library.
Scan for DB query patterns and classify by cacheability:
High-value cache candidates (read often, change rarely):
Poor cache candidates (skip these):
# Find the most-called query patterns
grep -rn "\.find\b\|\.findById\|\.findOne\|\.where\|SELECT" \
--include="*.rb" --include="*.py" --include="*.js" --include="*.ts" \
. 2>/dev/null | grep -v node_modules | grep -v test | grep -v spec | head -30
For each candidate, note:
user:{id}, product:{slug})For each cacheable read, apply this pattern:
async function getUser(id: string) {
const cacheKey = `user:${id}`;
const cached = await redis.get(cacheKey);
if (cached) return JSON.parse(cached);
const user = await db.users.findById(id);
await redis.set(cacheKey, JSON.stringify(user)); // no TTL — permanent until invalidated
return user;
}
def find_user(id)
Rails.cache.fetch("user:#{id}") do
User.find(id) # only called on cache miss
end
end
def get_user(user_id: int):
cache_key = f"user:{user_id}"
cached = redis_client.get(cache_key)
if cached:
return json.loads(cached)
user = db.session.get(User, user_id)
redis_client.set(cache_key, json.dumps(user.to_dict())) # no expiry
return user
def getUser(id: Long): Future[User] = {
cache.getOrElseUpdate(s"user:$id") {
userRepository.findById(id)
}
}
For every place that mutates cached data, add invalidation immediately after the DB write succeeds:
async function updateUser(id: string, data: Partial<User>) {
const user = await db.users.update(id, data);
await redis.del(`user:${id}`); // invalidate on change
return user;
}
def update_user(id, attrs)
user = User.find(id).tap { |u| u.update!(attrs) }
Rails.cache.delete("user:#{id}")
user
end
Important: invalidate on delete too:
async function deleteUser(id: string) {
await db.users.delete(id);
await redis.del(`user:${id}`);
}
For lists/collections, invalidate the collection key when any item in it changes:
await redis.del(`user:${id}`); // the specific item
await redis.del(`users:list`); // any cached list that included this item
Use a consistent key naming scheme across the codebase:
<entity>:<identifier> → user:123, product:slug-name
<entity>:list:<filter> → products:list:category-5
<entity>:<id>:<relation> → user:123:orders
aggregate:<entity>:<filter> → aggregate:orders:user-123-total
Document the convention in a comment at the top of your cache module:
// Cache key conventions:
// user:{id} — single user record
// users:list — paginated user list (invalidate on any user change)
// user:{id}:orders — orders belonging to a user
For critical data that must never have a cold-start miss, add a warm-up step on app boot:
async function warmCache() {
const activeUsers = await db.users.findActiveUsers();
await Promise.all(
activeUsers.map(u => redis.set(`user:${u.id}`, JSON.stringify(u)))
);
}
Report what was implemented:
## Cache Strategy Applied
### Cache layer: Redis (permanent, no TTL)
### Reads cached (X total)
- user:{id} — UserService.getUser()
- product:{slug} — ProductService.findBySlug()
- ...
### Invalidation points added (Y total)
- user:{id} — UserService.updateUser(), UserService.deleteUser()
- product:{slug} — ProductService.updateProduct()
- ...
### Estimated DB load reduction
Before: ~X DB queries/min
After: ~Y DB queries/min (first-read only, then cache)
Note: for data that comes from third-party APIs or sources where you can't intercept writes, use a long TTL (hours, not minutes) as a fallback — but flag these separately so they can be revisited if an invalidation webhook becomes available.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub ariadoss/superskills --plugin superskills48 skills in this plugin
/a11yAccessibility audit for frontend changes — WCAG 2.2 AA, screen-reader
compatibility, keyboard navigation, focus management, ARIA correctness, color
contrast, and reduced-motion. Static diff-scoped analysis (safe to auto-run) plus
an optional dynamic axe pass against a running app. Use when asked to "check
accessibility", "a11y audit", "screen reader check", "WCAG", "is this
accessible", "keyboard navigation", "ARIA review", or after heavy frontend work.
/articleExtract clean article content from URLs (blog posts, articles, tutorials) and save as readable text. Use when user wants to download, extract, or save an article/blog post from a URL without ads, navigation, or clutter./basic-reviewRead-only correctness review of pending changes, needing no external
install: correctness, security, reliability/performance and contract risk,
each finding cited as file:line with why it is wrong and a fix. The fallback
when gstack's /review is unavailable (not installed, or its install is
broken); /qa-full and /daily-qa call it automatically then. Applies a
vendored copy of gstack's pre-landing checklist. Use when asked for
a "basic review", a "quick review without gstack", or a review in a tool where
/review is missing. Not for quality cleanups (use /clean-code), and not the
first choice when /review is installed: /review goes deeper and applies fixes.
Other plugins' skills for the same job