Cloudflare & Wrangler CLI

SkillWeb & browsing

Cloudflare platform management via Wrangler CLI, Agents SDK (v0.13+), and Browser Rendering API. Deploy Pages, Workers, KV, R2, D1, Queues, Vectorize, Workflows, Hyperdrive. Build stateful AI agents with the full SDK stack — Agent, AIChatAgent, Think, Voice, sub-agents, fibers, HITL, scheduling, observability, Code Mode (Dynamic Worker sandboxes). Budget web scraping via cf_browser.py. Use when deploying to Cloudflare, managing CF infrastructure, configuring wrangler.toml/wrangler.jsonc, building AI agents or chat agents on Workers, adding voice, orchestrating sub-agents, or for cheap web scraping. Triggers: Cloudflare, wrangler, Pages, KV, R2, D1, Workers, Vectorize, Queues, Workflows, Hyperdrive, cf_browser, Browser Rendering, Agents SDK, Code Mode, codemode, MCP, Think, AIChatAgent, Voice agent, sub-agents, fibers, HITL, Dynamic Workers.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Cloudflare & Wrangler CLI skill

What this skill tells your AI

The instructions your AI receives, as published by tdimino/claude-code-minoan in skills/integration-automation/cloudflare/SKILL.md and read by ahel’s review.

Manage Cloudflare infrastructure from the terminal: Pages, Workers, KV, R2, D1, Queues, Vectorize, and more.

Prerequisites

# Install
npm install -g wrangler

# Authenticate (opens browser OAuth flow)
wrangler login

# Verify
wrangler whoami

Environment variables (alternative to wrangler login):

  • CLOUDFLARE_API_TOKEN — scoped API token (recommended for CI/CD)
  • CLOUDFLARE_ACCOUNT_ID — your account ID (found in dashboard URL)

Quick Start

# Deploy a static site to Cloudflare Pages
npm run build && wrangler pages deploy out --project-name mysite

Quick Reference

CommandPurposeExample
wrangler pages deployDeploy static sitewrangler pages deploy out --project-name mysite
wrangler pages project listList Pages projectswrangler pages project list
wrangler deployDeploy Workerwrangler deploy
wrangler devLocal dev serverwrangler dev
wrangler tailStream live logswrangler tail my-worker
wrangler kv namespace listList KV namespaceswrangler kv namespace list
wrangler r2 bucket listList R2 bucketswrangler r2 bucket list
wrangler d1 listList D1 databaseswrangler d1 list
wrangler secret putSet encrypted secretwrangler secret put API_KEY
wrangler whoamiCheck auth statuswrangler whoami

Full CLI reference: references/wrangler-commands.md


Pages

Primary use case for static site deployment (Next.js output: 'export', Astro, etc.).

Deploy

# Direct deploy (no git integration needed)
npm run build
wrangler pages deploy out --project-name worldwarwatcher

# With commit tracking
wrangler pages deploy out --project-name mysite --commit-hash $(git rev-parse HEAD) --commit-message "$(git log -1 --format=%s)"

# Preview deploy (non-production branch)
wrangler pages deploy out --project-name mysite --branch staging

Project Management

wrangler pages project create mysite --production-branch main
wrangler pages project list
wrangler pages project delete mysite

Deployment History & Rollback

wrangler pages deployment list --project-name mysite
wrangler pages deployment tail --project-name mysite    # Stream logs

To rollback: redeploy a previous build directory, or use the dashboard to promote an earlier deployment.

Custom Domains

Custom domain management is dashboard-only — wrangler cannot add/remove custom domains for Pages projects. Use the Cloudflare dashboard:

  1. Workers & Pages → project → Custom Domains → Add
  2. CF auto-creates DNS records and provisions TLS

Pages Config Files

Place _headers and _redirects in your static assets directory (e.g., public/ for Next.js, Astro, Vite) — the build process copies them to the output root.

Details: references/pages-config.md_headers format, _redirects format, framework presets, preview deploys.


Workers

# Create new Worker project (C3 scaffolding)
npm create cloudflare@latest my-worker

# Local development (with hot reload)
wrangler dev

# Deploy to production
wrangler deploy

# Stream live logs
wrangler tail my-worker

Note: wrangler init is deprecated — use npm create cloudflare@latest instead.


Agents SDK & Code Mode

Build stateful AI agents on Cloudflare Workers with durable state, chat persistence, voice, sub-agents, durable execution, MCP tools, and sandboxed code execution. SDK at agents@0.13.2 (May 2026).

