Communitygithub.com

SiteGround Cache Buster

Desativa o cache do SiteGround (SG CachePress + LiteSpeed) para desenvolvimento WordPress. Adiciona código de quebra de cache em temas filhos para testes de desenvolvimento em tempo real.

O que é SiteGround Cache Buster?

Este skill é projetado para desenvolvedores WordPress que trabalham em sites hospedados na SiteGround e precisam contornar o cache agressivo (SG CachePress e LiteSpeed Cache) durante o desenvolvimento. Ele injeta um snippet PHP no arquivo functions.php do tema filho que desativa o cache para administradores logados, adiciona cabeçalhos HTTP no-cache e quebra o cache do navegador adicionando timestamps às URLs de CSS e JS. Também exibe um banner visual que confirma que a versão mais recente do tema está sendo carregada. O skill suporta os modos de implantação FTP/SFTP e é estritamente limitado a ambientes de staging — a implantação em produção é bloqueada e o desenvolvedor humano deve fazê-la manualmente. É compatível com Claude Code (e ferramentas similares como Cursor, Codex, etc.) e armazena credenciais no arquivo gitignorado CLAUDE.local.md para uso em sessões futuras. Útil para evitar o ciclo frustrante de fazer uma alteração, salvar, atualizar o navegador e ainda ver conteúdo obsoleto em cache.

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

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

Skill SiteGround Cache Buster

Desativa o cache do SiteGround (SG CachePress + LiteSpeed) para desenvolvimento WordPress. Adiciona código de quebra de cache em temas filhos para testes de desenvolvimento em tempo real.


⛔ CRÍTICO: APENAS STAGING - NUNCA PRODUÇÃO

Claude está PROIBIDO de implantar em sites de produção.

AçãoPermitida?
Implantar em staging✅ SIM
Implantar em produção❌ ABSOLUTAMENTE NUNCA
Ler de produção✅ SIM (somente leitura)
Escrever em produção❌ ABSOLUTAMENTE NUNCA

Se o usuário solicitar implantação em produção:

  1. RECUSE a solicitação
  2. Explique que implantações em produção devem ser feitas manualmente pelo usuário
  3. Ofereça implantar em staging

Caminhos de produção estão BLOQUEADOS. Qualquer caminho que NÃO contenha "staging" é proibido para escritas.


Informações Necessárias

Antes de usar este skill, Claude perguntará:

  1. Credenciais FTP/SFTP

    • Hostname (ex.: ftp.exemplo.com)
    • Nome de usuário
    • Senha
    • Porta (geralmente 21 para FTP, 22 para SFTP)
  2. URLs do Site

    • URL de staging (ex.: https://staging.exemplo.com)
    • URL de produção (NÃO necessária – Claude não implantará lá)
  3. Caminho do Tema

    • Nome da pasta do tema filho (ex.: tema-filho)

Armazene as credenciais no CLAUDE.local.md do projeto (gitignorado) para sessões futuras.


Fluxo de Trabalho Apenas Staging

Desenvolvimento Local → Site de Staging → [USUÁRIO MANUALMENTE] → Produção
        ↑              ↑                   ↑
    Claude edita   Claude implanta     USUÁRIO implanta

Claude lida com: Edição local + Implantação em staging Usuário lida com: Implantação em produção (via SiteGround, cliente FTP ou manualmente)


O Que Ele Faz

  1. Desativa o cache do lado do servidor para administradores - LiteSpeed Cache + SG CachePress
  2. Adiciona cabeçalhos no-cache - Impede cache de CDN/proxy
  3. Quebra o cache do navegador - Adiciona timestamp em URLs de CSS/JS
  4. Mostra banner de versão - Confirmação visual de que o tema está carregando (apenas admin)

O Código

Snippet PHP (adicione ao functions.php)

/**
 * SiteGround Cache Buster para Desenvolvimento
 * Desativa o cache para administradores logados
 * REMOVA OU DESATIVE EM PRODUÇÃO quando terminar os testes
 */

// Banner de modo de desenvolvimento (mostra versão para confirmar que o tema está ativo)
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>';
    }
}

// Desativa todo cache para administradores
add_action('init', 'sg_disable_cache_for_dev');
function sg_disable_cache_for_dev() {
    if (current_user_can('administrator')) {
        // Desativa LiteSpeed Cache
        if (!defined('LSCACHE_NO_CACHE')) {
            define('LSCACHE_NO_CACHE', true);
        }

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

        // Envia cabeçalhos no-cache
        nocache_headers();

        // Cabeçalhos adicionais para bypass de 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');
    }
}

// Quebra cache do navegador adicionando timestamp a CSS/JS do 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')) {
        // Só quebra cache para assets do 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: Injeção automática via Script

