mcpField
Q
quota-management

quota-management

github.com/atholaDevelopment343101 installsUpdated 1d ago
Repository

About quota-management

quota-management is a skill for teams integrating rate-limited services, with patterns for tracking cumulative request and token usage and applying thresholds. It also describes estimating task requirements before execution and recording usage afterward.

Key features

  1. 01Track request and token usage
  2. 02Three-tier quota thresholds
  3. 03Check capacity before tasks
  4. 04Record usage and request details
  5. 05Estimate token and cost needs

Use cases

  1. 01Integrating rate-limited APIs
  2. 02Tracking usage across sessions
  3. 03Deferring work near quota limits
  4. 04Estimating costs before operations

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/athola/claude-night-market --skill quota-management

After installing, type/quota-managementin Claude Code to confirm it loaded.

Bundled filesmodules/estimation-patterns.mdmodules/threshold-strategies.md

Details

From the project README

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:

LevelUsageAction
Healthy<80%Proceed normally
Warning80-95%Alert, consider batching
Critical>95%Defer non-urgent, use secondary services
Quota Types
@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
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
tracker.record_request(tokens=estimated_tokens, success=True, duration=elapsed_seconds)
Estimate Before Execution
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:

# 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

Comments

Markdown supported