rate-limiting_skill

This skill helps implement rate limiting strategies including token bucket, exponential backoff, and Redis-backed quotas to protect APIs and clients.
  • Python

3

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill dasien/claudemultiagenttemplate --skill rate-limiting

  • SKILL.md11.7 KB

Overview

This skill implements practical rate limiting strategies for clients and servers, including token bucket, sliding window, and exponential backoff. It provides patterns and components for API quota management, distributed limits with Redis, and graceful handling of 429 responses to keep systems stable.

How this skill works

It supplies client-side token bucket logic to smooth calls and allow controlled bursts, server-side integrations (Flask + Flask-Limiter) for per-IP, per-key, or tiered limits, and a Redis-backed sliding-window limiter for distributed environments. It also includes exponential backoff with jitter, Retry-After handling, and retry/circuit-breaker controls to avoid cascades.

When to use it

  • Calling third‑party APIs with documented quotas
  • Protecting your own endpoints from abuse or spikes
  • Implementing tiered or per‑key rate limits
  • Running services across multiple nodes (distributed limits)
  • Reducing retries and collisions after 429 responses

Best practices

  • Prefer token bucket for smooth throughput with allowed bursts
  • Use sliding window or Redis approaches where accuracy and distribution matter
  • Always honor Retry-After headers when provided
  • Add exponential backoff with jitter and a max retry limit
  • Expose rate limit headers and return 429 + Retry-After on the server
  • Monitor limit hits, alert on approaching quotas, and adapt limits by usage

Example use cases

  • Client library that throttles requests with TokenBucket and backs off on 429
  • Flask API with Redis-backed limits and custom 429 handler returning retry_after
  • Distributed microservices enforcing shared quotas using a Redis sliding window
  • Tiered API offering distinct limits per plan (free/basic/premium)
  • Circuit breaker that trips after repeated failures despite backoff

FAQ

Use token bucket when you want smooth rate control plus short bursts. Choose sliding window when strict accuracy over a time window and no burst allowance are required, especially in distributed systems.

What should I do when an API returns Retry-After?

Respect the Retry-After value first. If absent, use exponential backoff with jitter and a capped maximum wait. Also limit total retry attempts and consider a circuit breaker for persistent errors.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational