rate-limiting

rate-limiting is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 81 tokens per session (1,426 once invoked), scanned A, original, Apache-2.0.

A control that limits how often a user, API key, tenant, or other caller can make requests. It can also limit simultaneous work sent to another service.

In plain words
What is it for?
It helps protect login endpoints, APIs, quotas, and downstream services from bursts, repeated attempts, and excessive concurrency. It covers choosing the caller key, limit algorithm, shared storage, and client-facing behaviour.
Why use it?
Without limits, a faulty or abusive caller can overload an API, service, or downstream system. A shared counter and a clear response help the limit work correctly across multiple server instances without blocking normal use.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps protect login endpoints, APIs, quotas, and downstream services from bursts, repeated attempts, and excessive concurrency. It covers choosing the caller key, limit algorithm, shared storage, and client-facing behaviour.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tmj-90/gaffer/rate-limiting
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tmj-90/gaffer --skill rate-limiting
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rate-limiting

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/rate-limiting/github.svg)](https://agentmods.dev/skills/tmj-90/gaffer/rate-limiting)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/rate-limiting"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/rate-limiting/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rate-limiting

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmj-90/gaffer/rate-limiting"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/rate-limiting.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 81 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,426 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00081 $0.01426
Opus 5.5 $0.00032 $0.00570
Sonnet 5.5 $0.00016 $0.00285
Haiku 4.5 $0.00008 $0.00143

Measured 16d ago against content hash e8ab44985119, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

rate-limiting scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 16d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

runner/skills/rate-limiting/SKILL.md · 93 lines

How it starts

The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Add rate limiting

A rate limit is a promise about fairness and safety: no single caller can consume the service, and callers are told how to behave. Decide what you limit (a key), how (an algorithm), where the counters live (shared, atomic), and what clients see; then test the boundary exactly, including under concurrent requests. Sources: RFC 6585 (429), RFC 9110 (Retry-After), IETF draft-ietf-httpapi-ratelimit-headers (RateLimit, RateLimit-Policy), OWASP Authentication and Credential Stuffing Prevention cheat sheets, Redis documentation on atomic scripts.

Steps

  1. Name the threat and the key. Credential stuffing, a noisy client, scraping, or a downstream to protect. The key follows: user id, API key, tenant, IP (weakest: NAT and IPv6 rotation; use a /64 for IPv6), or a combination. Derive the IP from the trusted proxy chain only, never a raw client-supplied X-Forwarded-For. Call search_lore for existing limiter middleware.
  2. Choose the algorithm for the behaviour you want. Token bucket / GCRA: bursts up to capacity, steady refill (most APIs). Sliding-window counter: smooth rate, little memory. Fixed window: simplest, allows 2× bursts at window edges. Concurrency limit (semaphore): protects a downstream's capacity, not a rate. Use the repo's, gateway's or a maintained library's implementation before writing one.
  3. Share and atomically update the counters. An in-process counter behind a load balancer is not a limit. Use the shared store with one atomic operation per decision: a Redis Lua script or INCR whose returned value is compared, never GET then SET (concurrent requests all read the same value and all pass). Set the TTL in the same atomic step: an INCR followed by a separate EXPIRE that fails leaves a key that never expires, locking the caller out forever. Use the store's clock (Redis TIME) so instance clock skew cannot widen the window.
  4. Fail open or closed on purpose. If the store is unavailable: fail open for ordinary reads (availability), fail closed or fall back to a conservative local limit for login, password reset, OTP and costly writes. Put a short timeout on the store call. Comment the decision and test it.
  5. Tell the client. Reject with 429 and Retry-After (seconds). Emit the repo's rate-limit headers; if the repo has none, use the current IETF draft fields, RateLimit-Policy: "default";q=100;w=60 and RateLimit: "default";r=42;t=18, on successful responses as well as rejections. Retry-After takes precedence over RateLimit. Legacy X-RateLimit-* headers stay if clients depend on them. Never leak other tenants' identifiers in a partition key. Document it (the openapi-contract skill).
  6. Throttle authentication without enabling lockout abuse. Limit per account and per source; prefer progressive delays or a challenge over hard account lockout (an attacker can lock a victim out); return the same response whether or not the account exists. Never disable a security limit for convenience.
  7. Check early and cheaply. Run the limiter before expensive work (body parsing, downstream calls) where the key is available; for authenticated keys, after cheap token validation. Keep key derivation allocation-free.
  8. Leave a way out. Allow-lists for internal callers, per-tenant overrides in config, and a rejection metric by limit name (not by user id; cardinality) with an alert, so a limit locking out a real customer is seen within minutes.

Read the full file on GitHub · 93 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 16d ago Changed · +29 lines e8ab44985119
  2. 19d ago First seen · 64 lines · 81 tokens per session scan A b2d04c74c7cf

Subscribe to this mod's changes

rate-limiting is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 81 tokens to every session and 1,426 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-28.

Related

Other skills, from other repositories

bulwark-brainstorm

Role-based brainstorming with dual modes: --scoped (sequential Task tool, 5 roles) and --exploratory (Agent Teams peer debate, 4 roles). Use for feasibility assessment and idea validation.

QBall-Inc/the-bulwark · 50 tokens

plan-creation

Create structured implementation plans via a 4-role scrum team (Product Owner, Architect, Eng/Delivery Lead, QA/Critic) with optional Agent Teams peer debate mode.

QBall-Inc/the-bulwark · 38 tokens

anthropic-validator

Validates Claude Code assets (skills, hooks, agents, commands, MCP servers, plugins) against official Anthropic standards. Fetches latest docs dynamically and produces structured validation reports.

QBall-Inc/the-bulwark · 40 tokens

create-subagent

Generates single-purpose Claude Code sub-agents for use via the Task tool. Use when creating dedicated sub-agents, scaffolding agent definitions, or generating agents with diagnostics and permissions setup.

QBall-Inc/the-bulwark · 42 tokens

test-audit

Audit test suites for T1-T4 violations using AST analysis, mock detection, and multi-stage synthesis. Invoke when user asks to audit tests, check test quality, find mock violations, review test effectiveness, or inspect test suites for over-mocking. Triggers automatic rewrites when quality gates fail.

QBall-Inc/the-bulwark · 0 tokens

code-review

Comprehensive code review with distinct aspect based sections. Use when reviewing code, checking for security issues, finding type safety problems, auditing code quality, or when user asks to review code, PRs or changes. Three-phase workflow runs static tools, LLM judgment, and writes diagnostic log.

QBall-Inc/the-bulwark · 61 tokens