Communitygithub.com

SiteGround Cache Buster Skill

Omite el almacenamiento en caché de SiteGround (SG CachePress + LiteSpeed) para el desarrollo de WordPress. Agrega código de ruptura de caché a temas hijo para pruebas de desarrollo en tiempo real.

¿Qué es SiteGround Cache Buster Skill?

Esta skill está diseñada para desarrolladores de WordPress que trabajan con sitios alojados en SiteGround y necesitan deshabilitar el almacenamiento en caché de SG CachePress y LiteSpeed durante el desarrollo. La skill agrega un fragmento de PHP al archivo functions.php del tema hijo que desactiva el caché del lado del servidor para administradores, envía cabeceras de no-caché, agrega una marca de tiempo a las URL de CSS/JS para evitar el caché del navegador y muestra un banner visual de confirmación. Es compatible con Claude Code y Cursor, y se integra mediante FTP/SFTP para implementaciones en staging. Incluye un flujo de trabajo estricto de solo staging, prohibiendo la implementación en producción. La skill también proporciona scripts de inyección automática y plantillas para almacenar credenciales de forma segura en archivos locales gitignorados.

Compatible con✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/crazyswami/siteground-cache

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Skill de Ruptura de Caché de SiteGround

Omite el almacenamiento en caché de SiteGround (SG CachePress + LiteSpeed) para el desarrollo de WordPress. Agrega código de ruptura de caché a temas hijo para pruebas de desarrollo en tiempo real.


⛔ CRÍTICO: SOLO STAGING - NUNCA PRODUCCIÓN

Claude tiene PROHIBIDO implementar en sitios de producción.

Acción¿Permitido?
Implementar en staging✅ SÍ
Implementar en producción❌ ABSOLUTAMENTE NUNCA
Leer desde producción✅ SÍ (solo lectura)
Escribir en producción❌ ABSOLUTAMENTE NUNCA

Si el usuario solicita implementar en producción:

  1. RECHAZA la solicitud
  2. Explica que las implementaciones en producción deben hacerse manualmente por el usuario
  3. Ofrece implementar en staging en su lugar

Las rutas de producción están BLOQUEADAS. Cualquier ruta que NO contenga "staging" está prohibida para escritura.


Información Requerida

