[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79D2V0YDBJ2BVWDT2KXZAZM":3,"skill-same:01M79D2V0YDBJ2BVWDT2KXZAZM":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M79D2V0YDBJ2BVWDT2KXZAZM","building-ai-agent-on-cloudflare",null,"Builds AI agents on Cloudflare using the Agents SDK with state management,\nreal-time WebSockets, scheduled tasks, tool integration, and chat capabilities.\nGenerates production-ready agent code deployed to Workers.\n\nUse when: user wants to \"build an agent\", \"AI agent\", \"chat agent\", \"stateful\nagent\", mentions \"Agents SDK\", needs \"real-time AI\", \"WebSocket AI\", or asks\nabout agent \"state management\", \"scheduled tasks\", or \"tool calling\".\nBiases towards retrieval from Cloudflare docs over pre-trained knowledge.","zfifteen\u002Fskills-catalog","zfifteen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F221906715?v=4","01M79CQFXDZM5J5CJTCECPFA66","Dionisio Alberto Lopez III","01M79CQFY4C62PN8A2T5KDAHGA",1,"MIT","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fbuilding-ai-agent-on-cloudflare\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: building-ai-agent-on-cloudflare\ndescription: |\n  Builds AI agents on Cloudflare using the Agents SDK with state management,\n  real-time WebSockets, scheduled tasks, tool integration, and chat capabilities.\n  Generates production-ready agent code deployed to Workers.\n\n  Use when: user wants to \"build an agent\", \"AI agent\", \"chat agent\", \"stateful\n  agent\", mentions \"Agents SDK\", needs \"real-time AI\", \"WebSocket AI\", or asks\n  about agent \"state management\", \"scheduled tasks\", or \"tool calling\".\n  Biases towards retrieval from Cloudflare docs over pre-trained knowledge.\n---\n\n# Building Cloudflare Agents\n\nYour knowledge of the Agents SDK may be outdated. **Prefer retrieval over pre-training** for any agent-building task.\n\n## Retrieval Sources\n\n| Source | How to retrieve | Use for |\n|--------|----------------|---------|\n| Agents SDK docs | `https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fagents\u002Ftree\u002Fmain\u002Fdocs` | SDK API, state, routing, scheduling |\n| Cloudflare Agents docs | `https:\u002F\u002Fdevelopers.cloudflare.com\u002Fagents\u002F` | Platform integration, deployment |\n| Workers docs | Search tool or `https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002F` | Runtime APIs, bindings, config |\n\n## When to Use\n\n- User wants to build an AI agent or chatbot\n- User needs stateful, real-time AI interactions\n- User asks about the Cloudflare Agents SDK\n- User wants scheduled tasks or background AI work\n- User needs WebSocket-based AI communication\n\n## Prerequisites\n\n- Cloudflare account with Workers enabled\n- Node.js 18+ and npm\u002Fpnpm\u002Fyarn\n- Wrangler CLI (`npm install -g wrangler`)\n\n## Quick Start\n\n```bash\nnpm create cloudflare@latest -- my-agent --template=cloudflare\u002Fagents-starter\ncd my-agent\nnpm start\n```\n\nAgent runs at `http:\u002F\u002Flocalhost:8787`\n\n## Core Concepts\n\n### What is an Agent?\n\nAn Agent is a stateful, persistent AI service that:\n- Maintains state across requests and reconnections\n- Communicates via WebSockets or HTTP\n- Runs on Cloudflare's edge via Durable Objects\n- Can schedule tasks and call tools\n- Scales horizontally (each user\u002Fsession gets own instance)\n\n### Agent Lifecycle\n\n```\nClient connects → Agent.onConnect() → Agent processes messages\n                                    → Agent.onMessage()\n                                    → Agent.setState() (persists + syncs)\nClient disconnects → State persists → Client reconnects → State restored\n```\n\n## Basic Agent Structure\n\n```typescript\nimport { Agent, Connection } from \"agents\";\n\ninterface Env {\n  AI: Ai;  \u002F\u002F Workers AI binding\n}\n\ninterface State {\n  messages: Array\u003C{ role: string; content: string }>;\n  preferences: Record\u003Cstring, string>;\n}\n\nexport class MyAgent extends Agent\u003CEnv, State> {\n  \u002F\u002F Initial state for new instances\n  initialState: State = {\n    messages: [],\n    preferences: {},\n  };\n\n  \u002F\u002F Called when agent starts or resumes\n  async onStart() {\n    console.log(\"Agent started with state:\", this.state);\n  }\n\n  \u002F\u002F Handle WebSocket connections\n  async onConnect(connection: Connection) {\n    connection.send(JSON.stringify({\n      type: \"welcome\",\n      history: this.state.messages,\n    }));\n  }\n\n  \u002F\u002F Handle incoming messages\n  async onMessage(connection: Connection, message: string) {\n    const data = JSON.parse(message);\n\n    if (data.type === \"chat\") {\n      await this.handleChat(connection, data.content);\n    }\n  }\n\n  \u002F\u002F Handle disconnections\n  async onClose(connection: Connection) {\n    console.log(\"Client disconnected\");\n  }\n\n  \u002F\u002F React to state changes\n  onStateUpdate(state: State, source: string) {\n    console.log(\"State updated by:\", source);\n  }\n\n  private async handleChat(connection: Connection, userMessage: string) {\n    \u002F\u002F Add user message to history\n    const messages = [\n      ...this.state.messages,\n      { role: \"user\", content: userMessage },\n    ];\n\n    \u002F\u002F Call AI\n    const response = await this.env.AI.run(\"@cf\u002Fmeta\u002Fllama-3-8b-instruct\", {\n      messages,\n    });\n\n    \u002F\u002F Update state (persists and syncs to all clients)\n    this.setState({\n      ...this.state,\n      messages: [\n        ...messages,\n        { role: \"assistant\", content: response.response },\n      ],\n    });\n\n    \u002F\u002F Send response\n    connection.send(JSON.stringify({\n      type: \"response\",\n      content: response.response,\n    }));\n  }\n}\n```\n\n## Entry Point Configuration\n\n```typescript\n\u002F\u002F src\u002Findex.ts\nimport { routeAgentRequest } from \"agents\";\nimport { MyAgent } from \".\u002Fagent\";\n\nexport default {\n  async fetch(request: Request, env: Env) {\n    \u002F\u002F routeAgentRequest handles routing to \u002Fagents\u002F:class\u002F:name\n    return (\n      (await routeAgentRequest(request, env)) ||\n      new Response(\"Not found\", { status: 404 })\n    );\n  },\n};\n\nexport { MyAgent };\n```\n\nClients connect via: `wss:\u002F\u002Fmy-agent.workers.dev\u002Fagents\u002FMyAgent\u002Fsession-id`\n\n## Wrangler Configuration\n\n```toml\nname = \"my-agent\"\nmain = \"src\u002Findex.ts\"\ncompatibility_date = \"2024-12-01\"\n\n[ai]\nbinding = \"AI\"\n\n[durable_objects]\nbindings = [{ name = \"AGENT\", class_name = \"MyAgent\" }]\n\n[[migrations]]\ntag = \"v1\"\nnew_classes = [\"MyAgent\"]\n```\n\n## State Management\n\n### Reading State\n\n```typescript\n\u002F\u002F Current state is always available\nconst currentMessages = this.state.messages;\nconst userPrefs = this.state.preferences;\n```\n\n### Updating State\n\n```typescript\n\u002F\u002F setState persists AND syncs to all connected clients\nthis.setState({\n  ...this.state,\n  messages: [...this.state.messages, newMessage],\n});\n\n\u002F\u002F Partial updates work too\nthis.setState({\n  preferences: { ...this.state.preferences, theme: \"dark\" },\n});\n```\n\n### SQL Storage\n\nFor complex queries, use the embedded SQLite database:\n\n```typescript\n\u002F\u002F Create tables\nawait this.sql`\n  CREATE TABLE IF NOT EXISTS documents (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    title TEXT NOT NULL,\n    content TEXT,\n    created_at DATETIME DEFAULT CURRENT_TIMESTAMP\n  )\n`;\n\n\u002F\u002F Insert\nawait this.sql`\n  INSERT INTO documents (title, content)\n  VALUES (${title}, ${content})\n`;\n\n\u002F\u002F Query\nconst docs = await this.sql`\n  SELECT * FROM documents WHERE title LIKE ${`%${search}%`}\n`;\n```\n\n## Scheduled Tasks\n\nAgents can schedule future work:\n\n```typescript\nasync onMessage(connection: Connection, message: string) {\n  const data = JSON.parse(message);\n\n  if (data.type === \"schedule_reminder\") {\n    \u002F\u002F Schedule task for 1 hour from now\n    const { id } = await this.schedule(3600, \"sendReminder\", {\n      message: data.reminderText,\n      userId: data.userId,\n    });\n\n    connection.send(JSON.stringify({ type: \"scheduled\", taskId: id }));\n  }\n}\n\n\u002F\u002F Called when scheduled task fires\nasync sendReminder(data: { message: string; userId: string }) {\n  \u002F\u002F Send notification, email, etc.\n  console.log(`Reminder for ${data.userId}: ${data.message}`);\n\n  \u002F\u002F Can also update state\n  this.setState({\n    ...this.state,\n    lastReminder: new Date().toISOString(),\n  });\n}\n```\n\n### Schedule Options\n\n```typescript\n\u002F\u002F Delay in seconds\nawait this.schedule(60, \"taskMethod\", { data });\n\n\u002F\u002F Specific date\nawait this.schedule(new Date(\"2025-01-01T00:00:00Z\"), \"taskMethod\", { data });\n\n\u002F\u002F Cron expression (recurring)\nawait this.schedule(\"0 9 * * *\", \"dailyTask\", {});  \u002F\u002F 9 AM daily\nawait this.schedule(\"*\u002F5 * * * *\", \"everyFiveMinutes\", {});  \u002F\u002F Every 5 min\n\n\u002F\u002F Manage schedules\nconst schedules = await this.getSchedules();\nawait this.cancelSchedule(taskId);\n```\n\n## Chat Agent (AI-Powered)\n\nFor chat-focused agents, extend `AIChatAgent`:\n\n```typescript\nimport { AIChatAgent } from \"agents\u002Fai-chat-agent\";\n\nexport class ChatBot extends AIChatAgent\u003CEnv> {\n  \u002F\u002F Called for each user message\n  async onChatMessage(message: string) {\n    const response = await this.env.AI.run(\"@cf\u002Fmeta\u002Fllama-3-8b-instruct\", {\n      messages: [\n        { role: \"system\", content: \"You are a helpful assistant.\" },\n        ...this.messages,  \u002F\u002F Automatic history management\n        { role: \"user\", content: message },\n      ],\n      stream: true,\n    });\n\n    \u002F\u002F Stream response back to client\n    return response;\n  }\n}\n```\n\nFeatures included:\n- Automatic message history\n- Resumable streaming (survives disconnects)\n- Built-in `saveMessages()` for persistence\n\n## Client Integration\n\n### React Hook\n\n```tsx\nimport { useAgent } from \"agents\u002Freact\";\n\nfunction Chat() {\n  const { state, send, connected } = useAgent({\n    agent: \"my-agent\",\n    name: userId,  \u002F\u002F Agent instance ID\n  });\n\n  const sendMessage = (text: string) => {\n    send(JSON.stringify({ type: \"chat\", content: text }));\n  };\n\n  return (\n    \u003Cdiv>\n      {state.messages.map((msg, i) => (\n        \u003Cdiv key={i}>{msg.role}: {msg.content}\u003C\u002Fdiv>\n      ))}\n      \u003Cinput onKeyDown={(e) => e.key === \"Enter\" && sendMessage(e.target.value)} \u002F>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n### Vanilla JavaScript\n\n```javascript\nconst ws = new WebSocket(\"wss:\u002F\u002Fmy-agent.workers.dev\u002Fagents\u002FMyAgent\u002Fuser123\");\n\nws.onopen = () => {\n  console.log(\"Connected to agent\");\n};\n\nws.onmessage = (event) => {\n  const data = JSON.parse(event.data);\n  console.log(\"Received:\", data);\n};\n\nws.send(JSON.stringify({ type: \"chat\", content: \"Hello!\" }));\n```\n\n## Common Patterns\n\nSee [references\u002Fagent-patterns.md](references\u002Fagent-patterns.md) for:\n- Tool calling and function execution\n- Multi-agent orchestration\n- RAG (Retrieval Augmented Generation)\n- Human-in-the-loop workflows\n\n## Deployment\n\n```bash\n# Deploy\nnpx wrangler deploy\n\n# View logs\nwrangler tail\n\n# Test endpoint\ncurl https:\u002F\u002Fmy-agent.workers.dev\u002Fagents\u002FMyAgent\u002Ftest-user\n```\n\n## Troubleshooting\n\nSee [references\u002Ftroubleshooting.md](references\u002Ftroubleshooting.md) for common issues.\n\n## References\n\n- [references\u002Fexamples.md](references\u002Fexamples.md) — Official templates and production examples\n- [references\u002Fagent-patterns.md](references\u002Fagent-patterns.md) — Advanced patterns\n- [references\u002Fstate-patterns.md](references\u002Fstate-patterns.md) — State management strategies\n- [references\u002Ftroubleshooting.md](references\u002Ftroubleshooting.md) — Error solutions\n","# Building Cloudflare Agents\n\nYour knowledge of the Agents SDK may be outdated. **Prefer retrieval over pre-training** for any agent-building task.\n\n## Retrieval Sources\n\n| Source | How to retrieve | Use for |\n|--------|----------------|---------|\n| Agents SDK docs | `https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fagents\u002Ftree\u002Fmain\u002Fdocs` | SDK API, state, routing, scheduling |\n| Cloudflare Agents docs | `https:\u002F\u002Fdevelopers.cloudflare.com\u002Fagents\u002F` | Platform integration, deployment |\n| Workers docs | Search tool or `https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002F` | Runtime APIs, bindings, config |\n\n## When to Use\n\n- User wants to build an AI agent or chatbot\n- User needs stateful, real-time AI interactions\n- User asks about the Cloudflare Agents SDK\n- User wants scheduled tasks or background AI work\n- User needs WebSocket-based AI communication\n\n## Prerequisites\n\n- Cloudflare account with Workers enabled\n- Node.js 18+ and npm\u002Fpnpm\u002Fyarn\n- Wrangler CLI (`npm install -g wrangler`)\n\n## Quick Start\n\n```bash\nnpm create cloudflare@latest -- my-agent --template=cloudflare\u002Fagents-starter\ncd my-agent\nnpm start\n```\n\nAgent runs at `http:\u002F\u002Flocalhost:8787`\n\n## Core Concepts\n\n### What is an Agent?\n\nAn Agent is a stateful, persistent AI service that:\n- Maintains state across requests and reconnections\n- Communicates via WebSockets or HTTP\n- Runs on Cloudflare's edge via Durable Objects\n- Can schedule tasks and call tools\n- Scales horizontally (each user\u002Fsession gets own instance)\n\n### Agent Lifecycle\n\n```\nClient connects → Agent.onConnect() → Agent processes messages\n                                    → Agent.onMessage()\n                                    → Agent.setState() (persists + syncs)\nClient disconnects → State persists → Client reconnects → State restored\n```\n\n## Basic Agent Structure\n\n```typescript\nimport { Agent, Connection } from \"agents\";\n\ninterface Env {\n  AI: Ai;  \u002F\u002F Workers AI binding\n}\n\ninterface State {\n  messages: Array\u003C{ role: string; content: string }>;\n  preferences: Record\u003Cstring, string>;\n}\n\nexport class MyAgent extends Agent\u003CEnv, State> {\n  \u002F\u002F Initial state for new instances\n  initialState: State = {\n    messages: [],\n    preferences: {},\n  };\n\n  \u002F\u002F Called when agent starts or resumes\n  async onStart() {\n    console.log(\"Agent started with state:\", this.state);\n  }\n\n  \u002F\u002F Handle WebSocket connections\n  async onConnect(connection: Connection) {\n    connection.send(JSON.stringify({\n      type: \"welcome\",\n      history: this.state.messages,\n    }));\n  }\n\n  \u002F\u002F Handle incoming messages\n  async onMessage(connection: Connection, message: string) {\n    const data = JSON.parse(message);\n\n    if (data.type === \"chat\") {\n      await this.handleChat(connection, data.content);\n    }\n  }\n\n  \u002F\u002F Handle disconnections\n  async onClose(connection: Connection) {\n    console.log(\"Client disconnected\");\n  }\n\n  \u002F\u002F React to state changes\n  onStateUpdate(state: State, source: string) {\n    console.log(\"State updated by:\", source);\n  }\n\n  private async handleChat(connection: Connection, userMessage: string) {\n    \u002F\u002F Add user message to history\n    const messages = [\n      ...this.state.messages,\n      { role: \"user\", content: userMessage },\n    ];\n\n    \u002F\u002F Call AI\n    const response = await this.env.AI.run(\"@cf\u002Fmeta\u002Fllama-3-8b-instruct\", {\n      messages,\n    });\n\n    \u002F\u002F Update state (persists and syncs to all clients)\n    this.setState({\n      ...this.state,\n      messages: [\n        ...messages,\n        { role: \"assistant\", content: response.response },\n      ],\n    });\n\n    \u002F\u002F Send response\n    connection.send(JSON.stringify({\n      type: \"response\",\n      content: response.response,\n    }));\n  }\n}\n```\n\n## Entry Point Configuration\n\n```typescript\n\u002F\u002F src\u002Findex.ts\nimport { routeAgentRequest } from \"agents\";\nimport { MyAgent } from \".\u002Fagent\";\n\nexport default {\n  async fetch(request: Request, env: Env) {\n    \u002F\u002F routeAgentRequest handles routing to \u002Fagents\u002F:class\u002F:name\n    return (\n      (await routeAgentRequest(request, env)) ||\n      new Response(\"Not found\", { status: 404 })\n    );\n  },\n};\n\nexport { MyAgent };\n```\n\nClients connect via: `wss:\u002F\u002Fmy-agent.workers.dev\u002Fagents\u002FMyAgent\u002Fsession-id`\n\n## Wrangler Configuration\n\n```toml\nname = \"my-agent\"\nmain = \"src\u002Findex.ts\"\ncompatibility_date = \"2024-12-01\"\n\n[ai]\nbinding = \"AI\"\n\n[durable_objects]\nbindings = [{ name = \"AGENT\", class_name = \"MyAgent\" }]\n\n[[migrations]]\ntag = \"v1\"\nnew_classes = [\"MyAgent\"]\n```\n\n## State Management\n\n### Reading State\n\n```typescript\n\u002F\u002F Current state is always available\nconst currentMessages = this.state.messages;\nconst userPrefs = this.state.preferences;\n```\n\n### Updating State\n\n```typescript\n\u002F\u002F setState persists AND syncs to all connected clients\nthis.setState({\n  ...this.state,\n  messages: [...this.state.messages, newMessage],\n});\n\n\u002F\u002F Partial updates work too\nthis.setState({\n  preferences: { ...this.state.preferences, theme: \"dark\" },\n});\n```\n\n### SQL Storage\n\nFor complex queries, use the embedded SQLite database:\n\n```typescript\n\u002F\u002F Create tables\nawait this.sql`\n  CREATE TABLE IF NOT EXISTS documents (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    title TEXT NOT NULL,\n    content TEXT,\n    created_at DATETIME DEFAULT CURRENT_TIMESTAMP\n  )\n`;\n\n\u002F\u002F Insert\nawait this.sql`\n  INSERT INTO documents (title, content)\n  VALUES (${title}, ${content})\n`;\n\n\u002F\u002F Query\nconst docs = await this.sql`\n  SELECT * FROM documents WHERE title LIKE ${`%${search}%`}\n`;\n```\n\n## Scheduled Tasks\n\nAgents can schedule future work:\n\n```typescript\nasync onMessage(connection: Connection, message: string) {\n  const data = JSON.parse(message);\n\n  if (data.type === \"schedule_reminder\") {\n    \u002F\u002F Schedule task for 1 hour from now\n    const { id } = await this.schedule(3600, \"sendReminder\", {\n      message: data.reminderText,\n      userId: data.userId,\n    });\n\n    connection.send(JSON.stringify({ type: \"scheduled\", taskId: id }));\n  }\n}\n\n\u002F\u002F Called when scheduled task fires\nasync sendReminder(data: { message: string; userId: string }) {\n  \u002F\u002F Send notification, email, etc.\n  console.log(`Reminder for ${data.userId}: ${data.message}`);\n\n  \u002F\u002F Can also update state\n  this.setState({\n    ...this.state,\n    lastReminder: new Date().toISOString(),\n  });\n}\n```\n\n### Schedule Options\n\n```typescript\n\u002F\u002F Delay in seconds\nawait this.schedule(60, \"taskMethod\", { data });\n\n\u002F\u002F Specific date\nawait this.schedule(new Date(\"2025-01-01T00:00:00Z\"), \"taskMethod\", { data });\n\n\u002F\u002F Cron expression (recurring)\nawait this.schedule(\"0 9 * * *\", \"dailyTask\", {});  \u002F\u002F 9 AM daily\nawait this.schedule(\"*\u002F5 * * * *\", \"everyFiveMinutes\", {});  \u002F\u002F Every 5 min\n\n\u002F\u002F Manage schedules\nconst schedules = await this.getSchedules();\nawait this.cancelSchedule(taskId);\n```\n\n## Chat Agent (AI-Powered)\n\nFor chat-focused agents, extend `AIChatAgent`:\n\n```typescript\nimport { AIChatAgent } from \"agents\u002Fai-chat-agent\";\n\nexport class ChatBot extends AIChatAgent\u003CEnv> {\n  \u002F\u002F Called for each user message\n  async onChatMessage(message: string) {\n    const response = await this.env.AI.run(\"@cf\u002Fmeta\u002Fllama-3-8b-instruct\", {\n      messages: [\n        { role: \"system\", content: \"You are a helpful assistant.\" },\n        ...this.messages,  \u002F\u002F Automatic history management\n        { role: \"user\", content: message },\n      ],\n      stream: true,\n    });\n\n    \u002F\u002F Stream response back to client\n    return response;\n  }\n}\n```\n\nFeatures included:\n- Automatic message history\n- Resumable streaming (survives disconnects)\n- Built-in `saveMessages()` for persistence\n\n## Client Integration\n\n### React Hook\n\n```tsx\nimport { useAgent } from \"agents\u002Freact\";\n\nfunction Chat() {\n  const { state, send, connected } = useAgent({\n    agent: \"my-agent\",\n    name: userId,  \u002F\u002F Agent instance ID\n  });\n\n  const sendMessage = (text: string) => {\n    send(JSON.stringify({ type: \"chat\", content: text }));\n  };\n\n  return (\n    \u003Cdiv>\n      {state.messages.map((msg, i) => (\n        \u003Cdiv key={i}>{msg.role}: {msg.content}\u003C\u002Fdiv>\n      ))}\n      \u003Cinput onKeyDown={(e) => e.key === \"Enter\" && sendMessage(e.target.value)} \u002F>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n### Vanilla JavaScript\n\n```javascript\nconst ws = new WebSocket(\"wss:\u002F\u002Fmy-agent.workers.dev\u002Fagents\u002FMyAgent\u002Fuser123\");\n\nws.onopen = () => {\n  console.log(\"Connected to agent\");\n};\n\nws.onmessage = (event) => {\n  const data = JSON.parse(event.data);\n  console.log(\"Received:\", data);\n};\n\nws.send(JSON.stringify({ type: \"chat\", content: \"Hello!\" }));\n```\n\n## Common Patterns\n\nSee [references\u002Fagent-patterns.md](references\u002Fagent-patterns.md) for:\n- Tool calling and function execution\n- Multi-agent orchestration\n- RAG (Retrieval Augmented Generation)\n- Human-in-the-loop workflows\n\n## Deployment\n\n```bash\n# Deploy\nnpx wrangler deploy\n\n# View logs\nwrangler tail\n\n# Test endpoint\ncurl https:\u002F\u002Fmy-agent.workers.dev\u002Fagents\u002FMyAgent\u002Ftest-user\n```\n\n## Troubleshooting\n\nSee [references\u002Ftroubleshooting.md](references\u002Ftroubleshooting.md) for common issues.\n\n## References\n\n- [references\u002Fexamples.md](references\u002Fexamples.md) — Official templates and production examples\n- [references\u002Fagent-patterns.md](references\u002Fagent-patterns.md) — Advanced patterns\n- [references\u002Fstate-patterns.md](references\u002Fstate-patterns.md) — State management strategies\n- [references\u002Ftroubleshooting.md](references\u002Ftroubleshooting.md) — Error solutions\n",{"name":5,"description":7},"main","d9535210da9af28aa76bca80de80355197e1b6d6","skills\u002Fbuilding-ai-agent-on-cloudflare","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog","https:\u002F\u002Fgithub.com\u002Fzfifteen","I like to measure things.","2026-07-19 23:41:54",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add zfifteen\u002Fskills-catalog --skill building-ai-agent-on-cloudflare",{"tool":37,"command":38},"bunx","bunx skills add zfifteen\u002Fskills-catalog --skill building-ai-agent-on-cloudflare",{"tool":40,"command":41},"pnpm","pnpm dlx skills add zfifteen\u002Fskills-catalog --skill building-ai-agent-on-cloudflare","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fbuilding-ai-agent-on-cloudflare\u002FSKILL.md",true,[45,51,55,59,63],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"agents\u002Fopenai.yaml","REFERENCE","参考文档",132,"https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fbuilding-ai-agent-on-cloudflare\u002Fagents\u002Fopenai.yaml",{"path":52,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":53,"sourceHtmlUrl":54},"references\u002Fagent-patterns.md",12349,"https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fbuilding-ai-agent-on-cloudflare\u002Freferences\u002Fagent-patterns.md",{"path":56,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002Fexamples.md",4273,"https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fbuilding-ai-agent-on-cloudflare\u002Freferences\u002Fexamples.md",{"path":60,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":61,"sourceHtmlUrl":62},"references\u002Fstate-patterns.md",8247,"https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fbuilding-ai-agent-on-cloudflare\u002Freferences\u002Fstate-patterns.md",{"path":64,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":65,"sourceHtmlUrl":66},"references\u002Ftroubleshooting.md",8032,"https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fbuilding-ai-agent-on-cloudflare\u002Freferences\u002Ftroubleshooting.md",[68,75,82,89,98,105],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M79GXQ2PWPT2E4CJYHXVJ0YE","Zotero","Use Zotero Desktop from Codex to enable\u002Fprobe the local API, search a local Zotero library, list items\u002Fcollections\u002Ftags, export BibTeX, insert citation keys into LaTeX or Markdown drafts, read indexed full text when requested, and import BibTeX\u002FRIS records into Zotero through the connector server. Use when the user mentions Zotero, citations, references.bib, BibTeX export, local Zotero API, localhost:23119, or adding citations from a Zotero library.","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fzotero\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M79GXN85NETKBE06865CWK6Z","zoom-apps-sdk","Use when using Apps SDK.","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M79GXCYD7FGYS932J9N9RFFY","youtube","Obtain accurate, timestamped YouTube video transcripts (preferring manual captions over auto-generated) as the primary deliverable, then derive summaries, key claims, or notes from that transcript.  Use when the user provides a YouTube URL (or video ID) and wants the transcript, a faithful summary, key claims with attribution, timestamped notes, or \"what does this video actually say\".  The skill is transcript-first: never substitute metadata, title, description, or search snippets for the spoken content.  Triggers: \"youtube transcript\", \"get the transcript of this video\", \"summarize this youtube video\", \"what did they say in https:\u002F\u002Fyoutube.com\u002F...\", \"key claims from this talk\".","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":93,"licenseFileUrl":94,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":19},"01M79GX8EXHHYM566BKR7MS778","yeet","Publish local changes to GitHub by confirming scope, committing intentionally, pushing the branch, and opening a draft PR through the GitHub app from this plugin, with `gh` used only as a fallback where connector coverage is insufficient.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":19},"01M79GX2HFJPX84NMRE5VBTYX9","x-post-creator","Create X-ready post threads and co-located story packages from the active conversation or referenced project material. Use when the user says turn this into an X-post, \u002Fx-post, make this into an X thread, or wants plain-language social posts with supporting images saved to docs\u002Fx-posts\u002F[story-name]\u002F.","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fx-post-creator\u002FSKILL.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":19},"01M79GWXQT4HBT6QME6QSBZJFA","x-api","Search, read, and write X posts through the local X API MCP server (the same backend used by the Codex x-api skill). Use for searching X\u002Fx.com, reading threads and replies, creating lists, staging\u002Fpublishing posts for @alltheputs, finding high-visibility reply targets for research outreach, ingesting public context, or any request that mentions \u002Fx-api or \"search X\".","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fx-api\u002FSKILL.md",[],[]]