Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Valkey Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-valkey-knowledge-patch)
---
name: valkey-knowledge-patch
description: Valkey
version: "9.2.1"
license: MIT
metadata:
author: Nevaberry
---
# Valkey compatibility guidance
Load this skill when writing Valkey commands or client integrations, changing
cluster or persistence configuration, investigating operational behavior, or
developing modules. Use the topic references for command details, release-specific
fixes, security patch selection, and examples.
## Reference index
| Reference | Topics |
| --- | --- |
| [Security and ACLs](references/security-and-acl.md) | Security fixes, database permissions, roles, ACL reloads, TLS |
| [Strings and transactions](references/strings-and-transactions.md) | Conditional writes and deletes, transactions, increments, TTLs |
| [Hashes and paths](references/hashes-and-paths.md) | Field expiration, retrieval and deletion, validation, Path Hash |
| [Collections and streams](references/collections-and-streams.md) | Sorted sets, lists, geospatial queries, consumer groups |
| [Cluster and databases](references/cluster-and-databases.md) | Numbered databases, scanning, routing, failover, Sentinel |
| [Slot migration](references/slot-migration.md) | Migration commands, status, cancellation, authentication, replication |
| [Persistence and replication](references/persistence-and-replication.md) | AOF recovery, RDB validation, forkless saves, compression, full sync |
| [Operations and observability](references/operations-and-observability.md) | RESP, logs, metrics, client limits, clocks, hot keys, configuration |
| [Modules and scripting](references/modules-and-scripting.md) | Scripting engines, module APIs, memory accounting, callbacks, loading |
| [Tools and builds](references/tools-and-build.md) | CLI endpoints, cluster operations, benchmarks, build requirements |
## Compatibility changes to check first
- RESP request fields must end in `\r\n`: 8.1.8 strictly validates delimiters,
and 9.0.5 rejects invalid CRLF terminators.
- In 8.1.9 and 9.0.5, the RESP3 `COMMAND INFO` subcommands field is an empty
Array for commands without subcommands. Older 8.1 releases returned an empty Set.
- In 9.0.6 and 9.1.2, `HPERSIST`, `HTTL`, `HPTTL`, `HEXPIRETIME`, and
`HPEXPIRETIME` require `FIELDS`. In 9.1.1, `HGETDEL` rejects missing or
misplaced `FIELDS`.
- `sanitize-dump-payload` is a no-op in 9.0.6 and 9.1.2; its associated ACL
flags are also no-ops in 9.1.2. These releases always validate listpacks on
RDB load and `RESTORE` and reject malformed stream payloads.
- In 9.2, `OBJECT ENCODING` reports `btree` for large sorted sets in place of
`skiplist`. Update monitoring or tests that inspect the encoding name.
- In 9.2, `ZRANGEBYSCORE`, `ZREVRANGEBYSCORE`, `ZCOUNT`, and `ZRANGESTORE`
reject an empty score bound or a bare `(`. Use `0` or `(0` for zero bounds.
- Valkey 9.0 restores the usage recommendation for 25 previously deprecated
commands as part of its API compatibility policy.
The 8.0.8 tag was revoked because it pointed outside the 8.0 release branch.
Upgrade from 8.0.7 directly to 8.0.9 or later for the intended security fixes.
The security reference records the separate fixes and patch requirements for
client eviction with `maxmemory-clients`, cluster Pub/Sub, RDMA, and Lua.
## Conditional string changes and transactions
In 8.1.0, `SET` with `IFEQ` writes only when the current value equals the
comparison value. With `GET`, it returns the previous value regardless of whether
the comparison succeeds.
```text
SET mode off
SET mode on IFEQ off GET
```
In 9.2, `SET mode standby IFNE maintenance` writes only on a mismatch.
`DELEX mode IFEQ standby` deletes a matching string; `DELEX` also accepts `IFNE`.
In 9.0.0, `DELIFEQ key value` returns `1` on deletion, `0` for a missing key or
different string, and `WRONGTYPE` for a non-string key. Pass the original
acquisition token when releasing a lock.
In 9.2, `EXEC` accepts `IFEQ`, `IFNE`, `NX`, and `XX` conditions to check values
or key existence at execution time without a preceding `WATCH`.
In 9.1.0, `MSETEX` writes all pairs atomically. `NX` requires every key to be
absent; `XX` requires every key to exist. The reply is `1` when all writes succeed
or `0` when the condition fails and no keys are written.
```text
MSETEX 2 {session}:a user:1 {session}:b user:2 NX EX 3600
```
In 9.2, `INCREX` combines an integer or float increment with expiration control
and supports `NX` and `XX`. `LBOUND` and `UBOUND` set bounds; `SATURATE` clamps
the result. `ENX` and `PERSIST` control expiration.
## Hash-field expiration and paths
Valkey 9.0 supports the Redis 8.0 hash field expiration API, including through
GLIDE 2.1.0. Use `hexpire` for TTLs in seconds, `httl` for remaining seconds,
and `hexpiretime` for Unix expiration timestamps in seconds, one result per field.
`HSETEX` writes and sets a field TTL in one call; `HGETEX` reads and refreshes
it. In GLIDE, both accept `expiry`, such as
`ExpirySet(ExpiryType.MILLSEC, 60_000)` for a 60-second lifetime.
For `HGETEX`, put at most one expiration option before
`FIELDS <count> <field> ...`: `EX`/`PX` are relative seconds/milliseconds,
`EXAT`/`PXAT` are Unix times in the same units, and `PERSIST` clears TTLs.
Without an option it behaves like `HMGET`; replies follow field order.
A zero relative TTL or past absolute timestamp returns the values and immediately
removes those fields.
```text
HSET session:42 token abc
HGETEX session:42 PX 0 FIELDS 1 token
```
Background expiration removes expired hash fields; a field can remain readable
after its TTL elapses until that job removes it. In 9.0.6 and 9.1.2, `HGETEX`
requires ACL write permission on the hash key itself.
In 9.1.0, `HGETDEL key FIELDS count field [field ...]` atomically returns and
deletes the requested fields. The hash reference covers conditional writes,
expired-field reads, and keys named `fields`.
In 9.2, Path Hash stores fields at binary-safe paths. `PHSCAN` scans one exact
path; `PHPATHSCAN` traverses paths incrementally in order. `PHPREFIXES` returns
matching prefixes longest first with pagination and supports `EXCLUDESELF`.
`PHPATHDEL routes /eu WITHSUBPATHS` deletes a subtree and returns its path count.
## Cluster databases and scanning
In Valkey 9.0, `SELECT` supports numbered databases in cluster mode. The same key
name can hold different values in different databases, and all instances map to
the same hash slot. Databases share cluster resources.
`FLUSHDB`, `SCAN`, and `DBSIZE` operate on the selected database on the connected
node. For cluster-wide work, select the same database on each primary and run the
command on each, maintaining a separate `SCAN` cursor per primary.
Use a cluster client that supports nonzero databases and selects the intended
database on its node connections. `SELECT` state can carry between callers on
pooled or multiplexed connections.
In 9.2, `MOVE leaderboard 5 REPLACE` atomically moves the selected database's
key and overwrites an existing destination key in database 5.
In 9.1.0, `CLUSTERSCAN` returns `[next-cursor, keys]`. Start with `0`, pass each
cursor back verbatim, route continuations by the cursor's hash tag, and stop only
when the cursor returns `0`, even after an empty intermediate page.
For single-slot scans, keep the same `SLOT` on each call.
Follow `MOVED` with the same cursor. Use the same `hash-seed` on every node to
keep cursors compatible across migrations and failovers. Duplicates are possible.
## Atomic slot migration
Run `CLUSTER MIGRATESLOTS` on the source primary. Repeat
`SLOTSRANGE <start> <end> NODE <target-node-id>` to queue multiple migrations.
```text
CLUSTER MIGRATESLOTS SLOTSRANGE 0 99 NODE <target-a-id> SLOTSRANGE 200 299 NODE <target-b-id>
```
The source serves the slots while the target catches up, then briefly pauses
mutations before transferring ownership atomically. Same-slot multi-key commands
avoid migration-related retry errors, and clients avoid `ASK` during the copy.
`CLUSTER CANCELSLOTMIGRATIONS` cancels all ongoing migrations originating on the
receiving node. Cancellation or failure automatically discards staged data.
`CLUSTER GETSLOTMIGRATIONS` reports active and recently completed jobs.
Only `success`, `failed`, and `cancelled` are terminal states. The log stays in
memory and clears on restart; active jobs remain visible even above
`cluster-slot-migration-log-max-len`.
In 9.2, add `AUTH username password` to a target's `NODE` clause to authenticate;
the slow log and `MONITOR` redact these credentials. The migration reference
details status fields, numbered databases, replication, and failover limits.
## ACLs and stream consumer groups
In 9.1.0, `db=0,1` restricts an ACL user's command and key permissions to
databases 0 and 1; authenticated `SELECT 2` returns `NOPERM`.
In 9.2, manage roles with `ACL SETROLE`, `ACL GETROLE`, `ACL ROLES`, and
`ACL DELROLE`. Assign an existing role with `ACL SETUSER reader role:profile-read`.
Run `ACL DIGEST` after `ACL LOAD` to fingerprint effective rules, including roles.
In 9.2, `XACKDEL` acknowledges and deletes stream entries; `XDELEX` deletes them.
Both offer `KEEPREF`, `DELREF`, and `ACKED`; `ACKED` requires acknowledgment by
all groups before deletion. With `KEEPREF`, `XACKDEL` returns `1` for acknowledging
an entry even if its stream message has already been deleted.
## Persistence and replication configuration
In 9.2, prefer background-thread snapshots for RDB saves and disk-based or
diskless full syncs with:
```conf
forkless-infrastructure-enabled yes
forkless-policy prefer-forkless
```
The policy also accepts `require-fork`. Inspect method and progress with
`INFO persistence`; `forkless_estimated_seconds_remaining` covers diskless full
sync, and `forkless_fallbacks_*` counters are under `INFO debug`.
`rdbcompression` controls the on-disk RDB format and defaults to per-string LZF.
In 9.2, `rdbcompression lz4` selects whole-stream compression; Zstd is another
streaming codec. Set `repl-compression` independently for the replication wire
format, including full sync. Capability negotiation allows uncompressed transfer
to replicas without compression support.
In 9.2, active key and hash-field expiration counts toward `save` change
thresholds and can trigger more frequent background saves.
In 9.2.1, a replica aborts and resynchronizes if the primary link breaks while
it applies buffered data during dual-channel replication.
## Operations and module development
In 8.1.0, `log-format logfmt` enables structured logs; `log-timestamp-format`
independently accepts `iso8601` or `milliseconds`. Both settings default to
`legacy`. In 9.1.0, `log-format json` emits one JSON object per line.
In 9.2, `hotkeys-top-k 10` enables hot-key tracking; inspect it with `HOTKEYS GET`
and clear it with `HOTKEYS RESET`. `CONFIG INFO maxmemory` exposes configuration
metadata. `maxclients-reserved` reserves connections for prioritized clients from
`priority-subnets`; normal clients are limited to `maxclients` minus that count.
In 9.2, `maxmemory-scripts` limits cached `EVAL` script memory; `SCRIPT LOAD` is
subject to global `maxmemory`. `CONFIG REWRITE` preserves module load order so
dependencies still load first. `MODULE LOAD` is rejected during async replication
loading or atomic slot migration.
Use the module reference for callback time limits and resumable cursors, borrowed
scans, external memory accounting, write pauses, and scripting-engine changes.