redis-core — Claude Code skill: Redis data modeling guide
A skill that tells your agent which Redis data type fits the job and how to name keys. Useful when you design a cache, counters or session storage.
npx skills add redis/agent-skills --skill redis-core -a claude-codeWhat redis-core does
The skill covers the two decisions that drive memory use and maintainability most: data type selection and key naming. Your agent gets a use-case table — String for simple values and counters, Hash for an object whose fields change independently, List for queues, Set for membership checks, Sorted Set for rankings, JSON for nested structures, Stream for an event log, Vector Set for vector search.
One anti-pattern gets called out by name: a flat object stuffed into a serialized string. Changing a single field means fetch, parse, mutate, rewrite. A Hash avoids that. Key naming follows a short rule set — lowercase, colon-separated segments, a stable hierarchy like user:1001:profile. Full URLs make poor keys; pull out a short identifier or use a hash digest. For multi-tenancy, prefix with something like tenant:42:user:7:cart so scans and ACLs can target one tenant.
Two reference files ship with it: references/choose-data-structure.md with the reasoning plus Python and Java examples, and references/key-naming.md with cleanup cases. Installation runs through npx skills add, so you need Node.js with npx available.
What it helps with
- pick a Redis data type that matches the access pattern
- model an object with per-field updates instead of a serialized blob
- standardize key names on colon-separated segments
- prefix keys per tenant so scans and ACLs stay scoped
- audit existing keys and rewrite them under one convention
Example prompts for the agent
- Help me design the Redis data model for a user cart
- Hash or JSON for a profile where fields update independently?
- Review the key names in this project and make them consistent
How to install redis-core
1Skills CLI (Vercel)
npx skills add redis/agent-skills --skill redis-core -a claude-code2Manually: put the files in place
~/.claude/skills/redis-core/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/redis-core/
1Skills CLI (Vercel)
npx skills add redis/agent-skills --skill redis-core -a codex2Manually: put the files in place
.agents/skills/redis-core/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add redis/agent-skills --skill redis-core -a cursor2Manually: put the files in place
.cursor/skills/redis-core/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install redis/agent-skills redis-core2Manually: put the files in place
.github/skills/redis-core/SKILL.md1Skills CLI (Vercel)
npx skills add redis/agent-skills --skill redis-core -a gemini-cli2Platform CLI
gemini skills install https://github.com/redis/agent-skills --path skills/redis-coreManually: put the files in place
.devin/skills/redis-core/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add redis/agent-skills --skill redis-core -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about redis-core
How do I install redis-core in Claude?
Run npx skills add redis/agent-skills --skill redis-core -a claude-code. The skill lands at ~/.claude/skills/redis-core/SKILL.md.
What does redis-core do?
It gives your agent rules for choosing a Redis data type per use case and a consistent colon-separated key naming scheme.
Which data types does the skill cover?
String, Hash, List, Set, Sorted Set, JSON, Stream and Vector Set, each mapped to the access pattern it fits.
Source text
SKILL.md · MIT
---
name: redis-core
description: Core Redis modeling guidance — choose the right data structure (String, Hash, List, Set, Sorted Set, JSON, Stream, Vector Set) and use consistent colon-separated key names. Use when designing a Redis data model, caching objects, deciding between Hash and JSON, building counters, leaderboards, membership sets, or session stores, or when reviewing/cleaning up Redis key naming.
license: MIT
metadata:
author: Redis, Inc.
version: "0.1.0"
---
# Redis Core
Foundational guidance for modeling data in Redis. Covers data-type selection and key-name conventions — the two decisions that most directly drive memory, performance, and maintainability.
## When to apply
- Caching objects, sessions, or per-user state.
- Counters, leaderboards, recent-items lists, unique-membership sets.
- Reviewing or refactoring Redis key names.
- Deciding between a Redis Hash and a JSON document for an entity.
## 1. Choose the right data structure
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. Updating one field means fetch + parse + mutate + rewrite. Use a Hash instead.
See [references/choose-data-structure.md](references/choose-data-structure.md) for full rationale and Python/Java examples.
## 2. Use consistent key names
Use `colon-separated` segments with a stable hierarchy:
```
{entity}:{id}:{attribute}
user:1001:profile
user:1001:settings
order:2024:items
session:abc123
article:987:likes
game:space-invaders:leaderboard
```
Rules of thumb:
- **Lowercase, colon-separated.** No spaces, no mixed casing (`User_1001_Profile` is bad).
- **Keep keys short but readable** — keys live in memory and appear in every command.
- **Don't use full URLs or long strings as keys.** Extract a short identifier, or use a hash digest of the URL.
- **Prefix for multi-tenancy** (`tenant:42:user:7:cart`) so scans and ACLs can target a tenant cleanly.
- **Be consistent.** Pick one convention per service and apply it across all keys.
See [references/key-naming.md](references/key-naming.md) for cleanup examples and edge cases.
## References
- [Redis: Choosing the right data type](https://redis.io/docs/latest/develop/data-types/compare-data-types/)
- [Redis: Keys](https://redis.io/docs/latest/develop/use/keyspace/)
© Redis, Inc. · MIT · redis/agent-skills