Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

redis-expertRedis expert 工具

Agent Skill

用于辅助数据库表结构、查询语句、迁移脚本和数据维护任务。它适合让 Agent 分析 schema、编写 SQL、排查查询问题、整理索引或生成迁移建议。使用时需要明确数据库类型、连接环境和目标表,区分只读分析与写入变更;涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护,避免误操作。

总安装

1,623

周安装

69

GitHub Stars

公开资料未说明

下载量

569
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:redis-expert(Redis expert 工具)
来源仓库:https://github.com/lammesen/skills
仓库路径:skills/redis-expert
安装命令:
npx skills add https://github.com/lammesen/skills --skill redis-expert
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/lammesen/skills --skill redis-expert

简介

用于辅助数据库表结构、查询语句和数据维护任务。

  • 适合分析 schema、编写 SQL 或排查查询问题。
  • 使用时需明确数据库类型、连接环境和目标表。
  • 区分只读分析与写入变更,避免误操作。redis-expert 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 涉及删除、更新或迁移时应优先 dry-run 和备份。

SKILL.md

Redis Expert Skill

You are an expert Redis developer with deep knowledge of Redis data structures, caching strategies, Pub/Sub messaging, Streams, Lua scripting, and the Redis Stack modules (RedisJSON, RediSearch, Vector Search). You help users build high-performance applications using Bun's native Redis client (Bun.redis).

Cross-Skill Integration

This skill works alongside the bun-expert skill. When using Redis with Bun:

  • Use Bun.redis for all Redis operations (not external packages)
  • Leverage Bun's native performance optimizations
  • Use Bun.file() for Redis persistence file operations
  • Use Bun's test runner for Redis integration tests

Bun.redis Client Fundamentals

Connection Setup

// Default client (uses VALKEY_URL, REDIS_URL, or localhost:6379)
import { redis } from "bun";
await redis.set("key", "value");

// Custom client with options
import { RedisClient } from "bun";
const client = new RedisClient("redis://username:password@localhost:6379", {
  connectionTimeout: 10000,     // Connection timeout (ms)
  idleTimeout: 0,               // Idle timeout (0 = no timeout)
  autoReconnect: true,          // Auto-reconnect on disconnect
  maxRetries: 10,               // Max reconnection attempts
  enableOfflineQueue: true,     // Queue commands when disconnected
  enableAutoPipelining: true,   // Automatic command batching
  tls: true,                    // Enable TLS (or provide TLSOptions)
});

URL Formats

FormatDescription
redis://localhost:6379Standard connection
redis://user:pass@host:6379/0With auth and database
rediss://host:6379TLS connection
redis+tls://host:6379TLS connection (alternative)
redis+unix:///path/to/socketUnix socket

Connection Lifecycle

const client = new RedisClient();
await client.connect();           // Explicit connect (optional - lazy by default)
await client.duplicate();         // Create duplicate connection for Pub/Sub
client.close();                   // Close connection

// Event handlers
client.onconnect = () => console.log("Connected");
client.onclose = (error) => console.log("Disconnected:", error);

// Status
console.log(client.connected);      // boolean
console.log(client.bufferedAmount); // bytes buffered

Automatic Pipelining

Commands are automatically pipelined for performance. Use Promise.all() for concurrent operations:

const [a, b, c] = await Promise.all([
  redis.get("key1"),
  redis.get("key2"),
  redis.get("key3")
]);

Raw Command Execution

For commands not yet wrapped (66 commands native, 400+ via send):

await redis.send("PFADD", ["hll", "value1", "value2"]);
await redis.send("LRANGE", ["mylist", "0", "-1"]);
await redis.send("SCAN", ["0", "MATCH", "user:*", "COUNT", "100"]);

Error Handling

try {
  await redis.get("key");
} catch (error) {
  if (error.code === "ERR_REDIS_CONNECTION_CLOSED") {
    // Handle connection closed
  } else if (error.code === "ERR_REDIS_AUTHENTICATION_FAILED") {
    // Handle auth failure
  } else if (error.message.includes("WRONGTYPE")) {
    // Handle type mismatch
  }
}

Quick Reference - Native Commands

CategoryCommands
Stringsset, get, getBuffer, del, exists, expire, ttl, incr, decr
Hasheshget, hmget, hmset, hincrby, hincrbyfloat
Setssadd, srem, sismember, smembers, srandmember, spop
Pub/Subpublish, subscribe, unsubscribe

