Cloudflare
OpenAIOfficialCreated by CloudflareDistributed by OpenAI
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- Medium risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The Cloudflare platform skill provides a centralized resource for developers building on Cloudflare's edge network. It covers the full ecosystem, including compute (Workers, Pages), storage (KV, D1, R2), AI integration (Workers AI, Agents SDK), networking, and security. The skill emphasizes a retrieval-first approach, directing users to official Cloudflare documentation and configuration schemas to ensure accuracy regarding API signatures, limits, and pricing.
What it does
- Provides decision trees to help select the right Cloudflare product for specific compute, storage, or networking needs.
- Offers structured references for the Cloudflare Agents SDK, including lifecycle hooks and state management.
- Guides users on integrating AI models and vector databases into edge applications.
- Outlines methods for managing infrastructure-as-code using Terraform or Pulumi.
- Facilitates access to product-specific documentation for security, media, and analytics services.
- Maintains a directory of developer tools like Wrangler and Miniflare for local development and testing.
When to use it
- When starting a new project on the Cloudflare platform and needing to choose the appropriate architecture.
- When implementing stateful AI agents using the Cloudflare Agents SDK.
- When configuring edge compute, storage bindings, or networking rules.
- When troubleshooting API limits, configuration errors, or deployment issues.
- When integrating AI models or vector search into existing edge applications.
Advantages
- Consolidates a vast ecosystem into a navigable, task-oriented structure.
- Promotes the use of official, up-to-date documentation over potentially stale training data.
- Simplifies complex architectural decisions through clear, logic-based decision trees.
- Provides specific code patterns for advanced features like Durable Objects and AI agents.
- Supports modern infrastructure-as-code workflows for consistent deployments.
Usage examples
- “I need to build a stateful AI chat agent on Cloudflare. How do I start?”
- The agent will guide you to use the AIChatAgent class from the Agents SDK, explain how to manage message history, and provide a template for integrating AI models.
- “Which storage solution should I use for relational data in my Worker?”
- The agent will point you to D1 for SQLite-based relational storage or Hyperdrive for connecting to existing Postgres/MySQL databases.
- “How do I expose my local development server to the internet via Cloudflare?”
- The agent will provide instructions on using Cloudflare Tunnel to securely connect your local service to the Cloudflare edge.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/openai/cloudflare/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip cloudflare.zip -d .agents/skills
Documentation by Cloudflare
Cloudflare Platform Skill
Consolidated skill for building on the Cloudflare platform. Use decision trees below to find the right product, then load detailed references.
Your knowledge of Cloudflare APIs, types, limits, and pricing may be outdated. Prefer retrieval over pre-training — the references in this skill are starting points, not source of truth.
Retrieval Sources
Fetch the latest information before citing specific numbers, API signatures, or configuration options. Do not rely on baked-in knowledge or these reference files alone.
| Source | How to retrieve | Use for |
|---|---|---|
| Cloudflare docs | Search https://developers.cloudflare.com/ directly | Limits, pricing, API reference, compatibility dates/flags |
| Workers types | npm pack @cloudflare/workers-types or check node_modules | Type signatures, binding shapes, handler types |
| Wrangler config schema | node_modules/wrangler/config-schema.json | Config fields, binding shapes, allowed values |
| Product changelogs | https://developers.cloudflare.com/changelog/ | Recent changes to limits, features, deprecations |
When a reference file and the docs disagree, trust the docs. This is especially important for: numeric limits, pricing tiers, type signatures, and configuration options.
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 → pages/
├─ 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 analytics/metrics data"
Need analytics?
├─ Query across all Cloudflare products (HTTP, Workers, DNS, etc.) → graphql-api/
├─ Custom high-cardinality metrics from Workers → analytics-engine/
├─ Client-side (RUM) performance data → web-analytics/
├─ Workers Logs and real-time debugging → observability/
└─ Raw logs (Logpush to external tools) → Cloudflare docs"I need infrastructure-as-code"
Need IaC? → pulumi/ (Pulumi), terraform/ (Terraform), or api/ (REST API)Product Index
Compute & Runtime
| Product | Reference |
|---|---|
| Workers | references/workers/ |
| Pages | references/pages/ |
| Pages Functions | references/pages-functions/ |
| Durable Objects | references/durable-objects/ |
| Workflows | references/workflows/ |
| Containers | references/containers/ |
| Workers for Platforms | references/workers-for-platforms/ |
| Cron Triggers | references/cron-triggers/ |
| Tail Workers | references/tail-workers/ |
| Snippets | references/snippets/ |
| Smart Placement | references/smart-placement/ |
Storage & Data
| Product | Reference |
|---|---|
| KV | references/kv/ |
| D1 | references/d1/ |
| R2 | references/r2/ |
| Queues | references/queues/ |
| Hyperdrive | references/hyperdrive/ |
| DO Storage | references/do-storage/ |
| Secrets Store | references/secrets-store/ |
| Pipelines | references/pipelines/ |
| R2 Data Catalog | references/r2-data-catalog/ |
| R2 SQL | references/r2-sql/ |
AI & Machine Learning
| Product | Reference |
|---|---|
| Workers AI | references/workers-ai/ |
| Vectorize | references/vectorize/ |
| Agents SDK | references/agents-sdk/ |
| AI Gateway | references/ai-gateway/ |
| AI Search | references/ai-search/ |
Networking & Connectivity
| Product | Reference |
|---|---|
| Tunnel | references/tunnel/ |
| Spectrum | references/spectrum/ |
| TURN | references/turn/ |
| Network Interconnect | references/network-interconnect/ |
| Argo Smart Routing | references/argo-smart-routing/ |
| Workers VPC | references/workers-vpc/ |
Security
| Product | Reference |
|---|---|
| WAF | references/waf/ |
| DDoS Protection | references/ddos/ |
| Bot Management | references/bot-management/ |
| API Shield | references/api-shield/ |
| Turnstile | references/turnstile/ |
Media & Content
| Product | Reference |
|---|---|
| Images | references/images/ |
| Stream | references/stream/ |
| Browser Rendering | references/browser-rendering/ |
| Zaraz | references/zaraz/ |
Real-Time Communication
| Product | Reference |
|---|---|
| RealtimeKit | references/realtimekit/ |
| Realtime SFU | references/realtime-sfu/ |
Developer Tools
| Product | Reference |
|---|---|
| Wrangler | references/wrangler/ |
| Miniflare | references/miniflare/ |
| C3 | references/c3/ |
| Observability | references/observability/ |
| GraphQL Analytics API | references/graphql-api/ |
| Analytics Engine | references/analytics-engine/ |
| Web Analytics | references/web-analytics/ |
| Sandbox | references/sandbox/ |
| Workerd | references/workerd/ |
| Workers Playground | references/workers-playground/ |
Infrastructure as Code
| Product | Reference |
|---|---|
| Pulumi | references/pulumi/ |
| Terraform | references/terraform/ |
| API | references/api/ |
Other Services
| Product | Reference |
|---|---|
| Email Routing | references/email-routing/ |
| Email Workers | references/email-workers/ |
| Static Assets | references/static-assets/ |
| Bindings | references/bindings/ |
| Cache Reserve | references/cache-reserve/ |
Files
- ATTRIBUTION.mdAdded by AutoGineer906 B
- LICENSE.txt10.5 KiB
- SKILL.md8.0 KiB
- agents/openai.yaml375 B
- assets/cloudflare-small.svg1.2 KiB
- assets/cloudflare.png1.2 KiB
- references/agents-sdk/README.md2.7 KiB
- references/agents-sdk/api.md5.7 KiB
- references/agents-sdk/configuration.md3.5 KiB
- references/agents-sdk/gotchas.md5.0 KiB
- references/agents-sdk/patterns.md5.4 KiB
- references/ai-gateway/README.md6.2 KiB
- references/ai-gateway/configuration.md2.9 KiB
- references/ai-gateway/dynamic-routing.md1.8 KiB
- references/ai-gateway/features.md2.7 KiB
- references/ai-gateway/sdk-integration.md2.6 KiB
- references/ai-gateway/troubleshooting.md2.4 KiB
- references/ai-search/README.md4.4 KiB
- references/ai-search/api.md2.5 KiB
- references/ai-search/configuration.md1.7 KiB
- references/ai-search/gotchas.md2.1 KiB
- references/ai-search/patterns.md2.0 KiB
- references/analytics-engine/README.md3.1 KiB
- references/analytics-engine/api.md3.1 KiB
- references/analytics-engine/configuration.md2.3 KiB
- references/analytics-engine/gotchas.md2.0 KiB
- references/analytics-engine/patterns.md2.3 KiB
- references/api-shield/README.md1.8 KiB
- references/api-shield/api.md3.8 KiB
- references/api-shield/configuration.md4.9 KiB
- references/api-shield/gotchas.md4.8 KiB
- references/api-shield/patterns.md5.7 KiB
- references/api/README.md2.3 KiB
- references/api/api.md4.2 KiB
- references/api/configuration.md3.7 KiB
- references/api/gotchas.md5.3 KiB
- references/api/patterns.md4.5 KiB
- references/argo-smart-routing/README.md4.0 KiB
- references/argo-smart-routing/api.md6.4 KiB
- references/argo-smart-routing/configuration.md4.3 KiB
- references/argo-smart-routing/gotchas.md4.2 KiB
- references/argo-smart-routing/patterns.md3.0 KiB
- references/bindings/README.md3.9 KiB
- references/bindings/api.md5.1 KiB
- references/bindings/configuration.md4.4 KiB
- references/bindings/gotchas.md6.0 KiB
- references/bindings/patterns.md4.9 KiB
- references/bot-management/README.md3.7 KiB
- references/bot-management/api.md5.6 KiB
- references/bot-management/configuration.md5.6 KiB
- references/bot-management/gotchas.md5.5 KiB
- references/bot-management/patterns.md4.8 KiB
- references/browser-rendering/README.md3.0 KiB
- references/browser-rendering/api.md2.9 KiB
- references/browser-rendering/configuration.md1.8 KiB
- references/browser-rendering/gotchas.md2.5 KiB
- references/browser-rendering/patterns.md2.6 KiB
- references/c3/README.md3.3 KiB
- references/c3/api.md2.2 KiB
- references/c3/configuration.md1.6 KiB
- references/c3/gotchas.md2.2 KiB
- references/c3/patterns.md2.1 KiB
- references/cache-reserve/README.md5.5 KiB
- references/cache-reserve/api.md5.9 KiB
- references/cache-reserve/configuration.md3.6 KiB
- references/cache-reserve/gotchas.md5.6 KiB
- references/cache-reserve/patterns.md6.1 KiB
- references/containers/README.md3.4 KiB
- references/containers/api.md4.2 KiB
- references/containers/configuration.md5.3 KiB
- references/containers/gotchas.md4.4 KiB
- references/containers/patterns.md4.8 KiB
- references/cron-triggers/README.md2.9 KiB
- references/cron-triggers/api.md5.7 KiB
- references/cron-triggers/configuration.md4.1 KiB
- references/cron-triggers/gotchas.md6.1 KiB
- references/cron-triggers/patterns.md6.8 KiB
- references/d1/README.md4.6 KiB
- references/d1/api.md6.6 KiB
- references/d1/configuration.md5.3 KiB
- references/d1/gotchas.md4.2 KiB
- references/d1/patterns.md7.1 KiB
- references/ddos/README.md2.0 KiB
- references/ddos/api.md4.1 KiB
- references/ddos/configuration.md2.9 KiB
- references/ddos/gotchas.md3.8 KiB
- references/ddos/patterns.md5.5 KiB
- references/do-storage/README.md2.7 KiB
- references/do-storage/api.md3.5 KiB
- references/do-storage/configuration.md2.2 KiB
- references/do-storage/gotchas.md5.1 KiB
- references/do-storage/patterns.md5.1 KiB
- references/do-storage/testing.md4.8 KiB
- references/durable-objects/README.md6.4 KiB
- references/durable-objects/api.md6.0 KiB
- references/durable-objects/configuration.md4.2 KiB
- references/durable-objects/gotchas.md7.1 KiB
- references/durable-objects/patterns.md6.5 KiB
- references/email-routing/README.md3.3 KiB
- references/email-routing/api.md5.2 KiB
- references/email-routing/configuration.md3.5 KiB
- references/email-routing/gotchas.md4.0 KiB
- references/email-routing/patterns.md5.3 KiB
- references/email-workers/README.md5.2 KiB
- references/email-workers/api.md5.9 KiB
- references/email-workers/configuration.md2.7 KiB
- references/email-workers/gotchas.md3.0 KiB
- references/email-workers/patterns.md2.7 KiB
- references/graphql-api/README.md7.6 KiB
- references/graphql-api/api.md5.6 KiB
- references/graphql-api/configuration.md4.6 KiB
- references/graphql-api/gotchas.md4.7 KiB
- references/graphql-api/patterns.md6.4 KiB
- references/hyperdrive/README.md2.8 KiB
- references/hyperdrive/api.md3.8 KiB
- references/hyperdrive/configuration.md3.8 KiB
- references/hyperdrive/gotchas.md3.8 KiB
- references/hyperdrive/patterns.md5.8 KiB
- references/images/README.md2.8 KiB
- references/images/api.md2.5 KiB
- references/images/configuration.md4.0 KiB
- references/images/gotchas.md2.4 KiB
- references/images/patterns.md3.5 KiB
- references/kv/README.md2.8 KiB
- references/kv/api.md4.2 KiB
- references/kv/configuration.md3.0 KiB
- references/kv/gotchas.md4.3 KiB
- references/kv/patterns.md4.6 KiB
- references/miniflare/README.md2.9 KiB
- references/miniflare/api.md4.5 KiB
- references/miniflare/configuration.md3.4 KiB
- references/miniflare/gotchas.md3.6 KiB
- references/miniflare/patterns.md4.2 KiB
- references/network-interconnect/README.md3.2 KiB
- references/network-interconnect/api.md5.5 KiB
- references/network-interconnect/configuration.md4.2 KiB
- references/network-interconnect/gotchas.md5.4 KiB
- references/network-interconnect/patterns.md3.9 KiB
- references/observability/README.md3.8 KiB
- references/observability/api.md3.4 KiB
- references/observability/configuration.md3.5 KiB
- references/observability/gotchas.md3.7 KiB
- references/observability/patterns.md2.4 KiB
- references/pages-functions/README.md3.2 KiB
- references/pages-functions/api.md4.6 KiB
- references/pages-functions/configuration.md2.9 KiB
- references/pages-functions/gotchas.md3.8 KiB
- references/pages-functions/patterns.md4.1 KiB
- references/pages/README.md2.8 KiB
- references/pages/api.md5.8 KiB
- references/pages/configuration.md5.7 KiB
- references/pages/gotchas.md7.7 KiB
- references/pages/patterns.md5.8 KiB
- references/pipelines/README.md3.3 KiB
- references/pipelines/api.md5.0 KiB
- references/pipelines/configuration.md2.7 KiB
- references/pipelines/gotchas.md2.4 KiB
- references/pipelines/patterns.md2.0 KiB
- references/pulumi/README.md3.2 KiB
- references/pulumi/api.md5.6 KiB
- references/pulumi/configuration.md5.5 KiB
- references/pulumi/gotchas.md6.3 KiB
- references/pulumi/patterns.md6.8 KiB
- references/queues/README.md3.0 KiB
- references/queues/api.md5.4 KiB
- references/queues/configuration.md3.7 KiB
- references/queues/gotchas.md7.0 KiB
- references/queues/patterns.md5.4 KiB
- references/r2-data-catalog/README.md6.9 KiB
- references/r2-data-catalog/api.md5.9 KiB
- references/r2-data-catalog/configuration.md5.2 KiB
- references/r2-data-catalog/gotchas.md5.9 KiB
- references/r2-data-catalog/patterns.md5.7 KiB
- references/r2-sql/README.md5.1 KiB
- references/r2-sql/api.md3.9 KiB
- references/r2-sql/configuration.md3.7 KiB
- references/r2-sql/gotchas.md6.1 KiB
- references/r2-sql/patterns.md6.6 KiB
- references/r2/README.md2.8 KiB
- references/r2/api.md5.5 KiB
- references/r2/configuration.md3.6 KiB
- references/r2/gotchas.md4.9 KiB
- references/r2/patterns.md5.7 KiB
- references/realtime-sfu/README.md3.0 KiB
- references/realtime-sfu/api.md3.7 KiB
- references/realtime-sfu/configuration.md3.4 KiB
- references/realtime-sfu/gotchas.md4.8 KiB
- references/realtime-sfu/patterns.md5.3 KiB
- references/realtimekit/README.md4.0 KiB
- references/realtimekit/api.md8.2 KiB
- references/realtimekit/configuration.md5.1 KiB
- references/realtimekit/gotchas.md6.7 KiB
- references/realtimekit/patterns.md7.5 KiB
- references/sandbox/README.md3.0 KiB
- references/sandbox/api.md4.8 KiB
- references/sandbox/configuration.md3.3 KiB
- references/sandbox/gotchas.md5.3 KiB
- references/sandbox/patterns.md5.0 KiB
- references/secrets-store/README.md2.2 KiB
- references/secrets-store/api.md4.3 KiB
- references/secrets-store/configuration.md3.8 KiB
- references/secrets-store/gotchas.md3.7 KiB
- references/secrets-store/patterns.md5.5 KiB
- references/smart-placement/README.md4.9 KiB
- references/smart-placement/api.md5.4 KiB
- references/smart-placement/configuration.md6.0 KiB
- references/smart-placement/gotchas.md5.5 KiB
- references/smart-placement/patterns.md5.6 KiB
- references/snippets/README.md3.1 KiB
- references/snippets/api.md5.0 KiB
- references/snippets/configuration.md6.2 KiB
- references/snippets/gotchas.md2.2 KiB
- references/snippets/patterns.md3.3 KiB
- references/spectrum/README.md2.3 KiB
- references/spectrum/api.md4.8 KiB
- references/spectrum/configuration.md4.2 KiB
- references/spectrum/gotchas.md3.6 KiB
- references/spectrum/patterns.md4.7 KiB
- references/static-assets/README.md2.1 KiB
- references/static-assets/api.md4.3 KiB
- references/static-assets/configuration.md4.7 KiB
- references/static-assets/gotchas.md4.0 KiB
- references/static-assets/patterns.md4.8 KiB
- references/stream/README.md3.8 KiB
- references/stream/api-live.md5.0 KiB
- references/stream/api.md5.1 KiB
- references/stream/configuration.md3.1 KiB
- references/stream/gotchas.md4.2 KiB
- references/stream/patterns.md6.2 KiB
- references/tail-workers/README.md2.9 KiB
- references/tail-workers/api.md5.0 KiB
- references/tail-workers/configuration.md3.4 KiB
- references/tail-workers/gotchas.md4.5 KiB
- references/tail-workers/patterns.md3.9 KiB
- references/terraform/README.md3.6 KiB
- references/terraform/api.md3.9 KiB
- references/terraform/configuration.md7.4 KiB
- references/terraform/gotchas.md5.1 KiB
- references/terraform/patterns.md6.5 KiB
- references/tunnel/README.md3.6 KiB
- references/tunnel/api.md4.3 KiB
- references/tunnel/configuration.md3.6 KiB
- references/tunnel/gotchas.md3.8 KiB
- references/tunnel/networking.md3.9 KiB
- references/tunnel/patterns.md3.8 KiB
- references/turn/README.md3.6 KiB
- references/turn/api.md5.1 KiB
- references/turn/configuration.md4.1 KiB
- references/turn/gotchas.md6.9 KiB
- references/turn/patterns.md6.0 KiB
- references/turnstile/README.md3.4 KiB
- references/turnstile/api.md6.3 KiB
- references/turnstile/configuration.md6.6 KiB
- references/turnstile/gotchas.md6.1 KiB
- references/turnstile/patterns.md4.5 KiB
- references/vectorize/README.md4.2 KiB
- references/vectorize/api.md2.3 KiB
- references/vectorize/configuration.md1.9 KiB
- references/vectorize/gotchas.md2.1 KiB
- references/vectorize/patterns.md2.5 KiB
- references/waf/README.md3.4 KiB
- references/waf/api.md5.7 KiB
- references/waf/configuration.md4.7 KiB
- references/waf/gotchas.md6.1 KiB
- references/waf/patterns.md5.2 KiB
- references/web-analytics/README.md5.1 KiB
- references/web-analytics/configuration.md2.0 KiB
- references/web-analytics/gotchas.md1.9 KiB
- references/web-analytics/integration.md1.7 KiB
- references/web-analytics/patterns.md2.2 KiB
- references/workerd/README.md2.7 KiB
- references/workerd/api.md4.8 KiB
- references/workerd/configuration.md5.1 KiB
- references/workerd/gotchas.md4.7 KiB
- references/workerd/patterns.md4.8 KiB
- references/workers-ai/README.md5.9 KiB
- references/workers-ai/api.md2.7 KiB
- references/workers-ai/configuration.md1.9 KiB
- references/workers-ai/gotchas.md2.6 KiB
- references/workers-ai/patterns.md3.0 KiB
- references/workers-for-platforms/README.md3.8 KiB
- references/workers-for-platforms/api.md5.4 KiB
- references/workers-for-platforms/configuration.md3.8 KiB
- references/workers-for-platforms/gotchas.md5.3 KiB
- references/workers-for-platforms/patterns.md5.4 KiB
- references/workers-playground/README.md3.9 KiB
- references/workers-playground/api.md2.2 KiB
- references/workers-playground/configuration.md4.4 KiB
- references/workers-playground/gotchas.md2.0 KiB
- references/workers-playground/patterns.md3.2 KiB
- references/workers-vpc/README.md5.3 KiB
- references/workers-vpc/api.md5.2 KiB
- references/workers-vpc/configuration.md3.8 KiB
- references/workers-vpc/gotchas.md4.4 KiB
- references/workers-vpc/patterns.md5.9 KiB
- references/workers/README.md3.4 KiB
- references/workers/api.md5.0 KiB
- references/workers/configuration.md4.2 KiB
- references/workers/frameworks.md4.2 KiB
- references/workers/gotchas.md4.6 KiB
- references/workers/patterns.md5.3 KiB
- references/workflows/README.md2.4 KiB
- references/workflows/api.md6.3 KiB
- references/workflows/configuration.md3.6 KiB
- references/workflows/gotchas.md4.5 KiB
- references/workflows/patterns.md6.5 KiB
- references/wrangler/README.md4.6 KiB
- references/wrangler/api.md4.5 KiB
- references/wrangler/configuration.md4.6 KiB
- references/wrangler/gotchas.md5.7 KiB
- references/wrangler/patterns.md4.8 KiB
- references/zaraz/IMPLEMENTATION_SUMMARY.md3.4 KiB
- references/zaraz/README.md3.8 KiB
- references/zaraz/api.md3.1 KiB
- references/zaraz/configuration.md1.8 KiB
- references/zaraz/gotchas.md2.0 KiB
- references/zaraz/patterns.md2.1 KiB
references/turn/gotchas.md
TURN Gotchas & Troubleshooting
Common mistakes, security best practices, and troubleshooting for Cloudflare TURN.
Quick Reference
| Issue | Solution | Details |
|---|---|---|
| Credentials not working | Check TTL ≤ 48hrs | See Troubleshooting |
| Connection drops after ~48hrs | Implement credential refresh | See Connection Drops |
| Port 53 fails in browser | Filter server-side | See Port 53 |
| High packet loss | Check rate limits | See Rate Limits |
| Connection fails after maintenance | Implement ICE restart | See ICE Restart |
Critical Constraints
| Constraint | Value | Consequence if Violated |
|---|---|---|
| Max credential TTL | 48 hours (172800s) | API rejects request |
| Credential revocation delay | ~seconds | Billing stops immediately, connection drops shortly |
| IP allowlist update window | 14 days (if IPs change) | Connection fails if IPs change |
| Packet rate | 5-10k pps per allocation | Packet drops |
| Data rate | 50-100 Mbps per allocation | Packet drops |
| Unique IP rate | >5 new IPs/sec | Packet drops |
Limits Per TURN Allocation
Per user (not account-wide):
IP addresses: >5 new unique IPs per second
Packet rate: 5-10k packets per second (inbound/outbound)
Data rate: 50-100 Mbps (inbound/outbound)
MTU: No specific limit
Burst rates: Higher than documented
Exceeding limits results in packet drops.
Common Mistakes
Setting TTL > 48 hours
// ❌ BAD: API will reject
const creds = await generate({ ttl: 604800 }); // 7 days
// ✅ GOOD:
const creds = await generate({ ttl: 86400 }); // 24 hoursHardcoding IPs without monitoring
// ❌ BAD: IPs can change with 14-day notice
const iceServers = [{ urls: 'turn:141.101.90.1:3478' }];
// ✅ GOOD: Use DNS
const iceServers = [{ urls: 'turn:turn.cloudflare.com:3478' }];Using port 53 in browsers
// ❌ BAD: Blocked by Chrome/Firefox
urls: ['turn:turn.cloudflare.com:53']
// ✅ GOOD: Filter port 53
urls: urls.filter(url => !url.includes(':53'))Not handling credential expiry
// ❌ BAD: Credentials expire but call continues → connection drops
const creds = await fetchCreds();
const pc = new RTCPeerConnection({ iceServers: creds });
// ✅ GOOD: Refresh before expiry
setInterval(() => refreshCredentials(pc), 3000000); // 50 minMissing ICE restart support
// ❌ BAD: No recovery from TURN maintenance
pc.addEventListener('iceconnectionstatechange', () => {
console.log('State changed:', pc.iceConnectionState);
});
// ✅ GOOD: Implement ICE restart
pc.addEventListener('iceconnectionstatechange', async () => {
if (pc.iceConnectionState === 'failed') {
await refreshCredentials(pc);
pc.restartIce();
}
});Exposing TURN key secret client-side
// ❌ BAD: Secret exposed to client
const secret = 'your-turn-key-secret';
const response = await fetch(`https://rtc.live.cloudflare.com/v1/turn/...`, {
headers: { 'Authorization': `Bearer ${secret}` }
});
// ✅ GOOD: Generate credentials server-side
const response = await fetch('/api/turn-credentials');ICE Restart Required Scenarios
These events require ICE restart (see patterns.md):
TURN server maintenance (occasional on Cloudflare's network)
Network topology changes (anycast routing changes)
Credential refresh during long sessions (>1 hour)
Connection failure (iceConnectionState === 'failed')
Implement in all production apps:
pc.addEventListener('iceconnectionstatechange', async () => {
if (pc.iceConnectionState === 'failed' ||
pc.iceConnectionState === 'disconnected') {
await refreshTURNCredentials(pc);
pc.restartIce();
const offer = await pc.createOffer({ iceRestart: true });
await pc.setLocalDescription(offer);
// Send offer to peer via signaling...
}
});Reference: RFC 8445 Section 2.4
Security Checklist
[ ] Credentials generated server-side only (never client-side)
[ ] TURN_KEY_SECRET in wrangler secrets, not vars
[ ] TTL ≤ expected session duration (and ≤ 48 hours)
[ ] Rate limiting on credential generation endpoint
[ ] Client authentication before issuing credentials
[ ] Credential revocation API for compromised sessions
[ ] No hardcoded IPs (or DNS monitoring in place)
[ ] Port 53 filtered for browser clients
Troubleshooting
Issue: TURN credentials not working
Check:
Key ID and secret are correct
Credentials haven't expired (check TTL)
TTL doesn't exceed 172800 seconds (48 hours)
Server can reach rtc.live.cloudflare.com
Network allows outbound HTTPS
Solution:
// Validate before using
if (ttl > 172800) {
throw new Error('TTL cannot exceed 48 hours');
}Issue: Slow connection establishment
Solutions:
Ensure proper ICE candidate gathering
Check network latency to Cloudflare edge
Verify firewall allows WebRTC ports (3478, 5349, 443)
Consider using TURN over TLS (port 443) for corporate networks
Issue: High packet loss
Check:
Not exceeding rate limits (5-10k pps)
Not exceeding bandwidth limits (50-100 Mbps)
Not connecting to too many unique IPs (>5/sec)
Client network quality
Issue: Connection drops after ~48 hours
Cause: Credentials expired (48hr max)
Solution:
Set TTL to expected session duration
Implement credential refresh with setConfiguration()
Use ICE restart if connection fails
// Refresh credentials before expiry
const refreshInterval = ttl * 1000 - 60000; // 1 min early
setInterval(async () => {
await refreshTURNCredentials(pc);
}, refreshInterval);Issue: Port 53 URLs in browser fail silently
Cause: Chrome/Firefox block port 53
Solution: Filter port 53 URLs server-side:
const filtered = urls.filter(url => !url.includes(':53'));Issue: Hardcoded IPs stop working
Cause: Cloudflare changed IP addresses (14-day notice)
Solution:
Use DNS hostnames (
turn.cloudflare.com)Monitor DNS changes with automated alerts
Update allowlists within 14 days if using IP allowlisting
Cost Optimization
Use appropriate TTLs (don't over-provision)
Implement credential caching
Set
iceTransportPolicy: 'all'to try direct first (use'relay'only when necessary)Monitor bandwidth usage
Free when used with Cloudflare Calls SFU
See Also
api.md - Credential generation API, revocation
configuration.md - IP allowlisting, monitoring
patterns.md - ICE restart, credential refresh patterns
Requirements and compatibility
Written for: OpenAI Codex
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
What our scanner noticed· Medium risk
- Possible data-exfiltration endpoints
- Instructions that use the network
- Downloads piped into a shell
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Cloudflare
- Publisher
- OpenAI (Official)
- Distributed by
- OpenAI
- Source
- openai/plugins · plugins/cloudflare/skills/cloudflare · commit d420d13
- Licence
- Apache License 2.0 (redistribution allowed)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Cloudflare or OpenAI.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download cloudflare.zip