/vercel-pack:vercel-rate-limitsfrom vercel-pack
Handles Vercel API rate limits with retry logic and exponential backoff, and configures WAF rate limiting for Vercel-deployed endpoints. Useful when hitting 429 errors or setting up rate limiting.
Ships in vercel-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Handle Vercel REST API rate limits with proper retry logic, and configure Vercel's WAF rate limiting SDK to protect your deployed API endpoints from abuse. Covers both consuming the Vercel API (outbound) and protecting your own functions (inbound).
The Vercel REST API enforces rate limits per endpoint. When exceeded, the API returns HTTP 429 with rate limit headers:
HTTP/1.1 429 Too Many Requests
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1711152000
Retry-After: 60
Known API limits:
| Endpoint Category | Rate Limit |
|---|---|
| Deployments (create) | 100/hour per project |
| Deployments (list/get) | 500/min |
| Projects (CRUD) | 200/min |
| Environment variables | 200/min |
| Domains | 200/min |
| Teams | 200/min |
| DNS records | 200/min |
| General API | 120 requests/min (default) |
// lib/rate-limit-handler.ts
interface RateLimitInfo {
limit: number;
remaining: number;
reset: number; // Unix timestamp
}
function parseRateLimitHeaders(headers: Headers): RateLimitInfo {
return {
limit: Number(headers.get('X-RateLimit-Limit') ?? 100),
remaining: Number(headers.get('X-RateLimit-Remaining') ?? 100),
reset: Number(headers.get('X-RateLimit-Reset') ?? 0),
};
}
async function vercelFetchWithRetry(
url: string,
options: RequestInit,
maxRetries = 3
): Promise<Response> {
for (let attempt = 0; attempt <= maxRetries; attempt++) {
const res = await fetch(url, options);
if (res.status !== 429) return res;
if (attempt === maxRetries) {
throw new Error(`Rate limited after ${maxRetries} retries: ${url}`);
}
// Use Retry-After header if present, otherwise exponential backoff
const retryAfter = res.headers.get('Retry-After');
const waitMs = retryAfter
? Number(retryAfter) * 1000
: Math.min(1000 * Math.pow(2, attempt) + Math.random() * 1000, 30000);
console.warn(`Rate limited (attempt ${attempt + 1}/${maxRetries}). Waiting ${Math.round(waitMs)}ms...`);
await new Promise(r => setTimeout(r, waitMs));
}
throw new Error('Unreachable');
}
// lib/rate-limiter.ts
// Track remaining quota and slow down before hitting the wall
class VercelRateLimiter {
private remaining = 100;
private resetAt = 0;
async throttle(): Promise<void> {
// If near the limit, wait until reset
if (this.remaining < 5) {
const waitMs = Math.max(0, this.resetAt * 1000 - Date.now()) + 1000;
console.warn(`Near rate limit (${this.remaining} remaining). Waiting ${waitMs}ms...`);
await new Promise(r => setTimeout(r, waitMs));
}
}
update(headers: Headers): void {
this.remaining = Number(headers.get('X-RateLimit-Remaining') ?? this.remaining);
this.resetAt = Number(headers.get('X-RateLimit-Reset') ?? this.resetAt);
}
}
Vercel's WAF provides built-in rate limiting for your deployed functions:
// middleware.ts — WAF rate limiting via Vercel Firewall SDK
import { ipAddress } from '@vercel/functions';
import { checkRateLimit } from '@vercel/firewall';
export async function middleware(request: Request) {
const ip = ipAddress(request) ?? '127.0.0.1';
// Rate limit: 100 requests per 60 seconds per IP
const { rateLimited } = await checkRateLimit('api-limit', {
key: ip,
limit: 100,
window: '60s',
});
if (rateLimited) {
return new Response(
JSON.stringify({ error: 'Too many requests. Please try again later.' }),
{ status: 429, headers: { 'Content-Type': 'application/json', 'Retry-After': '60' } }
);
}
}
export const config = {
matcher: '/api/:path*',
};
Install: npm install @vercel/firewall @vercel/functions
// api/rate-limited-endpoint.ts
import { get } from '@vercel/edge-config';
export const config = { runtime: 'edge' };
// Simple in-memory sliding window (per-isolate, not global)
const windowMs = 60_000;
const maxRequests = 50;
const requests = new Map<string, number[]>();
function isRateLimited(key: string): boolean {
const now = Date.now();
const timestamps = (requests.get(key) ?? []).filter(t => now - t < windowMs);
timestamps.push(now);
requests.set(key, timestamps);
return timestamps.length > maxRequests;
}
export default async function handler(request: Request): Promise<Response> {
const ip = request.headers.get('x-forwarded-for') ?? 'unknown';
if (isRateLimited(ip)) {
return Response.json({ error: 'Rate limit exceeded' }, { status: 429 });
}
return Response.json({ data: 'ok' });
}
| Plan | Concurrent Executions | Builds/Hour |
|---|---|---|
| Hobby | 10 | 32 |
| Pro | 1,000 | 6,000/day |
| Enterprise | 100,000 | Custom |
| Error | Cause | Solution |
|---|---|---|
429 Too Many Requests | API rate limit exceeded | Use vercelFetchWithRetry() wrapper |
FUNCTION_THROTTLED | Concurrent execution limit hit | Reduce parallelism or upgrade plan |
| Rate limit not applied | Middleware not matching routes | Check config.matcher pattern |
| In-memory rate limit resets | Edge function isolate recycled | Use Redis or Vercel KV for persistent state |
Start with a per-route, per-principal limit in preview and exempt only named, authenticated service identities through a reviewed allowlist. Exercise normal, burst, and retry behavior with synthetic clients, ensuring 429 responses include a safe retry interval and do not reveal internal quota details. Monitor false positives after rollout; if a critical integration is blocked, use a narrowly scoped temporary limit adjustment, then correct the policy instead of disabling rate limiting.
For security best practices, see vercel-security-basics.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
30 skills in this plugin
/vercel-advanced-troubleshootingAdvanced debugging for hard-to-diagnose Vercel issues including cold starts, edge errors, and function tracing.
Use when standard troubleshooting fails, investigating intermittent failures,
or preparing evidence for Vercel support escalation.
Trigger with phrases like "vercel hard bug", "vercel mystery error",
"vercel intermittent failure", "difficult vercel issue", "vercel deep debug".
/vercel-architecture-variantsChoose and implement Vercel architecture blueprints for different scales and use cases.
Use when designing new Vercel projects, choosing between static, serverless, and edge architectures,
or planning how to structure a multi-project Vercel deployment.
Trigger with phrases like "vercel architecture", "vercel blueprint",
"how to structure vercel", "vercel monorepo", "vercel multi-project".
/vercel-ci-integrationConfigure Vercel CI/CD with GitHub Actions, preview deployments, and automated testing.
Use when setting up automated deployments, configuring preview bots,
or integrating Vercel into your CI pipeline.
Trigger with phrases like "vercel CI", "vercel GitHub Actions",
"vercel automated deploy", "CI vercel", "vercel pipeline".
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin vercel-packOther plugins' skills for the same job