add-rate-limiting
Skill0 starsChanged 23 days agoMITView on GitHub
Add rate limits and abuse controls to login, signup, password reset, OTP, forms, uploads, public APIs and AI or other paid API routes, using a shared store (Upstash or Redis, Cloudflare rules, KV or Durable Objects) with 429 responses, per-user quotas and spend caps. Use when the user worries about bots, spam, brute force or surprise AI bills.
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- packs/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- database-access-rulesSkill
- launch-polishSkill
- lean-changesSkill
- secure-api-endpointSkill
- stripe-webhook-setupSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Before launch, for every public or paid route.
- Distinctive: line 17
After a spam wave, credential-stuffing attempt or a surprise invoice.
- Very specific: line 25
AI and paid APIs: add per-user daily quotas, max_tokens, timeouts, and remind the user to set a spend cap and billing alert in the provider …
- Distinctive: line 35
Never load-test or flood production.
- Distinctive: line 37
Do not change provider billing settings yourself.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add rate limiting
A single script should not be able to lock out your users, empty your email quota or run up your AI bill.
When to use
- Before launch, for every public or paid route.
- After a spam wave, credential-stuffing attempt or a surprise invoice.
Steps
- List the routes that are public, auth-related or call paid APIs. Propose a limit for each (for example login 5 per minute per IP and per account, AI chat 20 per minute and 200 per day per user).
- Pick the store that fits the hosting: Upstash Redis for Vercel or Netlify serverless, Cloudflare rate limiting rules or Durable Objects on Cloudflare, Redis for containers or a VPS. Explain why an in-memory limiter is not enough when there is more than one instance.
- Choose the key: user id when signed in, trusted client IP otherwise (platform helper or trusted proxy header), plus email for login and reset routes.
- Implement the limiter as one helper, apply it at the top of each route, return 429 with
Retry-After. - AI and paid APIs: add per-user daily quotas,
max_tokens, timeouts, and remind the user to set a spend cap and billing alert in the provider dashboard (they do this themselves). - Bots on forms: suggest Turnstile, hCaptcha or reCAPTCHA on signup and contact forms.
- Test with a short loop of requests and show the first 429.
Output format
Table of routes with limits and keys, the limiter helper, the changed routes, and the test output.
Safety rules (always)
- Never load-test or flood production. Test locally or on staging.
- Redis or Upstash tokens only from environment variables; never print or commit them.
- Do not change provider billing settings yourself; give the user the exact steps.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

