Command Palette

Search for a command to run...

Назад к скиллам
скилл № 34981

marketplace-rate-limiting

Apply when implementing retry logic, rate limit handling, or resilience patterns in VTEX API integrations. Covers VTEX rate limit headers…

БесплатноБез исполняемых скриптов
vtexот vtex★ 47 звёзд на GitHub

Установить marketplace-rate-limiting в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

API Rate Limiting & Resilience

When this skill applies

Use this skill when building any integration that calls VTEX APIs — catalog sync, order processing, price/inventory updates, or fulfillment operations — and needs to handle rate limits gracefully without losing data or degrading performance.

  • Implementing retry logic with exponential backoff and jitter
  • Reading and reacting to VTEX rate limit headers (Retry-After, X-RateLimit-Remaining, X-RateLimit-Reset)
  • Building circuit breakers for high-throughput integrations
  • Controlling request throughput with queuing

Do not use this skill for:

  • Catalog-specific synchronization logic (see marketplace-catalog-sync)
  • Order event consumption and processing (see marketplace-order-hook)
  • Invoice and tracking submission (see marketplace-fulfillment)

Decision rules

  • Always implement exponential backoff with jitter on 429 responses. Formula: delay = min(maxDelay, baseDelay * 2^attempt) * (0.5 + random(0, 0.5)).
  • Always read the Retry-After header on 429 responses. Use the greater of the Retry-After value and the calculated backoff delay.
  • Use a circuit breaker when a service consistently fails (e.g., after 5 consecutive failures), to prevent cascading failures and give the service time to recover.
  • Use a request queue to control throughput and avoid bursts that trigger rate limits.
  • Monitor X-RateLimit-Remaining proactively on successful responses and slow down before hitting 429.
  • VTEX rate limits vary by API:
    • Pricing API: PUT/POST: 40 requests/second/account with 1000 burst credits. DELETE: 16 requests/second/account with 300 burst credits.
    • Catalog API: Varies by endpoint; no published fixed limits.
    • Orders API: Subject to general platform limits; VTEX recommends 1-minute backoff on 429.
  • Burst Credits: When you exceed the rate limit, excess requests consume burst credits (1 credit per excess request). When burst credits reach 0, the request is blocked with 429. Credits refill over time at the same rate as the route's limit when the route is not being used.

Rate Limit Response Headers:

Header Description
Retry-After Seconds to wait before retrying (present on 429 responses)
X-RateLimit-Remaining Number of requests remaining in the current window
X-RateLimit-Reset Timestamp (seconds) when the rate limit window resets

Architecture/Data Flow:

Your Integration                          VTEX API
      │                                       │
      │── Request ──────────────────────────▶│
      │◀── 200 OK ─────────────────────────│  (success)
      │                                       │
      │── Request ──────────────────────────▶│
      │◀── 429 + Retry-After: 30 ──────────│  (rate limited)
      │                                       │
      │   [Wait: max(Retry-After, backoff)]   │
      │   [backoff = base * 2^attempt * jitter]│
      │                                       │
      │── Retry ───────────────────────────▶│
      │◀── 200 OK ─────────────────────────│  (success)

Hard constraints

Constraint: Implement Exponential Backoff on 429 Responses

When receiving a 429 response, the integration MUST wait before retrying using exponential backoff with jitter. The wait time MUST respect the Retry-After header when present.

Why this matters

Immediate retries after a 429 will be rejected again and consume burst credits faster, leading to prolonged blocking. Without jitter, all clients retry simultaneously after the window resets, causing another rate limit spike (thundering herd).

Detection

If you see immediate retry on 429 (no delay, no backoff) → STOP and implement exponential backoff. If you see retry logic without reading the Retry-After header → warn that the header should be respected. If you see while(true) retry loops or setInterval with intervals less than 5 seconds → warn about tight loops.

Correct

import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, AxiosResponse } from "axios";

interface RetryConfig {
  maxRetries: number;
  baseDelayMs: number;
  maxDelayMs: number;
}

const DEFAULT_RETRY_CONFIG: RetryConfig = {
  maxRetries: 5,
  baseDelayMs: 1000,
  maxDelayMs: 60000,
};

/**
 * Calculates exponential backoff delay with full jitter.
 *
 * Formula: min(maxDelay, baseDelay * 2^attempt) * random(0.5, 1.0)
 *
 * The jitter prevents thundering herd when multiple clients
 * are rate-limited simultaneously.
 */
function calculateBackoffWithJitter(
  attempt: number,
  baseDelayMs: number,
  maxDelayMs: number
): number {
  const exponentialDelay = baseDelayMs * Math.pow(2, attempt);
  const boundedDelay = Math.min(maxDelayMs, exponentialDelay);
  // Full jitter: random value between 50% and 100% of the bounded delay
  const jitter = 0.5 + Math.random() * 0.5;
  return Math.floor(boundedDelay * jitter);
}

/**
 * Executes an API request with au
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл marketplace-rate-limiting?

Apply when implementing retry logic, rate limit handling, or resilience patterns in VTEX API integrations. Covers VTEX rate limit headers (X-RateLimit-Remaining, X-RateLimit-Reset, Retry-After), 429 status handling, exponential backoff with jitter, circuit breaker patterns, and request queuing. Use for any VTEX marketplace integration that must gracefully handle API throttling and maintain high availability.

Как установить скилл marketplace-rate-limiting?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл marketplace-rate-limiting запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить marketplace-rate-limiting с