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.

referencespages-functionsREADME.md

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

Cloudflare Pages Functions

Serverless functions on Cloudflare Pages using Workers runtime. Full-stack dev with file-based routing.

Quick Navigation

Need to...

Task Go to
Set up TypeScript types configuration.md - TypeScript Setup
Configure bindings (KV, D1, R2) configuration.md - wrangler.jsonc
Access request/env/params api.md - EventContext
Add middleware or auth patterns.md - Middleware, Auth
Background tasks (waitUntil) patterns.md - Background Tasks
Debug errors or check limits gotchas.md - Common Errors, Limits

Decision Tree: Is This Pages Functions?

Need serverless backend? 
├─ Yes, for a static site → Pages Functions
├─ Yes, standalone API → Workers
└─ Just static hosting → Pages (no functions)

Have existing Worker?
├─ Complex routing logic → Use _worker.js (Advanced Mode)
└─ Simple routes → Migrate to /functions (File-Based)

Framework-based?
├─ Next.js/SvelteKit/Remix → Uses _worker.js automatically
└─ Vanilla/HTML/React SPA → Use /functions

File-Based Routing

/functions
  ├── index.js              → /
  ├── api.js                → /api
  ├── users/
  │   ├── index.js          → /users/
  │   ├── [user].js         → /users/:user
  │   └── [[catchall]].js   → /users/*
  └── _middleware.js        → runs on all routes

Rules:

  • index.js → directory root
  • Trailing slash optional
  • Specific routes precede catch-alls
  • Falls back to static if no match

Dynamic Routes

Single segment [param] → string:

// /functions/users/[user].js
export function onRequest(context) {
  return new Response(`Hello ${context.params.user}`);
}
// Matches: /users/nevi

Multi-segment [[param]] → array:

// /functions/users/[[catchall]].js
export function onRequest(context) {
  return new Response(JSON.stringify(context.params.catchall));
}
// Matches: /users/nevi/foobar → ["nevi", "foobar"]

Key Features

  • Method handlers: onRequestGet, onRequestPost, etc.
  • Middleware: _middleware.js for cross-cutting concerns
  • Bindings: KV, D1, R2, Durable Objects, Workers AI, Service bindings
  • TypeScript: Full type support via wrangler types command
  • Advanced mode: Use _worker.js for custom routing logic

Reading Order

New to Pages Functions? Start here:

  1. README.md - Overview, routing, decision tree (you are here)
  2. configuration.md - TypeScript setup, wrangler.jsonc, bindings
  3. api.md - EventContext, handlers, bindings reference
  4. patterns.md - Middleware, auth, CORS, rate limiting, caching
  5. gotchas.md - Common errors, debugging, limits

Quick reference lookup:

See Also

  • pages - Pages platform overview and static site deployment
  • workers - Workers runtime API reference
  • d1 - D1 database integration with Pages Functions

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.