rate-limiting
/rate-limiting
Limit requests by the cost they impose and the identity behind them, using token buckets, deliberate keys, and tiered responses to abuse. Use when protecting an API, a login flow, or any expensive endpoint from brute force, scraping, and accidental overload.
- Author
- Amey-Thakur ↗
- Repository
- AI-SKILLS ↗
- Licence
- MIT
- Last repository change
- 05.09.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 05.09.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Limit requests by the cost they impose and the identity behind them, using token buckets, deliberate keys, and tiered responses to abuse. Use when protecting an API, a login flow, or any expensive endpoint from brute force, scraping, and accidental overload.
Original author description
Limit requests by the cost they impose and the identity behind them, using token buckets, deliberate keys, and tiered responses to abuse. Use when protecting an API, a login flow, or any expensive endpoint from brute force, scraping, and accidental overload.
How it works
- Method
- Litmus tests
- Boundaries
SKILL.md preview
--- name: rate-limiting description: Limit requests by the cost they impose and the identity behind them, using token buckets, deliberate keys, and tiered responses to abuse. Use when protecting an API, a login flow, or any expensive endpoint from brute force, scraping, and accidental overload. --- # Rate limiting A flat "100 requests per minute" treats a cache hit and a report export as equals, throttles a shared office behind one NAT while a distributed attacker sails through, and returns the same terse error to a confused user and a credential-stuffing bot. Effective limiting prices requests by what they actually cost, keys on the right identity, and answers each tier of abuse differently. ## Method 1. **Use a token bucket for steady rate with burst.** Give each key a bucket that refills at the sustained rate and holds a burst allowance, so normal spikes pass while sustained floods drain and block. This beats a fixed window, which lets double the limit through across a window boundary. 2. **Charge by cost, not by count.** Deduct more tokens for a search, an export, or an LLM call than for a cheap read. A single weight-1 limit invites attackers to hammer your most expensive endpoint at the same rate as your cheapest. 3. **Choose the key to match the threat.** Rate-limit login by account and by source together so one account cannot be brute-forced and one IP cannot spray many accounts. Prefer an authenticated user or API key over raw IP, since IPs are shared behind NAT and cheap for attackers to rotate. 4. **Keep counters in a shared store.** Hold state in Redis with atomic increments or a Lua script so the limit holds across every instance. A per-process counter effectively multiplies the limit by your replica count and protects nothing. 5. **Answer with 429 and a `Retry-After` header.** Return the standard status, tell honest clients when to come back, and expose `RateLimit-Remaining` so well-behaved integrations self-pace instead of retrying into the wall. 6. **Escalate responses by abuse tier.** Throttle a first offender, add a CAPTCHA or step-up on a suspicious pattern, and shadow-ban or block a confirmed abuser. Match friction to evidence so a fat-fingered user is not treated like a botnet. ## Litmus tests - Does the limit cost more tokens for expensive endpoints than cheap ones? - Does login limiting key on both account and source, defeating single-account brute force and single-IP spraying? - Do counters survive across instances, or does adding a replica quietly raise the effective limit? - Does a throttled response carry 429 and `Retry-After`, not a bare 500 or a silent drop? ## Boundaries Rate limiting shapes traffic volume; it does not authenticate, authorize, or distinguish a valid request from a malicious one that stays under the limit. Volumetric network floods belong to a CDN or DDoS layer upstream, not the application bucket. Tune thresholds against real traffic, since a limit set by guesswork either lets abuse through or pages you about legitimate users.
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · Amey-Thakur/AI-SKILLS | 90 | MIT |
| LineLuLan/line-harness | 100 | MIT |
| redhatproductsecurity/prodsec-skills | 100 | Apache-2.0 |
| tmj-90/gaffer | 90 | Apache-2.0 |
Database snapshot: 13.11.2026 · package version 162103146295 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 1 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100rate-limiting-apis
Implement sophisticated rate limiting with sliding windows, token buckets, and quotas. Use when protecting APIs from excessive requests. Trigger with phrases like "add rate limiting", "limit API requests", or "implement rate limits". - 100rate-limiting-apis
Implement sophisticated rate limiting with sliding windows, token buckets, and quotas. Use when protecting APIs from excessive requests. Trigger with phrases like "add rate limiting", "limit API requests", or "implement rate limits". - 100api-rate-limiting
Implements API rate limiting using token bucket, sliding window, and Redis-based algorithms to protect against abuse. Use when securing public APIs, implementing tiered access, or preventing denial-of-service attacks. - 100upstash-ratelimit-js
Rate limiting for serverless and edge apps with the @upstash/ratelimit TypeScript/JavaScript SDK backed by Upstash Redis. Use when adding a rate limiter or throttling to an API route, Next.js middleware, Vercel Edge, Cloudflare Workers, or any HTTP endpoint; returning 429 Too… - 100rate-limiter-flexible
Use this skill whenever working with rate limiting, brute-force protection, DoS mitigation, or the `rate-limiter-flexible` npm package in Node.js. Triggers include: mentions of 'rate limit', 'rate-limiter-flexible', 'RateLimiter', 'brute force protection', 'login endpoint… - 100api-rate-limiting-throttling
Use this skill when protecting backend services from traffic spikes and abuse using token bucket, leaky bucket, and Redis counters.