Skip to main content
skill CX Codex

valkey — Claude Code skill: features and installation

This skill guides Valkey setup for caching, rate limits, queues, and Redis migration. Use it when choosing data patterns or configuring a Docker Compose service.

MIT 142 installs ★ 29 updated 2026-08-17

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add oakoss/agent-skills --skill valkey -a claude-code
Open on GitHub

What valkey does

The skill covers Valkey patterns for caches, sessions, rate limiting, distributed locks, queues, and leaderboards. It distinguishes Pub/Sub, where messages are not retained, from Streams, which support consumer groups and replay. It also advises on TTLs, eviction policies, and command choices.

Other guidance covers Docker, AOF and RDB persistence, authentication, and moving from Redis. Valkey is not presented as a relational database replacement; values above 512 MB and multi-key ACID transactions without Lua are listed as poor fits. In production, leaving maxmemory and the eviction policy unset can lead to memory exhaustion.

What it helps with

  • set cache keys with TTL and an eviction policy
  • apply rate limits with counters or sorted sets
  • build a queue with processing acknowledgements
  • choose Pub/Sub or Streams for message delivery
  • plan a Redis-to-Valkey migration

Example prompts for the agent

  • Configure Valkey caching for this project and give cache keys a TTL.
  • Compare a list-based queue with Streams consumer groups for this workload.
  • Draft a Redis-to-Valkey migration plan that accounts for RDB and AOF.

How to install valkey

1Skills CLI (Vercel)

npx skills add oakoss/agent-skills --skill valkey -a claude-code

2Manually: put the files in place

~/.claude/skills/valkey/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/valkey/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about valkey

How do I install valkey in Claude Code?

Run npx skills add oakoss/agent-skills --skill valkey -a claude-code. The skill file is placed at ~/.claude/skills/valkey/SKILL.md.

What does the valkey skill do?

It helps choose Valkey commands and patterns for caching, sessions, queues, locks, and related workloads. It also covers Docker, persistence, and Redis migration.

When should I use Streams instead of Pub/Sub?

Pub/Sub does not retain messages. The skill recommends Streams when a queue needs consumer groups and replayable messages.

Source text

SKILL.md · MIT
---
name: valkey
description: 'Valkey (Redis-compatible) in-memory data store for caching, session storage, pub/sub, queues, and distributed locks. Use when configuring Valkey or Redis-compatible caching, choosing eviction policies, implementing rate limiting, setting up pub/sub or streams, writing Docker Compose services, migrating from Redis, or tuning performance. Use for valkey, redis, cache, session, pub/sub, streams, distributed-lock, rate-limit, sorted-set.'
license: MIT
metadata:
  author: oakoss
  version: '1.0'
  source: 'https://valkey.io/commands/'
user-invocable: false
---

# Valkey

Open-source, Redis-compatible in-memory data store maintained by the Linux Foundation. Forked from Redis OSS 7.2.4 (BSD 3-Clause license). Drop-in replacement for Redis OSS 2.x through 7.2.x — same protocol, commands, and data formats.

**When to use**: Caching, session storage, rate limiting, pub/sub messaging, task queues, leaderboards, distributed locks, real-time counters, or any workload requiring sub-millisecond key-value operations.

**When NOT to use**: Primary relational data store, large object storage (>512 MB values), workloads requiring strong ACID transactions across multiple keys without Lua scripting.

## Quick Reference

| Task               | Approach                                                 | Key Point                               |
| ------------------ | -------------------------------------------------------- | --------------------------------------- |
| Cache-aside        | `GET` -> miss -> DB read -> `SET key val EX ttl`         | Always set a TTL, even a long one       |
| Session storage    | `HSET session:{id} field val` + `EXPIRE`                 | Sliding TTL on each request             |
| Rate limiting      | `INCR` + `EXPIRE` (fixed window) or sorted set (sliding) | Sorted set for precision                |
| Distributed lock   | `SET lock:{res} token NX PX 30000`                       | Always set expiry to prevent deadlocks  |
| Queue (simple)     | `LPUSH` + `BRPOP`                                        | Blocking pop with timeout               |
| Queue (reliable)   | Streams + `XGROUP` + `XACK`                              | Consumer groups for at-least-once       |
| Pub/Sub            | `SUBSCRIBE` / `PUBLISH`                                  | Fire-and-forget, no persistence         |
| Streams            | `XADD` + `XREADGROUP`                                    | Persistent, replayable, consumer groups |
| Leaderboard        | Sorted set: `ZADD` / `ZREVRANGE`                         | O(log N) rank operations                |
| Unique count       | `PFADD` + `PFCOUNT` (HyperLogLog)                        | ~12 KB memory, 0.81% error              |
| Eviction policy    | `maxmemory-policy allkeys-lru`                           | Best default for most workloads         |
| Docker setup       | `valkey/valkey:8.1-alpine`                               | Health check: `valkey-cli ping`         |
| Persistence        | AOF (`appendonly yes`) + RDB snapshots                   | AOF for durability, RDB for backups     |
| Client library     | `ioredis` or `iovalkey` (official fork)                  | All Redis clients work unchanged        |
| Migrate from Redis | Swap binary, keep data files                             | RDB/AOF compatible through Redis 7.2    |

