# redis-query > Execute read-only Redis queries with multi-connection support and security enforcement. - Author: zhuyifan - Repository: kiligzzz/kiligz-skills - Version: 20260124204059 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/kiligzzz/kiligz-skills - Web: https://mule.run/skillshub/@@kiligzzz/kiligz-skills~redis-query:20260124204059 --- --- name: redis-query description: Execute read-only Redis queries with multi-connection support and security enforcement. author: Claude Code User version: 1.0.0 --- # Redis Query Skill Execute read-only Redis queries safely across multiple connections. ## Natural Language Triggers This skill responds to queries in these patterns: - "连接[连接名],执行redis命令[命令]" - "查询[连接名]的[key]" - "在[连接名]执行GET key" - "redis[连接名]查询[key]" - "看[连接名]的[key]" - "连[连接名]redis" - "query redis [连接名]" Examples: - `连接redis1,执行redis命令GET mykey` - `查询myredis的user:1001` - `在localredis执行HGETALL user:1001` - `redis mycache KEYS session:*` - `看production的cache:* ## Features - Multi-connection support (Standalone, Cluster, Sentinel) - Read-only command enforcement (GET, HGET, KEYS, etc.) - Connection management with config file - Result output in readable format - Support for Unix socket connections ## Usage ### Execute a query (simplified) ```bash # Simple positional arguments query # Examples python3 scripts/query.py query myredis "GET mykey" python3 scripts/query.py query myredis "HGETALL user:1001" python3 scripts/query.py query myredis "LRANGE mylist 0 10" ``` ### Execute a query (flag format) ```bash query --name --query # Example python3 scripts/query.py query --name myredis --query "KEYS session:*" ``` ### Add a Redis connection ```bash add --name --type --host --port --password --database # Examples # Standalone Redis python3 scripts/query.py add --name myredis --type standalone --host localhost --port 6379 --password secret --database 0 # Unix socket python3 scripts/query.py add --name localredis --type standalone --socket /tmp/redis.sock --database 0 ``` ### List all connections ```bash python3 scripts/query.py list ``` ## Supported Read-Only Commands | Category | Commands | |----------|----------| | String | GET, MGET | | Hash | HGET, HMGET, HGETALL, HKEYS, HVALS | | List | LINDEX, LRANGE, LPOS | | Sorted Set | ZRANGE, ZREVRANGE, ZCOUNT, ZCARD, ZSCORE | | Set | SMEMBERS, SRANDMEMBER, SISMEMBER, SCARD, SINTER, SUNION, SDIFF | | Server | KEYS, TYPE, TTL, PTTL, EXISTS, DBSIZE, INFO, PING | ## Config File Connections are stored in `../../../skills-work/redis-query/connections.yaml` (relative to scripts directory, i.e. `~/.claude/skills-work/redis-query/connections.yaml`): ```yaml connections: myredis: type: standalone host: localhost port: 6379 password: base64encodedpassword== database: 0 local: type: standalone socket: /tmp/redis.sock database: 0 ``` ## Security Rules - Only read-only commands are allowed (GET, HGET, KEYS, etc.) - Write commands (SET, DEL, FLUSHALL, etc.) are blocked - Each connection is isolated by name - Passwords are stored encrypted (base64) - Connection timeout: 30 seconds ## Dependencies Required packages (redis, pyyaml) are automatically installed on first run.