mcpField
C
cloudflare-deploy

cloudflare-deploy

github.com/mizchiCloud & DevOps41664 installsUpdated 2w ago
Repository

About cloudflare-deploy

cloudflare-deploy is a skill for using the cf CLI to configure and deploy Cloudflare services. It helps developers select products, discover commands, handle authentication, and follow current configuration guidance.

Key features

  1. 01Product selection decision trees
  2. 02cf command and schema discovery
  3. 03Authentication checks before deployment
  4. 04Worker setup and deployment guidance
  5. 05References for Cloudflare products

Use cases

  1. 01Choosing a Cloudflare compute or storage service
  2. 02Bootstrapping a Worker with KV and secrets
  3. 03Migrating an existing Wrangler project
  4. 04Preparing authenticated deployments and CI

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/mizchi/skills --skill cloudflare-deploy

After installing, type/cloudflare-deployin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

LICENSE.txt
README.md
agents/
openai.yaml
assets/
cloudflare-small.svg
references/agents-sdk/
api.md
configuration.md
gotchas.md
patterns.md
README.md
references/ai-gateway/
configuration.md
dynamic-routing.md
features.md
README.md
sdk-integration.md
troubleshooting.md
references/ai-search/
api.md
configuration.md
gotchas.md
patterns.md
README.md
references/analytics-engine/
api.md
configuration.md
gotchas.md
patterns.md
README.md
references/api-shield/
api.md
configuration.md
gotchas.md
patterns.md
README.md

Details

From the project README

Cloudflare Deploy

Use cf for Cloudflare operations. Use the decision trees below to pick a product, then read its runtime/API references and the current cf CLI guide.

Prerequisites

  • Node.js 24+ and pnpm. Install the npm package cf, not @cloudflare/cf.
  • Keep cf in project devDependencies and commit the lockfile. The checked example uses [email protected] and @cloudflare/vite-plugin@beta; recheck help and types when upgrading.
  • Workers use cloudflare.config.ts. For an existing Wrangler project, run cf migrate --dry-run, then cf migrate and resolve its follow-up items before project commands. Automatic configuration does not import the old bindings.

Authentication (Required Before Deploy)

Verify auth before publishing or mutating account resources:

pnpm exec cf auth whoami

See authentication. Use pnpm exec cf auth login locally; cf has its own login credentials. In CI set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID. A deploy dry run needs no credentials.

Discover Commands Before Running Them

pnpm exec cf cli search "create a D1 database"
pnpm exec cf schema d1 create
pnpm exec cf d1 create --help

Describe only the operation and resource type in search queries. Pass names and IDs to the discovered command, not to search. API commands return JSON on stdout and progress on stderr. Resource commands usually use IDs and remote data; inspect --local support instead of copying Wrangler's --remote, --env, --json, or --yes flags.

When to Read references/

Current CLI, migration, configuration and build guidance lives in references/cf/. Product references retain SDK and runtime knowledge; files marked as legacy preserve old CLI/config examples only as migration input. Do not execute those Wrangler examples or generate new Wrangler configuration from them. Translate the intended operation using cf search/schema and typed bindings.

Rules of thumb:

  • Picking a product? Use decision trees below, then load references/<picked-product>/
  • Writing cloudflare.config.ts? Read configuration first.
  • CI/CD setup? Read GitHub Actions.
  • Deploy fails? Read cf gotchas, then the product's runtime gotchas.
  • The minimal example below covers Workers + KV + secret — for anything beyond that, descend into references

Minimal Worker Example (copy-paste starter)

Start with this Worker, one KV binding and one secret. Apply the TypeScript setup from the configuration reference before typechecking:

// cloudflare.config.ts
import { bindings, defineConfig } from "cf/config";
import * as entrypoint from "./src/index.ts" with { type: "cf-worker" };

export default defineConfig({
  worker: {
    name: "my-worker",
    entrypoint,
    compatibilityDate: "2026-09-30", // Today's date for a new Worker
    observability: { enabled: true },
    env: {
      CACHE: bindings.kv({ id: "REPLACE_WITH_KV_ID" }),
      API_SECRET: bindings.secret(),
    },
  },
});
// vite.config.ts
import { cloudflare } from "@cloudflare/vite-plugin";
import { defineConfig } from "vite";
export default defineConfig({ plugins: [cloudflare()] });
// src/index.ts
export default {
  async fetch(req: Request, env: Env): Promise<Response> {
    const hit = await env.CACHE.get("greeting");
    return new Response(hit ?? "hello");
  }
} satisfies ExportedHandler<Env>;

Bootstrap commands:

pnpm add -D cf @cloudflare/vite-plugin@beta vite typescript
pnpm exec cf kv namespaces create --title CACHE # Copy the returned ID into config
pnpm exec cf workers types                      # Generates .cloudflare/types/index.d.ts
pnpm exec cf dev                                # Vite reports the local URL
pnpm exec cf deploy --dry-run --secrets-file .env.production
pnpm exec cf deploy --secrets-file .env.production

Put API_SECRET in an ignored .env.production for deployment and .dev.vars for local development. Declaring bindings.secret() makes that value required at deploy validation; dotenvx values in the CLI process are not automatically Worker secrets. Include .cloudflare/types in tsconfig.json; see the configuration reference for the full TypeScript setup. Change an existing Worker's compatibility date deliberately.

Live log streaming and legacy Pages asset deployment are not implemented in the checked cf beta, even when a command appears in search/help. Use Workers Logs in the dashboard for inspection and Workers static assets for new web projects. For a legacy Pages project, keep its deployment working while planning migration; do not invent a cf pages deploy replacement. See limitations.

For Pages / D1 / Durable Objects / multi-env / CI — descend into references/.

Quick Decision Trees

