Skip to main content
skill CX Codex

cloudflare-agents — Claude Code skill: AI agents on Cloudflare Workers

A skill for building AI agents on Cloudflare Workers with tools, MCP and LLM providers. Useful when the agent runs inside a worker.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add secondsky/claude-skills --skill cloudflare-agents -a claude-code
Open on GitHub

What cloudflare-agents does

The skill hands your coding agent reference material and templates for Cloudflare Agents. It covers patterns and concepts, configuration, the Agent class API, MCP integration, HTTP and Server-Sent Events, WebSockets, state management, scheduled tasks and workflows. A separate file goes into browser automation, RAG, calling other agents and client APIs. There is also an error catalog with fixes.

Thirteen templates ship with it: basic agent, browser agent, streaming chat, human-in-the-loop, MCP server, RAG, scheduled tasks, state sync, WebSocket, workflows, calling other agents, a React client and a wrangler config. Cloudflare bindings named in the docs are D1, KV, R2 and Durable Objects; LLM providers are OpenAI, Anthropic and Google Gemini. The model is set as a string on the agent object, gpt-4o in the example.

Everything assumes TypeScript and workers, so if you have not touched wrangler or bindings before, expect a slow start. Check that the bindings you need are declared in the worker config, otherwise the agent gets no storage.

What it helps with

  • scaffold an agent on Cloudflare Workers
  • wire an MCP server into a worker
  • build a streaming chat agent over SSE or WebSocket
  • connect an agent to D1, KV, R2 or Durable Objects
  • add RAG or browser automation to an agent

Example prompts for the agent

  • Scaffold a basic Cloudflare Workers agent from the skill template
  • Add MCP integration and tools to my agent
  • Build a streaming chat agent with state sync

How to install cloudflare-agents

1Skills CLI (Vercel)

npx skills add secondsky/claude-skills --skill cloudflare-agents -a claude-code

2Manually: put the files in place

~/.claude/skills/cloudflare-agents/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/cloudflare-agents/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about cloudflare-agents

How do I install cloudflare-agents in Claude?

Run npx skills add secondsky/claude-skills --skill cloudflare-agents -a claude-code. The skill file lands at ~/.claude/skills/cloudflare-agents/SKILL.md.

What does cloudflare-agents do?

It helps you write AI agents on Cloudflare Workers: tool registration, MCP support, LLM providers and Cloudflare bindings. References, templates and an error catalog are included.

Which LLM providers are supported?

The skill names OpenAI, Anthropic and Google Gemini. The model is set on the agent object, gpt-4o in the example.

Source text

SKILL.md · MIT
---
name: cloudflare-agents
description: Build AI agents on Cloudflare Workers with MCP integration, tool use, and LLM providers.
license: MIT
---

# Cloudflare Agents

**Last Updated**: 2025-11-21

## Quick Start

```typescript
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

```typescript
const agent = {
  tools: [...],
  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

**Official Docs**: https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-agents/

© secondsky · MIT · secondsky/claude-skills

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set89

bun-nuxt A skill that tells the agent how to run Nuxt 3 on Bun: scripts, Nitro preset, server routes and deployment. Useful when you want off Node. CX Codex +1 387installs multi-ai-consultant A skill that pulls in outside AIs when Claude is stuck on a bug or weighing an architecture call. Their answers get merged into one review. CX Codex +1 384installs graphql-implementation A skill for building GraphQL APIs: schema, resolvers, error codes and N+1 protection. Useful when moving off REST or adding real-time subscriptions. CX Codex +1 380installs model-deployment A skill for getting a trained model into production: FastAPI server, Docker, Kubernetes, monitoring and drift detection. Useful once the model works and serving does not. CX Codex +1 379installs cloudflare-mcp-server A skill for building MCP servers on Cloudflare Workers: tools, resources, prompts and transport choices. Useful when you write your own server for an AI agent. CX Codex +1 375installs thesys-generative-ui A skill that teaches your agent to build React components from plain-language prompts with the Thesys SDK. Handy when you want a UI sketched out from a description. CX Codex +1 371installs maz-ui This skill teaches your agent Maz-UI v4: 50+ components, composables and directives for Vue 3 and Nuxt 3. Handy when you build forms, dialogs or data tables. CX Codex +1 369installs woocommerce-dev-cycle A skill that walks you through the WooCommerce dev cycle: run tests, fix code style, sort out linting errors. CX Codex +1 361installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor