Api Rate Limiting
Reusable API rate limiting guide covering token bucket, sliding window, and fixed window algorithms with tiered limits.
- CCM score
- 41 of 100
- skills.sh installs
- 649
- GitHub stars
- 396
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers per-user, per-IP, and per-endpoint limiting strategies for protecting APIs from brute force attacks and traffic spikes
- Includes reference guides for token bucket, sliding window, Redis-based, tiered, and Flask implementations, plus response headers
- Recommends rate limit headers and a
Retry-Aftervalue on every throttled response, with Redis for distributed deployments - Warns against in-memory storage in production, simple counters across distributed systems, and exposing limit configuration publicly
Install
$ npx -y skills add aj-geddes/useful-ai-prompts --skill api-rate-limiting -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
API Rate Limiting
Table of Contents
Overview
Protect APIs from abuse and manage traffic using various rate limiting algorithms with per-user, per-IP, and per-endpoint strategies.
When to Use
- Protecting APIs from brute force attacks
- Managing traffic spikes
- Implementing tiered service plans
- Preventing DoS attacks
- Fairness in resource allocation
- Enforcing quotas and usage limits
Quick Start
Minimal working example:
// Token Bucket Rate Limiter
class TokenBucket {
constructor(capacity, refillRate) {
this.capacity = capacity;
this.tokens = capacity;
this.refillRate = refillRate; // tokens per second
this.lastRefillTime = Date.now();
}
refill() {
const now = Date.now();
const timePassed = (now - this.lastRefillTime) / 1000;
const tokensToAdd = timePassed * this.refillRate;
this.tokens = Math.min(this.capacity, this.tokens + tokensToAdd);
this.lastRefillTime = now;
}
consume(tokens = 1) {
this.refill();
Details
- Repository
- github.com/aj-geddes/useful-ai-prompts
- Categories
- Backend & APIs, Security
- First seen
- Jun 3, 2026
More from aj-geddes/useful-ai-prompts
All 258- Internationalization I18n649
- Information Architecture642
- Unit Testing Framework635
- Backup Disaster Recovery630
- Color Accessibility629
- Github Actions Workflow629
- Fastapi Development627
- Static Code Analysis624
- Aws Lambda Functions621
- Vulnerability Scanning621
- User Research Analysis620
- Data Encryption618
- Time Series Analysis618
- Api Authentication613
- Refactor Legacy Code612
- Performance Testing611
- Competitor Analysis610
- Security Testing610
- Frontend Accessibility607
- Design Patterns Implementation601
- Data Cleaning Pipeline600
- Aws S3 Management599
- Database Schema Design599
- Database Query Optimization594
Similar to Api Rate Limiting
More Backend & APIsrate-limiting-implementationSkillaj-geddes/useful-ai-prompts508 installsPractical rate limiting skill with token bucket, Redis, sliding window, and tiered guides for protecting APIs.
rate-limiting-abuse-protectionSkillpatricio0312rev/skills334 installsLayered API rate limiting and abuse protection with per-route, per-user, and per-IP policies and 429 responses.
upstash-ratelimit-jsSkillupstash/skills24.2K installsUpstash Redis-backed rate limiter for serverless and edge apps, with algorithm and cost guidance.
api-response-optimizationSkillaj-geddes/useful-ai-prompts491 installsLean response design that trims API payloads, adds caching, and compresses responses to cut latency and bandwidth.
FloodgateMCP serversathergate97 starsRate limiting for Next.js with sliding window and token bucket algorithms, no external services.
redis-patternsSkillaffaan-m/ecc9.1K installsPractical reference for Redis caching, rate limiting, distributed locks, pub/sub, and key design in production backends.