> cloudflare-agents
Build AI agents on Cloudflare Workers with MCP integration, tool use, and LLM providers.
curl "https://skillshub.wtf/secondsky/claude-skills/cloudflare-agents?format=md"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 preventionreferences/configuration-guide.md(152 lines) - Complete configuration deep divereferences/agent-api.md(115 lines) - Complete Agent Class API reference
Integration Guides
references/http-sse-guide.md(74 lines) - HTTP & Server-Sent Eventsreferences/websockets-guide.md(110 lines) - WebSocket integrationreferences/state-management.md(388 lines) - State management, scheduled tasks, workflowsreferences/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 setuptemplates/browser-agent.ts- Browser automationtemplates/calling-agents-worker.ts- Calling other agentstemplates/chat-agent-streaming.ts- Streaming chat agenttemplates/hitl-agent.ts- Human-in-the-looptemplates/mcp-server-basic.ts- MCP server integrationtemplates/rag-agent.ts- RAG implementationtemplates/react-useagent-client.tsx- React client integrationtemplates/scheduled-agent.ts- Scheduled taskstemplates/state-sync-agent.ts- State synchronizationtemplates/websocket-agent.ts- WebSocket agenttemplates/workflow-agent.ts- Workflows integrationtemplates/wrangler-agents-config.jsonc- Wrangler configuration
Official Docs: https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-agents/
> related_skills --same-repo
> zustand-state-management
--- name: zustand-state-management description: Zustand state management for React with TypeScript. Use for global state, Redux/Context API migration, localStorage persistence, slices pattern, devtools, Next.js SSR, or encountering hydration errors, TypeScript inference issues, persist middleware problems, infinite render loops. Keywords: zustand, state management, React state, TypeScript state, persist middleware, devtools, slices pattern, global state, React hooks, create store, useBoundS
> zod
TypeScript-first schema validation and type inference. Use for validating API requests/responses, form data, env vars, configs, defining type-safe schemas with runtime validation, transforming data, generating JSON Schema for OpenAPI/AI, or encountering missing validation errors, type inference issues, validation error handling problems. Zero dependencies (2kb gzipped).
> xss-prevention
--- name: xss-prevention description: XSS attack prevention with input sanitization, output encoding, Content Security Policy. Use for user-generated content, rich text editors, web application security, or encountering stored XSS, reflected XSS, DOM manipulation, script injection errors. Keywords: sanitization, HTML-encoding, DOMPurify, CSP, Content-Security-Policy, rich-text-editor, user-input, escaping, innerHTML, DOM-manipulation, stored-XSS, reflected-XSS, input-validation, output-encodi
> wordpress-plugin-core
--- name: wordpress-plugin-core description: WordPress plugin development with hooks, security, REST API, custom post types. Use for plugin creation, $wpdb queries, Settings API, or encountering SQL injection, XSS, CSRF, nonce errors. Keywords: wordpress plugin development, wordpress security, wordpress hooks, wordpress filters, wordpress database, wpdb prepare, sanitize_text_field, esc_html, wp_nonce, custom post type, register_post_type, settings api, rest api, admin-ajax, wordpress sql inj