Cloudflare cf CLI
cf is Cloudflare's new unified CLI, announced April 2026, intended to eventually become the next major version of Wrangler. It exposes ~3,000 API operations across 100+ products through one consistent command surface. This skill is about using it correctly while it is still a technical preview.
When to invoke
- The user mentions
cf, npx cf, or "the new Cloudflare CLI" / "CLI for all of Cloudflare".
- A script or workflow is about to replace
wrangler ... with cf ....
- An agent is generating
cf commands and may not know the flag conventions.
- A
cf invocation behaved as if it targeted production when the user expected local.
- The user is choosing between
cf, wrangler, direct REST, the official cloudflare SDK, or Terraform.
Cross-cutting rules
cf is technical preview. Only a small subset of products is wired up. Conventions can shift between releases. wrangler stays authoritative for CI/CD until cf reaches GA. Use cf for local exploration, ad-hoc agent work, and feedback. If cf must be used in a script, pin the exact version — never unpinned npx cf in CI.
cf defaults to the REMOTE resource. Without --local, every mutation hits production. See the local-vs-remote trap.
- Token scoping rules are identical to the
cloudflare-dns-zones skill — never the Global API Key, scope to minimum permissions on specific zones/accounts. For cf additionally: prefer a separate non-prod token for local work, so an accidental remote write fails 403 instead of corrupting production.
- Don't guess flag names by analogy.
cf enforces consistent flags across the surface (--force, --json, --local). Verify with cf <command> --help rather than reaching for the synonym another CLI uses.
Verify current preview status before recommending: https://blog.cloudflare.com/cf-cli-local-explorer/. Training data ages fast on preview tools.
Don't confuse cf with neighbors
| Tool |
What it is |
Use for |
cf (this skill) |
Cloudflare's new official unified CLI (preview). npm package: cf. |
Future Wrangler replacement. |
wrangler |
Current official CLI for Workers / KV / R2 / D1 / Pages. |
Production CI/CD today. |
c3 / create-cloudflare |
npm create cloudflare@latest — project scaffolder. |
Bootstrap a new Workers / Pages project. |
cfcli (cloudflare-cli) |
Unofficial third-party CLI. Config at ~/.cfcli.yml, different conventions. |
Not recommended — out of scope. |
cloudflare (TS SDK) |
Official TypeScript SDK. Env: CLOUDFLARE_API_TOKEN. |
Building tools against the API. |
If the user says "I installed cf and it does X" but X matches cfcli's shape (~/.cfcli.yml, CF_API_KEY env), they probably installed the wrong package. Have them check which cf and the npm package name.
Install and auth
npx cf <command> # one-off
npm install -g cf # global
npm install -g cf@<version> # pinned — use this in scripts
cf --version # verify binary
Auth: cf is built on the same API as Wrangler and the official SDK. Treat CLOUDFLARE_API_TOKEN as canonical until cf --help on your installed version documents otherwise.
Flag conventions
| Intent |
cf flag |
Common wrong guess |
| Read a resource |
get (subcommand) |
info, describe, show |
| Suppress confirmation prompts |
--force |
--yes, --no-prompt, --skip-confirmations |
| Machine-readable output |
--json |
--format=json, --output=json, -o json |
| Operate on local simulated resource |
--local |
--preview, --env=local, --dev |
--json is intended to be supported on every command but the preview may not cover all of them yet. If a command lacks --json, fall back to REST + jq for that one operation rather than parsing human output.
The local-vs-remote trap
cf mutations target production unless --local is passed. Example:
# Developer running `wrangler dev` in another terminal, expects this to seed local KV:
cf kv put session:abc '{"user":"test"}' # ❌ writes to PRODUCTION
# Correct — seeds the simulated namespace Local Explorer / wrangler dev see:
cf kv put session:abc '{"user":"test"}' --local
Guardrails:
- Non-prod token for local work (see cross-cutting rule 3). A 403 on accidental remote writes beats silent corruption.
- Prefer Local Explorer for local seeding. Press
e in the wrangler dev terminal, or point the agent at /cdn-cgi/explorer/api (OpenAPI spec advertised at that URL). Local Explorer is local-only by construction — no --local to forget.
- In review: any
cf mutation (put, delete, create, update) without --local is production-targeting. Confirm intent.
There is no global config knob in the preview to flip the default. --local is per-invocation.
Coexistence with Wrangler
cf shares wrangler.jsonc — the same config describes bindings, routes, and compatibility flags for both tools.
In practice during preview:
- A repo can use
wrangler for deploy/dev and cf for ad-hoc reads of resources Wrangler has no command for (because cf covers more API surface).
cf reading a KV namespace defined as a Wrangler binding works because both tools resolve wrangler.jsonc the same way.
- Don't mix them inside one CI job. Pick one per workflow step; mixing makes failures harder to debug when convention drift hits.
Agent-mode usage
cf is designed to be agent-usable. Two patterns:
- Invoke
cf directly. --json is the machine contract. Don't scrape human output.
- Point the agent at the Local Explorer OpenAPI. When
wrangler dev is running, <dev-host>:<port>/cdn-cgi/explorer/api advertises an OpenAPI spec covering the simulated KV / R2 / D1 / Durable Objects / Workflows. An agent that reads OpenAPI can manage local resources without cf installed at all — useful for sandboxed agents.
When to use what
| Task |
Best tool today |
| Deploy a Worker in CI |
wrangler deploy |
| Local dev / hot reload |
wrangler dev or Cloudflare Vite plugin |
| Seed/inspect local KV/R2/D1 during dev |
Local Explorer (e key, or /cdn-cgi/explorer/api) |
| Ad-hoc inspection of remote KV/R2/D1 from terminal |
cf get / cf list (preview), or REST + jq |
| DNS record CRUD in CI |
REST API + jq — see cloudflare-dns-zones skill |
| Multi-resource infra-as-code |
Terraform (cloudflare/cloudflare provider) |
| Building tools against the API |
Official cloudflare TypeScript SDK |
Anything not yet in cf |
REST API directly |
Don't reach for cf in CI just because it's new. Reach for it when it shortens a script you'd otherwise write with curl + jq — and pin the version when you do.
Anti-patterns
- ❌ Unpinned
npx cf in CI. Pin the version or use wrangler.
- ❌ Treating
cf and cfcli as the same tool. Different package, different conventions (~/.cfcli.yml, CF_API_KEY), different auth model.
- ❌
cf mutation (put, delete, create, update) without --local in a dev context. Default is remote.
- ❌ Parsing
cf human output. Use --json or fall back to REST.
- ❌ Mixing
cf and wrangler in the same CI job during preview.
- ❌ Using flag analogues from other CLIs (
--yes, --format=json, --preview). The documented conventions are --force, --json, --local — verify with cf <cmd> --help.
- ❌ Recommending
cf for DNS record CRUD when REST + the cloudflare-dns-zones skill is the proven path.
Cross-skill notes
- For DNS-specific work via REST, see the
cloudflare-dns-zones skill — GA, unaffected by cf's preview status.
- For R2 endpoint detection and credentials versus generic S3, see the
cloud-storage-identification skill.
- For Terraform-managed Cloudflare resources, the
terraform-workflows skill covers plan review and provider-upgrade discipline.
- A
cloudflare-local-explorer companion skill is planned; until then, agent-mode usage is the brief.
1---2name: cloudflare-cf-cli3description: Operates Cloudflare's new unified `cf` CLI (technical preview, April 2026) — install path, flag conventions, the local-vs-remote default trap, coexistence with Wrangler and `wrangler.jsonc`, and agent-mode usage via the Local Explorer OpenAPI. Use when the user mentions `cf`, `npx cf`, "the new Cloudflare CLI", or is choosing between `cf` / `wrangler` / REST / Terraform.4---56# Cloudflare `cf` CLI78`cf` is Cloudflare's new unified CLI, announced April 2026, intended to eventually become the next major version of Wrangler. It exposes ~3,000 API operations across 100+ products through one consistent command surface. This skill is about using it correctly while it is still a technical preview.910## When to invoke1112- The user mentions `cf`, `npx cf`, or "the new Cloudflare CLI" / "CLI for all of Cloudflare".13- A script or workflow is about to replace `wrangler ...` with `cf ...`.14- An agent is generating `cf` commands and may not know the flag conventions.15- A `cf` invocation behaved as if it targeted production when the user expected local.16- The user is choosing between `cf`, `wrangler`, direct REST, the official `cloudflare` SDK, or Terraform.1718## Cross-cutting rules19201. **`cf` is technical preview.** Only a small subset of products is wired up. Conventions can shift between releases. **`wrangler` stays authoritative for CI/CD until `cf` reaches GA.** Use `cf` for local exploration, ad-hoc agent work, and feedback. If `cf` must be used in a script, pin the exact version — never unpinned `npx cf` in CI.212. **`cf` defaults to the REMOTE resource.** Without `--local`, every mutation hits production. See [the local-vs-remote trap](#the-local-vs-remote-trap).223. **Token scoping rules are identical to the `cloudflare-dns-zones` skill** — never the Global API Key, scope to minimum permissions on specific zones/accounts. For `cf` additionally: prefer a separate non-prod token for local work, so an accidental remote write fails 403 instead of corrupting production.234. **Don't guess flag names by analogy.** `cf` enforces consistent flags across the surface (`--force`, `--json`, `--local`). Verify with `cf <command> --help` rather than reaching for the synonym another CLI uses.2425Verify current preview status before recommending: <https://blog.cloudflare.com/cf-cli-local-explorer/>. Training data ages fast on preview tools.2627## Don't confuse `cf` with neighbors2829| Tool | What it is | Use for |30|---|---|---|31| `cf` (this skill) | Cloudflare's new official unified CLI (preview). npm package: `cf`. | Future Wrangler replacement. |32| `wrangler` | Current official CLI for Workers / KV / R2 / D1 / Pages. | Production CI/CD today. |33| `c3` / `create-cloudflare` | `npm create cloudflare@latest` — project scaffolder. | Bootstrap a new Workers / Pages project. |34| `cfcli` (`cloudflare-cli`) | Unofficial third-party CLI. Config at `~/.cfcli.yml`, different conventions. | Not recommended — out of scope. |35| `cloudflare` (TS SDK) | Official TypeScript SDK. Env: `CLOUDFLARE_API_TOKEN`. | Building tools against the API. |3637If the user says "I installed `cf` and it does X" but X matches `cfcli`'s shape (`~/.cfcli.yml`, `CF_API_KEY` env), they probably installed the wrong package. Have them check `which cf` and the npm package name.3839## Install and auth4041```bash42npx cf <command> # one-off43npm install -g cf # global44npm install -g cf@<version> # pinned — use this in scripts45cf --version # verify binary46```4748Auth: `cf` is built on the same API as Wrangler and the official SDK. Treat `CLOUDFLARE_API_TOKEN` as canonical until `cf --help` on your installed version documents otherwise.4950## Flag conventions5152| Intent | `cf` flag | Common wrong guess |53|---|---|---|54| Read a resource | `get` (subcommand) | `info`, `describe`, `show` |55| Suppress confirmation prompts | `--force` | `--yes`, `--no-prompt`, `--skip-confirmations` |56| Machine-readable output | `--json` | `--format=json`, `--output=json`, `-o json` |57| Operate on local simulated resource | `--local` | `--preview`, `--env=local`, `--dev` |5859`--json` is intended to be supported on every command but the preview may not cover all of them yet. If a command lacks `--json`, fall back to REST + jq for that one operation rather than parsing human output.6061## The local-vs-remote trap6263`cf` mutations target production unless `--local` is passed. Example:6465```bash66# Developer running `wrangler dev` in another terminal, expects this to seed local KV:67cf kv put session:abc '{"user":"test"}' # ❌ writes to PRODUCTION6869# Correct — seeds the simulated namespace Local Explorer / wrangler dev see:70cf kv put session:abc '{"user":"test"}' --local71```7273Guardrails:74751. **Non-prod token for local work** (see cross-cutting rule 3). A 403 on accidental remote writes beats silent corruption.762. **Prefer Local Explorer for local seeding.** Press `e` in the `wrangler dev` terminal, or point the agent at `/cdn-cgi/explorer/api` (OpenAPI spec advertised at that URL). Local Explorer is local-only by construction — no `--local` to forget.773. **In review:** any `cf` mutation (`put`, `delete`, `create`, `update`) without `--local` is production-targeting. Confirm intent.7879There is no global config knob in the preview to flip the default. `--local` is per-invocation.8081## Coexistence with Wrangler8283`cf` shares `wrangler.jsonc` — the same config describes bindings, routes, and compatibility flags for both tools.8485In practice during preview:8687- A repo can use `wrangler` for `deploy`/`dev` and `cf` for ad-hoc reads of resources Wrangler has no command for (because `cf` covers more API surface).88- `cf` reading a KV namespace defined as a Wrangler binding works because both tools resolve `wrangler.jsonc` the same way.89- Don't mix them inside one CI job. Pick one per workflow step; mixing makes failures harder to debug when convention drift hits.9091## Agent-mode usage9293`cf` is designed to be agent-usable. Two patterns:94951. **Invoke `cf` directly.** `--json` is the machine contract. Don't scrape human output.962. **Point the agent at the Local Explorer OpenAPI.** When `wrangler dev` is running, `<dev-host>:<port>/cdn-cgi/explorer/api` advertises an OpenAPI spec covering the simulated KV / R2 / D1 / Durable Objects / Workflows. An agent that reads OpenAPI can manage local resources without `cf` installed at all — useful for sandboxed agents.9798## When to use what99100| Task | Best tool today |101|---|---|102| Deploy a Worker in CI | `wrangler deploy` |103| Local dev / hot reload | `wrangler dev` or Cloudflare Vite plugin |104| Seed/inspect local KV/R2/D1 during dev | Local Explorer (`e` key, or `/cdn-cgi/explorer/api`) |105| Ad-hoc inspection of remote KV/R2/D1 from terminal | `cf get` / `cf list` (preview), or REST + jq |106| DNS record CRUD in CI | REST API + jq — see `cloudflare-dns-zones` skill |107| Multi-resource infra-as-code | Terraform (`cloudflare/cloudflare` provider) |108| Building tools against the API | Official `cloudflare` TypeScript SDK |109| Anything not yet in `cf` | REST API directly |110111Don't reach for `cf` in CI just because it's new. Reach for it when it shortens a script you'd otherwise write with curl + jq — and pin the version when you do.112113## Anti-patterns114115- ❌ Unpinned `npx cf` in CI. Pin the version or use `wrangler`.116- ❌ Treating `cf` and `cfcli` as the same tool. Different package, different conventions (`~/.cfcli.yml`, `CF_API_KEY`), different auth model.117- ❌ `cf` mutation (`put`, `delete`, `create`, `update`) without `--local` in a dev context. Default is remote.118- ❌ Parsing `cf` human output. Use `--json` or fall back to REST.119- ❌ Mixing `cf` and `wrangler` in the same CI job during preview.120- ❌ Using flag analogues from other CLIs (`--yes`, `--format=json`, `--preview`). The documented conventions are `--force`, `--json`, `--local` — verify with `cf <cmd> --help`.121- ❌ Recommending `cf` for DNS record CRUD when REST + the `cloudflare-dns-zones` skill is the proven path.122123## Cross-skill notes124125- For DNS-specific work via REST, see the `cloudflare-dns-zones` skill — GA, unaffected by `cf`'s preview status.126- For R2 endpoint detection and credentials versus generic S3, see the `cloud-storage-identification` skill.127- For Terraform-managed Cloudflare resources, the `terraform-workflows` skill covers plan review and provider-upgrade discipline.128- A `cloudflare-local-explorer` companion skill is planned; until then, [agent-mode usage](#agent-mode-usage) is the brief.