"I need to run code"
Need to run code?
├─ Serverless functions at the edge → workers/
├─ Full-stack web app with Git deploys → workers/ (framework) + static-assets/
├─ Maintain or migrate an existing Pages app → pages/ (legacy reference)
├─ Stateful coordination/real-time → durable-objects/
├─ Long-running multi-step jobs → workflows/
├─ Run containers → containers/
├─ Multi-tenant (customers deploy code) → workers-for-platforms/
├─ Scheduled tasks (cron) → cron-triggers/
├─ Lightweight edge logic (modify HTTP) → snippets/
├─ Process Worker execution events (logs/observability) → tail-workers/
└─ Optimize latency to backend infrastructure → smart-placement/
"I need to store data"
Need storage?
├─ Key-value (config, sessions, cache) → kv/
├─ Relational SQL → d1/ (SQLite) or hyperdrive/ (existing Postgres/MySQL)
├─ Object/file storage (S3-compatible) → r2/
├─ Message queue (async processing) → queues/
├─ Vector embeddings (AI/semantic search) → vectorize/
├─ Strongly-consistent per-entity state → durable-objects/ (DO storage)
├─ Secrets management → secrets-store/
├─ Streaming ETL to R2 → pipelines/
└─ Persistent cache (long-term retention) → cache-reserve/
"I need AI/ML"
Need AI?
├─ Run inference (LLMs, embeddings, images) → workers-ai/
├─ Vector database for RAG/search → vectorize/
├─ Build stateful AI agents → agents-sdk/
├─ Gateway for any AI provider (caching, routing) → ai-gateway/
└─ AI-powered search widget → ai-search/
"I need networking/connectivity"
Need networking?
├─ Expose local service to internet → tunnel/
├─ TCP/UDP proxy (non-HTTP) → spectrum/
├─ WebRTC TURN server → turn/
├─ Private network connectivity → network-interconnect/
├─ Optimize routing → argo-smart-routing/
├─ Optimize latency to backend (not user) → smart-placement/
└─ Real-time video/audio → realtimekit/ or realtime-sfu/
"I need security"
Need security?
├─ Web Application Firewall → waf/
├─ DDoS protection → ddos/
├─ Bot detection/management → bot-management/
├─ API protection → api-shield/
├─ CAPTCHA alternative → turnstile/
└─ Credential leak detection → waf/ (managed ruleset)
"I need media/content"
Need media?
├─ Image optimization/transformation → images/
├─ Video streaming/encoding → stream/
├─ Browser automation/screenshots → browser-rendering/
└─ Third-party script management → zaraz/
"I need infrastructure-as-code"
Need IaC? → pulumi/ (Pulumi), terraform/ (Terraform), or api/ (REST API)

Product Index

Compute & Runtime
ProductReference
Workersreferences/workers/
Pagesreferences/pages/
Pages Functionsreferences/pages-functions/
Durable Objectsreferences/durable-objects/
Workflowsreferences/workflows/
Containersreferences/containers/
Workers for Platformsreferences/workers-for-platforms/
Cron Triggersreferences/cron-triggers/
Tail Workersreferences/tail-workers/
Snippetsreferences/snippets/
Smart Placementreferences/smart-placement/
Storage & Data
ProductReference
KVreferences/kv/
D1references/d1/
R2references/r2/
Queuesreferences/queues/
Hyperdrivereferences/hyperdrive/
DO Storagereferences/do-storage/
Secrets Storereferences/secrets-store/
Pipelinesreferences/pipelines/
R2 Data Catalogreferences/r2-data-catalog/
R2 SQLreferences/r2-sql/
AI & Machine Learning
ProductReference
Workers AIreferences/workers-ai/
Vectorizereferences/vectorize/
Agents SDKreferences/agents-sdk/
AI Gatewayreferences/ai-gateway/
AI Searchreferences/ai-search/
Networking & Connectivity
ProductReference
Tunnelreferences/tunnel/
Spectrumreferences/spectrum/
TURNreferences/turn/
Network Interconnectreferences/network-interconnect/
Argo Smart Routingreferences/argo-smart-routing/
Workers VPCreferences/workers-vpc/
Security
ProductReference
WAFreferences/waf/
DDoS Protectionreferences/ddos/
Bot Managementreferences/bot-management/
API Shieldreferences/api-shield/
Turnstilereferences/turnstile/
Media & Content
ProductReference
Imagesreferences/images/
Streamreferences/stream/
Browser Renderingreferences/browser-rendering/
Zarazreferences/zaraz/
Real-Time Communication
ProductReference
RealtimeKitreferences/realtimekit/
Realtime SFUreferences/realtime-sfu/
Developer Tools
ProductReference
cf CLIreferences/cf/
Miniflarereferences/miniflare/
C3references/c3/
Observabilityreferences/observability/
Analytics Enginereferences/analytics-engine/
Web Analyticsreferences/web-analytics/
Sandboxreferences/sandbox/
Workerdreferences/workerd/
Workers Playgroundreferences/workers-playground/
Infrastructure as Code
ProductReference
Pulumireferences/pulumi/
Terraformreferences/terraform/
APIreferences/api/
Other Services
ProductReference
Email Routingreferences/email-routing/
Email Workersreferences/email-workers/
Static Assetsreferences/static-assets/
Bindingsreferences/bindings/
Cache Reservereferences/cache-reserve/

Troubleshooting

Escalated Network Access

If deployment fails due to network issues (timeouts, DNS errors, connection resets), rerun the deploy with escalated permissions (use sandbox_permissions=require_escalated). The deploy requires escalated network access when sandbox networking blocks outbound requests.

Example guidance to the user:

The deploy needs escalated network access to deploy to Cloudflare. I can rerun the command with escalated permissions—want me to proceed?

Comments

Markdown supported