/be:redisfrom Backend Skills
Server code that touches Redis (Upstash by default) — one client with a short timeout and few retries, key builders and the `domain:action` grammar, a TTL on every key, a failure direction per primitive with timeouts counted as failures, read-through caches with group invalidation and a schema check on every hit, locks sized above the work, short first-seen claims released on failure, eviction policy, what never lives in Redis, and a fake that fails on demand. Use when adding a cache, lock, claim or any Redis key.
Ships in Backend Skills. 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.
Read when SKILL.md points to them.
Redis coordinates and accelerates; it never owns. Every key comes from a named builder, every key expires, and every primitive states what happens when Redis is down. Losing the whole instance must cost slower requests and a few retries, never data.
Before applying this skill, read the project's root AGENTS.md, the AGENTS.md closest to the files in question, and any doc they link for this skill's topic. Names, values and choices — budgets, tiers, tokens, voice, paths — come from those files, never from this skill.
clients/ kind, from the validated env (env); never a second one per request or helper. Server-only: its token reads and writes the whole database, so it's never logged, echoed in an error or bundled for a browser.mget over many gets, enableAutoPipelining so concurrent commands share a request, an explicit pipeline for a fixed batch. An awaited command inside a loop is a bug. (Over TCP with ioredis, a command is sub-millisecond and the concern becomes connection reuse.)signal: () => AbortSignal.timeout(…), a few hundred milliseconds) and one or two retries. The signal must be the function form: given a plain AbortSignal, the SDK treats an aborted request as a null result rather than an error, and once that signal has fired every later command returns null silently.TimeoutError or network failure is transient; an UpstashError from a bad command (WRONGTYPE, wrong arguments) is a bug that no retry fixes. Its message includes the command sent.set writes JSON and get<T> parses it. Never JSON.stringify a value yourself, and never let two writers of one key use different codecs.domain:action, general to specific: cache:plans:active, lock:order-checkout:<orderId>, claim:payout:<payoutId>.encodeURIComponent), so a value containing : can't forge another namespace's key.| Prefix | Holds | Default TTL | When Redis fails |
|---|---|---|---|
cache: | read-through copies of data stored elsewhere | per call site, by staleness | open — read the source |
lock: | a lock on a critical section | 2–3× the work's p99 | closed — the work doesn't start |
claim: | a first-seen claim on work that mustn't repeat | the work's worst duration | closed — refuse, the caller retries |
rl: | rate-limit counters and lockouts | the window | per tier — rate-limiting |
lb: | leaderboards and other derived sorted data | none, trimmed by a job | open — rebuild from the source |
ex, px, exat or pxat on the write itself, never a second expire call that a crash can skip.REDIS_TTL.MINUTE, .HOUR, .DAY), never inline numbers; a TTL that contradicts its purpose is a bug.try, and any failure falls back to the source: an outage makes a request slower, never a 5xx.rate-limiting).cached(namespace, key, ttl, fetcher, schema) — and the TTL chosen per call site by how stale the caller can bear.Date or a Firestore Timestamp. Store the wire form (schemas-and-contracts).cache:events:g7:<eventId>), and bumping it with INCR retires the whole group at once — never SCAN and delete on a request path. The old keys expire on their own. The generation key itself has no TTL — losing it would resurrect stale entries — so it carries a comment saying it's one small integer per group, bounded by the number of groups.auth).nextjs); Redis is for what the API shares across instances and non-framework callers. Never both for the same data.set(key, token, { nx: true, ex }) with a fresh random token. A check followed by a set is a race, not a lock.get then del can delete the next holder's lock if yours expired between the two.INCR taken at acquire, which the store checks on every write).set(claimKey, "1", { nx: true, ex }) succeeds for the first caller only; everyone after gets "already handled".del), so the retry runs instead of being skipped as a duplicate.api-architecture).Idempotency-Key header and replays the stored response for the same key; that record lives in the database beside the resource, not in Redis.auth puts them here; they're state Redis owns and fail closed.noeviction; only a cache-only database may run allkeys-lru. Keep the cache bounded by TTLs, and give it its own database once it dominates memory.rl: keys appear" is the signature of an app pointed at another tier's database.A fake client that behaves like Redis in memory, and that a test can make fail or time out on the next command (testing). Every primitive has a test proving its direction: a cache that serves the source when Redis fails, a lock and a claim that refuse, a claim released when the work throws.
Code for the client, keys, cache, lock and claim is in references/patterns.md.
signal as a function.SCAN on a request path; share a database across tiers.Rate limits, lockouts and the client IP rate-limiting · where a lock or claim sits in a route, and webhook records api-architecture · framework caching nextjs · cached values' schemas schemas-and-contracts · flags on this cache tier feature-flags · the fake client testing · env and credentials env · the SDK upstash-redis-js (official) · the audit redis-audit.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub timonwa/engineering-skills --plugin be22 skills in this plugin
/access-controlAccess control for a Next.js API on Firebase — roles, relationships and attributes (RBAC, ReBAC, ABAC) behind permission verbs and one pure can(); guards as the only gate, 404 before 403; tenant scoping; invitations; escalation limits; two-person approval and access reviews; stale claims; API-key scopes; share links and passcodes; where plan and flag checks sit; UI gates that only hide; and tests. Use when adding a permission, role, guarded route, API key, share link, or a control only some people see./access-control-auditManually invoked. Access-control audit — guards on every route and Server Action (BFLA), 404 before 403 and tenant scoping (BOLA), allowlisted writes and projected reads (BOPLA), verbs never role names, roles that add up, escalation and invitations, claims and revocation, sessions and sign-in, API keys and share links, the plan and flag order, UI gates, data rules and the tests. Verifies each finding and writes a prioritised report./api-architectureHow an API route is built in a Next.js API — the fixed order of rate limit, authorise, validate, delegate, audit, respond; thin routes over services; the response envelope and typed errors; caching headers; concurrent edits; long-running work; cursor pagination and allowlisted sorts; resource paths, versions, deprecation and state-transition sub-routes; and what every new route ships with. Cron, webhooks and audit logs are references. Use when adding, changing or reviewing a route handler or the API layer's structure.Other plugins' skills for the same job