Cloudflare Skill for OpenCode

repository·main·Indexed 20 days ago

https://github.com/dmmulroy/cloudflare-skill

A comprehensive reference documentation skill for OpenCode providing technical context for the Cloudflare platform. It includes guidance on the Cloudflare Agents SDK for building stateful AI agents, Cloudflare AI Gateway for proxying and analytics, AI Search for managed RAG pipelines, and the Workers Analytics Engine for high-cardinality time-series data. The skill provides API references, configuration details for wrangler.toml, and usage patterns to assist AI agents in performing Cloudflare-related tasks.

Tokens
488.1K
Snippets
1.5K
Records
2.1K
Agent score
72%

What's inside cloudflare-skill

  1. Overview of Cloudflare RealtimeKit

    main

    Cloudflare RealtimeKit is an SDK suite built on top of Realtime SFU. It abstracts WebRTC complexity to provide fast integration for real-time video and audio applications. It includes pre-built UI components and supports production features like recording, transcription, chat, and polls.

    Use cases:

    • Team meetings
    • Webinars
    • Social video
    • Audio calls
    • Interactive plugins
  2. Overview of Cloudflare Bot Management

    main

    Cloudflare Bot Management provides multi-tier protection against automated traffic using machine learning, heuristics, bot scores, and JavaScript detections. Protection levels depend on your Cloudflare plan:

    • Free (Bot Fight Mode): Automatic blocking of definite bots with no user configuration.
    • Pro/Business (Super Bot Fight Mode): Configurable actions, protection for static resources, and analytics groupings.
    • Enterprise (Bot Management): Granular bot scores (1-99), WAF integration, JA3/JA4 fingerprinting, Workers API access, and Advanced Analytics.
  3. What is Cloudflare Workers Analytics Engine?

    main

    Cloudflare Workers Analytics Engine is a time-series analytics database designed for high-cardinality data, meaning it can handle millions of unique dimensions (like user IDs or API keys) without performance degradation. It is optimized for writing data points directly from Cloudflare Workers and querying them via a SQL API.

    Common Use Cases:

    • Custom user-facing analytics dashboards
    • Usage-based billing and metering
    • Per-customer or per-feature monitoring
    • High-frequency instrumentation without impacting Worker performance
  4. Overview of Cloudflare TURN Service

    main

    Cloudflare TURN (Traversal Using Relays around NAT) is a managed relay service designed for WebRTC applications. It facilitates communication between WebRTC clients and SFUs (Selective Forwarding Units) when direct peer-to-peer connections are blocked by NATs or firewalls. The service leverages Cloudflare's global anycast network across 310+ cities to connect clients to the nearest available location.

    Key Characteristics:

    • Anycast Architecture: Automatically routes clients to the closest Cloudflare location.
    • Global Network: Available across the Cloudflare network (excluding China Network).
    • Zero Configuration: No manual region or server selection required.
    • Protocol Support: Supports STUN/TURN over UDP, TCP, and TLS.
    • Pricing: Free when used with Cloudflare Calls SFU; otherwise, it costs $0.05/GB outbound.
  5. Overview of Cloudflare Durable Objects Storage

    main

    Cloudflare Durable Objects (DO) Storage provides persistent storage for Durable Objects. It supports two primary backends: SQLite-backed (recommended) and KV-backed (legacy).

    Key features include:

    • SQL API: Full SQLite support with extensions like FTS5, JSON, and math.
    • KV APIs: Both synchronous (ctx.storage.kv) and asynchronous (ctx.storage) key-value access.
    • Concurrency Control: Automatic input/output gates to ensure race-free operations.
    • Data Protection: 30-day point-in-time recovery (PITR).
    • Lifecycle & Consistency: Support for transactions and alarms.

    Common Use Cases:

    • Stateful coordination
    • Real-time collaboration
    • Counters
    • Sessions
    • Rate limiters
  6. Overview of Cloudflare Cache Reserve

    main

    Cloudflare Cache Reserve is a persistent, large-scale cache storage layer built on R2. It serves as an upper-tier cache that stores cacheable content for extended periods (default 30+ days) to maximize cache hits, reduce origin egress fees, and protect origins from repeated requests for long-tail content.

    Cache Hierarchy

    Content flows through the following layers:

    1. Visitor Request
    2. Lower-Tier Cache (closest to visitor)
    3. Upper-Tier Cache (closest to origin)
    4. Cache Reserve (R2 persistent storage)
    5. Origin Server (final fallback)

    How It Works

    • On cache miss: Content is fetched from the origin and written to both Cache Reserve and edge caches simultaneously.
    • On edge eviction: Content may be removed from the edge cache but remains stored in Cache Reserve.
    • On subsequent request: If the edge cache misses but Cache Reserve hits, the content is restored to the edge caches.
    • Retention: Assets remain in Cache Reserve for 30 days since their last access (configurable via TTL).
  7. Overview of Cloudflare Agents SDK

    main

    The Cloudflare Agents SDK is designed for building stateful, globally distributed AI agents hosted on Durable Objects. It provides built-in support for persistent memory, real-time WebSocket connections, scheduled tasks, async workflows, and SQL integration.

    When to use this SDK:

    • When your agent requires persistent state or memory.
    • When you need real-time WebSocket connections.
    • For long-running workflows (lasting minutes or hours).
    • For building chat interfaces with AI models.
    • For scheduled or recurring tasks that maintain state.
    • When you need to perform DB queries using the agent's internal state.
  8. Overview of Cloudflare Argo Smart Routing

    main

    Argo Smart Routing is a performance optimization service that detects real-time network issues (congestion, outages, packet loss) and routes web traffic across the most efficient network paths within Cloudflare's 300+ data centers. It provides automatic failover (typically <1s) without requiring changes to your origin server.

    Note on Smart Shield: Argo Smart Routing is being integrated into Cloudflare's Smart Shield product for enhanced DDoS protection and performance. Existing Argo customers will undergo a gradual migration to Smart Shield features.

  9. Overview of Cloudflare Network Interconnect (CNI)

    main

    Cloudflare Network Interconnect (CNI) provides private, high-performance connectivity to Cloudflare's network. This is an Enterprise-only service.

    Connection Types

    • Direct: Physical fiber in a shared datacenter (10/100 Gbps). Requires ordering a cross-connect.
    • Partner: Virtual connectivity via partner SDN providers such as Console Connect, Equinix, or Megaport.
    • Cloud: Connectivity via AWS Direct Connect or GCP Cloud Interconnect (available for Magic WAN only).

    Dataplane Versions

    • v1 (Classic): Supports GRE tunnels, VLAN/BFD/LACP, asymmetric MTU (1500↓/1476↑), and peering support.
    • v2 (Beta): No GRE support, 1500 MTU in both directions, no VLAN/BFD/LACP (uses ECMP instead).
  10. Overview of Cloudflare API Shield reference documentation

    main

    The API Shield reference is organized into four main areas:

    • configuration.md: Covers setup, session identifiers, rules, and configurations for tokens and mTLS.
    • api.md: Covers endpoint management, discovery, validation APIs, and GraphQL operations.
    • patterns.md: Covers common implementation patterns, progressive rollout strategies, OWASP mappings, and security workflows.
    • gotchas.md: Covers troubleshooting, handling false positives, performance considerations, and best practices.
  11. Overview of Cloudflare Observability products

    main

    The Cloudflare Observability Skill covers the following core products:

    Workers Logs

    • Description: Console output from Workers (console.log/warn/error).
    • Access: Dashboard (Real-time Logs), Logpush, Tail Workers.
    • Cost: Free (included with all Workers).
    • Retention: Real-time only (no historical storage in dashboard).

    Workers Traces

    • Description: Execution traces including timing, CPU usage, and outcome.
    • Access: Dashboard (Workers Analytics $\rightarrow$ Traces), Logpush.
    • Cost: $0.10/1M spans (GA pricing starts March 1, 2026); 10M free/month.
    • Retention: 14 days included.

    Analytics Engine

    • Description: High-cardinality event storage and SQL queries.
    • Access: SQL API, Dashboard (Analytics $\rightarrow$ Analytics Engine).
    • Cost: $0.25/1M writes beyond 10M free/month.
    • Retention: 90 days (configurable up to 1 year).

    Tail Workers

    • Description: Workers that receive logs/traces from other Workers.
    • Use Cases: Log filtering, transformation, external export.
    • Cost: Standard Workers pricing.

    Logpush

    • Description: Stream logs to external storage (S3, R2, Datadog, etc.).
    • Access: Dashboard, API.
    • Cost: Requires Business/Enterprise plan.