Skip to content
Back to skills

Quota Management

ASecurity

Tracks quotas, monitors thresholds, and degrades gracefully for rate-limited APIs. Use when integrating external services that impose rate or cost limits.

  • 342 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added December 19, 2025
developmentpythongoapi

Works with

  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 20, 2026

npx -y skills add athola/claude-night-market --skill quota-management --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Quota Management?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Quota Management
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/athola-quota-management/badge)](https://www.skillsdirectory.com/skills/athola-quota-management)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: quota-management
description: Tracks quotas, monitors thresholds, and degrades gracefully for rate-limited APIs. Use when integrating external services that impose rate or cost limits.
alwaysApply: false
category: infrastructure
tags:
- quota
- rate-limiting
- resource-management
- thresholds
dependencies: []
tools: []
provides:
  infrastructure:
  - quota-tracking
  - threshold-monitoring
  - usage-estimation
  patterns:
  - graceful-degradation
  - quota-enforcement
  - cost-optimization
usage_patterns:
- service-integration
- rate-limit-management
- resource-monitoring
complexity: intermediate
model_hint: standard
estimated_tokens: 500
progressive_loading: true
modules:
- modules/threshold-strategies.md
- modules/estimation-patterns.md
---

# Quota Management

## Overview

Tracks cumulative token budgets and enforces limits. For per-call logging,
use usage-logging.

Patterns for tracking and enforcing resource quotas across rate-limited
services. This skill provides the infrastructure that other plugins use for
consistent quota handling.

## When To Use

- Building integrations with rate-limited APIs
- Need to track usage across sessions
- Want graceful degradation when limits approached
- Require cost estimation before operations

## When NOT To Use

- Project doesn't use the leyline infrastructure patterns
- Simple scripts without service architecture needs

## Core Concepts

### Quota Thresholds

Three-tier threshold system for proactive management:

| Level | Usage | Action |
|-------|-------|--------|
| **Healthy** | <80% | Proceed normally |
| **Warning** | 80-95% | Alert, consider batching |
| **Critical** | >95% | Defer non-urgent, use secondary services |

### Quota Types

```python
@dataclass
class QuotaConfig:
    requests_per_minute: int = 60
    requests_per_day: int = 1000
    tokens_per_minute: int = 100000
    tokens_per_day: int = 1000000
```

## Quick Start

### Check Quota Status
```python
from leyline.quota_tracker import QuotaTracker

tracker = QuotaTracker(service="my-service")
status, warnings = tracker.get_quota_status()

if status == "CRITICAL":
    # Defer or use secondary service
    pass
```

### Record Usage
```python
tracker.record_request(tokens=estimated_tokens, success=True, duration=elapsed_seconds)
```

### Estimate Before Execution
```python
can_proceed, issues = tracker.can_handle_task(estimated_tokens)
if not can_proceed:
    print(f"Quota issues: {issues}")
```

## Integration Pattern

Other plugins reference this skill:

```yaml
# In your skill's frontmatter
dependencies: [leyline:quota-management]
```

Then use the shared patterns:
1. Initialize tracker for your service
2. Check quota before operations
3. Record usage after operations
4. Handle threshold warnings gracefully

## Detailed Resources

- **Threshold Strategies**: See `modules/threshold-strategies.md` for degradation patterns
- **Estimation Patterns**: See `modules/estimation-patterns.md` for token/cost estimation

## Exit Criteria

- Quota status checked before operation
- Usage recorded after operation
- Threshold warnings handled appropriately

Files in this skill

  • SKILL.md2.9 KB
  • modules/estimation-patterns.md2.5 KB
  • modules/threshold-strategies.md1.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…