Contract
- Input: API inventory, traffic profile, client tiers, SLA targets, abuse patterns, and infrastructure capacity.
- Output: rate limiting design with algorithm selection, limit tiers, distributed coordination, API protection rules, graceful degradation, and monitoring.
- Scope: stay within the skill's declared boundaries; do not broaden without explicit direction.
- Rule: documented standards override defaults; explicit project rules take precedence.
- Rule: if blocked by missing context or dependencies, surface the blocker before proceeding.
Provenance
| Question |
Answer |
| What is the source of truth? |
The user's request, originating spec/issue, and the skill's declared outputs |
| What is in scope? |
Work covered by the skill's acceptance criteria and completion rules |
| What is explicitly out of scope? |
Files, behaviors, and decisions outside the skill's declared boundary |
| Who or what consumes this artifact afterward? |
The next skill in the workflow or the user |
| What evidence proves it is done? |
Completion criteria met, artifact saved, validation passed |
| What risk remains? |
Subjective judgment calls, missing context, or external dependency failures |
Artifact
Emit RateLimitingArtifact as both:
- JSON:
.agents/skills/platform/artifacts/rate-limiting/{identifier}.json
- Markdown view: same filename with
.md extension
Rate Limiting and Throttling
Use this skill when designing, reviewing, or implementing rate limiting and throttling systems — token bucket, sliding window, distributed rate limiting, API protection, and overload prevention.
Process
1. Identify protected resources and clients
- Catalog APIs by criticality, cost, and abuse surface.
- Classify clients: anonymous, authenticated, partner, or internal.
- Define traffic baseline, peak load, and growth projections.
Completion criterion: API inventory and client classification documented.
2. Choose rate limiting algorithms
- Select algorithm per use case: token bucket for bursty traffic, sliding window for strict intervals, fixed window for simplicity, or leaky bucket for steady rate.
- Evaluate distributed vs. local enforcement: edge gateway, service mesh, or application layer.
- Define algorithm parameters: capacity, refill rate, window size, and precision.
Completion criterion: algorithm selection documented with parameters and enforcement layer.
3. Define limit tiers and rules
- Set limit tiers per client, endpoint, or resource: free, standard, premium, or burst.
- Plan quota periods: per-second, per-minute, per-hour, or daily.
- Define multi-factor limits: requests per IP, per user, per API key, or per resource.
Completion criterion: limit tier matrix documented with enforcement granularity.
4. Design distributed coordination
- Choose coordination store for distributed limits: Redis, Memcached, or cloud-native.
- Plan consistency model: eventually consistent or strongly consistent counters.
- Handle clock skew, partition tolerance, and store failure behavior.
Completion criterion: distributed coordination design documented with failure behavior.
5. Plan error handling and graceful degradation
- Define HTTP status and headers for limit breach: 429 Too Many Requests, Retry-After, and X-RateLimit-* headers.
- Plan response degradation: queue requests, serve stale cache, or disable non-critical features.
- Design retry behavior for clients: backoff, jitter, and idempotency.
Completion criterion: error handling and degradation strategy documented.
6. Configure observability and alerting
- Define metrics: request rate, limit breach rate, 429 count, queue depth, and client impact.
- Configure tracing for rate-limited requests and audit logs for abuse patterns.
- Document operational runbook for false positive tuning and emergency limit changes.
Completion criterion: observability and operational runbook documented.
Rules
- Rule: never rate limit health check or readiness endpoints; they must remain accessible for load balancers and monitoring.
- Rule: set limits conservatively above normal traffic with headroom for legitimate bursts.
- Rule: log limit breach events with client identity and endpoint for audit and tuning.
- Rule: test limit enforcement under load with production-like traffic patterns before deploy.
- Rule: document emergency override procedures for false positives or incidents.
- Rule: apply rate limiting at the edge when possible to protect downstream services.
Completion
- the skill's completion criteria are explicitly checked
- the artifact is saved and validated
- any blockers or skipped validations are documented
- the next consumer is identified or the work is handed off
@include .agents/skills/platform/contract-base.xml
1---2name: "rate-limiting"3category: "backend"4maturity: "stable"5version: "1"6description: "Rate limiting and throttling (token bucket, sliding window, distributed rate limiting, API protection)."7license: "MIT"8capabilities:9 - apply rate limiting methods within explicit backend boundaries10 - analyze rate limiting and throttling (token bucket, sliding window, distributed rate limiting, api protection) with assumptions, constraints, and failure modes11 - produce and validate a backend artifact with evidence, decisions, and next steps12outputs: "rate limiting design with algorithm selection, limit tiers, distributed coordination, API protection rules, graceful degradation, and monitoring."13sideEffects: []14dependencies: []15stopCondition: "Rate limiting algorithms, limit tiers, distributed coordination, and API protection rules are explicit."16risk: "medium"17trustTier: "3"18maxIterations: "6"19promptVersion: "2.0"20artifactType: "backend"21modelTier: "reasoning"22evaluators: ["behavioral", "regression"]23fixturesPath: .agents/skills/platform/fixtures/behavioral/rate-limiting.json24diataxis: "how-to"25tags: ["backend"]26compatibility: []27approvalRequired: "true"28approvalFor: []29metadata:30 source: https://skillmd.com/skills/quantumquirkxyz/rate-limiting31---3233## Contract3435- Input: API inventory, traffic profile, client tiers, SLA targets, abuse patterns, and infrastructure capacity.36- Output: rate limiting design with algorithm selection, limit tiers, distributed coordination, API protection rules, graceful degradation, and monitoring.37- Scope: stay within the skill's declared boundaries; do not broaden without explicit direction.38- Rule: documented standards override defaults; explicit project rules take precedence.39- Rule: if blocked by missing context or dependencies, surface the blocker before proceeding.4041## Provenance4243| Question | Answer |44|---|---|45| What is the source of truth? | The user's request, originating spec/issue, and the skill's declared outputs |46| What is in scope? | Work covered by the skill's acceptance criteria and completion rules |47| What is explicitly out of scope? | Files, behaviors, and decisions outside the skill's declared boundary |48| Who or what consumes this artifact afterward? | The next skill in the workflow or the user |49| What evidence proves it is done? | Completion criteria met, artifact saved, validation passed |50| What risk remains? | Subjective judgment calls, missing context, or external dependency failures515253## Artifact5455Emit `RateLimitingArtifact` as both:56- JSON: `.agents/skills/platform/artifacts/rate-limiting/{identifier}.json`57- Markdown view: same filename with `.md` extension585960# 61# 62# Rate Limiting and Throttling6364Use this skill when designing, reviewing, or implementing rate limiting and throttling systems — token bucket, sliding window, distributed rate limiting, API protection, and overload prevention.656667## Process6869### 1. Identify protected resources and clients70- Catalog APIs by criticality, cost, and abuse surface.71- Classify clients: anonymous, authenticated, partner, or internal.72- Define traffic baseline, peak load, and growth projections.7374**Completion criterion:** API inventory and client classification documented.7576### 2. Choose rate limiting algorithms77- Select algorithm per use case: token bucket for bursty traffic, sliding window for strict intervals, fixed window for simplicity, or leaky bucket for steady rate.78- Evaluate distributed vs. local enforcement: edge gateway, service mesh, or application layer.79- Define algorithm parameters: capacity, refill rate, window size, and precision.8081**Completion criterion:** algorithm selection documented with parameters and enforcement layer.8283### 3. Define limit tiers and rules84- Set limit tiers per client, endpoint, or resource: free, standard, premium, or burst.85- Plan quota periods: per-second, per-minute, per-hour, or daily.86- Define multi-factor limits: requests per IP, per user, per API key, or per resource.8788**Completion criterion:** limit tier matrix documented with enforcement granularity.8990### 4. Design distributed coordination91- Choose coordination store for distributed limits: Redis, Memcached, or cloud-native.92- Plan consistency model: eventually consistent or strongly consistent counters.93- Handle clock skew, partition tolerance, and store failure behavior.9495**Completion criterion:** distributed coordination design documented with failure behavior.9697### 5. Plan error handling and graceful degradation98- Define HTTP status and headers for limit breach: 429 Too Many Requests, Retry-After, and X-RateLimit-* headers.99- Plan response degradation: queue requests, serve stale cache, or disable non-critical features.100- Design retry behavior for clients: backoff, jitter, and idempotency.101102**Completion criterion:** error handling and degradation strategy documented.103104### 6. Configure observability and alerting105- Define metrics: request rate, limit breach rate, 429 count, queue depth, and client impact.106- Configure tracing for rate-limited requests and audit logs for abuse patterns.107- Document operational runbook for false positive tuning and emergency limit changes.108109**Completion criterion:** observability and operational runbook documented.110111## Rules112113- Rule: never rate limit health check or readiness endpoints; they must remain accessible for load balancers and monitoring.114- Rule: set limits conservatively above normal traffic with headroom for legitimate bursts.115- Rule: log limit breach events with client identity and endpoint for audit and tuning.116- Rule: test limit enforcement under load with production-like traffic patterns before deploy.117- Rule: document emergency override procedures for false positives or incidents.118- Rule: apply rate limiting at the edge when possible to protect downstream services.119120## Completion121122- the skill's completion criteria are explicitly checked123- the artifact is saved and validated124- any blockers or skipped validations are documented125- the next consumer is identified or the work is handed off126---127@include .agents/skills/platform/contract-base.xml