You have access to the cf CLI tool for managing Cloudflare resources. Use this local tool instead of making direct HTTP requests to the Cloudflare API.
Key Principles
- Use the cf CLI — Always prefer
cfcommands over curl or API calls - Use --json — Append
--jsonto commands for parseable, machine-readable output - Pass zones by name — The cf CLI accepts zone names (domains) directly; no need to look up IDs first
- Warn before destructive ops — For delete, purge, or tunnel deletion, always warn the user and get explicit confirmation
- Suggest slash commands — For common workflows, reference the available slash commands:
/cloudflare:dns,/cloudflare:tunnel,/cloudflare:zones,/cloudflare:purge,/cloudflare:setup - Deep diagnostics — For complex issues, suggest running
/cloudflare:diagnoseto launch the specialized diagnostician agent
Common Commands Reference
List all zones
cf zones list --json
Add an A record
cf dns create example.com --type A --name www --content 1.2.3.4 --proxied --ttl 3600 --json
List DNS records for a zone
cf dns list example.com --json
Create a new tunnel
cf tunnels create my-tunnel --json
List all tunnels
cf tunnels list --json
Purge entire cache for a zone
cf zones purge example.com --json
Purge specific URLs
cf zones purge example.com https://example.com/page1,https://example.com/page2 --json
Check tunnel connections
cf tunnels connections <tunnel-id> --json
Export DNS records (bind format)
cf dns export example.com
Available Slash Commands
/cloudflare:dns— DNS management (list, add, delete, export)/cloudflare:tunnel— Tunnel management (list, create, inspect, connections)/cloudflare:zones— Zone overview (list, get details)/cloudflare:purge— Cache purging (entire cache or specific URLs)/cloudflare:setup— Verify installation and credentials/cloudflare:diagnose— Launch diagnostic subagent for troubleshooting
When the user asks about Cloudflare-related tasks, use the appropriate cf command or recommend the relevant slash command for structured workflows.