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.

referencesstatic-assetsgotchas.md

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

Best Practices

1. Use Selective Worker-First Routing

Instead of run_worker_first = true, use array patterns:

{
  "assets": {
    "run_worker_first": [
      "/api/*",           // API routes
      "/admin/*",         // Admin area
      "!/admin/assets/*"  // Except admin assets
    ]
  }
}

Benefits:

  • Reduces Worker invocations
  • Lowers costs
  • Improves asset delivery performance

2. Leverage Navigation Request Optimization

For SPAs, use compatibility_date = "2025-04-01" or later:

{
  "compatibility_date": "2025-04-01",
  "assets": {
    "not_found_handling": "single-page-application"
  }
}

Navigation requests skip Worker invocation, reducing costs.

3. Type Safety with Bindings

Always type your environment:

interface Env {
  ASSETS: Fetcher;
}

Common Errors

"Asset not found"

Cause: Asset not in assets directory, wrong path, or assets not deployed
Solution: Verify asset exists, check path case-sensitivity, redeploy if needed

"Worker not invoked for asset"

Cause: Asset served directly, run_worker_first not configured
Solution: Configure run_worker_first patterns to include asset routes (see configuration.md:66-106)

"429 Too Many Requests on free tier"

Cause: run_worker_first patterns invoke Worker for many requests, hitting free tier limits (100k req/day)
Solution: Use more selective patterns with negative exclusions, or upgrade to paid plan

"Smart Placement increases latency"

Cause: run_worker_first=true + Smart Placement routes all requests through single smart-placed location
Solution: Use selective patterns (array syntax) or disable Smart Placement for asset-heavy apps

"CF-Cache-Status header unreliable"

Cause: Header is probabilistically added for privacy reasons
Solution: Don't rely on CF-Cache-Status for critical routing logic. Use other signals (ETag, age).

"JWT expired during deployment"

Cause: Large asset deployments exceed JWT token lifetime
Solution: Update to Wrangler 4.34.0+ (automatic token refresh), or reduce asset count

"Cannot use 'assets' with 'site'"

Cause: Legacy site config conflicts with new assets config
Solution: Migrate from site to assets (see configuration.md). Remove site key from wrangler.jsonc.

"Assets not updating after deployment"

Cause: Browser or CDN cache serving old assets
Solution:

  • Hard refresh browser (Cmd+Shift+R / Ctrl+F5)
  • Use cache-busting (hashed filenames)
  • Verify deployment completed: wrangler tail

Limits

Resource/Limit Free Paid Notes
Max asset size 25 MiB 25 MiB Per file
Total assets 20,000 100,000 Requires Wrangler 4.34.0+ (Sep 2025)
Worker invocations 100k/day 10M/month Optimize with run_worker_first patterns
Asset storage Unlimited Unlimited Included

Version Requirements

Feature Minimum Wrangler Version
100k file limit (paid) 4.34.0
Vite plugin 4.0.0 + @cloudflare/vite-plugin 1.0.0
Navigation optimization 4.0.0 + compatibility_date: "2025-04-01"

Performance Tips

1. Use Hashed Filenames

Enable long-term caching with content-hashed filenames:

app.a3b2c1d4.js
styles.e5f6g7h8.css

Most bundlers (Vite, Webpack, Parcel) do this automatically.

2. Minimize Worker Invocations

Serve assets directly when possible:

{
  "assets": {
    // Only invoke Worker for dynamic routes
    "run_worker_first": ["/api/*", "/auth/*"]
  }
}

3. Leverage Browser Cache

Set appropriate Cache-Control headers:

// Versioned assets
'Cache-Control': 'public, max-age=31536000, immutable'

// HTML (revalidate often)
'Cache-Control': 'public, max-age=0, must-revalidate'

See patterns.md:169-189 for implementation.

4. Use .assetsignore

Reduce upload time by excluding unnecessary files:

*.map
*.md
.DS_Store
node_modules/

See configuration.md:107-126 for details.

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.