Cf CLI
CloudflareOfficialPublished by Cloudflare
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- Low risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The cf-cli is the official command-line tool for interacting with the Cloudflare API and managing Workers projects. It provides a unified interface for tasks ranging from authentication and account management to resource operations like DNS, D1, KV, and R2. Designed for both interactive terminal use and automated environments, it features a search-based command discovery system and supports schema-based API requests. The tool is currently in beta and emphasizes safe execution through dry-run capabilities and explicit configuration management.
What it does
- Provides a searchable interface for over 2,900 Cloudflare API commands.
- Manages authentication, user profiles, and API token configuration.
- Handles the full lifecycle of Workers projects including init, development, and deployment.
- Performs CRUD operations on Cloudflare resources like DNS, Zones, D1, KV, and R2.
- Supports schema inspection to verify API request structures before execution.
- Offers safe execution modes including dry-runs and non-interactive error handling.
When to use it
- When you need to manage Cloudflare resources directly from the terminal.
- When starting a new Workers project that does not require legacy Wrangler configuration.
- When you need to look up specific API command syntax or request parameters.
- When integrating Cloudflare operations into CI/CD pipelines using API tokens.
- When migrating existing projects from Wrangler to the newer cf configuration format.
Advantages
- Direct access to the comprehensive public Cloudflare API.
- Built-in search functionality helps discover commands without memorizing documentation.
- Schema-based validation ensures correct API request formatting.
- Dry-run mode prevents accidental changes to production infrastructure.
- Supports unattended authentication for automated CI environments.
Usage examples
- “cf cli search create a DNS record”
- The CLI returns a list of matching commands and their usage, allowing you to identify the correct syntax for creating a DNS record.
- “cf schema d1 create”
- Displays the required API request shape, including the method, path, and necessary body fields for creating a D1 database.
- “cf deploy --dry-run”
- Prints the JSON request that would be sent to the Cloudflare API without actually deploying the project, ensuring the configuration is correct.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/cloudflare/cf-cli/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip cf-cli.zip -d .agents/skills
Documentation by Cloudflare
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 whoamiRequires 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.
Files
- ATTRIBUTION.mdAdded by AutoGineer848 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md7.2 KiB
- references/skill-feedback.md2.7 KiB
references/skill-feedback.md
Skill feedback
GitHub issues are public: anyone can read an issue once it is posted. Never include sensitive information, and never post an issue until the user has seen the exact title and body and approved it.
Use this when the user reports that the cf-cli skill gave incorrect or outdated guidance, is missing information, or could be improved. This is about the skill (agent instructions), not about Cloudflare products.
What not to include
The issue is drafted from the conversation, so remove the following before drafting and describe the problem in general terms instead:
Credentials, API tokens, secrets, and passwords
Account IDs, zone IDs, and other resource identifiers
Customer or personal data, such as names, email addresses, and IP addresses
Internal hostnames and URLs
Private code, configuration, and logs
Steps
Ask permission – Ask the user if they would like to submit feedback to the skill maintainers. If they decline, move on.
Draft the issue – Fill in the table below from the conversation and use it as the issue body. Always identify which specific file and section caused the problem. Leave out everything listed in What not to include.
Review with the user – Show the user the exact title and body, then ask a yes/no question, such as "Post this as a public issue on cloudflare/skills?" Submit only after the user answers yes. If they ask for changes, apply them and ask again. If they answer no, do not post. Agreeing to send feedback in step 1 is not approval of the text.
Submit – Create a GitHub issue on the
cloudflare/skillsrepository with the approved draft as the body, for example withgh issue create --repo cloudflare/skills. The title must follow this format:skill-feedback: cf-cli: <summary of the problem>.Share the result – Share the issue URL with the user after submission. If submission fails, give the user the approved title and body, and this link to create the issue manually: https://github.com/cloudflare/skills/issues/new
Issue body
| Field | Value |
|---|---|
| Type | bug (incorrect guidance), outdated, missing, or improvement |
| Skill | cf-cli |
| Source | File and section, e.g. SKILL.md > "Section name" or references/<file>.md > "Section name" |
| Agent | The agent and model in use, if known |
| Task | What the user was trying to do, e.g. "deploy a preview" |
| Expected | What should have happened, e.g. "Create a Preview deployment" |
| Actual | What the skill said or what happened, e.g. "Unknown option: --preview" |
| Impact | The effect on the user, e.g. "Time spent finding the correct syntax" |
| Suggested fix | How the skill should change; leave blank if unsure |
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Cloudflare
- Publisher
- Cloudflare (Official)
- Source
- cloudflare/skills · skills/cf-cli · commit 6eb6c78
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Cloudflare or Cloudflare.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download cf-cli.zip