用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/kinncj/Heimdall --skill redis-patterns命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Manage GitHub Projects v2 board: add issues, update field values, and query board state. Use when managing project boards.
Run WCAG 2.2 Level AA accessibility audits against generated UI. Use when a story has ui:true or when asked to audit accessibility.
Generate a complete component file tree wired to design tokens with tests and Gherkin spec. Use when scaffolding a new UI component.
基于 SOC 职业分类
正在显示 SKILL.md
| name | redis-patterns |
| description | Apply Redis data structure, caching, and pub/sub patterns. Use when integrating Redis into a service. |
{app}:{domain}:{entity}:{id}
# Examples:
myapp:user:session:usr_123
myapp:product:cache:prod_456
myapp:rate:api:ip_1.2.3.4
myapp:queue:emails:pending
async function getUser(id: string): Promise<User> {
const key = `myapp:user:data:${id}`;
const ttl = 3600; // 1 hour
// Try cache first
const cached = await redis.get(key);
if (cached) {
return JSON.parse(cached) as User;
}
// Cache miss — fetch from DB
const user = await db.users.findById(id);
if (!user) throw new Error('User not found');
// Store in cache with TTL
await redis.setex(key, ttl, JSON.stringify(user));
return user;
}
// Invalidate on update
async function updateUser(id: string, data: Partial<User>): Promise<User> {
const user = await db.users.update(id, data);
await redis.del(`myapp:user:data:${id}`);
return user;
}
async function rateLimit(ip: string, limit: number, windowSeconds: number): Promise<boolean> {
const key = `myapp:rate:api:${ip}`;
const now = Date.now();
const windowStart = now - (windowSeconds * 1000);
const pipeline = redis.pipeline();
pipeline.zremrangebyscore(key, 0, windowStart);
pipeline.zadd(key, now, `${now}`);
pipeline.zcard(key);
pipeline.expire(key, windowSeconds);
const results = await pipeline.exec();
const count = results?.[2]?.[1] as number;
return count <= limit;
}
// Using ioredis with connect-redis
import session from 'express-session';
import RedisStore from 'connect-redis';
app.use(session({
store: new RedisStore({ client: redis }),
secret: process.env.SESSION_SECRET!,
resave: false,
saveUninitialized: false,
cookie: {
secure: process.env.NODE_ENV === 'production',
httpOnly: true,
maxAge: 1000 * 60 * 60 * 24, // 24 hours
}
}));
{app}:{domain}:{entity}:{id}.redis-cli info memory and redis-cli monitor (dev only).maxmemory-policy allkeys-lru for cache-only Redis instances.