davila7/claude-code-templates / cli-tool/components/skills/development/cloudflare-deploy
cloudflare-deploy
FlaggedDeploy applications and infrastructure to Cloudflare using Workers, Pages, and related platform services. Use when the user asks to deploy, host, publish, or set up a project on Cloudflare.
references/pulumi/configuration.md
View on GitHub# Resource Configuration
## Workers (cloudflare.WorkerScript)
```typescript
import * as cloudflare from "@pulumi/cloudflare";
import * as fs from "fs";
const worker = new cloudflare.WorkerScript("my-worker", {
accountId: accountId,
name: "my-worker",
content: fs.readFileSync("./dist/worker.js", "utf8"),
module: true, // ES modules
compatibilityDate: "2025-01-01",
compatibilityFlags: ["nodejs_compat"],
// v6.x: Observability
logpush: true, // Enable Workers Logpush
tailConsumers: [{service: "log-consumer"}], // Stream logs to Worker
// v6.x: Placement
placement: {mode: "smart"}, // Smart placement for latency optimization
// Bindings
kvNamespaceBindings: [{name: "MY_KV", namespaceId: kv.id}],
r2BucketBindings: [{name: "MY_BUCKET", bucketName: bucket.name}],
d1DatabaseBindings: [{name: "DB", databaseId: db.id}],
queueBindings: [{name: "MY_QUEUE", queue: queue.id}],
serviceBindings: [{name: "OTHER_SERVICE", service: other.name}],
plainTextBindings: [{name: "ENV_VAR", text: "value"}],
secretTextBindings: [{name: "API_KEY", text: secret}],
// v6.x: Advanced bindings
analyticsEngineBindings: [{name: "ANALYTICS", dataset: "my-dataset"}],
browserBinding: {name: "BROWSER"}, // Browser Rendering
aiBinding: {name: "AI"}, // Workers AI
hyperdriveBindings: [{name: "HYPERDRIVE", id: hyperdriveConfig.id}],
});
```
## Workers KV (cloudflare.WorkersKvNamespace)
```typescript
const kv = new cloudflare.WorkersKvNamespace("my-kv", {
accountId: accountId,
title: "my-kv-namespace",
});
// Write values
const kvValue = new cloudflare.WorkersKvValue("config", {
accountId: accountId,
namespaceId: kv.id,
key: "config",
value: JSON.stringify({foo: "bar"}),
});
```
## R2 Buckets (cloudflare.R2Bucket)
```typescript
const bucket = new cloudflare.R2Bucket("my-bucket", {
accountId: accountId,
name: "my-bucket",
location: "auto", // or "wnam", etc.
});
```
## D1 Databases (cloudflare.D1Database)
```typescript
const db = new cloudflare.D1Database("my-db", {accountId, name: "my-database"});
// Migrations via wrangler
import * as command from "@pulumi/command";
const migration = new command.local.Command("d1-migration", {
create: pulumi.interpolate`wrangler d1 execute ${db.name} --file ./schema.sql`,
}, {dependsOn: [db]});
```
## Queues (cloudflare.Queue)
```typescript
const queue = new cloudflare.Queue("my-queue", {accountId, name: "my-queue"});
// Producer
const producer = new cloudflare.WorkerScript("producer", {
accountId, name: "producer", content: code,
queueBindings: [{name: "MY_QUEUE", queue: queue.id}],
});
// Consumer
const consumer = new cloudflare.WorkerScript("consumer", {
accountId, name: "consumer", content: code,
queueConsumers: [{queue: queue.name, maxBatchSize: 10, maxRetries: 3}],
});
```
## Pages Projects (cloudflare.PagesProject)
```typescript
const pages = new cloudflare.PagesProject("my-site", {
accountId, name: "my-site", productionBranch: "main",
buildConfig: {buildCommand: "npm run build", destinationDir: "dist"},
source: {
type: "github",
config: {owner: "my-org", repoName: "my-repo", productionBranch: "main"},
},
deploymentConfigs: {
production: {
environmentVariables: {NODE_VERSION: "18"},
kvNamespaces: {MY_KV: kv.id},
d1Databases: {DB: db.id},
},
},
});
```
## DNS Records (cloudflare.DnsRecord)
```typescript
const zone = cloudflare.getZone({name: "example.com"});
const record = new cloudflare.DnsRecord("www", {
zoneId: zone.then(z => z.id), name: "www", type: "A",
content: "192.0.2.1", ttl: 3600, proxied: true,
});
```
## Workers Domains/Routes
```typescript
// Route (pattern-based)
const route = new cloudflare.WorkerRoute("my-route", {
zoneId: zoneId,
pattern: "example.com/api/*",
scriptName: worker.name,
});
// Domain (dedicated subdomain)
const domain = new cloudflare.WorkersDomain("my-domain", {
accountId: accountId,
hostname: "api.example.com",
service: worker.name,
zoneId: zoneId,
});
```
## Assets Configuration (v6.x)
Serve static assets from Workers:
```typescript
const worker = new cloudflare.WorkerScript("app", {
accountId: accountId,
name: "my-app",
content: code,
assets: {
path: "./public", // Local directory
// Assets uploaded and served from Workers
},
});
```
## v6.x Versioned Deployments (Advanced)
For gradual rollouts, use 3-resource pattern:
```typescript
// 1. Worker (container for versions)
const worker = new cloudflare.Worker("api", {
accountId: accountId,
name: "api-worker",
});
// 2. Version (immutable code + config)
const version = new cloudflare.WorkerVersion("v1", {
accountId: accountId,
workerId: worker.id,
content: fs.readFileSync("./dist/worker.js", "utf8"),
compatibilityDate: "2025-01-01",
compatibilityFlags: ["nodejs_compat"],
// Note: Bindings configured at deployment level
});
// 3. Deployment (version + bindings + traffic split)
const deployment = new cloudflare.WorkersDeployment("prod", {
accountId: accountId,
workerId: worker.id,
versionId: version.id,
// Bindings applied to deployment
kvNamespaceBindings: [{name: "MY_KV", namespaceId: kv.id}],
});
```
**When to use:** Blue-green deployments, canary releases, gradual rollouts
**When NOT to use:** Simple single-version deployments (use WorkerScript)
---
See: [README.md](./README.md), [api.md](./api.md), [patterns.md](./patterns.md), [gotchas.md](./gotchas.md)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |