All skills
openai avatar

/cloudflare-deploy

@bf9e226 official
by openaiopenai/skills28k stars
1,891

Deploy 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.

Use this Skill: https://skilld.dev/gh/openai/skills/cloudflare-deploy

This session only. Nothing lands on disk.

referenceskvapi.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

KV API Reference

Read Operations

// Single key (string)
const value = await env.MY_KV.get("user:123");

// JSON type (auto-parsed)
const config = await env.MY_KV.get<AppConfig>("config", "json");

// ArrayBuffer for binary
const buffer = await env.MY_KV.get("image", "arrayBuffer");

// Stream for large values
const stream = await env.MY_KV.get("large-file", "stream");

// With cache TTL (min 60s)
const value = await env.MY_KV.get("key", { type: "text", cacheTtl: 300 });

// Bulk get (max 100 keys, counts as 1 operation)
const keys = ["user:1", "user:2", "user:3", "missing:key"];
const results = await env.MY_KV.get(keys);
// Returns Map<string, string | null>

console.log(results.get("user:1"));     // "John" (if exists)
console.log(results.get("missing:key")); // null

// Process results with null handling
for (const [key, value] of results) {
  if (value !== null) {
    // Handle found keys
    console.log(`${key}: ${value}`);
  }
}

// TypeScript with generics (type-safe JSON parsing)
interface UserProfile { name: string; email: string; }
const profile = await env.USERS.get<UserProfile>("user:123", "json");
// profile is typed as UserProfile | null
if (profile) {
  console.log(profile.name); // Type-safe access
}

// Bulk get with type
const configs = await env.MY_KV.get<Config>(["config:app", "config:feature"], "json");
// Map<string, Config | null>

Write Operations

// Basic put
await env.MY_KV.put("key", "value");
await env.MY_KV.put("config", JSON.stringify({ theme: "dark" }));

// With expiration (UNIX timestamp)
await env.MY_KV.put("session", token, {
  expiration: Math.floor(Date.now() / 1000) + 3600
});

// With TTL (seconds from now, min 60)
await env.MY_KV.put("cache", data, { expirationTtl: 300 });

// With metadata (max 1024 bytes)
await env.MY_KV.put("user:profile", userData, {
  metadata: { version: 2, lastUpdated: Date.now() }
});

// Combined
await env.MY_KV.put("temp", value, {
  expirationTtl: 3600,
  metadata: { temporary: true }
});

Get with Metadata

// Single key
const result = await env.MY_KV.getWithMetadata("user:profile");
// { value: string | null, metadata: any | null }

if (result.value && result.metadata) {
  const { version, lastUpdated } = result.metadata;
}

// Multiple keys (bulk)
const keys = ["key1", "key2", "key3"];
const results = await env.MY_KV.getWithMetadata(keys);
// Returns Map<string, { value, metadata, cacheStatus? }>

for (const [key, result] of results) {
  if (result.value) {
    console.log(`${key}: ${result.value}`);
    console.log(`Metadata: ${JSON.stringify(result.metadata)}`);
    // cacheStatus field indicates cache hit/miss (when available)
  }
}

// With type
const result = await env.MY_KV.getWithMetadata<UserData>("user:123", "json");
// result: { value: UserData | null, metadata: any | null, cacheStatus?: string }

Delete Operations

await env.MY_KV.delete("key"); // Always succeeds (even if key missing)

List Operations

// List all
const keys = await env.MY_KV.list();
// { keys: [...], list_complete: boolean, cursor?: string }

// With prefix
const userKeys = await env.MY_KV.list({ prefix: "user:" });

// Pagination
let cursor: string | undefined;
let allKeys = [];
do {
  const result = await env.MY_KV.list({ cursor, limit: 1000 });
  allKeys.push(...result.keys);
  cursor = result.cursor;
} while (!result.list_complete);

Performance Considerations

Type Selection

Type Use Case Performance
stream Large values (>1MB) Fastest - no buffering
arrayBuffer Binary data Fast - single allocation
text String values Medium
json Objects (parse overhead) Slowest - parsing cost

Parallel Reads

// Efficient parallel reads with Promise.all()
const [user, settings, cache] = await Promise.all([
  env.USERS.get("user:123", "json"),
  env.SETTINGS.get("config:app", "json"),
  env.CACHE.get("data:latest")
]);

Error Handling

  • Missing keys: Return null (not an error)
  • Rate limit (429): Retry with exponential backoff (see gotchas.md)
  • Response too large (413): Values >25MB fail with 413 error

See gotchas.md for detailed error patterns and solutions.

Source: SKILL.md on GitHub

2 warnings17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill provides comprehensive guidance for deploying and managing infrastructure on the Cloudflare platform. It includes extensive educational material on secure development practices, such as preventing SQL injection and managing secrets effectively. No malicious patterns or security risks were identified.

  • Socket17d

    2 alerts: gptAnomaly

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer7mo

    310/310 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at bf9e226. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Activeupdated 8 months ago

README badge

README badge for openai/skills/cloudflare-deploy

Deploys applications and infrastructure to Cloudflare's platform, including Workers, Pages, D1, R2, Durable Objects, KV, and other services. Use decision trees to route to the right Cloudflare product based on compute, storage, AI, networking, security, or media needs.

Generated from the current SKILL.md.

Does this skill cover all Cloudflare products?
The skill is a consolidated index covering compute, storage, AI, networking, security, media, and developer tools on Cloudflare. It uses decision trees to route you to the right product reference, then loads detailed guidance for that product.
What authentication is required before deploying?
Run `npx wrangler whoami` to check if authenticated. For local deployment, use `wrangler login` (one-time OAuth). For CI/CD, set the `CLOUDFLARE_API_TOKEN` environment variable.
What should I do if deployment fails due to network issues?
Rerun the deploy with `sandbox_permissions=require_escalated` to grant elevated network access, which is required for outbound requests to Cloudflare during deployment.
How long does a Cloudflare deployment typically take?
Deployments may take several minutes. Use appropriate timeout values in your configuration or CI/CD environment.

Generated from the current SKILL.md. These answers refresh after source changes.