upstash-ratelimit
Skill by sickn33
Adds rate limiting to API routes, middleware and edge functions using @upstash/ratelimit and Upstash Redis. Covers sliding window, fixed window and token bucket algorithms. Aimed at developers protecting serverless or edge endpoints from abuse.
Install upstash-ratelimit
Built from the published package, never by AI.
git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills /tmp/agentic-awesome-skills && mkdir -p ~/.claude/skills && cp -r /tmp/agentic-awesome-skills/skills/upstash-ratelimit ~/.claude/skills/upstash-ratelimitRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills /tmp/agentic-awesome-skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/agentic-awesome-skills/skills/upstash-ratelimit ~/.gemini/antigravity-cli/skills/upstash-ratelimitAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill guides an AI assistant to add rate limiting to API routes, middleware and edge functions with the @upstash/ratelimit package. It covers fixed window, sliding window and token bucket algorithms, all backed by Upstash Redis. Because counters live in Redis, every instance of a serverless function or edge worker shares the same limits.
The skill shows how to create the limiter once outside the handler, call limit() with a stable identifier, and return 429 responses with Retry-After and X-RateLimit headers. It includes a Next.js middleware example and a per-plan token bucket example. It is aimed at developers protecting login, signup, webhook or LLM endpoints from abuse.
Written from the project's SKILL.md and checked against it.
What it can do
- Sliding window limiterLimits requests over a rolling window using Ratelimit.slidingWindow.
- Fixed window limiterLimits requests per fixed time window, with the lowest Redis cost of the three.
- Token bucket limiterAllows short bursts with Ratelimit.tokenBucket, useful for per-plan limits.
- limit() checkReturns success, limit, remaining, reset and pending for a given identifier.
- Next.js middleware patternShows returning a 429 response with Retry-After and X-RateLimit headers.
- Analytics optionEnables optional analytics, with pending work passed to waitUntil on edge runtimes.
What you need
- Upstash Redis database
- UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN environment variables
- npm packages @upstash/ratelimit and @upstash/redis
Try asking
- Add a sliding window rate limit of 10 requests per 10 seconds to my API route
- Create a Next.js middleware that returns 429 with Retry-After when limited
- Set up token bucket limits for free and pro plans keyed by API key
Good to know
- Requires an Upstash Redis database and does not work with other Redis servers.
- Each limit() call is at least one HTTP round trip to Redis, adding latency.
- Sliding window is an approximation, not an exact request log.
- If Redis is unreachable, the default 5 s timeout lets requests through (fails open).
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/upstash-ratelimit/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md7 KB
Alternatives to upstash-ratelimit
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
upstash-ratelimit: common questions
Does this work across multiple serverless instances?
Yes. The source says state lives in Redis, so every instance of a serverless function or edge worker shares the same counters.
Which rate limiting algorithms are included?
The package ships fixed window, sliding window and token bucket algorithms. The source notes MultiRegionRatelimit does not support token bucket.
What happens if Redis is down?
The default timeout of 5 seconds lets requests through with reason timeout, so it fails open rather than closed. The source advises choosing an explicit policy for security-sensitive endpoints.
How do I install upstash-ratelimit?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is upstash-ratelimit free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is upstash-ratelimit safe to use?
It scores 90 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to upstash-ratelimit?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
