summarize-database
Skill6.2k starsChanged 3 days agoMITView on GitHub
Profile/summarize a live Redis (RESP) database by sampling — discover key patterns, where data lives by count and by size, and what the values actually are (counters, JSON, XML, blobs, text). Use when asked to summarize, profile, analyze, audit, or characterize a Redis/Valkey/RESP database or its keyspace, understand key naming patterns, or find where memory/data is concentrated.
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 0 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Read-only only: Never run a command that writes, deletes, expires, or reconfigures.
- Very specific: line 20
Prefer a replica for the analysis load: Run INFO replication to read the topology, then:
- Very specific: line 21
If connected to a primary that has replicas (role:master, connected_slaves > 0, with slaveN:ip=…,port=… lines), suggest the user re-point …
- Very specific: line 23
Never blindly read a value of unknown size: Check the size command first.
- Very specific: line 30
Prefer resp-cli (the user's tool.
- Very specific: line 55
Cluster: if INFO/CLUSTER INFO shows cluster mode, DBSIZE/RANDOMKEY/SCAN are per-node.
- Very specific: line 88
Keep low-cardinality, stable segments literal (users, orders, cache, session).
- Very specific: line 94
Strings: use STRLEN, then GETRANGE key 0 200 to peek (never a bare GET on a large/unknown value).
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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
Summarize a database
Builds a statistical profile of a live, often production RESP database by sampling a fraction of the keyspace. The output answers three questions:
- (a) Key patterns — tokenize keys so
users:1243:ordersandusers:543:orderscollapse tousers:{id}:orders, and report the patterns by volume. - (b) Where the data is — which patterns/types hold the bulk, reported separately by count and by size (they often disagree: many tiny keys vs. a few huge ones).
- (c) What the values are — numeric counters, JSON, XML, base64/binary blobs, or plain text.
This is a read-only, sampling analysis. You are pointed at someone's real data; correctness and not harming the server matter more than completeness.
Hard safety rules (do not violate)
- Read-only only. Never run a command that writes, deletes, expires, or reconfigures. No
FLUSHALL/FLUSHDB,DEL,SET,CONFIG SET,DEBUG RELOAD, etc. - Never
KEYS(orKEYS *) — it blocks the server for the full scan on a large keyspace. Sample withRANDOMKEY; only useSCAN(cursored, withCOUNT) if you deliberately need coverage, neverKEYS. - Prefer a replica for the analysis load. Run
INFO replicationto read the topology, then:- If connected to a primary that has replicas (
role:master,connected_slaves > 0, withslaveN:ip=…,port=…lines), suggest the user re-point at one of those replicas —SCAN/MEMORY USAGE/value reads then land on a replica instead of the production primary. - If already on a replica (
role:slave/replica), stay there — do not suggest switching to its primary/master, even thoughmaster_host/master_portare visible. Moving "up" to the primary would push the load onto production, the opposite of the goal. (A replica may lag slightly, so note the profile reflects near-current, not necessarily live, state.)
- If connected to a primary that has replicas (
- Never blindly read a value of unknown size. Check the size command first; peek with
GETRANGE key 0 N, never a bareGETon an unknown key. - Bound the expensive calls —
MEMORY USAGE key SAMPLES <small>, and respect the sample cap below. - Confirm the target before connecting — echo back host/port/db (and whether it's a replica) so the user can stop you hitting the wrong server. Also confirm you're authorized to query this (possibly production) system at all, not just that the address is right.
- Value contents are confidential — get explicit consent before reading them. Key names are read by necessity — they're the basis of the pattern analysis, so they're treated as probative and acceptable to surface. Values are not: the content-classification phase (step 4) pulls real data into the agent's context, which leaves the machine (sent to the model, possibly logged) and may contain PII, secrets, or tokens. Ask before running step 4. If the user declines, produce a structure-only summary (steps 0–3 + 5: patterns, types, sizes, TTL) and skip value sampling. Even with consent, don't sample obviously-sensitive namespaces (keys matching
*token*/*secret*/*password*/*session*) unless the user opts in for those specifically.
Tooling
Prefer resp-cli (the user's tool; transparent about the wire protocol); fall back to redis-cli if resp-cli is missing or lacks a command — and say so rather than silently switching. Key facts:
resp-cli [cmd args] -h <host> -p <port> [-a <pass>] [-n <db>] [--tls] [-3]runs one command per process.-r Nrepeats a command N times — soresp-cli -r 200 randomkeyis a clean random sampler.resp-clihas no--scan/--bigkeys/--memkeysmode.redis-clidoes, and supports stdin pipelining, which matters for the probe phase (see Performance).- Never put the password on the command line.
-a <pass>leaks via the process list (ps, visible to other local users), shell history, and this transcript. Use the auth env vars instead —RESPCLI_AUTH(resp-cli) /REDISCLI_AUTH(redis-cli) — and--user <name>for an ACL username. Use--tlsfor in-transit encryption; never disable certificate validation (--insecure/--trust) just to make a connection succeed.
Server compatibility (Garnet & other non-Redis RESP servers)
The target may be a RESP-compatible server rather than stock Redis (this library explicitly supports Garnet, Valkey, etc.). Garnet in particular advertises a Redis version via HELLO (e.g. redis_version:7.4.3) but exposes a garnet_version field and does not implement every command. Detect the real server early with HELLO, and don't trust the redis_version string alone — redis_mode/version can look like Redis while commands are missing.
Observed on Garnet 2.0.1 (adapt rather than fail):
RANDOMKEYis unavailable (ERR unknown command) — so the default sampler doesn't work. Fall back toSCAN(cursored,COUNT) for sampling. For a small keyspace, a fullSCANenumeration is exact, cheap, and better than sampling — do that and report 100% coverage instead of extrapolating. On a large keyspace whereRANDOMKEYis missing and full enumeration is impractical there is no cheap unbiased sampler: a partialSCANreturns keys in hash-bucket order, so stopping early biases the sample. Either runSCANacross the full cursor (capping the per-key probing, not the scan itself) and sample from what you collect, or accept a partial-SCANsample and state the bias in the report.OBJECT ENCODING(andOBJECT HELP) are unavailable — you can't report internal encoding; omit that column and note it as unavailable.INFO keyspacemay be empty even whenDBSIZE> 0 — rely onDBSIZEfor the key count.- Still available and used as normal:
SCAN,TYPE,MEMORY USAGE,TTL, the O(1) size commands (HLEN/SCARD/…), andHGETALL/HRANDFIELD/LRANGE/etc. for content.
The same "detect, then degrade gracefully and say which probes were unavailable" approach applies to any RESP server that under-implements the command set.
Procedure
0. Scope & connect
HELLO (identify the real server — watch for garnet_version or other non-Redis markers; see Server compatibility), then INFO server, INFO keyspace, INFO memory, INFO replication, and DBSIZE. Note the server/RESP version, total key count, used memory, and whether a replica is available.
Cluster: if INFO/CLUSTER INFO shows cluster mode, DBSIZE/RANDOMKEY/SCAN are per-node. Either iterate each master node (sample and sum), or clearly state the summary is for the single node you connected to. Don't present one node's numbers as the whole cluster.
1. Choose the sample size
Default sample = min(5% of DBSIZE, cap), where the cap defaults to ~2,000 keys. Both the fraction and the cap are user-overridable — accept e.g. "sample 10%" or "up to 20000 keys" or "sample exactly 500". Report the actual sample size and what fraction of the DB it represents, since all extrapolations depend on it.
Draw keys with resp-cli -r <N> randomkey. RANDOMKEY samples with replacement, so de-duplicate the drawn keys (and note that a high duplicate rate implies a small or skewed keyspace).
2. Probe each sampled key
For each distinct sampled key collect:
TYPE key— string / hash / list / set / zset / stream.OBJECT ENCODING key— internal representation (int,embstr,raw,listpack,intset,hashtable,skiplist,quicklist,stream, …); reveals small-vs-large internal layout.- Element size, O(1) per type:
STRLEN(string),HLEN(hash),LLEN(list),SCARD(set),ZCARD(zset),XLEN(stream). - Memory:
MEMORY USAGE key SAMPLES 5— true bytes incl. overhead (additive to the element counts; the two answer different questions). Fall back gracefully if the command is disabled. TTL key— to report the volatile vs. persistent split.
Performance: one resp-cli process per command is fine for small samples but slow for thousands. When the sample is large, build the probe commands and pipeline them through redis-cli (printf '...\n' | redis-cli ...), keeping resp-cli for the scoping/interactive steps. The sample cap is what keeps this bounded — honor it.
3. Tokenize key patterns
Split each key into segments on : (Redis convention) and /. Replace variable segments with a typed placeholder, then group keys by their tokenized pattern and count members.
Collapse a segment when it looks like an identifier. In rough priority (most likely first), but cast a wider net than just these:
- integers →
{int} - UUIDs / GUIDs →
{uuid} - hex strings (e.g. ≥8 hex chars) →
{hex} - ULIDs / base62 / base64-ish tokens, long random-looking strings →
{id} - epoch timestamps / date-like segments →
{ts}/{date} - high-cardinality fallback: a segment position that takes many distinct values across the sample (relative to its siblings) is almost certainly an id even if it doesn't match a shape above — collapse it to
{var}.
Keep low-cardinality, stable segments literal (users, orders, cache, session). Report patterns with estimated full-DB counts (sample count ÷ sample fraction) and flag that they're estimates.
4. Classify content
This step reads real values — only run it with user consent (see Hard safety rules). Without consent, skip it and deliver a structure-only summary.
- Strings: use
STRLEN, thenGETRANGE key 0 200to peek (never a bareGETon a large/unknown value). Classify: integer counter (^-?\d+$and/orOBJECT ENCODING=int), JSON ({/[and parses), XML (<…>), base64/binary blob, or plain text. Note approximate value-size distribution. - Aggregates: sample a few members rather than reading the whole structure. Avoid
HGETALL/SMEMBERS/LRANGE key 0 -1on unknown-size aggregates — they're unbounded, so they're slow on large keys and pull far more data into context than needed. Size-gate first (HLEN/SCARD/LLEN), then use the random/ranged samplers:HRANDFIELD key 5 WITHVALUES,SRANDMEMBER key 5,ZRANDMEMBER key 5 WITHSCORES,LRANGE key 0 4,XRANGE key - + COUNT 5— and classify field names / element contents the same way.
5. Report
Produce a concise summary:
- Connection & scope: target (host/port/db, replica?),
DBSIZE, used memory, RESP version, cluster note; sample size and fraction. - Key patterns: table of tokenized patterns → estimated count, dominant type, dominant encoding, example raw key.
- Where the data is: top patterns/types by count and, separately, by estimated total size (per-key
MEMORY USAGE× extrapolation). Call out the count-vs-size divergence. - Content: per major pattern, what the values are (counter / JSON / XML / blob / text) with an example shape (redact obvious secrets/PII in examples).
- Caveats: sampling error, with-replacement duplicates, per-node vs. cluster-wide, any commands that were unavailable.
Notes
- Everything here is an estimate from a sample — say so, and give the sample fraction alongside extrapolated numbers.
redis-cli --bigkeys/--memkeysare complementary built-ins for the size question, but they don't do pattern tokenization or content classification — this skill's value is the patterns + content, so use the built-ins only as a cross-check.- See
AGENTS.mdfor theresp-cli-over-redis-clipreference and the broader project context.
Trending
Steady talk.about the whole repository
Who's talking about StackExchange/StackExchange.Redis
- Stack Overflow“StackExchange.Redis with Azure Redis is unusably slow or throws timeout errors”Stack Overflow · Aug 21, 2014 · 36 votes
- dotnet/aspnetcore“Add ability to leverage StackExchange.Redis.CommandFlags via IDistributedCache or IDistributedRedisCache (new)”GitHub · Feb 5, 2021 · 16 reactions
- Xabaril/AspNetCore.Diagnostics.HealthChecks“Redis (Sentinel): The underlying connection is not renew if it's broken ”GitHub · Mar 10, 2022 · 12 reactions
- Stack Overflow“Azure Function App Could not load System.IO.Pipelines connecting to Redis”Stack Overflow · Dec 29, 2020 · 12 votes
- dotnet/runtime“Binding redirects not generated for .NET 4.7.2 transitive dependency chains with System.Buffers”GitHub · Sep 27, 2018 · 11 reactions
The biggest 5 of 81 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 81
Talked about on GitHub, Stack Overflow and Hacker News (81 times).
On GitHub · 50
- Feb 5, 2021Add ability to leverage StackExchange.Redis.CommandFlags via IDistributedCache or IDistributedRedisCache (new) — dotnet/aspnetcore16 reactions · 27 comments
- Mar 10, 2022Redis (Sentinel): The underlying connection is not renew if it's broken — Xabaril/AspNetCore.Diagnostics.HealthChecks12 reactions · 3 comments
- Sep 27, 2018Binding redirects not generated for .NET 4.7.2 transitive dependency chains with System.Buffers — dotnet/runtime11 reactions · 7 comments
- Jun 30, 2018React to changes in StackExchange.Redis 2.0 — aspnet/Caching8 reactions · 35 comments
- Sep 5, 2018StackExchange.Redis.StrongName is discontinued — Azure/aspnet-redis-providers6 reactions · 12 comments
45 more on GitHub
- Mar 16, 2026Redis centralized rate limiting, GCRA — dotnet/aspnetcore5 reactions · 18 comments
- Oct 14, 2022reconnectOnError fails to handle errors stemming from Lua scripts — redis/ioredis4 reactions · 2 comments
- Oct 13, 2020.Caching.StackExchangeRedis Sentinel support — dotnet/aspnetcore4 reactions · 1 comment
- May 15, 2018Library instrumentation guidance with DiagnosticSource — microsoft/ApplicationInsights-dotnet4 reactions · 8 comments
- May 22, 2016Restore Socket.ConnectAsync via hostname on *nix platforms. — dotnet/runtime3 reactions · 35 comments
- Oct 23, 2026chore(deps): update dependency stackexchange.redis to 3.4.20 — thomhurst/TUnit2 reactions · 3 comments
- Oct 9, 2026chore(deps): update dependency stackexchange.redis to 3.4.0 — thomhurst/Respire2 reactions · 7 comments
- Oct 9, 2026chore(deps): update dependency stackexchange.redis to 3.4.0 — thomhurst/TUnit2 reactions · 3 comments
- Sep 22, 2026chore(deps): update dependency stackexchange.redis to 3.3.1 — thomhurst/Respire2 reactions · 3 comments
- Sep 22, 2026chore(deps): update dependency stackexchange.redis to 3.3.1 — thomhurst/TUnit2 reactions · 3 comments
- Sep 13, 2026chore(deps): update dependency stackexchange.redis to 3.2.1 — thomhurst/ModularPipelines2 reactions · 3 comments
- Sep 13, 2026chore(deps): update dependency stackexchange.redis to 3.2.1 — thomhurst/Respire2 reactions · 3 comments
- Sep 13, 2026chore(deps): update dependency stackexchange.redis to 3.2.1 — thomhurst/TUnit2 reactions · 3 comments
- Aug 21, 2026chore(deps): update dependency stackexchange.redis to 3.1.31 — thomhurst/Respire2 reactions · 2 comments
- Aug 21, 2026chore(deps): update dependency stackexchange.redis to 3.1.31 — thomhurst/TUnit2 reactions · 2 comments
- Aug 21, 2026chore(deps): update dependency stackexchange.redis to 3.1.31 — thomhurst/ModularPipelines2 reactions · 2 comments
- Aug 8, 2026chore(deps): update dependency stackexchange.redis to 2.13.17 — thomhurst/Respire2 reactions · 42 comments
- Aug 6, 2026chore(deps): update dependency stackexchange.redis to 3.1.13 — thomhurst/TUnit2 reactions · 2 comments
- Aug 6, 2026chore(deps): update dependency stackexchange.redis to 3.1.11 — thomhurst/TUnit2 reactions · 1 comment
- Aug 3, 2026chore(deps): update dependency stackexchange.redis to 3.1.3 — thomhurst/TUnit2 reactions · 2 comments
- Jul 31, 2026chore(deps): update dependency stackexchange.redis to 3.1.0 — thomhurst/TUnit2 reactions · 1 comment
- Jul 30, 2026chore(deps): update dependency stackexchange.redis to 3.0.25 — thomhurst/TUnit2 reactions · 2 comments
- Jul 21, 2026chore(deps): update dependency stackexchange.redis to v3 — thomhurst/ModularPipelines2 reactions · 2 comments
- Jul 21, 2026chore(deps): update dependency stackexchange.redis to 2.13.17 — thomhurst/ModularPipelines2 reactions · 3 comments
- May 13, 2024Support for DefaultAzureCredential / Azure Active Directory / Entra ID — Azure/aspnet-redis-providers2 reactions · 3 comments
- Mar 4, 2024SignalR redis perf : consider sharded pub/sub when available — dotnet/aspnetcore2 reactions · 2 comments
- Jan 28, 2020Handling RedisCache is not connected. — dotnet/aspnetcore2 reactions · 1 comment
- May 14, 2019[StackExchange.Redis] Add DefaultReadCommandFlag into RedisCacheOptions for read operations — dotnet/aspnetcore2 reactions · 6 comments
- Oct 9, 2026chore(deps): update dependency stackexchange.redis to 3.4.0 — thomhurst/ModularPipelines1 reaction · 2 comments
- Sep 22, 2026chore(deps): update dependency stackexchange.redis to 3.3.1 — thomhurst/ModularPipelines1 reaction · 2 comments
- Sep 18, 2026chore(deps): update dependency stackexchange.redis to 3.3.0 — thomhurst/Respire1 reaction · 3 comments
- Sep 18, 2026chore(deps): update dependency stackexchange.redis to 3.3.0 — thomhurst/TUnit1 reaction · 3 comments
- Sep 17, 2026chore(deps): update dependency stackexchange.redis to 3.2.15 — thomhurst/Respire1 reaction · 3 comments
- Sep 17, 2026chore(deps): update dependency stackexchange.redis to 3.2.15 — thomhurst/TUnit1 reaction · 3 comments
- Sep 10, 2026chore(deps): update dependency stackexchange.redis to 3.2.0 — thomhurst/ModularPipelines1 reaction · 2 comments
- Sep 10, 2026chore(deps): update dependency stackexchange.redis to 3.2.0 — thomhurst/Respire1 reaction · 2 comments
- Sep 10, 2026chore(deps): update dependency stackexchange.redis to 3.2.0 — thomhurst/TUnit1 reaction · 2 comments
- Aug 9, 2026chore(deps): update dependency stackexchange.redis to v3.1.13 — thomhurst/Respire1 reaction · 59 comments
- Aug 6, 2026Update dependency StackExchange.Redis to 3.1.13 — thomhurst/ModularPipelines1 reaction · 2 comments
- Aug 3, 2026Update dependency StackExchange.Redis to 3.1.3 — thomhurst/ModularPipelines1 reaction · 2 comments
- Jul 31, 2026Update dependency StackExchange.Redis to 3.1.0 — thomhurst/ModularPipelines1 reaction
- Jul 30, 2026Update dependency StackExchange.Redis to 3.0.25 — thomhurst/ModularPipelines1 reaction
- Jul 10, 2026chore(deps): update dependency stackexchange.redis to 3.0.17 — thomhurst/TUnit1 reaction · 2 comments
- Apr 22, 2026Support StackExchange.Redis 3.0+ — open-telemetry/opentelemetry-dotnet-instrumentation1 reaction
- Mar 10, 2025High integrity mode support — redis/lettuce1 reaction
On Stack Overflow · 30
- Aug 21, 2014StackExchange.Redis with Azure Redis is unusably slow or throws timeout errors36 votes · 5 answers
- Dec 29, 2020Azure Function App Could not load System.IO.Pipelines connecting to Redis12 votes
- Sep 25, 2014Partitioned key space for StackExchange Redis11 votes
- Sep 8, 2016Tune Redis connection inside an Azure Function to prevent timeouts9 votes · 2 answers
- May 12, 2014How to connect to Azure Redis Cache9 votes
25 more on Stack Overflow
- Nov 20, 2014Are there any StackExchange.Redis example projects8 votes
- May 29, 2014StackExchange.Redis ConnectionMultiplexer.Connect() Intermittently Works7 votes
- Sep 12, 2019Wat is the optimal Azure REDIS Stackexchange configuration and usage running a .NET Core 2.1 WebApi6 votes
- Jul 20, 2021How to properly load a Lua script in StackExchange.Redis?5 votes
- Feb 26, 2016Redis Connections May Not be Closing with c#5 votes
- Apr 16, 2014I can't find the command equivalent to keys in Stack Exchange Redis5 votes
- Jan 29, 2021Invalid multibulk length In redis4 votes
- Jan 22, 2020How to do contains search in Redis?4 votes · 2 answers
- Feb 19, 2019StackExchange Redis AddOrUpdate handling (optimistic concurrency)4 votes · 1 answer
- May 5, 2018StackExchange.Redis not reading responses on heavy load4 votes · 1 answer
- Nov 18, 2016How can I support the Redis sentinel architecture using StackExchange.Redis?4 votes
- Dec 20, 2019StackExchange.Redis.RedisConnectionException: 'It was not possible to connect to the redis server(s)3 votes
- Jan 28, 2019Redis Cache Number of connected clients increasing3 votes · 2 answers
- Jul 5, 2018How can I get data from Redis in C#?3 votes
- Apr 19, 2018.net core IDistributedCache redis sentinel support for master / slave3 votes
- Jul 21, 2017MSET in StackExchange.Redis3 votes
- Apr 4, 2017Doesn't dispose() method of ConnectionMultiplexer flushes all keys and the redis database it is connected to?3 votes
- Mar 21, 2017Redis how to find optimal value for IOCP3 votes · 1 answer
- Dec 13, 2022What's the Point of Multiple Redis Databases?2 votes
- Jul 16, 2019No connection is available to service this operation (Redis Client )2 votes · 2 answers
- Apr 15, 2019How to lock an existing key?2 votes · 1 answer
- Mar 23, 2018Redis timeout after UnableToResolvePhysicalConnection exception2 votes
- Jun 13, 2016What is Booksleave IKeyCommands.Find equivalent in StackExchange.Redis2 votes
- Dec 11, 2015StackExchange.Redis How to Connect to Sentinel2 votes
- Jun 1, 2015StackExchange.Redis StringGet Timeouts2 votes · 1 answer
On Hacker News · 1
- Apr 2, 2015StackExchange Redis Client2 points
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- audit-command-coverageSkill
- create-implementation-plan-for-redis-api-changeSkill
- implement-resp-commandSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