## Common Mistakes

| Mistake                                | Correct Pattern                                  |
| -------------------------------------- | ------------------------------------------------ |
| Using `KEYS *` in production           | Use `SCAN` with cursor for iteration             |
| No TTL on cache keys                   | Always set TTL — unbounded growth causes OOM     |
| `DEL` on large keys blocking server    | Use `UNLINK` for async deletion                  |
| Pub/Sub for durable messaging          | Use Streams with consumer groups for persistence |
| Same TTL on all keys (thundering herd) | Add jitter: `EX (base + random(0, spread))`      |
| No `maxmemory` set in production       | Set `maxmemory` + eviction policy explicitly     |
| Using `MULTI/EXEC` for locking         | Use `SET ... NX PX` for distributed locks        |
| Storing large blobs (>1 MB values)     | Store references; keep values small              |
| No health check in Docker Compose      | Add `valkey-cli ping` health check               |
| Ignoring `requirepass` in production   | Always set authentication + ACLs                 |

## Delegation

- **Discover caching patterns and data model review**: Use `Explore` agent
- **Plan migration strategy from Redis to Valkey**: Use `Plan` agent
- **Implement full caching layer with tests**: Use `Task` agent

> If the `docker` skill is available, delegate Compose networking and multi-stage build patterns to it.
> If the `performance-optimizer` skill is available, delegate application-level caching strategy to it.
> If the `database-security` skill is available, delegate ACL and TLS configuration review to it.

## References

- [Data structures and commands](references/data-structures.md) -- Strings, hashes, lists, sets, sorted sets, streams, HyperLogLog, bitmaps, geospatial
- [Caching patterns](references/caching-patterns.md) -- Cache-aside, write-through, TTL strategies, eviction policies, client-side caching, invalidation
- [Common patterns](references/common-patterns.md) -- Rate limiting, distributed locks, queues, session storage, pub/sub, streams, leaderboards
- [Docker and deployment](references/docker-and-deployment.md) -- Compose setup, persistence, replication, Sentinel, Cluster, security, migration from Redis

© oakoss · MIT · oakoss/agent-skills

Similar skills

All skills for Data and databases →

From the same set106

The whole set →
docker Skill for building Docker images, configuring Compose stacks, and preparing containers for production. CX Codex +1 145installs chrome-devtools chrome-devtools is a Claude Code skill that controls a real Chrome session through an extension or DevTools MCP to fill forms, inspect pages, and debug web apps. It works with an existing browser session. CX Codex +1 145installs hydration-guardian hydration-guardian finds where server-rendered HTML and the client React tree disagree, then points to the pattern that fixes it. CX Codex +1 144installs e2e-testing e2e-testing guides AI coding assistants on Playwright E2E test suite architecture, Page Object Models, network mocking, and CI sharding strategies. CX Codex +1 142installs remotion A rulebook for Remotion: your agent builds video out of React components and keeps animation tied to the timeline instead of CSS. CX Codex +1 141installs vite A skill for Vite work: config file, plugins, dev server, build output, SSR and env variables. Useful when the agent edits vite.config.ts in your project. CX Codex +1 138installs postgres-tuning postgres-tuning — a skill for Claude Code, Codex, Cursor and other agents that provides PostgreSQL 17/18+ performance tuning guidance. Covers async I/O, query plan forensics, index strategy, autovacuum, pgvector, and connection pooling. CX Codex +1 136installs tanstack-db Get guidance on TanStack DB collections, live queries, and optimistic writes. Useful when a UI needs reactive local data or explicit sync with a backend. CX Codex +1 136installs

Project sponsors

Companies that keep this analytics open