Rate limiter

From berkcangumusisik/claude-code-practices · View interactive version

Rate limiter is an AI agent skill from the GitHub repository berkcangumusisik/claude-code-practices. Adds rate limiting to API endpoints with Redis or in-memory storage

How to use this skill

Skill file

Add Rate Limiting

Endpoint: $1 (or all routes if not specified)

  1. Check existing rate limiting:
cat package.json | grep -E '"express-rate-limit"|"@fastify/rate-limit"|"rate-limiter-flexible"|"upstash"'
grep -rn "rateLimit\|rateLimiter" src/ --include="*.ts" | head -5
  1. Check if Redis is available (preferred for distributed deployments):
cat package.json | grep -E '"ioredis"|"redis"|"@upstash/redis"'
  1. Implement appropriate rate limiter:

Tiered limits by endpoint sensitivity:

// Auth endpoints - strict
authLimiter = rateLimit({ windowMs: 15 * 60 * 1000, max: 5 })

// API endpoints - moderate
apiLimiter = rateLimit({ windowMs: 60 * 1000, max: 100 })

// Public read endpoints - loose
publicLimiter = rateLimit({ windowMs: 60 * 1000, max: 300 })
  1. Include:
  1. Apply to the specified endpoint or globally.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.