rate-limiting

SKILL.md

Rate Limiting Patterns

Algorithms

Algorithm Accuracy Burst Handling Best For
Token Bucket High Allows controlled bursts API rate limiting, traffic shaping
Leaky Bucket High Smooths bursts entirely Steady-rate processing, queues
Fixed Window Low Allows edge bursts (2x) Simple use cases, prototyping
Sliding Window Log Very High Precise control Strict compliance, billing-critical
Sliding Window Counter High Good approximation Production APIs — best tradeoff

Fixed window problem: A user sends the full limit at 11:59 and again at 12:01, doubling the effective rate. Sliding window fixes this.

Token Bucket

Bucket holds tokens up to capacity. Tokens refill at a fixed rate. Each request consumes one.

Installs
11
First Seen
Mar 15, 2026