Agent skill
quota-management
Quota tracking, threshold monitoring, and graceful degradation for rate-limited API services. Triggers: quota, rate limiting, usage limits, thresholds Use when: integrating rate-limited services or tracking API usage
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/quota-management
SKILL.md
Quota Management
Overview
Universal patterns for tracking and enforcing resource quotas across any rate-limited service. This skill provides the foundational infrastructure that other plugins can 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
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 fallbacks |
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 fallback
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:
- Initialize tracker for your service
- Check quota before operations
- Record usage after operations
- Handle threshold warnings gracefully
Detailed Resources
- Threshold Strategies: See
modules/threshold-strategies.mdfor degradation patterns - Estimation Patterns: See
modules/estimation-patterns.mdfor token/cost estimation
Exit Criteria
- Quota status checked before operation
- Usage recorded after operation
- Threshold warnings handled appropriately
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?