Audit and harden deployed or launching Cloudflare sites across Wrangler/framework config, Zone Dashboard/API settings, and live HTTP/GEO/caching/billing behavior. Use when investigating unexpected Worker invocations or bills, low cache hit ratios, AI/search crawler 403s or GEO visibility issues, Bot Fight Mode webhook breakage, SSL/redirect loops, or reviewing all recommended Cloudflare settings before launch.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Cloudflare Prod Audit?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/deeflect-cloudflare-prod-audit)
---
name: cloudflare-prod-audit
description: Audit and harden deployed or launching Cloudflare sites across Wrangler/framework config, Zone Dashboard/API settings, and live HTTP/GEO/caching/billing behavior. Use when investigating unexpected Worker invocations or bills, low cache hit ratios, AI/search crawler 403s or GEO visibility issues, Bot Fight Mode webhook breakage, SSL/redirect loops, or reviewing all recommended Cloudflare settings before launch.
license: MIT
compatibility: Node 20+ for scripts/cf-audit.mjs. Optional read-only CLOUDFLARE_API_TOKEN or Wrangler OAuth for the API layer.
metadata:
author: deeflect
version: "1.0.0"
repository: https://github.com/deeflect/cloudflare-prod-audit
---
# Cloudflare Production Audit & Hardening
Reconcile the three layers Cloudflare splits apart for any site or fleet:
1. **Repository & Build** (`wrangler.*`, `_headers`, `_redirects`, `_routes.json`, framework adapters)
2. **Zone Dashboard & API** (SSL/TLS, Speed, Caching, Rulesets, WAF, Bot Management, AI Crawl Control, Workers Domains)
3. **Live Hostname Truth** (redirects, `cf-cache-status`, `/robots.txt`, HTML rewrites, probe routing, billing meters)
> **Scope boundary:** This skill owns **production hardening, GEO/crawler access, caching, and cost/billing guardrails**. For writing Workers, Durable Objects, or SDK code, use official [`cloudflare/skills`](https://github.com/cloudflare/skills).
## Hard Guardrails
- **Read-only first.** Never mutate live Cloudflare zones, Workers, or DNS until you present the mismatch table and get explicit approval.
- **Never guess routes when narrowing `run_worker_first`.** Inspect the Worker handler first for R2 image proxies, HTML form `POST` routes, webhooks, auth callbacks, and `/api` (both bare `/api` and `/api/*`). Blindly narrowing breaks live images (`404`) and mobile native form submits (`405`).
- **Never assume canonical host.** Some sites use `www → apex`, others `apex → www`. Check live redirects and canonical tags before changing redirects.
- **Never cache authenticated or failed responses.** Forcing Edge TTL on `Eligible for cache` strips `Set-Cookie` and leaks logged-in HTML. Caching upstream `5xx` errors turns a 5-second blip into a multi-day outage.
- **Never print secrets.** Check token presence without echoing values.
## Mode A: Audit an Existing Site or Fleet
Run the zero-dependency Node 20+ read-only collector first (`scripts/cf-audit.mjs`):
```bash
# 1. Audit one repo or a full coding folder
node scripts/cf-audit.mjs --repo /path/to/repo
node scripts/cf-audit.mjs --scan-root /path/to/projects
# 2. Probe live hostnames (redirects, cache hit/UTM split, robots/GEO, HTML traps, WAF probe paths)
node scripts/cf-audit.mjs --url https://example.com --url https://app.example.com
# 3. Include read-only Cloudflare API audit (uses CLOUDFLARE_API_TOKEN, or --wrangler-oauth)
CLOUDFLARE_API_TOKEN=... node scripts/cf-audit.mjs --api --zone example.com --repo . --url https://example.com
```
Then cross-check the script's findings against the scoped reference docs (load only what matches the site's stack or symptoms):
| Symptom / Area | Reference to read |
|---|---|
| Worker invocations, Static Assets, `run_worker_first`, Workers Cache trap, Observability Dec 2026, Spend limits, Builds, Snippets | [references/01-workers-routing-billing.md](references/01-workers-routing-billing.md) |
| R2, KV, D1, Durable Objects, Queues, Images `/cdn-cgi/image`, Containers, Workers AI, Browser Run, Search for Agents, AI Gateway, Argo | [references/02-storage-ai-edge-billing-traps.md](references/02-storage-ai-edge-billing-traps.md) |
| Cache hit ratio, CDN vs Worker execution order, `Set-Cookie` leaks, `CDN-Cache-Control`, `Vary`, UTM query split, Smart Tiered Cache, Purge | [references/03-caching-headers-vary.md](references/03-caching-headers-vary.md) |
| GEO / SEO / AI crawlers, Sept 2026 Search/Agents/Training split, Managed `robots.txt`, Perplexity caveat, Bot Fight Mode vs WAF Skip | [references/04-geo-ai-crawlers-bots.md](references/04-geo-ai-crawlers-bots.md) |
| Complete Dashboard vs API vs Wrangler settings baseline (SSL/TLS, Speed traps, URL Normalization, Transform/Config Rules, Free 5 WAF + 1 RL rule, O2O) | [references/05-dashboard-zone-baseline.md](references/05-dashboard-zone-baseline.md) |
| Astro, Next.js/OpenNext, Vite SPA, Hono, SvelteKit, multi-config deploy safety, Email Sending, Turnstile, Passkeys | [references/06-framework-deploy-traps.md](references/06-framework-deploy-traps.md) |
## Mode B: Pre-Launch / New-Zone Hardening Checklist
Apply in this exact order so no layer undercuts another:
1. **Wrangler (`wrangler.jsonc`)**
- Pin `"$schema": "./node_modules/wrangler/config-schema.json"` and a tested `compatibility_date`.
- Disable unused platform hosts on custom-domain prod Workers: `"workers_dev": false`, `"preview_urls": false`.
- Keep `cache.enabled` **OFF** on asset-first Workers (enabling Workers Cache bills every cache hit AND converts free static assets into billed Worker requests).
- Serve static files first with narrow `assets.run_worker_first` arrays (include **both** `"/api"` and `"/api/*"`), plus `assets.not_found_handling: "404-page"` or `"single-page-application"`.
- Sample logs (`observability.head_sampling_rate: 0.1` or `0.01`, or `invocation_logs: false`) under Dec 2026 Observability ingestion billing.
- In multi-config repos, always pin `-c wrangler.<target>.jsonc` in deploy scripts and Workers Builds.
2. **Caching & Headers**
- Turn **Smart Tiered Cache ON** (free on all plans).
- Separate browser vs edge caching (`Cache-Control` vs `Cloudflare-CDN-Cache-Control`). Only set `immutable` on content-hashed URLs — never on `/favicon.ico`, `/og/`, or descriptive image paths.
- Never force Edge TTL on routes that return `Set-Cookie` or personalized HTML; never cache transient `5xx` responses.
- Put public R2 buckets behind an R2 **Custom Domain** (never `r2.dev`, which bypasses CDN and bills Class B reads).
3. **GEO / AI Crawlers & Bots**
- In **Security → Settings → Bot traffic → AI Crawler and Agent access policies**: for public sites wanting search + AI citations without training, set **Search → Allow**, **Agents → Allow**, **Training → Disallow**, **Bot Preference Sync → ON**. Never set **Training → Block** on sites that rely on `Googlebot`, `Bingbot`, or `Applebot`.
- Fetch live `/robots.txt` on the canonical host after saving to confirm Managed directives did not override your rules.
- On Free zones with APIs or webhooks, leave **Bot Fight Mode OFF** (WAF Skip cannot bypass it). Use Free's 5 Custom WAF rules (block impossible probes like `/.env`, `/wp-login.php`, `/xmlrpc.php` *before* compute) + 1 Rate Limiting rule (10s window) + Turnstile on browser forms.
4. **Zone Security, SSL & Speed Baseline**
- **SSL/TLS:** `Full (strict)`, `Always Use HTTPS` ON, `Minimum TLS Version` = `1.2` (default is 1.0), `TLS 1.3` ON, staged `HSTS`, `Authenticated Origin Pulls` or `Cloudflare Tunnel` for origin protection.
- **Speed ON:** `HTTP/3`, `Early Hints` (public resources only), `URL Normalization` (incoming ON), `Crawler Hints` (public indexable sites), default compression (`Zstd`/`Brotli`).
- **Speed Traps OFF:** `Rocket Loader` (breaks hydrated React/Next/Astro), `Email Address Obfuscation` (ON by default at signup), `0-RTT` (unless all GETs are strictly idempotent), `Hotlink Protection` (or exempt OG share images). Ignore retired `Mirage` and deprecated `Auto Minify`.
- **Redirects:** Use Edge **Single Redirects** (canonical `www`↔apex) and **Bulk Redirects** (`*.pages.dev` → custom domain) instead of burning Worker invocations.
5. **Billing Guardrails**
- Set **Account Spend Limits** for Workers and Durable Objects, remembering that a Workers limit **excludes KV, R2, and D1**.
- Lock down Image Transformation allowed origins + fixed widths, keep **Search for Agents** (`/.well-known/search`) OFF unless rate-limited and budgeted ($0.75/1k semantic queries after 1k/mo free), and set monorepo **Build Watch Paths** in Workers/Pages Builds.
## Output Format
Always return a single prioritized **Mismatch Table** plus exact verification steps:
| Severity | Layer | Target | Finding & Evidence | Exact Fix | Verify With |
|---|---|---|---|---|---|
| `HIGH` / `MED` / `LOW` | `Wrangler` / `API` / `Dashboard-only` / `App` | repo or host | Concrete observed value (`file:line`, header, or API field) | Minimal safe change | Concrete `curl` / `wrangler` / dashboard check |
Separate **verified** live/local checks from **unverified** items (e.g., dashboard-only settings or missing API permissions marked `unknown`). Never claim fixed without re-running the check.