Api Rate Limiting
Practical rate limiting that compares token bucket, sliding window, and fixed window approaches for protecting public APIs.
- CCM score
- 54 of 100
- skills.sh installs
- 517
- GitHub stars
- 257
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers three algorithms in a comparison table, plus Node.js token bucket and Express middleware examples
- Includes standard
X-RateLimit-*andRetry-Afterresponse headers, and tiered limits for Free, Pro, and Enterprise plans - Enforces 429 responses with a Retry-After value and recommends Redis for distributed limits across instances
- Designed for teams securing public APIs, implementing tiered access, or defending against denial-of-service abuse
Install
$ npx -y skills add secondsky/claude-skills --skill api-rate-limiting -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
API Rate Limiting
Protect APIs from abuse using rate limiting algorithms with per-user and per-endpoint strategies.
Algorithms
| Algorithm | Pros | Cons |
|---|---|---|
| Token Bucket | Handles bursts, smooth | Memory per user |
| Sliding Window | Accurate | Memory intensive |
| Fixed Window | Simple | Boundary spikes |
Token Bucket (Node.js)
class TokenBucket {
constructor(capacity, refillRate) {
this.capacity = capacity;
this.tokens = capacity;
this.refillRate = refillRate; // tokens per second
this.lastRefill = Date.now();
}
consume() {
this.refill();
if (this.tokens >= 1) {
this.tokens--;
return true;
}
return false;
}
refill() {
const now = Date.now();
const elapsed = (now - this.lastRefill) / 1000;
this.tokens = Math.min(this.capacity, this.tokens + elapsed * this.refillRate);
this.lastRefill = now;
}
}
Express Middleware
const rateLimit = require('express-rate-limit');
const limiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100,
standardHeaders: true,
message: { error: 'Too many requests, try again later' }
});
Details
- Repository
- github.com/secondsky/claude-skills
- Categories
- Backend & APIs, DevOps & Cloud, Security
- First seen
- Jun 3, 2026
Questions
What does the api-rate-limiting skill do?
The api-rate-limiting skill implements API rate limiting with token bucket, sliding window and Redis-based algorithms to protect against abuse. It supports per-user and per-endpoint strategies, tiered access limits and proper 429 responses with Retry-After headers.
How do I install the api-rate-limiting skill?
Run npx -y skills add secondsky/claude-skills --skill api-rate-limiting -y in your project to install it. Once installed, the api-rate-limiting skill lets your agent add rate limiting to public APIs and prevent denial-of-service attacks.
Which rate limiting algorithms does the api-rate-limiting skill cover?
The api-rate-limiting skill covers token bucket, sliding window and fixed window approaches, and compares their trade-offs for bursts, accuracy and memory use. It includes a Node.js token bucket class and an Express middleware example built on express-rate-limit.
Who should use the api-rate-limiting skill?
The api-rate-limiting skill suits developers securing public APIs or offering tiered access to different plans. It also helps teams who want to monitor rate limit metrics and test their APIs under load.
More from secondsky/claude-skills
All 116- Design System Creation515
- Threejs509
- React Composition Patterns504
- Api Contract Testing500
- Technical Specification500
- React Native Skills499
- Mobile App Testing491
- Csrf Protection487
- Ml Model Training487
- Bun Test Basics483
- Payment Gateway Integration481
- Test Quality Analysis480
- Bun Hono Integration476
- Api Reference Documentation475
- Mutation Testing471
- Tanstack Router471
- Internationalization I18n467
- Security Headers Configuration466
- Systematic Debugging466
- Bun Package Manager465
- Interaction Design465
- Seo Optimizer465
- Api Error Handling463
- Sequential Thinking458
Similar to Api Rate Limiting
More Backend & APIsrate-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.
FloodgateMCP serversathergate97 starsRate limiting for Next.js with sliding window and token bucket algorithms, no external services.
api-security-hardeningSkillsecondsky/claude-skills522 installsExpress middleware stack for REST API hardening with helmet, rate limiting, input validation, and security headers.
api-security-hardenerSkillpatricio0312rev/skills290 installsHardening guide for production APIs covering validation, auth, authorization, and rate limiting in Express.
api-gateway-configurationSkillsecondsky/claude-skills430 installsAPI gateway configuration examples for Kong, Nginx, and AWS API Gateway, covering routing, auth, and rate limiting.