# Navegue até seu projeto
cd /caminho/para/projeto-wordpress

# Execute o script de injeção
/root/.claude/skills/siteground-cache/add-cache-buster.sh ./wp-content/themes/seu-tema-filho

Método 2: Cópia Manual

  1. Copie o código PHP acima
  2. Cole no final do arquivo functions.php do seu tema filho
  3. Envie via FTP SOMENTE PARA STAGING
  4. Visite o site de staging como admin – você verá o banner de versão

Método 3: Via Claude

Basta pedir:

  • "Adicione quebra de cache do SiteGround a este tema"
  • "Ative modo de desenvolvimento para SiteGround"
  • "Adicione cache buster ao functions.php"

Claude implantará apenas em staging.


Fluxo de Implantação (SOMENTE STAGING)

Passo 1: Obter Credenciais (Pergunte ao Usuário)

Antes de implantar, pergunte ao usuário:

Preciso das credenciais FTP para implantar no STAGING. Por favor, forneça:
1. Host FTP (ex.: ftp.seudominio.com)
2. Usuário FTP
3. Senha FTP
4. Caminho do site de staging (ex.: staging.seudominio.com/public_html)

Passo 2: Implantar no Staging

# SOMENTE STAGING - Nunca produção!
lftp -u "usuario,senha" -e "
    set ssl:verify-certificate no
    mirror -R ./tema-filho staging.exemplo.com/public_html/wp-content/themes/tema-filho
    bye
" ftp://ftp.exemplo.com

Passo 3: Verificar no Staging

  1. Visite o site de staging como admin
  2. Confirme se o banner de desenvolvimento aparece (canto inferior direito)
  3. Teste se alterações de CSS/JS são visíveis
  4. Verifique se há erros de PHP

Passo 4: Usuário Implanta em Produção

Claude NÃO faz este passo. Diga ao usuário:

As alterações estão prontas no staging. Para implantar em produção:

Opção 1: SiteGround Site Tools
  - Acesse Site Tools > WordPress > Staging
  - Clique em "Push to Live"

Opção 2: Cliente FTP (FileZilla, Cyberduck, etc.)
  - Baixe do staging
  - Envie para produção

Opção 3: Cópia manual de arquivos via FTP

Como Cada Parte Funciona

1. Bypass do LiteSpeed Cache

define('LSCACHE_NO_CACHE', true);

O plugin LiteSpeed Cache verifica esta constante e pula o cache quando definida.

2. Bypass do SG CachePress

define('SG_CACHEPRESS_NO_CACHE', true);

O plugin de cache da SiteGround respeita esta constante.

3. Cabeçalhos HTTP

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

Informa navegadores e CDNs para não armazenar em cache a resposta.

4. Quebra de Cache de Assets

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

Adiciona ?v=1704567890 às URLs de CSS/JS. Como o timestamp muda a cada segundo, os navegadores sempre buscam arquivos novos.


Solução de Problemas

O banner não aparece?

  • Certifique-se de que está logado como Administrador
  • Verifique se o tema filho está ativo (Aparência > Temas)
  • Verifique se há erros de PHP no log de erros

Ainda vendo conteúdo em cache?

  1. Tente uma janela anônima/privada do navegador
  2. Limpe o cache do navegador manualmente
  3. Verifique SiteGround Site Tools > Speed > Caching > Purge Cache
  4. Verifique se o Cloudflare está na frente (precisa purgar lá também)

Alterações de CSS não aparecem?

  • Veja o código-fonte da página e verifique se o timestamp ?v= está nas URLs de CSS
  • Atualização forçada: Ctrl+Shift+R (Windows) ou Cmd+Shift+R (Mac)

Arquivos Neste Skill

/root/.claude/skills/siteground-cache/
├── SKILL.md                 # Esta documentação
├── add-cache-buster.sh      # Script de injeção automática
├── cache-buster.php         # Snippet PHP independente
└── remove-cache-buster.sh   # Script de remoção

Exemplo de Template CLAUDE.local.md

Armazene no seu projeto (gitignorado):

# Credenciais SiteGround (NÃO COMMITAR)

## Acesso FTP
- Host: ftp.exemplo.com
- Usuário: [email protected]
- Senha: sua-senha
- Porta: 21

## URLs do Site
- Staging: https://staging.exemplo.com
- Produção: https://exemplo.com (SOMENTE LEITURA para Claude)

## Caminhos dos Temas
- Staging: staging.exemplo.com/public_html/wp-content/themes/tema-filho
- Produção: PROIBIDO (usuário implanta manualmente)

Relacionados

  • wp-docker - Desenvolvimento WordPress local
  • wp-performance - Otimização de cache em produção
  • visual-qa - Testes de captura de tela após alterações

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

Habilidades Relacionadas