Quick Start

# Scaffold with the starter (includes chat, tools, HITL, scheduling)
npx create-cloudflare@latest --template cloudflare/agents-starter

# Or install packages individually
npm install agents @cloudflare/ai-chat @cloudflare/think @cloudflare/voice @cloudflare/codemode

Class Hierarchy

ClassPackagePurpose
Agent<Env, State>agentsBase: state, scheduling, fibers, sub-agents, RPC, MCP
AIChatAgent@cloudflare/ai-chatChat: message persistence, streaming, tool approval, data parts
Think@cloudflare/thinkOpinionated chat: full agentic loop, extensions, auto-continuation
withVoice(Agent)@cloudflare/voiceMixin: real-time STT/TTS over WebSocket (beta)

Key Concepts

ConceptDescription
this.subAgent(Class, id)Spawn co-located child agents with typed RPC and isolated SQLite
runAgentTool / agentToolRun sub-agents as retained, streaming tools from a parent
runFiber() / stash()Durable execution — work survives DO eviction with checkpoint recovery
needsApprovalHuman-in-the-loop tool approval (5 patterns available)
this.schedule() / scheduleEvery()Persistent scheduling: delayed, cron, interval (survives restarts)
this.retry()Built-in exponential backoff with jitter
keepAlive()Prevent DO eviction during long-running work
diagnostics_channelStructured observability across 7 typed event channels
addMcpServer()Consume MCP tools via HTTP/SSE or RPC (DO binding, no HTTP overhead)
createCodeTool()Code Mode: wraps tools into TypeScript API for LLM-generated code
DynamicWorkerExecutorRuns LLM code in isolated V8 sandbox (Dynamic Workers, open beta)
Chat RecoveryServer turns survive client disconnect, resume on reconnect (v0.12.4+)
codeMcpServer()Wrap an MCP server with Code Mode — all tools become typed sandbox APIs

When to Use

NeedApproach
Static API endpoint or cronStandard Worker (wrangler deploy)
Custom protocol, non-chat agentAgent base class
Chat with full control over agentic loopAIChatAgent
Chat with minimal boilerplateThink (handles everything)
Voice interactionwithVoice(Agent) or withVoice(AIChatAgent)
Orchestrating multiple agentsAgent + subAgent()
LLM composing multiple tools via codeCode Mode (@cloudflare/codemode)
Durable multi-step workflowAgentWorkflow (Workflows integration)

Full API references: references/agents-sdk-core.md, references/agents-sdk-chat-voice.md, references/codemode.md


Storage & Data Services

ServicePurposeKey Commands
KVKey-value storekv namespace create/list, kv key put/get/list/delete
R2Object storage (S3-compatible)r2 bucket create/list, r2 object put/get/delete
D1SQLite databased1 create/list, d1 execute --remote, d1 migrations apply --remote
QueuesMessage queues between Workersqueues create/list/delete, queues consumer add/remove
VectorizeVector DB for AI/embeddingsvectorize create/list/delete, vectorize insert
HyperdriveConnection pooling for external DBshyperdrive create/list/delete

Important: D1 commands default to the local dev database. Add --remote to target production:

wrangler d1 execute my-database --command "SELECT * FROM users" --remote

Full command reference with all flags: references/wrangler-commands.md


Secrets

wrangler secret put SECRET_NAME          # Prompts for value
echo "value" | wrangler secret put SECRET_NAME  # From stdin
wrangler secret list
wrangler secret bulk secrets.json        # Bulk upload

Common Workflows

CI/CD with GitHub Actions

# .github/workflows/deploy.yml
- name: Deploy to Cloudflare Pages
  uses: cloudflare/wrangler-action@v3
  with:
    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
    accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
    command: pages deploy out --project-name mysite

Note: In CI/CD (non-interactive), create the project first with wrangler pages project create — auto-creation only works interactively.

Tail Production Logs

wrangler tail my-worker --format pretty
wrangler pages deployment tail --project-name mysite

Troubleshooting

# Check auth
wrangler whoami

# Re-authenticate
wrangler logout && wrangler login

# Check wrangler version
wrangler --version

# Verbose output for debugging
WRANGLER_LOG=debug wrangler pages deploy out --project-name mysite
  • "Authentication error" — Run wrangler login or set CLOUDFLARE_API_TOKEN
  • "Project not found" — Check project name: wrangler pages project list
  • "Build output not found" — Verify build output directory exists. See references/pages-config.md for framework-to-directory mapping.
  • Pages deploy hangs — Check _headers/_redirects syntax (no YAML, plain text format)
  • Deploy includes too many files — Ensure --directory points to the build output only (e.g., out/, dist/), not the project root

