用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/arbazkhan971/godmode --skill ratelimit命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | ratelimit |
| description | Rate limiting algorithms, quota management, throttling, API protection. |
/godmode:ratelimit, "rate limit", "throttle"grep -r "rate.limit\|ratelimit\|throttle" \
package.json requirements.txt go.mod 2>/dev/null
grep -r "rateLim\|throttle\|RateLimit" \
--include="*.ts" --include="*.py" -l 2>/dev/null
Current: None | Basic (nginx) | App-level | Multi-layer
API Surface: public <N>, authenticated <N>, internal <N>
Risk: unauthenticated abuse, cost-sensitive endpoints
IF unsure: use sliding window counter. IF burst tolerance needed: use token bucket.
Anonymous: 20/min, burst 5, 1K/day
Free: 60/min, burst 15, 10K/day
Basic/$29: 300/min, burst 50, 100K/day
Pro/$99: 1K/min, burst 200, 1M/day
Enterprise: 5K/min, burst 1K, unlimited
Internal: no limit (bypass)
Endpoint overrides (stricter):
Resolution: endpoint > user tier > global IP.
Standard: RateLimit-Limit, RateLimit-Remaining,
RateLimit-Reset. On 429: add Retry-After.
Set headers on EVERY response (success and 429).
Lua script for atomic sliding window counter.
Without shared state, N instances * limit = N*limit.
Load script via SCRIPT LOAD, call via EVALSHA.
Resolve client key (API key or IP), resolve tier, call Redis Lua, set headers, return 429 when denied. Skip health checks and internal paths.
RULE: Rate limiter failure NEVER causes app failure. Fail OPEN when Redis is down. Log warning. Optional local in-memory fallback (less accurate).
Rate limit = short window (100/min).
Quota = long window (10K/day, 1M/month).
INCR quota:{key}:{date} with 2-day TTL.
Warn at 75%, 90%, 100%. Optional overage billing.
Metrics: requests_total, rejected_total (>100/min), rejected_ratio (>10%), latency P95 (>5ms), redis_errors, failopen_total (>0), quota_usage (>90%).
All public endpoints protected, auth endpoints strict (<=5/min), headers on all responses, 429 has Retry-After, atomic ops, fail-open, tier limits set.
Append .godmode/ratelimit.tsv:
timestamp algorithm storage tiers endpoint_overrides quota status
KEEP if: limit enforced atomically AND headers present
AND fail-open on Redis down.
DISCARD if: race condition allows bypass
OR 429 missing Retry-After OR fail-closed.
STOP when FIRST of:
- All public endpoints protected
- Tiers configured
- Fail-open verified
On failure: git reset --hard HEAD~1. Never pause.
| Failure | Action |
|---|---|
| Redis unavailable | Fail open, in-memory fallback |
| Clients bypassing | Check atomic ops, add IP limit |
| 429 no Retry-After | Add to response handler |
| Limits too strict | Analyze traffic, increase burst |
| Lua script errors | Check Redis version, reload |