Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
secondsky avatar

Api Rate Limiting

  • 387 installs
  • 202 repo stars
  • Updated August 4, 2026
  • secondsky/claude-skills

api-rate-limiting is an agent skill that implements API rate limiting with token bucket, sliding window, and Redis-backed algorithms for developers securing public endpoints against abuse and tiered-access overuse.

About

api-rate-limiting is an MIT-licensed agent skill in secondsky/claude-skills that implements API throttling with token bucket, sliding window, and fixed window algorithms, including Redis-backed distributed counters for multi-instance services. The SKILL.md compares trade-offs—token bucket burst tolerance versus sliding-window accuracy versus fixed-window simplicity—and provides a Node.js TokenBucket reference implementation with per-user and per-endpoint strategies. Developers reach for api-rate-limiting when exposing public REST or GraphQL APIs, adding freemium tier quotas, or mitigating denial-of-service patterns before launch. The workflow covers algorithm selection, memory implications, boundary spike risks on fixed windows, and Redis integration for shared state across nodes. Use while hardening auth-adjacent routes or monetized API products. Skip when rate limiting is already enforced at a CDN or API gateway with no application-layer changes, or for internal-only services behind private networks with no abuse surface.

  • api-rate-limiting

Api Rate Limiting by the numbers

  • 387 all-time installs (skills.sh)
  • +21 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #1,118 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/secondsky/claude-skills --skill api-rate-limiting

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs387
repo stars202
Last updatedAugust 4, 2026
Repositorysecondsky/claude-skills

How do you add Redis rate limiting to APIs?

Use api-rate-limiting for development tasks

Who is it for?

Backend developers shipping public APIs who need application-layer throttling with token bucket or Redis sliding-window algorithms and tiered access limits.

Skip if: Teams relying solely on CDN or gateway throttling with no app-layer changes, or internal microservices with no public abuse surface.

When should I use this skill?

User asks to add API rate limiting, implement token bucket middleware, configure Redis throttling, or prevent API abuse on public endpoints.

What you get

Rate-limit middleware, algorithm configuration, Redis counter keys, and per-user or per-endpoint quota rules protecting API routes.

  • Rate-limit middleware code
  • Redis key schema
  • Per-tier quota configuration

By the numbers

  • Compares 3 rate-limiting algorithms in the skill reference table
  • Includes Node.js TokenBucket sample implementation

Files

SKILL.mdMarkdownGitHub ↗

API Rate Limiting

Protect APIs from abuse using rate limiting algorithms with per-user and per-endpoint strategies.

Algorithms

AlgorithmProsCons
Token BucketHandles bursts, smoothMemory per user
Sliding WindowAccurateMemory intensive
Fixed WindowSimpleBoundary 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' }
});

app.use('/api/', limiter);

Response Headers

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1705320000
Retry-After: 60

Tiered Limits

TierRequests/Hour
Free100
Pro1,000
Enterprise10,000

Best Practices

  • Use Redis for distributed rate limiting
  • Include proper headers in responses
  • Return 429 status with Retry-After
  • Implement tiered limits for different plans
  • Monitor rate limit metrics
  • Test under load

Related skills

How it compares

Use api-rate-limiting for in-app Redis or token-bucket middleware; use gateway or WAF configuration when throttling is entirely edge-managed.

FAQ

Which rate-limit algorithms does api-rate-limiting cover?

api-rate-limiting documents token bucket, sliding window, and fixed window algorithms, comparing burst handling, accuracy, memory cost, and boundary spike risks for each.

Does api-rate-limiting support distributed APIs?

api-rate-limiting includes Redis-based patterns so rate counters stay consistent across multiple application instances serving the same public endpoints.

When should api-rate-limiting run versus gateway throttling?

api-rate-limiting fits when application-layer per-user or per-endpoint quotas and custom tier logic must live inside the API codebase rather than only at a CDN edge.

Backend & APIsbackendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.