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.
npx skills add mickeyyaya/refactoring-skills --skill api-rate-limiting-throttlinggit clone --depth 1 https://github.com/mickeyyaya/refactoring-skillsWrote 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.
[](https://agentmods.dev/skills/mickeyyaya/refactoring-skills/api-rate-limiting-throttling)<a href="https://agentmods.dev/skills/mickeyyaya/refactoring-skills/api-rate-limiting-throttling"><img src="https://agentmods.dev/badge/skills/mickeyyaya/refactoring-skills/api-rate-limiting-throttling/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.
<a href="https://agentmods.dev/skills/mickeyyaya/refactoring-skills/api-rate-limiting-throttling"><img src="https://agentmods.dev/badge/skills/mickeyyaya/refactoring-skills/api-rate-limiting-throttling.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00067 | $0.05265 |
| Opus 5.5 | $0.00027 | $0.02106 |
| Sonnet 5.5 | $0.00013 | $0.01053 |
| Haiku 4.5 | $0.00007 | $0.00526 |
Grade A, and why
api-rate-limiting-throttling 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 3mo 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.
How it starts
The opening of the file, as written. The whole thing — 595 lines — stays where its author put it; the contents beside it link to each section on GitHub.
API Rate Limiting and Throttling
Overview
Rate limiting protects services from traffic spikes, abuse, and accidental overload. Choosing the wrong algorithm leads to either boundary spikes that allow bursting through limits, or excessive rejection of legitimate traffic. Use this guide to implement, review, or debug rate limiting logic.
When to use: Designing public or internal APIs; reviewing middleware for throttling correctness; evaluating Redis-based distributed limiting; auditing rate limit response headers; checking client-side retry and backoff behavior.
Quick Reference
| Algorithm | Burst Tolerance | Accuracy | Complexity | Best For |
|---|---|---|---|---|
| Token Bucket | High — refills at rate R, allows bursts up to capacity C | Good | Medium | APIs that allow short bursts |
| Leaky Bucket | None — constant drain rate | Good | Medium | Smoothing traffic to downstream |
| Sliding Window Counter | High — no boundary spikes | Excellent | Medium-High | Accurate per-user limits |
| Fixed Window Counter | Medium — full quota resets at boundary | Fair | Low | Simple counters, background jobs |
| Distributed (Redis Lua) | Configurable | Excellent | High | Multi-instance production APIs |
Patterns in Detail
1. Token Bucket Algorithm
The token bucket holds up to capacity tokens. Tokens are added at refillRate per second. Each request consumes one token. Requests that arrive when the bucket is empty are rejected or queued.
Red Flags:
- Storing last-refill timestamp as an integer — truncation error accumulates over time
- Not capping tokens at capacity — bucket grows unboundedly after idle periods
- Per-process in-memory state in multi-instance deployments — each instance has a full bucket
TypeScript:
interface TokenBucket {
tokens: number;
lastRefillMs: number;
readonly capacity: number;
readonly refillRatePerMs: number;
}
function createTokenBucket(capacity: number, refillRatePerSecond: number): TokenBucket {
return {
tokens: capacity,
lastRefillMs: Date.now(),
capacity,
refillRatePerMs: refillRatePerSecond / 1000,
};
}
function consumeToken(bucket: TokenBucket): { allowed: boolean; bucket: TokenBucket } {
const now = Date.now();
const elapsed = now - bucket.lastRefillMs;
const refilled = Math.min(
bucket.capacity,
bucket.tokens + elapsed * bucket.refillRatePerMs,
);
if (refilled < 1) {
return { allowed: false, bucket: { ...bucket, tokens: refilled, lastRefillMs: now } };
}
return { allowed: true, bucket: { ...bucket, tokens: refilled - 1, lastRefillMs: now } };
}
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.
- 3mo ago First seen · 595 lines · 67 tokens per session scan A 85382808c910
api-rate-limiting-throttling is a skill published in the GitHub repository mickeyyaya/refactoring-skills (7 stars, last pushed 8mo ago), licensed MIT. It adds 67 tokens to every session and 5,265 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-08-31.
api-rate-limiting-throttling compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| api-rate-limiting-throttlingmickeyyaya/refactoring-skills | Skill | 7 | 8mo ago | MIT | A | 67 | Claude Code, Codex |
| using-redis-token-bucketsPostHog/posthog-foss | Skill | 733 | today | MIT | A | 148 | Claude Code, Codex |
| background-job-orchestratorcuriositech/some_claude_skills | Skill | 278 | 2d ago | MIT | A | 95 | Claude Code |
| using-redis-token-bucketsPostHog/posthog | Skill | 41k | today | none | A | 148 | Claude Code, Codex |
| spring-data-redisrrezartprebreza/spring-boot-skills | Skill | 370 | 13d ago | MIT | A | 37 | Claude Code, Codex |
| bullmqzhe-qi/clhoria-template | Skill | 193 | 2d ago | MIT | A | 45 | Claude Code |
| idempotency-handlingsecondsky/claude-skills | Skill | 257 | 8d ago | MIT | A | 46 | Claude Code |