All skills
redis avatar

/redis-core

@a2c48c0 official
by redisredis/agent-skills163 stars
30

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.

Use this Skill: https://skilld.dev/gh/redis/agent-skills/redis-core

This session only. Nothing lands on disk.

SKILL.md

≈98 tokens always: the name and description. ≈639 when used: this file. ≈962 more on demand in 2 files.

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 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 for cleanup examples and edge cases.

References

Source: SKILL.md on GitHub

No alerts1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill provides architectural best practices and code examples for Redis data modeling. No security risks were identified.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

Signed by skilld at a2c48c0. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 4 months ago
metadata
{
  "author": "Redis, Inc.",
  "version": "0.1.0"
}
  • redis
  • data-structures
  • caching
  • key-naming
  • hash
  • sorted-set
  • stream
  • schema-design

README badge

README badge for redis/agent-skills/redis-core

Provides foundational guidance on Redis data-structure selection (String, Hash, List, Set, Sorted Set, JSON, Stream, Vector Set) and colon-separated key-naming conventions. Use when designing a Redis data model, caching objects, building counters or leaderboards, or refactoring key names for consistency and memory efficiency.

Generated from the current SKILL.md.

Does this skill cover all Redis data types?
Yes. It covers String, Hash, List, Set, Sorted Set, JSON, Stream, and Vector Set — the full set of core Redis types with guidance on when to use each based on access patterns.
Can I use this skill to refactor existing Redis keys?
Yes. The skill includes key-naming conventions and cleanup examples to help review and standardize existing key schemes across a service.
Does this skill provide code examples?
The SKILL.md includes Python and Java examples in bundled reference files for each data type choice and access pattern.
Should I use a Hash or JSON for storing an object in Redis?
The skill provides a decision framework: use a Hash for independently updated fields; use JSON for nested or hierarchical data that benefits from path-level updates and RQE indexing.
Is this skill specific to a Redis client library?
No. The skill covers Redis data modeling and naming conventions independent of client library — applicable to any Redis setup or language.

Generated from the current SKILL.md. These answers refresh after source changes.