Safe change checklist
Work through every step. Skip a step only if it says it's optional.
1. Pin the target
- Resolve the account id and zone id from memory. Pass
CLOUDFLARE_ACCOUNT_ID=<id> inline and -z <zone id>
explicitly. Use ids, not names.
- If you're in a project directory, check
.env* files for CLOUDFLARE_* values that would override.
- Confirm the token that will run the write. Use the write token inline, only for this command.
- Classify the target as production or non-production from memory. If you can't tell, treat it as production.
2. Snapshot current state (to a file, never pasted into chat)
Save to ./cf-snapshots/<UTC timestamp>-<resource>.json (or .bind) in your working area.
| Change |
Snapshot command (verified) |
| DNS |
cf dns records export -z $Z > pre.bind and cf dns records list -z $Z --per-page 100 --page N (all pages) > pre.json |
| Zone setting |
cf zones settings get <setting> -z $Z > pre.json |
| WAF/rules |
cf rulesets account-rulesets phases get <phase> -z $Z > pre.json (includes version) |
| DNSSEC |
cf dns dnssec get -z $Z > pre.json (also record the DS at the registrar) |
| Access |
cf zero-trust access applications list and ... policies list (UNVERIFIED args) |
| Worker |
cf workers deployments list and cf workers versions list (UNVERIFIED args; record the current version id) |
| Tokens |
cf accounts tokens list | jq 'map({id,name,status,policies})' |
| Snapshots can contain sensitive values (TXT verification strings, binding text). Keep them local and |
|
| never share them. |
|
3. Build the exact command and diff
- Find it with
cf cli search, read <command> --help and cf schema <command>.
- Run it with
--dry-run to confirm the method, URL, and body. Skip this for secret-bearing commands,
because dry-run echoes the body.
- Write a human diff: before and after, per field, with counts. For DNS, also say whether proxied changes.
4. Risk checks for the dangerous classes
- Cache purge: prefer
files, tags, hosts, or prefixes over {"purge_everything":true}. A full
purge sends an origin load spike. Always confirm it.
- SSL mode: going to
strict needs a valid origin cert, and going to off or flexible can cause
redirect loops. Check the origin with a curl first.
- Proxy toggle: turning proxied off exposes the origin IP and bypasses WAF and cache. Turning it on
breaks non-HTTP services.
- Nameservers or zone moves: these propagate over hours to days. The rollback is slow. Always confirm.
- DNSSEC: never disable while a DS record exists at the registrar (remove the DS first and wait for the TTL).
Never enable without planning to add the DS.
- Access: make sure the change doesn't remove the owner's own access or a service-token path used by
automation. Test with
cf zero-trust access applications user-policy-checks list (UNVERIFIED args).
- Worker routes or triggers: list existing routes for the zone first. Beta.5 has no routes-list command,
so use the API through curl (UNVERIFIED) or the dashboard. A more specific overlapping pattern wins
silently.
- Rulesets:
phases update replaces the WHOLE entry-point ruleset. Include every existing rule or you
delete them. Prefer rules create/edit on a single rule.
- Bulk: dry-run one, confirm, run one real canary, verify it, then run the batch. Never loop a
mutation over unpaginated input.
5. Confirm
If the change is on the confirm list (see cloudflare-cf-operating-rules and memory), ask with a question
widget that shows the account, zone, resource, exact command (token redacted), diff, blast radius, and
rollback. Wait for a yes. Only then add --force where cf requires it.
6. Apply
Run exactly the confirmed command. Capture the exit code and output to a file. On a non-zero exit, stop,
report the exact error, and do not retry blindly.
7. Verify
- Re-read the resource with the same command as the snapshot and diff it against pre.
- For DNS, run
dig +short <name> @1.1.1.1 (and against the zone's assigned nameservers). For HTTP, run
curl -sI https://<host> and check the status, the cf-ray header, and redirects.
- For Workers, hit the route, and check recent errors with
cf observability telemetry query (UNVERIFIED
query body) or wrangler tail if the Worker is delegated.
8. Rollback plan (write it before applying)
- DNS: re-create or edit from pre.json. Don't bulk-import the whole BIND file over a live zone, because
import adds records and can create duplicates.
- Settings:
cf zones settings edit <setting> ... back to the pre value.
- Rulesets: re-apply the pre ruleset body with
phases update --body @pre.json (strip read-only fields;
UNVERIFIED).
- Workers: redeploy the previous version with
cf workers deployments create (UNVERIFIED flags).
- Record the change (what, when, rollback command) in memory, and update the inventory.
1---2name: cloudflare-safe-change3description: "Use this before ANY Cloudflare mutation (DNS, settings, rules, Access, Workers, routes, cache, tokens) to snapshot state, show a diff, get confirmation when required, apply, verify, and keep a rollback."4metadata:5 source: https://skillmd.com/skills/shixuuu/cloudflare-safe-change6---78# Safe change checklist910Work through every step. Skip a step only if it says it's optional.1112## 1. Pin the target13- Resolve the account id and zone id from memory. Pass `CLOUDFLARE_ACCOUNT_ID=<id>` inline and `-z <zone id>`14 explicitly. Use ids, not names.15- If you're in a project directory, check `.env*` files for CLOUDFLARE_* values that would override.16- Confirm the token that will run the write. Use the write token inline, only for this command.17- Classify the target as production or non-production from memory. If you can't tell, treat it as production.1819## 2. Snapshot current state (to a file, never pasted into chat)20Save to `./cf-snapshots/<UTC timestamp>-<resource>.json` (or `.bind`) in your working area.21| Change | Snapshot command (verified) |22|---|---|23| DNS | `cf dns records export -z $Z > pre.bind` and `cf dns records list -z $Z --per-page 100 --page N` (all pages) `> pre.json` |24| Zone setting | `cf zones settings get <setting> -z $Z > pre.json` |25| WAF/rules | `cf rulesets account-rulesets phases get <phase> -z $Z > pre.json` (includes `version`) |26| DNSSEC | `cf dns dnssec get -z $Z > pre.json` (also record the DS at the registrar) |27| Access | `cf zero-trust access applications list` and `... policies list` (UNVERIFIED args) |28| Worker | `cf workers deployments list` and `cf workers versions list` (UNVERIFIED args; record the current version id) |29| Tokens | `cf accounts tokens list \| jq 'map({id,name,status,policies})'` |30Snapshots can contain sensitive values (TXT verification strings, binding text). Keep them local and31never share them.3233## 3. Build the exact command and diff34- Find it with `cf cli search`, read `<command> --help` and `cf schema <command>`.35- Run it with `--dry-run` to confirm the method, URL, and body. **Skip this for secret-bearing commands**,36 because dry-run echoes the body.37- Write a human diff: before and after, per field, with counts. For DNS, also say whether proxied changes.3839## 4. Risk checks for the dangerous classes40- **Cache purge:** prefer `files`, `tags`, `hosts`, or `prefixes` over `{"purge_everything":true}`. A full41 purge sends an origin load spike. Always confirm it.42- **SSL mode:** going to `strict` needs a valid origin cert, and going to `off` or `flexible` can cause43 redirect loops. Check the origin with a curl first.44- **Proxy toggle:** turning proxied off exposes the origin IP and bypasses WAF and cache. Turning it on45 breaks non-HTTP services.46- **Nameservers or zone moves:** these propagate over hours to days. The rollback is slow. Always confirm.47- **DNSSEC:** never disable while a DS record exists at the registrar (remove the DS first and wait for the TTL).48 Never enable without planning to add the DS.49- **Access:** make sure the change doesn't remove the owner's own access or a service-token path used by50 automation. Test with `cf zero-trust access applications user-policy-checks list` (UNVERIFIED args).51- **Worker routes or triggers:** list existing routes for the zone first. Beta.5 has no routes-list command,52 so use the API through curl (UNVERIFIED) or the dashboard. A more specific overlapping pattern wins53 silently.54- **Rulesets:** `phases update` replaces the WHOLE entry-point ruleset. Include every existing rule or you55 delete them. Prefer `rules create/edit` on a single rule.56- **Bulk:** dry-run one, confirm, run one real canary, verify it, then run the batch. Never loop a57 mutation over unpaginated input.5859## 5. Confirm60If the change is on the confirm list (see `cloudflare-cf-operating-rules` and memory), ask with a question61widget that shows the account, zone, resource, exact command (token redacted), diff, blast radius, and62rollback. Wait for a yes. Only then add `--force` where cf requires it.6364## 6. Apply65Run exactly the confirmed command. Capture the exit code and output to a file. On a non-zero exit, stop,66report the exact error, and do not retry blindly.6768## 7. Verify69- Re-read the resource with the same command as the snapshot and diff it against pre.70- For DNS, run `dig +short <name> @1.1.1.1` (and against the zone's assigned nameservers). For HTTP, run71 `curl -sI https://<host>` and check the status, the `cf-ray` header, and redirects.72- For Workers, hit the route, and check recent errors with `cf observability telemetry query` (UNVERIFIED73 query body) or wrangler tail if the Worker is delegated.7475## 8. Rollback plan (write it before applying)76- DNS: re-create or edit from pre.json. Don't bulk-import the whole BIND file over a live zone, because77 import adds records and can create duplicates.78- Settings: `cf zones settings edit <setting> ...` back to the pre value.79- Rulesets: re-apply the pre ruleset body with `phases update --body @pre.json` (strip read-only fields;80 UNVERIFIED).81- Workers: redeploy the previous version with `cf workers deployments create` (UNVERIFIED flags).82- Record the change (what, when, rollback command) in memory, and update the inventory.