Skip to content
Back to skills

1 Handle Rate Limits

ASecurity

Sub-skill of time-tracking: 1. Handle Rate Limits (+2).

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 9, 2026
developmentpythongoapi

Works with

  • api

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add vamseeachanta/workspace-hub --skill 1-handle-rate-limits --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 1 Handle Rate Limits?

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

Security grade badge for 1 Handle Rate Limits
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vamseeachanta-1-handle-rate-limits/badge)](https://www.skillsdirectory.com/skills/vamseeachanta-1-handle-rate-limits)

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: time-tracking-1-handle-rate-limits
description: 'Sub-skill of time-tracking: 1. Handle Rate Limits (+2).'
version: 1.0.0
category: business
type: reference
scripts_exempt: true
---

# 1. Handle Rate Limits (+2)

## 1. Handle Rate Limits


```python
import time
from functools import wraps

def rate_limited(max_per_second=1):
    """Rate limiting decorator."""
    min_interval = 1.0 / max_per_second
    last_call = [0.0]

    def decorator(func):
        @wraps(func)
        def wrapper(*args, **kwargs):
            elapsed = time.time() - last_call[0]
            if elapsed < min_interval:
                time.sleep(min_interval - elapsed)
            result = func(*args, **kwargs)
            last_call[0] = time.time()
            return result
        return wrapper
    return decorator
```


## 2. Cache API Responses


```python
from functools import lru_cache
from datetime import datetime

@lru_cache(maxsize=100)
def get_projects_cached(workspace_id, cache_key=None):
    """Get projects with caching."""
    return toggl.get_projects(workspace_id)

# Invalidate cache daily
cache_key = datetime.now().strftime("%Y-%m-%d")
projects = get_projects_cached(workspace_id, cache_key)
```


## 3. Validate Time Entries


```python
def validate_time_entry(entry):
    """Validate time entry before creating."""
    if not entry.get("description"):
        raise ValueError("Description is required")

    duration = entry.get("duration", 0)
    if duration > 12 * 3600:  # More than 12 hours
        raise ValueError("Duration exceeds 12 hours")

    if duration < 60:  # Less than 1 minute
        raise ValueError("Duration too short")

    return True
```

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…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.