---
name: "cloudflare-page-rules-edge-cache"
description: "Accelerate static and dynamic content delivery using Cloudflare Cache Rules and Cache-Tags."
metadata:
  author: "Cloudflare"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "configure cloudflare cache rules"
  - "purge cloudflare cache by tag"
  - "edge ttl cloudflare"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Cloudflare Cache Rules & Edge TTL Optimization

Configures Cloudflare Cache Rules: defining cache eligibility by path/file extension, setting Edge Cache TTL and Browser TTL, bypassing cache on dynamic cookies, and purging cache by Cache-Tag via API.

## When to Invoke
Invoke this skill whenever you need to:
- configure cloudflare cache rules
- purge cloudflare cache by tag
- edge ttl cloudflare

## Execution SOP & Rules
1. Navigate to Caching -> Cache Rules and create targeted rules matching URL path expressions.
2. Set Cache Eligibility: Eligible for cache, with Edge TTL: Override origin (e.g. 7 days).
3. Emit 'Cache-Tag: product-123' headers in origin application HTTP responses.
4. Purge targeted tags via API: POST /zones/{zone_id}/purge_cache with JSON: { tags: ['product-123'] }.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
