Files
life-echo/api/.agents/skills/redis-development/rules/_template.md
Sully 53e0065e3e refactor(api): TOML 配置 SSOT、统一错误契约、Auth/事务加固与可观测性 (#33)
配置 SSOT(TOML + .env)
统一错误契约
Auth 与事务边界
Redis / Celery 可靠性:业务 Redis(DB/0)与 Celery broker/backend(DB/1)显式拆分;连接池、sync client
可观测性(OpenTelemetry + LGTM)
2026-05-22 13:44:50 +08:00

1.5 KiB

title, impact, impactDescription, tags, description, alwaysApply
title impact impactDescription tags description alwaysApply
Clear, Action-Oriented Title (e.g., "Use Connection Pooling") MEDIUM Brief quantified benefit (e.g., "Reduces connection overhead by 10x") relevant, keywords, here Clear, Action-Oriented Title (e.g., "Use Connection Pooling") true

[Rule Title]

[1-2 sentence explanation of the problem and why it matters. Focus on practical impact.]

Correct: Description of the good approach.

# Comment explaining why this is better
pool = ConnectionPool(host='localhost', max_connections=50)
redis = Redis(connection_pool=pool)  # Reuse connections
result = redis.get('key')

Choose ONE of the following patterns:

Pattern A: "Incorrect" (when alternative causes real harm)

Use when the alternative causes race conditions, security issues, crashes, or significant performance problems.

Incorrect: Description of the problematic approach.

# Comment explaining what makes this problematic
redis = Redis(host='localhost')  # New connection per request - 10x overhead
result = redis.get('key')

Pattern B: "When to use" (for feature introductions)

Use when not using the feature is a valid choice for many use cases.

When to use:

  • Scenario where this approach is beneficial
  • Another scenario where it helps

When NOT needed:

  • Scenario where the simpler approach is fine
  • Another scenario where this adds unnecessary complexity

[Optional: Additional context, edge cases, or trade-offs]

Reference: Redis Docs