Antes de usar esta skill, Claude preguntará por:

  1. Credenciales FTP/SFTP

    • Hostname (ej., ftp.example.com)
    • Usuario
    • Contraseña
    • Puerto (normalmente 21 para FTP, 22 para SFTP)
  2. URLs del Sitio

    • URL de staging (ej., https://staging.example.com)
    • URL de producción (NO necesaria - Claude no implementará allí)
  3. Ruta del Tema

    • Nombre de la carpeta del tema hijo (ej., theme-child)

Almacena las credenciales en CLAUDE.local.md (en gitignore) para futuras sesiones.


Flujo de Trabajo Solo Staging

Desarrollo Local → Sitio Staging → [USUARIO MANUALMENTE] → Producción
        ↑              ↑                   ↑
    Claude edita   Claude implementa    USUARIO implementa

Claude maneja: Edición local + Implementación en staging El usuario maneja: Implementación en producción (a través de SiteGround, cliente FTP o manualmente)


Qué Hace

  1. Desactiva el caché del lado del servidor para administradores - LiteSpeed Cache + SG CachePress
  2. Agrega cabeceras de no-caché - Previene el almacenamiento en caché de CDN/proxy
  3. Rompe el caché del navegador - Agrega una marca de tiempo a las URL de CSS/JS
  4. Muestra un banner de versión - Confirmación visual de que el tema se está cargando (solo administradores)

El Código

Fragmento PHP (agregar a functions.php)

<?php
/**
 * SiteGround Cache Buster para Desarrollo
 * Desactiva el almacenamiento en caché para administradores conectados
 * ELIMINAR O DESACTIVAR EN PRODUCCIÓN cuando terminen las pruebas
 */

// Banner de modo desarrollo (muestra versión para confirmar que el tema está activo)
add_action('wp_head', 'sg_dev_mode_banner');
function sg_dev_mode_banner() {
    if (current_user_can('administrator')) {
        $theme = wp_get_theme();
        $version = $theme->get('Version');
        $name = $theme->get('Name');
        echo '<style>
            .sg-dev-banner {
                position: fixed;
                bottom: 20px;
                right: 20px;
                background: #34889A;
                color: white;
                padding: 10px 20px;
                border-radius: 8px;
                font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
                font-size: 12px;
                z-index: 999999;
                box-shadow: 0 4px 12px rgba(0,0,0,0.3);
            }
        </style>
        <div class="sg-dev-banner">
            ' . esc_html($name) . ' v' . esc_html($version) . ' - ' . date('M j, H:i') . '
        </div>';
    }
}

// Desactiva todo el almacenamiento en caché para administradores
add_action('init', 'sg_disable_cache_for_dev');
function sg_disable_cache_for_dev() {
    if (current_user_can('administrator')) {
        // Desactiva LiteSpeed Cache
        if (!defined('LSCACHE_NO_CACHE')) {
            define('LSCACHE_NO_CACHE', true);
        }

        // Desactiva SG Optimizer/CachePress
        if (!defined('SG_CACHEPRESS_NO_CACHE')) {
            define('SG_CACHEPRESS_NO_CACHE', true);
        }

        // Envía cabeceras de no-caché
        nocache_headers();

        // Cabeceras adicionales para evitar CDN
        header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
        header('Pragma: no-cache');
        header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
    }
}

// Rompe el caché del navegador agregando marca de tiempo a CSS/JS del tema
add_filter('style_loader_src', 'sg_bust_asset_cache', 999);
add_filter('script_loader_src', 'sg_bust_asset_cache', 999);
function sg_bust_asset_cache($src) {
    if (current_user_can('administrator')) {
        // Solo rompe caché para activos del tema
        $theme_uri = get_stylesheet_directory_uri();
        $parent_uri = get_template_directory_uri();

        if (strpos($src, $theme_uri) !== false || strpos($src, $parent_uri) !== false) {
            $src = add_query_arg('v', time(), $src);
        }
    }
    return $src;
}

Uso

Método 1: Inyección automática mediante Script

# Navega a tu proyecto
cd /ruta/a/tu-proyecto-wordpress

# Ejecuta el script de inyección
/root/.claude/skills/siteground-cache/add-cache-buster.sh ./wp-content/themes/tu-tema-hijo

Método 2: Copia Manual

  1. Copia el código PHP anterior
  2. Pégalo al final del functions.php de tu tema hijo
  3. Sube vía FTP SOLO A STAGING
  4. Visita el sitio de staging como administrador - deberías ver el banner de versión

Método 3: A través de Claude

Simplemente pregunta:

  • "Agrega ruptura de caché de SiteGround a este tema"
  • "Habilita el modo desarrollo para SiteGround"
  • "Agrega cache buster a functions.php"

Claude solo implementará en staging.


Flujo de Implementación (SOLO STAGING)

Paso 1: Obtener Credenciales (Preguntar al Usuario)

Antes de implementar, pregunta al usuario:

Necesito credenciales FTP para implementar en STAGING. Por favor proporciona:
1. Host FTP (ej., ftp.tudominio.com)
2. Usuario FTP
3. Contraseña FTP
4. Ruta del sitio staging (ej., staging.tudominio.com/public_html)

Paso 2: Implementar en Staging

# SOLO STAGING - ¡Nunca producción!
lftp -u "usuario,contraseña" -e "
    set ssl:verify-certificate no
    mirror -R ./tema-hijo staging.ejemplo.com/public_html/wp-content/themes/tema-hijo
    bye
" ftp://ftp.ejemplo.com

Paso 3: Verificar en Staging

  1. Visita el sitio de staging como administrador
  2. Confirma que aparece el banner de desarrollo (esquina inferior derecha)
  3. Prueba que los cambios en CSS/JS sean visibles
  4. Verifica errores de PHP

Paso 4: El Usuario Implementa en Producción

Claude NO realiza este paso. Dile al usuario:

Los cambios están listos en staging. Para implementar en producción:

Opción 1: SiteGround Site Tools
  - Ve a Site Tools > WordPress > Staging
  - Haz clic en "Push to Live"

Opción 2: Cliente FTP (FileZilla, Cyberduck, etc.)
  - Descarga desde staging
  - Sube a producción

Opción 3: Copia manual de archivos vía FTP

Cómo Funciona Cada Parte

1. Omisión de LiteSpeed Cache

define('LSCACHE_NO_CACHE', true);

El plugin LiteSpeed Cache verifica esta constante y omite el almacenamiento en caché cuando está establecida.

2. Omisión de SG CachePress

define('SG_CACHEPRESS_NO_CACHE', true);

El plugin de caché de SiteGround respeta esta constante.

3. Cabeceras HTTP

nocache_headers();
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');

Indica a los navegadores y CDN que no almacenen en caché la respuesta.

4. Ruptura de Caché de Activos

add_query_arg('v', time(), $src);

Agrega ?v=1704567890 a las URL de CSS/JS. Como la marca de tiempo cambia cada segundo, los navegadores siempre obtienen archivos frescos.


Solución de Problemas

¿El banner no aparece?

  • Asegúrate de haber iniciado sesión como Administrador
  • Verifica que el tema hijo esté activado (Apariencia > Temas)
  • Revisa errores de PHP en el registro de errores

¿Aún ves contenido en caché?

  1. Prueba con una ventana de incógnito/privada del navegador
  2. Limpia manualmente el caché del navegador
  3. Verifica SiteGround Site Tools > Speed > Caching > Purge Cache
  4. Comprueba si Cloudflare está delante (necesitarás purgar allí también)

¿Los cambios en CSS no aparecen?

  • Ve al código fuente de la página y verifica si la marca de tiempo ?v= está en las URL de CSS
  • Recarga forzada: Ctrl+Shift+R (Windows) o Cmd+Shift+R (Mac)

Archivos en esta Skill

/root/.claude/skills/siteground-cache/
├── SKILL.md                 # Esta documentación
├── add-cache-buster.sh      # Script de inyección automática
├── cache-buster.php         # Fragmento PHP independiente
└── remove-cache-buster.sh   # Script de eliminación

Plantilla de Ejemplo de CLAUDE.local.md

Almacena esto en tu proyecto (en gitignore):

# Credenciales de SiteGround (NO SUBIR AL REPOSITORIO)

## Acceso FTP
- Host: ftp.ejemplo.com
- Usuario: [email protected]
- Contraseña: tu-contraseña
- Puerto: 21

## URLs del Sitio
- Staging: https://staging.ejemplo.com
- Producción: https://ejemplo.com (SOLO LECTURA para Claude)

## Rutas del Tema
- Staging: staging.ejemplo.com/public_html/wp-content/themes/tema-hijo
- Producción: PROHIBIDO (el usuario implementa manualmente)

Relacionado

  • wp-docker - Desarrollo local de WordPress
  • wp-performance - Optimización de almacenamiento en caché en producción
  • visual-qa - Pruebas de captura de pantalla después de cambios

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

Skills relacionados