loom-rate-limiting

loom-rate-limiting is a skill for Claude Code, Codex from cosmix/loom. It costs 26 tokens per session (3,475 once invoked), scanned A, original, MIT.

API rate limiting controls how often a client can send requests, while quota management sets limits on how much it may use over time.

In plain words
What is it for?
Use it to choose and implement fixed-window, sliding-window, token-bucket, leaky-bucket, or GCRA limits, including distributed limits backed by Redis.
Why use it?
It helps protect services from abuse and overload, share capacity fairly, and control traffic sent to slower systems.

Skill for Claude CodeCodex

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

Good fit Use it to choose and implement fixed-window, sliding-window, token-bucket, leaky-bucket, or GCRA limits, including distributed limits backed by Redis.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cosmix/loom/loom-rate-limiting
View source ↗ cosmix/loom
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 cosmix/loom --skill loom-rate-limiting
Clone the repo
git clone --depth 1 https://github.com/cosmix/loom

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 loom-rate-limiting

README.md
[![agentmods](https://agentmods.dev/badge/skills/cosmix/loom/loom-rate-limiting/github.svg)](https://agentmods.dev/skills/cosmix/loom/loom-rate-limiting)
Your own site
<a href="https://agentmods.dev/skills/cosmix/loom/loom-rate-limiting"><img src="https://agentmods.dev/badge/skills/cosmix/loom/loom-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 loom-rate-limiting

Your own site · 80×15
<a href="https://agentmods.dev/skills/cosmix/loom/loom-rate-limiting"><img src="https://agentmods.dev/badge/skills/cosmix/loom/loom-rate-limiting.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,475 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00026 $0.03475
Opus 5.5 $0.00010 $0.01390
Sonnet 5.5 $0.00005 $0.00695
Haiku 4.5 $0.00003 $0.00347

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

Security

Grade A, and why

loom-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 2mo 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.

skills/loom-rate-limiting/SKILL.md · 248 lines

How it starts

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

Rate Limiting

Overview

Control the request rate a client can make: protect from abuse, enforce fair usage, shed load. Two decisions dominate correctness: which algorithm (burst tolerance vs accuracy vs memory) and how to make the counter atomic in a distributed setting. Everything else is headers and policy.

Algorithm Selection

Algorithm Burst behavior Accuracy Memory/key Use when
Fixed window Allows 2× limit at window boundary Poor 1 counter Cheap, coarse limits where boundary burst is acceptable
Sliding window log Exact, no boundary burst Exact O(limit) timestamps Low limits needing precision (e.g. 5 login attempts)
Sliding window counter Smooths boundary, small over/under ~99% 2 counters General-purpose distributed limiting (best default)
Token bucket Allows configurable burst up to capacity Rate-exact avg 2 numbers (tokens, ts) APIs that should tolerate bursts (most public APIs)
Leaky bucket No burst; smooths to constant output Shapes traffic Queue Protecting a fragile downstream at fixed throughput
GCRA Burst = capacity, single value Exact 1 timestamp (TAT) High-throughput distributed limiting; token-bucket equivalent, cheaper

⚠ Fixed-window boundary burst is the classic footgun: with limit=100/min, a client can send 100 at 00:59.9 and 100 at 01:00.1 — 200 requests in ~0.2s while never violating either window. If bursts matter, use sliding-window or token-bucket.

⚠ Token bucket ≈ leaky bucket (as a meter) ≈ GCRA — mathematically equivalent rate meters differing in burst allowance and storage. Don't reimplement all three; pick token bucket for app code, GCRA for a single-value distributed limiter.

Token Bucket

Allows bursts up to capacity, refills at refillRate tokens/sec. Refill is computed lazily on access (no background timer needed).

class TokenBucket {
  private tokens: number;
  private lastRefill = Date.now();
  constructor(private capacity: number, private refillRate: number) {
    this.tokens = capacity;
  }
  consume(n = 1): boolean {
    const now = Date.now();
    this.tokens = Math.min(this.capacity, this.tokens + ((now - this.lastRefill) / 1000) * this.refillRate);
    this.lastRefill = now;
    if (this.tokens >= n) { this.tokens -= n; return true; }
    return false;
  }
}
// 100 req/min sustained, burst of 10:
const bucket = new TokenBucket(10, 100 / 60);

Read the full file on GitHub · 248 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. 2mo ago Changed · +13 tokens per session a4b90df83ed3
  2. 2mo ago Changed · -39 tokens per session 568607c7da41
  3. 3mo ago First seen · 248 lines · 52 tokens per session scan A 09d807aa7964

Subscribe to this mod's changes

loom-rate-limiting is a skill published in the GitHub repository cosmix/loom (66 stars, last pushed yesterday), licensed MIT. It adds 26 tokens to every session and 3,475 once invoked, about $0.0001 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-30.

Related

loom-rate-limiting compared with skills from other repositories

loom-rate-limiting next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
loom-rate-limitingcosmix/loomSkill66yesterdayMITA26Claude Code, Codex
API Discoverability for Agentsniels-emmer/myaceSkill1yesterdayMITA51Claude Code, Codex
durable-objectscloudflare/skillsSkill3.5k5d agoApache-2.0A22Claude Code
sandbox-nextcloudflare/skillsSkill3.5k5d agoApache-2.0A39Claude Code
cloudflarecloudflare/skillsSkill3.5k5d agoApache-2.0A103Claude Code
cloudflare-email-servicecloudflare/skillsSkill3.5k5d agoApache-2.0A21Claude Code
workers-best-practicescloudflare/skillsSkill3.5k5d agoApache-2.0A25Claude Code