public-redis-expert-base
Skill25 starsChanged 4 months agoApache-2.0View on GitHub
Redis 知识基座。覆盖数据结构选型、Key 命名、连接池与 Pipeline、集群与副本读取、TTL 与淘汰策略。供 devlab-redis-usage 通过 extends 继承。
In this repository57 other files it gives its agents.
- base-cn-registry-mirror-strategySkill
- base-manual-captureSkill
- devlab-ai-agent-engineeringSkill
- devlab-ai-kit-minerSkill
- devlab-cicd-onboardSkill
- devlab-contract-web-serverSkill
- devlab-dao-sql-compatSkill
- devlab-db-data-migrationSkill
- devlab-eval-driven-agentSkill
- devlab-integration-fullstackSkill
- devlab-srv-test-apiSkill
- devlab-tech-debt-opsSkill
- devlab-test-expertSkill
- devlab-test-onboardSkill
- devlab-web-contextSkill
- devlab-web-deep-acceptanceSkill
- devlab-web-echarts-usageSkill
- devlab-web-engineeringSkill
- devlab-web-extension-bootstrapSkill
- devlab-web-skywalking-rum-usageSkill
- devlab-web-test-e2eSkill
- devlab-web-visual-opsSkill
- devlab-web-xyflow-usageSkill
- diag-container-oomSkill
- diag-k8s-node-pressureSkill
- diag-k8s-pod-crashloopSkill
- diag-mysql-deadlockSkill
- diag-mysql-replicationSkill
- diag-mysql-slow-querySkill
- diag-network-port-unreachSkill
- infra-dify-opsSkill
- infra-harbor-opsSkill
- infra-jenkins-pipeline-opsSkill
- infra-nexus-opsSkill
- infra-ragflow-opsSkill
- infra-sonarqube-opsSkill
- infra-system-env-opsSkill
- infra-woodpecker-pipeline-opsSkill
- markitdownSkill
- patent-disclosure-workflowSkill
- patent-reviewSkill
- patent-specification-writerSkill
- public-git-workflow-expert-baseSkill
- public-kafka-expert-baseSkill
- public-mongodb-expert-baseSkill
- public-mysql-expert-baseSkill
- public-nl2sql-expert-baseSkill
- public-oracle-expert-baseSkill
- public-postgres-expert-baseSkill
- public-rabbitmq-expert-baseSkill
- work-convertSkill
- work-exportSkill
- work-markitdownSkill
- work-sc-document-sop-builderSkill
- work-sc-docx-comment-replySkill
- work-sc-patent-specification-writerSkill
- work-sc-software-copyright-writerSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 5 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 40
Use colon-separated segments with a stable hierarchy:
- Distinctive: line 51
Keep keys short but readable.
- Distinctive: line 52
Don't use full URLs or long strings as keys.
- Distinctive: line 59
Always use pooling or multiplexing — never one connection per request.
- Very specific: line 82
Avoid commands that scan everything: use SCAN instead of KEYS, SSCAN instead of SMEMBERS on large sets.
- Distinctive: line 98
Always set TTL for cache keys.
- Very specific: line 99
Use EXPIRE / PEXPIRE for time-based eviction.
- Very specific: line 104
Never use KEYS * in production — use SCAN.
- Very specific: line 105
Never HGETALL or SMEMBERS on large containers — use HSCAN/SSCAN.
- Distinctive: line 106
Prefer Hash over serialized String for objects with multiple fields.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Redis Knowledge Base
Foundational guidance for modeling data in Redis and connecting to it efficiently.
Source: Adapted from redis/agent-skills (redis-core + redis-connections + redis-clustering). Official Redis team content.
Workflow
- Identify the access pattern (read/write mix, data shape, latency target).
- Choose the matching data structure (Section 1).
- Design key names following conventions (Section 2).
- Configure connection pool and timeouts (Section 3).
- Batch work with pipelining (Section 4).
- Plan for cluster mode if scaling (Section 5).
Data Structure Selection
Pick the type that matches the access pattern, not just the shape of the data.
| Use case | Recommended type | Why |
| Simple values, counters | String | Atomic INCR/DECR, SET/GET |
| Object with independently updated fields | Hash | Per-field reads/writes, no whole-object rewrite |
| Queue, recent-N items | List | O(1) push/pop at ends |
| Unique items, membership checks | Set | O(1) SADD/SISMEMBER/SCARD |
| Rankings, score-based ranges | Sorted Set | Score-ordered; ZADD/ZRANGE/ZRANK |
| Nested / hierarchical data | JSON | Path-level updates, nested arrays, RQE indexing |
| Event log, fan-out messaging | Stream | Persistent, consumer groups |
| Vector similarity | Vector Set | Native vector storage with HNSW |
Common anti-pattern: stuffing a flat object into a serialized string. Use a Hash instead.
References:
- choose-data-structure
Key Naming
Use colon-separated segments with a stable hierarchy:
{entity}:{id}:{attribute}
user:1001:profile
session:abc123
article:987:likesRules:
- Lowercase, colon-separated. No spaces, no mixed casing.
- Keep keys short but readable.
- Don't use full URLs or long strings as keys.
- Prefix for multi-tenancy (
tenant:42:user:7:cart).
References:
- key-naming
Connection Management
Always use pooling or multiplexing — never one connection per request.
| Style | Used by | Note |
| Pool | redis-py, Jedis, go-redis | Each lease blocks if pool exhausted |
| Multiplex | Lettuce, NRedisStack | Single connection; cannot carry blocking commands |
Set explicit timeouts: connect timeout shorter than read/write timeout.
References:
- pooling
- timeouts
Pipelining & Batching
For N commands that don't depend on each other's results, send as a single batch.
pipe = redis.pipeline()
for user_id in user_ids:
pipe.get(f"user:{user_id}")
results = pipe.execute()Avoid commands that scan everything: use SCAN instead of KEYS, SSCAN instead of SMEMBERS on large sets.
References:
- pipelining
- blocking-commands
Clustering & Replication
In Redis Cluster, keys are distributed across 16,384 slots. Multi-key operations require all keys on the same slot — use hash tags: {user:1001}:profile.
For read-heavy workloads, route reads to replicas (eventually consistent).
References:
- hash-tags
- read-replicas
TTL & Eviction
- Always set TTL for cache keys; never rely on manual cleanup.
- Use
EXPIRE/PEXPIREfor time-based eviction. - Choose eviction policy based on workload:
allkeys-lrufor cache,volatile-lrufor mixed. - Monitor
evicted_keysinINFO statsto detect memory pressure.
Guardrails
- Never use
KEYS *in production — useSCAN. - Never
HGETALLorSMEMBERSon large containers — useHSCAN/SSCAN. - Prefer Hash over serialized String for objects with multiple fields.
- Set TTL on all cache keys; avoid manual cleanup patterns.
参考文档:
- references/REFERENCE-README.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