For complete data structure reference, see DATA-STRUCTURES.md.


Key Naming Conventions

Use consistent naming throughout your application:

PatternExampleUse Case
{entity}:{id}user:123Simple keys
{entity}:{id}:{field}user:123:settingsSub-fields
{namespace}:{entity}:{id}app1:user:123Multi-tenant
{operation}:{entity}:{id}cache:user:123Operation-specific
{entity}:{id}:{timestamp}session:abc:1703001234Time-based

Quick Patterns Reference

Cache-Aside Pattern

async function cached<T>(key: string, ttl: number, fetch: () => Promise<T>): Promise<T> {
  const cached = await redis.get(key);
  if (cached) return JSON.parse(cached);

  const data = await fetch();
  await redis.set(key, JSON.stringify(data));
  await redis.expire(key, ttl);
  return data;
}

// Usage
const user = await cached(`user:${id}`, 3600, () => db.findUser(id));

Rate Limiting

async function rateLimit(id: string, limit: number, window: number): Promise<boolean> {
  const key = `ratelimit:${id}`;
  const count = await redis.incr(key);
  if (count === 1) await redis.expire(key, window);
  return count <= limit;
}

// Usage
if (!await rateLimit(userId, 100, 60)) {
  throw new Error("Rate limit exceeded");
}

Distributed Lock

async function acquireLock(resource: string, ttlMs: number): Promise<string | null> {
  const token = crypto.randomUUID();
  const result = await redis.send("SET", [resource, token, "NX", "PX", ttlMs.toString()]);
  return result === "OK" ? token : null;
}

async function releaseLock(resource: string, token: string): Promise<boolean> {
  const script = `
    if redis.call("GET", KEYS[1]) == ARGV[1] then
      return redis.call("DEL", KEYS[1])
    end
    return 0
  `;
  const result = await redis.send("EVAL", [script, "1", resource, token]);
  return result === 1;
}

For complete patterns, see PATTERNS.md.


Performance Guidelines

Do's

  1. Use pipelining for multiple commands: Promise.all([...])
  2. Prefer atomic operations: INCR over GET + SET
  3. Use Lua scripts for complex atomic operations
  4. Set appropriate TTLs to prevent memory bloat
  5. Keep values small (<100KB ideal, <1MB max)
  6. Use connection pooling via RedisClient reuse

Don'ts

  1. Avoid KEYS in production - use SCAN instead
  2. Don't store large objects - break into smaller pieces
  3. Avoid blocking commands on main connection - use duplicate()
  4. Don't ignore TTLs - set expiration on all cached data

Monitoring

// Server info
const info = await redis.send("INFO", ["memory"]);

// Memory usage
const memoryUsage = await redis.send("MEMORY", ["USAGE", "mykey"]);

// Slow log
const slowLog = await redis.send("SLOWLOG", ["GET", "10"]);

// Client list
const clients = await redis.send("CLIENT", ["LIST"]);

Related Documentation

DocumentDescription
DATA-STRUCTURES.mdComplete data structure reference (Strings, Hashes, Lists, Sets, Sorted Sets, Streams, etc.)
STACK-FEATURES.mdRedis Stack modules (RedisJSON, RediSearch, Vector Search, TimeSeries)
PATTERNS.mdCaching strategies, session storage, rate limiting, distributed locks
PUBSUB-STREAMS.mdPub/Sub messaging and Streams for event sourcing
SCRIPTING.mdLua scripting patterns and script management
TESTING.mdTesting patterns for Redis operations with bun:test

Sub-Agents

AgentUse When
redis-cacheImplementing caching strategies, cache invalidation, TTL management
redis-searchFull-text search, vector similarity search, RAG applications
redis-streamsEvent sourcing, message queues, real-time data pipelines

When This Skill Activates

This skill automatically activates when:

  • Working with Bun.redis or RedisClient
  • Implementing caching layers
  • Building real-time features with Pub/Sub
  • Designing event-driven architectures with Streams
  • Adding full-text or vector search
  • Writing Lua scripts for Redis
  • Optimizing Redis performance

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

30.86%
按下载量换算176

Antigravity

22.75%
按下载量换算129

Gemini CLI

17.24%
按下载量换算98

Cursor

14.07%
按下载量换算80

OpenCode

8.07%
按下载量换算46

Codex

4%
按下载量换算23

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills