Cloudflare cf CLI
Finds and runs commands of Cloudflare's beta cf CLI through cf cli search, cf schema and dry runs, and picks cf or Wrangler per project. Use when managing DNS, zones, D1, KV or R2 from the terminal or starting a new Workers project.
cf-cli- Author
- Cloudflare
- Source
- cloudflare/skills/skills/cf-cli @ 5108325
- License
- Apache-2.0
About this skill
What it does
The skill teaches the agent Cloudflare's cf CLI, which is in beta: more than 2,900 commands generated mostly from the public API, plus cf dev, cf build and cf deploy for Workers projects. Instead of a command list it gives a lookup loop: describe the task to cf cli search, check the request shape with cf schema or the options with --help, preview with --dry-run, then run.
Setup is npm install --global cf, which adds an identical cloudflare command in case another cf is on the PATH. cf auth login prints a link and a one-time code (--no-browser over SSH or in a container); unattended agents and CI use CLOUDFLARE_API_TOKEN.
A destructive command without --force in a non-interactive session prints Aborted. and still exits 0. --force can also be an API parameter: cf workers delete --force also deletes a Worker other Workers reference. --local works only for KV, some D1 commands and R2.
The skill also picks the CLI for a project: cloudflare.config.ts means cf; a Wrangler config means Wrangler for dev, build and deploy, with cf only for resource commands; neither means cf. Wrangler commands from product docs are translated, not run; live logs and single secrets, which cf lacks, go through npx wrangler. references/skill-feedback.md reports faults in the skill as a GitHub issue you approve first.
When to use it, and when not
Use it for DNS, zones, D1, KV, R2 and other API operations from the terminal, for new Workers projects and for projects with cloudflare.config.ts.
Not for dev, build or deploy in a Wrangler project.
How to run it
The install command below puts the skill folder in place; the CLI is installed separately, as shown, and needs Node.js 22.18 or later (not Bun). To call the skill yourself:
- Claude Code:
/cf-cli, or ask for the skill by name. - Codex:
$cf-cli. - Cursor: type
/in the Agent chat and pickcf-cli.
Example: /cf-cli Create a CNAME record for docs.example.com in my zone; show the dry run first.
The skill suggests a line for your user-level AGENTS.md or CLAUDE.md so agents prefer cf unless a Wrangler config exists.
How it differs from similar skills
Wrangler CLI covers the Workers lifecycle in Wrangler projects; this skill covers the whole API and new projects. Hugging Face Hub CLI embeds a generated list of hf commands in SKILL.md; with 2,900 commands, this one has the agent search instead. Sentry issues and events uses a similar sentry schema and sentry api pair, but only reads.
Install
Run one command — it saves SKILL.md and the files it uses into your agent's skills folder. Claude Code and Codex pick up a new skill without a restart; if it does not show up, restart the agent.
curl -fsSL --create-dirs -o ~/.claude/skills/cf-cli/SKILL.md https://anymodel.org/en/skills/cloudflare/cf-cli/SKILL.md -o ~/.claude/skills/cf-cli/LICENSE https://anymodel.org/en/skills/cloudflare/cf-cli/LICENSE -o ~/.claude/skills/cf-cli/references/skill-feedback.md https://anymodel.org/en/skills/cloudflare/cf-cli/references/skill-feedback.md
curl -fsSL --create-dirs -o ~/.agents/skills/cf-cli/SKILL.md https://anymodel.org/en/skills/cloudflare/cf-cli/SKILL.md -o ~/.agents/skills/cf-cli/LICENSE https://anymodel.org/en/skills/cloudflare/cf-cli/LICENSE -o ~/.agents/skills/cf-cli/references/skill-feedback.md https://anymodel.org/en/skills/cloudflare/cf-cli/references/skill-feedback.md
foreach ($f in 'SKILL.md','LICENSE','references/skill-feedback.md') { $p = Join-Path "$HOME\.claude\skills\cf-cli" $f; New-Item -ItemType Directory -Force (Split-Path $p) | Out-Null; Invoke-WebRequest "https://anymodel.org/en/skills/cloudflare/cf-cli/$f" -UseBasicParsing -OutFile $p }foreach ($f in 'SKILL.md','LICENSE','references/skill-feedback.md') { $p = Join-Path "$HOME\.agents\skills\cf-cli" $f; New-Item -ItemType Directory -Force (Split-Path $p) | Out-Null; Invoke-WebRequest "https://anymodel.org/en/skills/cloudflare/cf-cli/$f" -UseBasicParsing -OutFile $p }Any other agent: save the file into its skills folder, or give it the link to the file: https://anymodel.org/en/skills/cloudflare/cf-cli/SKILL.md
SKILL.md
Cloudflare CLI (cf)
cf is Cloudflare's command-line interface for the public Cloudflare API (2,900+ commands, most generated from API schemas) and for Workers projects. It is in beta: commands, configuration, and Build Output can change before the stable release.
Prefer retrieval over pre-trained knowledge. Describe the task to cf cli search, inspect the match with cf schema or --help, and preview with --dry-run before running a command you have not verified.
Docs index: https://developers.cloudflare.com/cf/llms.txt
Documentation
FIRST: check installation and sign in
npm install --global cf # installs two equivalent commands: `cf` and `cloudflare`
cf --version
cf auth whoami
- Requires Node.js 22.18 or later. Bun is not supported.
- If another tool named
cfis on yourPATH, usecloudflareinstead — the package installs both commands. cf auth loginprints a link and a one-time code, then opens the browser. On a remote machine, over SSH, or in a container, add--no-browsersocfonly prints the link; approve it from another device. Add--forceto sign in again.cfkeeps its own credentials and does not reuse a Wrangler login.- Unattended agents and CI cannot complete
cf auth login— setCLOUDFLARE_API_TOKENinstead (see https://developers.cloudflare.com/cf/ci/index.md).
To make agents prefer cf, add this to the user-level AGENTS.md, CLAUDE.md, or equivalent:
When interacting with Cloudflare, use the `cf` CLI unless the project has a
Wrangler configuration file.
Find commands
cf cli search "create a DNS record" # local, no credentials; quote the whole task; up to 5 JSON matches
cf schema d1 create # API request shape: method, path, params, body fields
cf <command> --help # arguments and options (e.g. cf deploy --help)
cf cli search takes the task as one argument — unquoted words after the first are parsed as unknown commands. cf schema covers generated API commands; for command arguments and options use --help.
Read output
- Results are JSON on standard output; status messages and errors go to standard error, so piping to
jqor redirecting needs no extra flags. - Lists print one JSON array page; paging options differ per command — check
--help. - A failed command exits non-zero and prints the error to standard error.
Run commands safely
- Preview first.
--dry-runprints the request as JSON without sending it, and needs no credentials. - Aborted deletes still exit 0. In a non-interactive session, a destructive command without
--forceprintsAborted.to standard error and exits0— a zero exit does not mean the resource was deleted. - Review
--forcebefore allowing it. On some commands--forceis also an API parameter (for example,cf workers delete --forcealso deletes a Worker that other Workers reference). --localis limited. It works for KV keys, D1 databases (cf d1 raw,cf d1 migrations list|apply), and R2 objects; other commands (includingcf d1 query) return an error instead of calling the API.
Choose the CLI for this project
cloudflare.config.tsexists: usecf.wrangler.jsonc,wrangler.json, orwrangler.tomlexists, and nocloudflare.config.ts: keep Wrangler fordev,build, anddeploy. Do not runcf dev,cf build, orcf deploythere — they can generate a new configuration that ignores the Wrangler file, or fail.cfresource commands (DNS, zones, storage) are fine alongside it. Runcf migrateonly when the user asks, and follow Migrate a Wrangler project: preview withcf migrate --dry-run, runcf migrate, then resolve theTODO(@cloudflare)comments in the generatedcloudflare.config.ts.- Neither exists: use
cf, as Use cf with coding agents recommends. Do not install Wrangler or create a Wrangler configuration file.
Product documentation often shows only Wrangler commands and wrangler.jsonc configuration. In a cf project, treat those as tasks to translate, not commands to run, and do not add a Wrangler configuration file. Use one CLI per project; the only exceptions are the commands under Commands cf does not support yet. For Wrangler equivalents, use the Wrangler to cf reference or cf cli search. Do not translate Wrangler commands from memory. For the full comparison, refer to cf for Wrangler users.
Commands cf does not support yet
cf does not support every Wrangler command yet. Run these with npx wrangler instead of adding Wrangler to the project. Wrangler does not read cloudflare.config.ts, so pass the Worker name:
- Live logs:
npx wrangler tail <WORKER_NAME>. - A single secret:
npx wrangler secret put <SECRET_NAME> --name <WORKER_NAME>. Or upload secrets with a new Worker version by passing--secrets-file <PATH>tocf deployorcf workers versions create.
For the current list, refer to "Commands not yet supported" in the Wrangler to cf reference.
Skill feedback
If the user reports that this skill gave incorrect or outdated guidance, or is missing information, read references/skill-feedback.md.
Connect through AnyModel API
This skill runs on whatever model your agent uses. Point Claude Code, Codex or Cursor at AnyModel to run it on Claude, GPT, Gemini and more with one key — pay per token, no subscription.
AnyModel