Token导航 LogoToken导航TokenDH.com
AI 工具需要联网github未标认证来源可访问clear审计通过

redisRedis 数据库

Agent Skill

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

总安装

792

周安装

33

GitHub Stars

11

下载量

264
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/lobbi-docs/claude --skill redis

简介

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

  • 适合分析 schema、编写命令、排查问题或生成迁移建议。
  • 需明确连接环境和目标数据,区分只读分析与写入变更。
  • 安装方式:通过 npx skills add 命令从 GitHub 仓库添加。
  • 涉及删除、更新或批量操作时应优先 dry-run 或事务保护。

SKILL.md

Redis Skill

Provides comprehensive Redis capabilities for the Golden Armada AI Agent Fleet Platform.

When to Use This Skill

Activate this skill when working with:

  • Caching implementation
  • Session management
  • Pub/Sub messaging
  • Rate limiting
  • Distributed locks

Redis CLI Quick Reference

Connection


# Connect

redis-cli -h localhost -p 6379 redis-cli -h localhost -p 6379 -a password

# Test connection

redis-cli ping ```

### Basic Operations

Strings

SET key "value" SET key "value" EX 3600 # With TTL GET key DEL key EXISTS key TTL key EXPIRE key 3600

Hashes

HSET user:1 name "John" age "30" HGET user:1 name HGETALL user:1 HDEL user:1 age

Lists

LPUSH queue "item1" RPUSH queue "item2" LPOP queue RPOP queue LRANGE queue 0 -1

Sets

SADD tags "python" "redis" SMEMBERS tags SISMEMBER tags "python" SREM tags "python"

Sorted Sets

ZADD leaderboard 100 "player1" 200 "player2" ZRANGE leaderboard 0 -1 WITHSCORES ZRANK leaderboard "player1" ZINCRBY leaderboard 50 "player1" ```

Python Redis Client


# Synchronous client

r = redis.Redis(host='localhost', port=6379, db=0, decode_responses=True)

# Async client

async_redis = aioredis.from_url("redis://localhost:6379", decode_responses=True)

# Basic operations

r.set('key', 'value', ex=3600) value = r.get('key') r.delete('key')

# Hash operations

r.hset('user:1', mapping={'name': 'John', 'age': '30'}) user = r.hgetall('user:1')

# List operations

r.lpush('queue', 'item1', 'item2') items = r.lrange('queue', 0, -1) item = r.rpop('queue')

# Async operations

async def cache_get(key: str): async with aioredis.from_url("redis://localhost") as redis: return await redis.get(key) ```

## Caching Patterns

### Cache-Aside Pattern
# Cache miss - fetch from database
agent = await db.get_agent(agent_id)
if agent:
    await redis.set(cache_key, json.dumps(agent), ex=3600)

return agent

async def update_agent(agent_id: str, data: dict) -> dict: # Update database agent = await db.update_agent(agent_id, data)

# Invalidate cache
cache_key = f"agent:{agent_id}"
await redis.delete(cache_key)

return agent

### Rate Limiting
async with redis.pipeline() as pipe:
    pipe.incr(window_key)
    pipe.expire(window_key, window * 2)
    results = await pipe.execute()

count = results[0]
return count <= limit

Usage

if not await rate_limit(f"user:{user_id}", limit=100, window=60): raise HTTPException(status_code=429, detail="Rate limit exceeded") ```

Distributed Lock


class DistributedLock: def **init**(self, redis_client, key: str, timeout: int = 10): self.redis = redis_client self.key = f"lock:{key}" self.timeout = timeout self.token = str(uuid.uuid4())

async def __aenter__(self): while True: acquired = await self.redis.set( self.key, self.token, nx=True, ex=self.timeout ) if acquired: return self await asyncio.sleep(0.1)

async def __aexit__(self, exc_type, exc_val, exc_tb): # Only release if we own the lock script = """ if redis.call("get", KEYS[1]) == ARGV[1] then return redis.call("del", KEYS[1]) else return 0 end """ await self.redis.eval(script, 1, self.key, self.token)


# Usage

async with DistributedLock(redis, "resource:123"): await do_critical_work() ```

## Pub/Sub

Publisher

async def publish_event(channel: str, message: dict): await redis.publish(channel, json.dumps(message))

Subscriber

async def subscribe_events(): pubsub = redis.pubsub() await pubsub.subscribe("agent:events")

async for message in pubsub.listen():
    if message["type"] == "message":
        data = json.loads(message["data"])
        await handle_event(data)

## Session Management

security = HTTPBearer()

async def create_session(user_id: str) -> str: session_id = secrets.token_urlsafe(32) session_key = f"session:{session_id}"

await redis.hset(session_key, mapping={
    "user_id": user_id,
    "created_at": datetime.utcnow().isoformat()
})
await redis.expire(session_key, 86400)  # 24 hours

return session_id

async def get_session(token: str = Depends(security)) -> dict: session_key = f"session:{token.credentials}" session = await redis.hgetall(session_key)

if not session:
    raise HTTPException(status_code=401, detail="Invalid session")

# Refresh TTL
await redis.expire(session_key, 86400)
return session

## Best Practices

1. **Use connection pooling** for production
2. **Set TTL on all keys** to prevent memory bloat
3. **Use pipelining** for batch operations
4. **Implement proper error handling** for connection issues
5. **Monitor memory usage** with `INFO memory`
6. **Use Lua scripts** for atomic operations

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

能力 5

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

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

平台分布

Claude Code

29.75%
按下载量换算79

Gemini CLI

25.29%
按下载量换算67

Antigravity

17.07%
按下载量换算45

Codex

13.79%
按下载量换算36

windsurf

6.97%
按下载量换算18

OpenCode

3.52%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills