api-rate-limiting

Implements API rate limiting with token bucket, sliding window, and Redis-based algorithms.

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/aicodepro/ai-agent-nexi --skill api-rate-limiting-aicodepro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-rate-limiting
Source: https://github.com/aicodepro/ai-agent-nexi/tree/main/agent/skills/api-rate-limiting
Command: npx skills add https://github.com/aicodepro/ai-agent-nexi --skill api-rate-limiting-aicodepro

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires express-rate-limit.

What problem does it solve? Public APIs are vulnerable to abuse, denial-of-service attacks, and runaway clients that degrade service for everyone. This Skill provides proven rate limiting patterns to enforce per-user and per-endpoint request quotas. ## Core Features & Use Cases - Multiple Algorithms: Implement token bucket, sliding window, and fixed window strategies with clear trade-off comparisons. - Express Middleware Integration: Apply express-rate-limit to protect API routes with standard headers and 429 responses. - Tiered Access Control: Enforce different request quotas for Free, Pro, and Enterprise plans. - Use Case: You are launching a public API and need to cap free-tier users at 100 requests per hour while returning proper X-RateLimit headers and Retry-After responses. ## Quick Start Add rate limiting middleware to my Express API with a 100 requests per 15 minutes limit and standard rate limit headers.

Frequently Asked Questions about api-rate-limiting

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add rate limiting to an Express API?

Use the express-rate-limit middleware with a windowMs and max request count, then apply it to your routes with app.use. It returns 429 responses with standard rate limit headers when clients exceed the limit.

Token bucket vs sliding window rate limiting, which should I use?

Token bucket handles traffic bursts smoothly but uses memory per user, while sliding window is more accurate at the cost of higher memory usage. Fixed window is simplest but allows boundary spikes where limits can be doubled at window edges.

How do I implement rate limiting across multiple servers?

Use Redis as a shared store for distributed rate limiting so all server instances enforce the same counters. In-memory buckets only work for single-process deployments and reset on restart.

What HTTP headers should rate limited APIs return?

Return X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset on normal responses, and a 429 status with a Retry-After header when the limit is exceeded. This lets clients back off gracefully.

How do I set different rate limits per pricing tier?

Assign each tier its own quota, such as 100 requests per hour for Free, 1,000 for Pro, and 10,000 for Enterprise. Look up the user's tier from their API key or session and apply the matching limiter configuration.