api-rate-limiting
Implement API rate limiting strategies using token bucket, sliding window, and fixed window algorithms. Use when protecting APIs from abuse, managing traffic, or implementing tiered rate limits.
npx skills add majiayu000/claude-skill-registry --skill api-rate-limiting-aj-geddes-useful-ai-prompts-2 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# API Rate Limiting ## 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 ## Instructions ### 1. **Token Bucket Algorithm** ```javascript // 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(); if (this.tokens >= tokens) { this.tokens -= tokens; return true; } return false; } available() { this.refill(); return Math.floor(this.tokens); } } // Express middleware const express = require('express'); const app = express(); const rateLimiters = new Map();
- Overview
- When to Use
- Instructions
- 1. Token Bucket Algorithm
- 2. Sliding Window Algorithm
- 3. Redis-Based Rate Limiting
- 4. Tiered Rate Limiting
- 5. Python Rate Limiting (Flask)
- 6. Response Headers
- Best Practices
- ✅ DO
- ❌ DON'T
- Monitoring
What does the api-rate-limiting skill do?
Implement API rate limiting strategies using token bucket, sliding window, and fixed window algorithms. Use when protecting APIs from abuse, managing traffic, or implementing tiered rate limits.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill api-rate-limiting-aj-geddes-useful-ai-prompts-2 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
