AGENT SKILL

upstash-ratelimit

Rules, standards, and references for rate limiting in serverless environments using Upstash Ratelimit. Use when implementing rate limiting, configuring Upstash Redis, or handling request blocking.

License 许可
MIT
最近更新
2026-08-02
Stars
★ 0
Forks
0

01 前言 Front Matter

name
upstash-ratelimit
license
MIT
metadata
{ "author": "ngxc", "version": "1.0.0" }
description
Rules, standards, and references for rate limiting in serverless environments using Upstash Ratelimit. Use when implementing rate limiting, configuring Upstash Redis, or handling request blocking.
argument-hint
[--limit <number>] [--window <string>]

02 资源文件 7

03 SKILL.md 正文

Upstash Rate Limiting Guide

Comprehensive guide for rate limiting in stateless, serverless, and edge environments using @upstash/ratelimit.

Core Principles

  1. Stateless Compliance: Never use in-memory rate limiting (RateLimiterMemory) in serverless environments (Vercel, AWS Lambda, Cloudflare Workers). Use @upstash/ratelimit with Redis REST connections.
  2. Graceful Fallback: Handle Redis timeouts and missing credentials gracefully so that infrastructure issues do not crash the application or block legitimate users.
  3. Identifier Granularity: Rate limit based on the narrowest specific identifier (e.g., user ID, API key, or hashed client IP) to avoid blanket blocking.
  4. Asynchronous Chores: Wait for background analytics or MultiRegion synchronization promises (pending) to resolve before returning responses in serverless contexts.

When to Apply

Reference these guidelines when:

  • Enforcing rate limits on public or sensitive API routes and Server Actions.
  • Configuring Upstash Redis connection clients.
  • Implementing IP-based deny lists or traffic protection.
  • Optimizing rate limiting performance and costs in Cloudflare Workers or Vercel Edge.

Rule Categories by Priority

Priority Category Impact Prefix Rules
1 Connection & Setup CRITICAL setup- 2
2 Algorithm Selection HIGH algo- 1
3 Features & Optimization HIGH feat- 3

Quick Reference

1. Connection & Setup (CRITICAL)

2. Algorithm Selection (HIGH)

3. Features & Optimization (HIGH)

How to Use

Read individual reference files for detailed guidelines, configurations, and code examples:

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

References

04 同仓库更多 Skills

ngxccc
ngxccc/agent-skills-kit

zustand

Rules and standards for state management using Zustand in React and Next.js. Use when implementing client-side stores, persistence with localStorage, or preventing SSR hydration mismatch.

★ 0
ngxccc
ngxccc/agent-skills-kit

zod

Zod v4 schema validation best practices. Use when defining schemas, utilizing safeParse, or customizing error messages.

★ 0
ngxccc
ngxccc/agent-skills-kit

ui-design

UI/UX and frontend design best practices guidelines (formerly frontend-design). This skill should be used when writing, reviewing, or designing frontend code to ensure accessibility, performance, and usability. Triggers on tasks involving HTML structure, CSS styling, responsive layouts, form design, animations, or accessibility improvements.

★ 0
ngxccc
ngxccc/agent-skills-kit

typescript

TypeScript performance, tsconfig, type errors, async patterns — triggered when the user asks to "optimize TypeScript performance", "speed up tsc compilation", "configure tsconfig.json", "fix type errors", "improve async patterns", or encounters TS errors (TS2322, TS2339, "is not assignable to"). Also triggers on .ts, .tsx, .d.ts file work involving type definitions, module organization, or memory management. Does NOT cover TypeScript basics, framework-specific patterns, or testing.

★ 0
ngxccc
ngxccc/agent-skills-kit

typescript-refactor

TypeScript and TSX refactoring and modernization guidelines from a principal specialist perspective, current to TypeScript 6.0 and React 19. This skill should be used when refactoring, reviewing, or modernizing TypeScript or React/TSX code for type safety, compiler performance, and idiomatic patterns. Triggers on tasks involving type architecture, narrowing, generics, discriminated unions, error handling, React component and hook typing, or migration to modern TypeScript features (satisfies, using, const type parameters, inferred type predicates, isolatedDeclarations, erasable syntax, import attributes).

★ 0
ngxccc
ngxccc/agent-skills-kit

typescript-advanced-patterns

Advanced TypeScript — type-level programming, library/DSL APIs, declaration merging, modern language features at depth (decorators, using, const T, NoInfer, variance), and feature implementation patterns built on advanced types. Trigger on tasks involving recursive conditional types, infer patterns, mapped-type key remapping, variadic tuples, fluent builders with phantom state, schema-first inference (Zod/Valibot), end-to-end-typed API clients, finite state machines, module augmentation, and library-publishing concerns. Trigger even when the user does not say "advanced" — if the work involves type-level algorithms, library-author API design, or going beyond surface-level uses of TS 5.x features, this is the skill. Assumes the reader has absorbed the `typescript-refactor` skill — this one extends those patterns at depth, never restates them.

★ 0