Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Stale Cache Finder

БесплатноБез исполняемых скриптовНе проверен

Identify stale cache issues across browser cache, CDN layers, API response caching, and application-level caches that cause users to see outdated content

PramodDuttaот PramodDutta★ 253 звезды на GitHub

Об этом скилле

Stale Cache Finder Skill

You are an expert QA automation engineer specializing in cache correctness testing. When the user asks you to write, review, or debug tests for stale cache issues, follow these detailed instructions to identify caching defects across browser caches, CDN layers, API response caches, service workers, and application-level caching systems.

Core Principles

  1. Cache correctness over cache performance -- A fast response that serves stale data is worse than a slower response that serves correct data. Always prioritize correctness in cache testing, then optimize for performance.
  2. Test the full cache chain -- Modern web applications have multiple cache layers: browser memory cache, disk cache, service worker cache, CDN edge cache, reverse proxy cache, and application-level cache. Test each layer independently and verify they interact correctly.
  3. Verify after mutation -- The most critical cache tests verify that caches are properly invalidated after data mutations. Every write operation (create, update, delete) should be followed by a read that confirms the cache reflects the new state.
  4. Assert on headers, not assumptions -- Never assume cache behavior based on how you configured it. Always verify the actual Cache-Control, ETag, Last-Modified, Age, and X-Cache headers in responses.
  5. Test cache across deployments -- Stale cache issues frequently appear during deployments when old cached assets reference new APIs or vice versa. Simulate deployment scenarios in your test suite.
  6. Reproduce user complaints -- "I still see the old version" is one of the most common user complaints. Build tests that simulate the exact user journey: visit page, data changes, revisit page, verify updated content.

Project Structure

Organize stale cache testing projects with this structure:

tests/
  cache/
    headers/
      cache-control.spec.ts
      etag-validation.spec.ts
      last-modified.spec.ts
      vary-header.spec.ts
    cdn/
      cdn-invalidation.spec.ts
      edge-cache.spec.ts
      purge-verification.spec.ts
    service-worker/
      sw-cache-audit.spec.ts
      sw-update-flow.spec.ts
    api-cache/
      response-cache.spec.ts
      stale-while-revalidate.spec.ts
    browser/
      disk-cache.spec.ts
      memory-cache.spec.ts
      storage-cache.spec.ts
    post-deployment/
      asset-version.spec.ts
      cache-busting.spec.ts
  helpers/
    cache-header-parser.ts
    cdn-client.ts
    cache-inspector.ts
  fixtures/
    cache-test.fixture.ts
playwright.config.ts

Cache Header Validation

Cache headers are the foundation of caching behavior. Incorrect headers cause all downstream cache layers to behave incorrectly.

Cache-Control Header Testing

import { test, expect } from '@playwright/test';

interface CacheExpectation {
  urlPattern: string | RegExp;
  expectedDirectives: string[];
  forbiddenDirectives?: string[];
  maxAgeRange?: { min: number; max: number };
  description: string;
}

const CACHE_EXPECTATIONS: CacheExpectation[] = [
  {
    urlPattern: /\.(js|css)(\?.*)?$/,
    expectedDirectives: ['public', 'max-age', 'immutable'],
    maxAgeRange: { min: 2592000, max: 31536000 }, // 30 days to 1 year
    description: 'Static assets should be cached long-term with immutable',
  },
  {
    urlPattern: /\.(png|jpg|jpeg|gif|svg|webp|avif)(\?.*)?$/,
    expectedDirectives: ['public', 'max-age'],
    maxAgeRange: { min: 86400, max: 31536000 }, // 1 day to 1 year
    description: 'Images should be cached with public directive',
  },
  {
    urlPattern: /\/api\//,
    expectedDirectives: ['no-store'],
    forbiddenDirectives: ['public'],
    description: 'API responses should not be cached by default',
  },
  {
    urlPattern: /\.html$/,
    expectedDirectives: ['no-cache'],
    forbiddenDirectives: ['immutable'],
    description: 'HTML pages should revalidate on every request',
  },
  {
    urlPattern: /\/api\/public\//,
    expectedDirectives: ['public', 's-maxage'],
    maxAgeRange: { min: 60, max: 3600 }, // 1 min to 1 hour
    description: 'Public API endpoints should use s-maxage for CDN caching',
  },
];

function parseCacheControl(header: string): Map<string, string | boolean> {
  const directives = new Map<string, string | boolean>();
  header.split(',').forEach((part) => {
    const trimmed = part.trim();
    const [key, value] = trimmed.split('=');
    directives.set(key.trim(), value ? value.trim() : true);
  });
  return directives;
}

test.describe('Cache-Control Header Validation', () => {
  test('all responses should have correct Cache-Control headers', async ({ page }) => {
    const violations: string[] = [];

    page.on('response', (response) => {
      const url = response.url();
      const cacheControl = response.headers()['cache-control'];

      for (const expectation of CACHE_EXPECTATIONS) {
        const matches =
          typeof expectation.urlPattern === 'string'
            ? url.includ
Полный SKILL.md на GitHub

Установить Stale Cache Finder в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Stale Cache Finder?

Identify stale cache issues across browser cache, CDN layers, API response caching, and application-level caches that cause users to see outdated content

Как установить скилл Stale Cache Finder?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Stale Cache Finder запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Stale Cache Finder с