cloudflare-agents

cloudflare-agents is a skill for Claude Code from secondsky/claude-skills. It costs 24 tokens per session (674 once invoked), scanned A, original, MIT.

A guide to building AI agents that run on Cloudflare Workers, Cloudflare’s serverless platform. It covers connecting language models to tools, MCP services, and Cloudflare storage.

In plain words
What is it for?
Use it to build agents with tools, OpenAI, Anthropic, or Gemini models, MCP support, and Cloudflare services such as D1, KV, R2, and Durable Objects.
Why use it?
It helps you understand how to connect an AI model to actions and data while running the agent on Cloudflare’s platform.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the cloudflare-agents plugin — 1 skill shipped together

Good fit Use it to build agents with tools, OpenAI, Anthropic, or Gemini models, MCP support, and Cloudflare services such as D1, KV, R2, and Durable Objects.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/secondsky/claude-skills/cloudflare-agents
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add secondsky/claude-skills --skill cloudflare-agents
Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills

Made for: Claude Code.

Or install cloudflare-agents, the plugin that ships this one along with the rest of its 1 skill.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cloudflare-agents

README.md
[![agentmods](https://agentmods.dev/badge/skills/secondsky/claude-skills/cloudflare-agents.svg)](https://agentmods.dev/skills/secondsky/claude-skills/cloudflare-agents)
Your own site
<a href="https://agentmods.dev/skills/secondsky/claude-skills/cloudflare-agents"><img src="https://agentmods.dev/badge/skills/secondsky/claude-skills/cloudflare-agents.svg" alt="Measured on agentmods" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 674 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00024 $0.00674
Opus 5 $0.00012 $0.00337
Sonnet 5 $0.00005 $0.00135
Haiku 4.5 $0.00002 $0.00067

Measured 4d ago against content hash 3e73ecc57a89, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

cloudflare-agents scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

The scan reads SKILL.md. This mod also ships 11 executable files (templates/basic-agent.ts, templates/browser-agent.ts, templates/calling-agents-worker.ts, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

async fetch(request, env, ctx) {
plugins/cloudflare-agents/skills/cloudflare-agents/SKILL.md · 85 lines

How it starts

The opening of the file, as written. The whole thing — 85 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Cloudflare Agents

Last Updated: 2025-11-21

Quick Start

export default {
  async fetch(request, env, ctx) {
    const agent = {
      tools: [
        { name: 'getTodo', handler: async ({id}) => ({id, title: 'Task'}) }
      ],
      async run(input) {
        return await processWithLLM(input, this.tools);
      }
    };
    
    return Response.json(await agent.run(await request.text()));
  }
};

Core Features

  • Tool Integration: Register and execute tools
  • LLM Providers: OpenAI, Anthropic, Google Gemini
  • MCP Protocol: Model Context Protocol support
  • Cloudflare Bindings: D1, KV, R2, Durable Objects

Agent Pattern

const agent = {
  tools: [...],
  systemPrompt: 'You are a helpful assistant',
  model: 'gpt-4o',
  async run(input) {
    // Process with LLM
  }
};

Resources

Core Documentation

  • references/patterns-concepts.md (317 lines) - What is Cloudflare Agents, patterns & concepts, critical rules, known issues prevention
  • references/configuration-guide.md (152 lines) - Complete configuration deep dive
  • references/agent-api.md (115 lines) - Complete Agent Class API reference

Integration Guides

  • references/http-sse-guide.md (74 lines) - HTTP & Server-Sent Events
  • references/websockets-guide.md (110 lines) - WebSocket integration
  • references/state-management.md (388 lines) - State management, scheduled tasks, workflows
  • references/mcp-integration.md (130 lines) - Model Context Protocol integration

Advanced Features

  • references/advanced-features.md (637 lines) - Browser automation, RAG, AI model integration, calling agents, client APIs

Error Reference

  • references/error-catalog.md (10 lines) - Common errors and solutions

Templates

  • templates/basic-agent.ts - Basic agent setup
  • templates/browser-agent.ts - Browser automation
  • templates/calling-agents-worker.ts - Calling other agents
  • templates/chat-agent-streaming.ts - Streaming chat agent
  • templates/hitl-agent.ts - Human-in-the-loop
  • templates/mcp-server-basic.ts - MCP server integration
  • templates/rag-agent.ts - RAG implementation
  • templates/react-useagent-client.tsx - React client integration
  • templates/scheduled-agent.ts - Scheduled tasks
  • templates/state-sync-agent.ts - State synchronization
  • templates/websocket-agent.ts - WebSocket agent
  • templates/workflow-agent.ts - Workflows integration
  • templates/wrangler-agents-config.jsonc - Wrangler configuration

Read the full file on GitHub · 85 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 85 lines · 24 tokens per session scan A 3e73ecc57a89

Subscribe to this mod's changes

cloudflare-agents is a skill published in the GitHub repository secondsky/claude-skills (215 stars, last pushed today), licensed MIT. It adds 24 tokens to every session and 674 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.