Browser Rendering (Web Scraping & Crawling)

Budget alternative to Firecrawl using Cloudflare's headless Chrome on the edge. Free tier: 10 min/day, 5 crawls/day, 100 pages/crawl. Static fetches (--no-render) are free during beta.

Quick Start

# Single page to markdown
python3 ~/.claude/skills/cloudflare/scripts/cf_browser.py markdown https://example.com

# Free static fetch (no JS rendering, free during beta)
python3 ~/.claude/skills/cloudflare/scripts/cf_browser.py markdown https://example.com --no-render

# With filter pipeline (same as Firecrawl)
python3 ~/.claude/skills/cloudflare/scripts/cf_browser.py markdown https://docs.example.com | \
  python3 ~/.claude/skills/firecrawl/scripts/filter_web_results.py --sections "API" --max-chars 5000

# Multi-page crawl
python3 ~/.claude/skills/cloudflare/scripts/cf_browser.py crawl https://docs.example.com --limit 50

# Screenshot / PDF
python3 ~/.claude/skills/cloudflare/scripts/cf_browser.py screenshot https://example.com -o page.png
python3 ~/.claude/skills/cloudflare/scripts/cf_browser.py pdf https://example.com -o page.pdf

# AI-structured extraction (Workers AI, free tier included)
python3 ~/.claude/skills/cloudflare/scripts/cf_browser.py json https://example.com --prompt "Extract product names and prices"

# Extract links
python3 ~/.claude/skills/cloudflare/scripts/cf_browser.py links https://example.com

When to Use CF Browser Rendering vs Firecrawl vs Scrapling

NeedBest ToolWhy
Clean markdown, reliablefirecrawl scrape --only-main-contentBest markdown quality, optimized for LLMs
Cheap/free JS-rendered scrapecf_browser.py markdown URLFree 10 min/day, $0.09/hr after
Free static page fetchcf_browser.py markdown URL --no-renderFREE during beta
Multi-page crawl on a budgetcf_browser.py crawl URL5 free crawls/day, 100 pages each
Incremental re-crawlcf_browser.py crawl --modified-sinceBuilt-in cache, Firecrawl lacks this
Autonomous data finding (no URL)firecrawl_api.py agentNo CF equivalent
Anti-bot / Cloudflare bypassscrapling --stealthLocal, no API key
Web search + scrapefirecrawl search --scrapeNo CF search API
Twitter/X contentjina URLOnly tool that works

Subcommands

CommandDescription
markdownSingle page → markdown
contentSingle page → rendered HTML
crawlMulti-page async crawl (polls until done, or --async)
statusCheck crawl job status
cancelCancel a running crawl
screenshotPage screenshot (PNG)
pdfPage → PDF
linksExtract all links
scrapeExtract elements via CSS selectors
jsonAI-structured extraction (Workers AI)

Auth

Uses CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN (preferred) or CLOUDFLARE_GLOBAL_API_KEY + CLOUDFLARE_EMAIL (fallback). All in ~/.config/env/secrets.env.

Pricing

TierBrowser HoursCrawl Limits
Free10 min/day5 jobs/day, 100 pages/job
Paid10 hr/month included, $0.09/hr after100,000 pages/job

Full API reference: references/browser-rendering-api.md


Reference Documentation

FileContents
references/wrangler-commands.mdFull Wrangler CLI command reference with all flags
references/pages-config.mdPages config: _headers, _redirects, build presets, env vars
references/browser-rendering-api.mdBrowser Rendering REST API: endpoints, params, pricing, limits
references/agents-sdk-core.mdAgents SDK core: Agent class, scheduling, fibers, HITL, workflows, observability, MCP
references/agents-sdk-chat-voice.mdChat (AIChatAgent, Think), Voice, sub-agents, agent tools, chat recovery
references/codemode.mdCode Mode, Dynamic Workers (open beta), sandbox security, MCP barrel export

Signals

GitHub stars
41
Forks
4
Last commit
Sep 2026
Hacker News mentions
20

ahel review

  • S4info
    community integration — published by tdimino, not cloudflare

Automated review, not a security audit. Ruleset v1.

Advanced
Catalog kind
skill
Gateway key
cloudflare-tdimino
Source
github.com/tdimino/claude-code-minoan