Token导航 LogoToken导航TokenDH.com
研究检索需要联网clawhub未标认证来源可访问clear审计提醒

api-rate-limiter-designerAPI rate limiter designer 搜索

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

742

周安装

30

GitHub Stars

公开资料未说明

下载量

233
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:api-rate-limiter-designer(API rate limiter designer 搜索)
来源仓库:https://github.com/charlie-morrison/api-rate-limiter-designer
安装命令:
openclaw skills install api-rate-limiter-designer
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install api-rate-limiter-designer

简介

设计和实现 API 速率限制策略 — 令牌桶、滑动窗口、固定窗口、带有 Redis 支持的分布式速率限制的漏桶。

SKILL.md

name
api-rate-limiter-designer
description
Design and implement API rate limiting strategies — token bucket, sliding window, fixed window, leaky bucket with Redis-backed distributed rate limiting.
metadata
tags
["api", "rate-limiting", "security", "performance", "architecture"]

API Rate Limiter Designer

Design and implement API rate limiting strategies tailored to your application's needs. Analyzes traffic patterns, recommends algorithms (token bucket, sliding window, fixed window, leaky bucket), and generates implementation code for popular frameworks with Redis-backed distributed rate limiting.

Usage

"Design rate limiting for my API"
"What rate limiting strategy should I use?"
"Implement rate limiting with Redis"
"Audit my existing rate limiter configuration"

How It Works

1. Traffic Analysis

Understand current API usage patterns:

# Analyze access logs for request patterns
cat access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head -20  # requests per IP
cat access.log | awk '{print $7}' | sort | uniq -c | sort -rn | head -20  # requests per endpoint
# Peak vs average rates
cat access.log | awk '{print $4}' | cut -d: -f1-2 | uniq -c | sort -rn | head -10

2. Algorithm Selection

Fixed Window:

  • Simple counter reset each minute/hour
  • Pros: Easy to implement, low memory
  • Cons: Burst at window boundaries (2x theoretical limit)
  • Best for: Simple APIs, internal services

Sliding Window Log:

  • Track exact timestamps of each request
  • Pros: Most accurate, no boundary bursts
  • Cons: High memory for high-volume APIs
  • Best for: Payment APIs, security-critical endpoints

Sliding Window Counter:

  • Weighted average of current and previous window
  • Pros: Good accuracy, low memory
  • Cons: Approximate (not exact)
  • Best for: Most APIs — good balance of accuracy and performance

Token Bucket:

  • Tokens refill at fixed rate, burst up to bucket size
  • Pros: Allows controlled bursts, smooth rate limiting
  • Cons: More complex to implement
  • Best for: APIs that need burst tolerance (e.g., real-time, webhooks)

Leaky Bucket:

  • Requests queue and process at fixed rate
  • Pros: Smoothest output rate, predictable load
  • Cons: Adds latency, can drop requests
  • Best for: APIs calling rate-limited third parties, processing pipelines

3. Rate Limit Design

Design limits based on:

  • Per-user limits: Authenticated users get higher limits
  • Per-IP limits: Protect against anonymous abuse
  • Per-endpoint limits: Different limits for different endpoints
  • Global limits: Protect overall system capacity
  • Tier-based: Free/Pro/Enterprise tiers with different limits

Recommended structure:

Anonymous:     60 req/min per IP
Free tier:     100 req/min per user
Pro tier:      1,000 req/min per user  
Enterprise:    10,000 req/min per user
Write endpoints: 10% of read limits
Webhooks:      burst of 50, then 10/sec

4. Response Headers

Standard rate limit response headers:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 67
X-RateLimit-Reset: 1714456800
Retry-After: 30

5. Distributed Rate Limiting

For multi-instance deployments, use Redis-backed rate limiting:

  • Redis INCR + EXPIRE for fixed window
  • Redis sorted sets for sliding window
  • Redis + Lua scripts for atomic operations
  • Redis Cluster for high availability

6. Edge Cases

  • Rate limit bypass for health checks and monitoring
  • Graceful degradation when Redis is down
  • Rate limit key design (IP + user ID + endpoint)
  • Handling proxy chains (X-Forwarded-For)
  • WebSocket rate limiting (messages, not connections)

Output

## Rate Limiting Design

**API:** REST API with 23 endpoints
**Traffic:** ~50K req/hr peak, ~15K req/hr average
**Users:** 3 tiers (Free, Pro, Enterprise)

### Recommended Configuration

| Tier | Read Limit | Write Limit | Algorithm |
|------|-----------|-------------|-----------|
| Anonymous | 30/min per IP | 5/min per IP | Fixed window |
| Free | 100/min | 10/min | Sliding window counter |
| Pro | 1,000/min | 100/min | Token bucket (burst: 50) |
| Enterprise | 10,000/min | 1,000/min | Token bucket (burst: 200) |

### Endpoint Overrides
- POST /api/auth/login: 5/min per IP (brute force protection)
- POST /api/payments: 10/min per user (abuse protection)
- GET /api/search: 30/min per user (expensive query)
- POST /api/webhooks: token bucket 50 burst, 10/sec sustain

### Implementation: Express + Redis

const rateLimit = require('express-rate-limit'); const RedisStore = require('rate-limit-redis'); const Redis = require('ioredis');

const redis = new Redis({ host: 'localhost', port: 6379 });

const apiLimiter = rateLimit({ store: new RedisStore({ sendCommand: (...args) => redis.call(...args) }), windowMs: 60 * 1000, max: (req) => req.user?.tier === 'pro' ? 1000 : 100, standardHeaders: true, legacyHeaders: false, handler: (req, res) => { res.status(429).json({ error: 'Too many requests', retryAfter: Math.ceil(res.getHeader('Retry-After')) }); } });

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

80.01%
按下载量换算186

安全审计

VirusTotal

通过

ClawScan

可疑

Static analysis

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills