Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Rate Limiting?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/adityaaatiwari-rate-limiting)
---
description: Protect APIs from abuse and overload with distributed rate limiters, standard headers, keying, and safe degradation
profile: standard
tags: api, security, performance, backend
---
# Rate limiting
Use when adding request throttling to public endpoints, auth flows, webhooks, or expensive AI/compute APIs.
## Strategy and keying
- Apply multi-layer keys: tighter limits on anonymous IP/subnet plus authenticated user/tenant quotas on write and expensive routes.
- Choose token bucket or sliding window algorithms (via atomic Redis Lua/pipeline scripts) to avoid boundary bursts at fixed window edges.
- Exempt health checks cleanly while keeping login, OTP, password reset, and token endpoints strictly throttled.
## Responses and resilience
- Return `HTTP 429` with `Retry-After` and standard `RateLimit-Limit`, `RateLimit-Remaining`, and `RateLimit-Reset` headers.
- Decide fail-open vs fail-closed explicitly per endpoint: fail open for read APIs on Redis outage, fail closed for brute-force/payment endpoints.
- Put rate limiting ahead of DB lookups and model calls so rejected requests stay cheap.
## Verify
Test concurrent burst requests hitting `429`, `Retry-After` header accuracy, key isolation across tenants, and limiter store timeout behavior.