skills/redis-development/rules/_template.md

1.5 KiB

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