agentsclimarketplace

Cache strategist

Skill AtulPurohit/Antigravity-Awesome-Skills/skills/cache-strategist

Installable GitHub library of 300+ professional agentic skills for Claude Code, Antigravity IDE, Gemini CLI, Cursor, and Copilot. Features a custom NPX installer, 9 stack-specific bundles, validation schemas, security auditing, and an interactive catalog explorer app.

Install
npx -y skills add AtulPurohit/Antigravity-Awesome-Skills --skill cache-strategist

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

3 things to look at

  • 26 days oldThe repository was created 26 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Design comprehensive caching strategies across all layers: browser cache, CDN, application cache, database query cache, and Redis. Maximize performance while maintaining data freshness.

SKILL.md

5.2 KB, as published. Nobody here has run it

Cache Strategist

Purpose

Design and implement a multi-layer caching strategy that dramatically improves application performance while ensuring appropriate data freshness.

Operating Mode

You are a performance and caching engineer. You identify what to cache, for how long, and design invalidation strategies that prevent stale data.

Caching Layers

1️⃣ Cache Layer Architecture

Client Browser Cache
        ↓
    CDN Cache (Cloudflare, CloudFront)
        ↓
    Application Cache (Redis, Memcached)
        ↓
    Database Query Cache
        ↓
    Database (MySQL, PostgreSQL)

2️⃣ What to Cache (Decision Matrix)

Data TypeCache?TTLReason
Static assets (JS/CSS/images)✅ Yes1 year + CDNNever changes (content hash)
Public page HTML✅ Yes5-60 minHigh traffic, slow to generate
User session✅ Yes2 hoursEvery request needs it
Auth tokens✅ YesToken lifetimeSpeed, avoid DB per request
Search results✅ Yes5 minExpensive queries
Product catalog✅ Yes1 hourChanges infrequently
User-specific data⚠️ Selective30 minRisk of stale user data
Financial totals❌ No0Must be accurate
Real-time stock❌ No0Always fresh

3️⃣ Cache Patterns

Cache-Aside (Lazy Loading)

function getUser(int $id): User
{
    $key = "user:{$id}";
    
    if ($cached = Cache::get($key)) {
        return $cached;  // Cache hit
    }
    
    $user = User::find($id);  // Cache miss - hit DB
    Cache::put($key, $user, ttl: 3600);
    return $user;
}

Write-Through

function updateUser(int $id, array $data): User
{
    $user = User::findOrFail($id)->update($data);
    Cache::put("user:{$id}", $user, 3600);  // Always update cache
    return $user;
}

Read-Through (pattern with Repository)

class CachedUserRepository
{
    public function find(int $id): ?User
    {
        return Cache::remember("user:{$id}", 3600, fn() => 
            $this->db->find($id)  // Only fetches when cache misses
        );
    }
}

Cache-Aside with Stampede Prevention

function getExpensiveData(string $key): mixed
{
    // Use atomic lock to prevent stampede
    return Cache::lock("lock:{$key}", seconds: 10)
        ->block(seconds: 5, callback: fn() =>
            Cache::remember($key, 300, fn() => computeExpensiveData())
        );
}

4️⃣ Cache Invalidation Strategies

Tag-Based Invalidation

// Store with tags
Cache::tags(['posts', "user:123"])->put("post:456", $post, 3600);

// Invalidate user's cached posts when user updates
public function updateUser(User $user, array $data): void
{
    $user->update($data);
    Cache::tags(["user:{$user->id}"])->flush();  // Clears all user's cached data
}

Event-Driven Invalidation

// Listen to model events
class Post extends Model
{
    protected static function booted(): void
    {
        static::saved(fn($post) => Cache::forget("post:{$post->id}"));
        static::deleted(fn($post) => Cache::forget("post:{$post->id}"));
    }
}

5️⃣ CDN Configuration (Cloudflare)

# Page rules for caching:

# Cache static assets for 1 year
*.js, *.css, *.png, *.woff2
Cache-Control: public, max-age=31536000, immutable

# Cache API responses for 60 seconds
/api/v1/products*
Cache-Control: public, s-maxage=60, stale-while-revalidate=300

# Never cache
/api/v1/cart, /api/v1/auth/*
Cache-Control: no-store

# Vary header for content negotiation
Vary: Accept-Encoding, Accept

6️⃣ Redis Cache Configuration

// config/cache.php
'redis' => [
    'driver'     => 'redis',
    'connection' => 'cache',    // Separate Redis DB for cache
    'lock_connection' => 'default',
],

// Separate Redis connection for cache vs sessions vs queues
'connections' => [
    'default' => ['url' => env('REDIS_URL'), 'database' => 0],  // Default/sessions
    'cache'   => ['url' => env('REDIS_CACHE_URL'), 'database' => 1],  // Cache
    'queue'   => ['url' => env('REDIS_QUEUE_URL'), 'database' => 2],  // Queues
],

7️⃣ Monitoring Cache Performance

# Redis cache hit rate monitoring
redis-cli info stats | grep keyspace_hits
redis-cli info stats | grep keyspace_misses

# Target: > 95% hit rate for frequently accessed data
# Formula: hits / (hits + misses) * 100

# Monitor memory usage
redis-cli info memory | grep used_memory_human

# List largest keys (find memory hogs)
redis-cli --bigkeys

Outputs

  1. Multi-layer caching strategy document
  2. Cache implementation code (per framework)
  3. Invalidation strategy for each entity type
  4. CDN configuration
  5. Cache monitoring dashboard queries
  6. Performance baseline and targets

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.