Skip to main content
prompt GP ChatGPT

API Rate Limiting taste — ChatGPT prompt: what it does, how to install

API Rate Limiting taste — a prompt for ChatGPT that defines rate limiting rules for API endpoints. Helps design backend protection against abuse and traffic spikes.

CC0-1.0 ★ 178,201 updated 2026-10-24

Open on GitHub

What API Rate Limiting taste does

The prompt outlines requirements for safeguarding public and authenticated endpoints using token bucket or sliding-window counters. It mandates storing limiter state in a shared Redis store with atomic operations rather than in local memory behind a load balancer.

The instruction specifies returning HTTP 429 with Retry-After headers, separating limits for expensive versus cheap operations, and failing open on standard traffic during outages. Additional points cover shadow mode testing, login throttling against credential stuffing, and maintaining limiter configuration in code.

To install this prompt in Claude Code, place the text into .claude/commands/prompts.csv.md.

What it helps with

  • design rate limits for public APIs
  • configure HTTP 429 responses with Retry-After headers
  • store rate limiter state in Redis
  • separate limits for expensive and cheap endpoints
  • run new rate limits in shadow mode

Example prompts for the agent

  • Apply the API Rate Limiting taste prompt to design endpoint protection
  • Use API Rate Limiting taste rules for setting up Redis rate limits
  • Review rate limiting configuration based on API Rate Limiting taste

How to install API Rate Limiting taste

How to use

Paste the text at the start of a chat or into project instructions

Questions about API Rate Limiting taste

How to install API Rate Limiting taste in Claude Code?

Create .claude/commands/prompts.csv.md and add the prompt text to it.

What does API Rate Limiting taste do?

It provides architectural guidelines and rules for implementing API rate limiting in backend services.

Where should the rate limiter state be kept?

The limiter state must be kept in a shared store like Redis using atomic operations.

Source text

prompts.csv · CC0-1.0
# API Rate Limiting taste of a backend platform engineer
- Rate limit every public endpoint from day one, including authenticated ones; abuse rarely announces itself in advance. Confidence: 0.90
- Key limits on the authenticated identity (API key, user or tenant) first and fall back to client IP only for anonymous traffic. Confidence: 0.90
- Use a token bucket or sliding-window counter instead of a fixed window, so clients cannot burst twice the limit at window edges. Confidence: 0.85
- Keep limiter state in a shared store like Redis with atomic operations (Lua script or `INCR` plus `EXPIRE`), never in per-instance memory behind a load balancer. Confidence: 0.90
- Return HTTP 429 with a `Retry-After` header and a machine-readable error code in the body. Confidence: 0.95
- Send `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` headers on every response so clients can pace themselves. Confidence: 0.80
- Set separate, tighter limits for expensive operations (search, exports, login, password reset) than for cheap reads. Confidence: 0.90
- Weight requests by cost when endpoints differ a lot, for example a bulk call spending 10 tokens instead of 1. Confidence: 0.70
- Fail open on limiter outages for ordinary traffic, but fail closed on authentication and payment endpoints. Confidence: 0.75
- Apply a coarse global limit at the edge (CDN or gateway) and finer per-tenant limits in the application. Confidence: 0.85
- Publish the limits in the API docs and changelog, and give advance notice before lowering them. Confidence: 0.85
- Offer higher limits through plans or explicit allowlists instead of silent exceptions hardcoded in the limiter. Confidence: 0.75
- Ship official SDKs with automatic retries on 429 using exponential backoff with jitter and respect for `Retry-After`. Confidence: 0.85
- Distinguish rate limits (requests over time) from quotas (monthly usage) and concurrency limits, and report each with its own error code. Confidence: 0.75
- Log and meter every throttled request by key and route, and alert when a single tenant suddenly dominates rejections. Confidence: 0.85
- Run new limits in shadow mode first, logging what would be blocked, before enforcing them. Confidence: 0.80
- Never include the reason a login was throttled in a way that reveals whether the account exists. Confidence: 0.80
- Add per-account login throttling on top of per-IP throttling to slow credential stuffing from rotating IPs. Confidence: 0.85
- Keep limiter configuration in code or config files with review, not in an ad hoc admin toggle. Confidence: 0.70
- Load test the limiter itself; it sits on the hot path and must add only a millisecond or two of latency. Confidence: 0.75

© f · CC0-1.0 · f/prompts.chat

Similar prompts

All prompts for Backend and APIs →

From the same set218

The whole set →
Angular App taste Angular App taste — a prompt for ChatGPT and Claude Code that enforces modern enterprise Angular architectural standards. Sets rules for standalone components, signals, and native control flow. GP ChatGPT ★ 178,201repo stars SQLite taste SQLite taste — a prompt for ChatGPT that gives practical SQLite guidance. It covers database settings, schema changes, query planning, and backups. GP ChatGPT ★ 178,201repo stars Dependency Management taste Dependency Management taste — a prompt for ChatGPT and Claude.ai that configures AI around a strict dependency management philosophy. Prevents surprise breakages. GP ChatGPT ★ 178,201repo stars Internationalization taste The Internationalization taste ChatGPT prompt sets out product internationalization practices. It covers localized UI text, data formats, and public pages. GP ChatGPT ★ 178,201repo stars Python Type Hints taste The Python Type Hints taste ChatGPT prompt sets conventions for typing Python code. It covers annotations, type choices, and static checking. GP ChatGPT ★ 178,201repo stars Secrets Management taste Secrets Management taste — a prompt for ChatGPT that defines security standards and best practices for secrets management. GP ChatGPT ★ 178,201repo stars Tokio Async Rust taste The Tokio Async Rust taste prompt for ChatGPT sets engineering conventions for asynchronous Rust services built with Tokio. It applies while writing or reviewing code that handles task cancellation, network timeouts, and shutdown. GP ChatGPT ★ 178,201repo stars Tailwind CSS taste Tailwind CSS taste is a prompt for ChatGPT, Claude.ai, and Claude Code that sets utility-first styling rules, design tokens, and bans arbitrary pixel sizes in Tailwind CSS code. GP ChatGPT ★ 178,201repo stars

Project sponsors

Companies that keep this analytics open