secondsky/claude-skills / plugins/cloudflare-agents/skills/cloudflare-agents
cloudflare-agents
VerifiedBuild AI agents on Cloudflare Workers with MCP integration, tool use, and LLM providers.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 2.7 KB |
| references/advanced-features.md | markdown | 13.5 KB |
| references/agent-api.md | markdown | 2.9 KB |
| references/configuration-guide.md | markdown | 3.1 KB |
| references/error-catalog.md | markdown | 275 B |
| references/http-sse-guide.md | markdown | 2.0 KB |
| references/mcp-integration.md | markdown | 2.7 KB |
| references/patterns-concepts.md | markdown | 11.0 KB |
| references/state-management.md | markdown | 9.5 KB |
| references/websockets-guide.md | markdown | 3.0 KB |
| templates/basic-agent.ts | script | 383 B |
| templates/browser-agent.ts | script | 4.9 KB |
| templates/calling-agents-worker.ts | script | 3.7 KB |
| templates/chat-agent-streaming.ts | script | 1.5 KB |
| templates/hitl-agent.ts | script | 6.6 KB |
| templates/mcp-server-basic.ts | script | 4.0 KB |
| templates/rag-agent.ts | script | 4.8 KB |
| templates/react-useagent-client.tsx | other | 5.5 KB |
| templates/scheduled-agent.ts | script | 4.5 KB |
| templates/state-sync-agent.ts | script | 3.9 KB |
| templates/websocket-agent.ts | script | 4.1 KB |
| templates/workflow-agent.ts | script | 3.8 KB |
| templates/wrangler-agents-config.jsonc | other | 1.9 KB |
templates/workflow-agent.ts
View on GitHub// Agent that triggers Cloudflare Workflows
import { Agent } from "agents";
import { WorkflowEntrypoint, WorkflowEvent, WorkflowStep } from "cloudflare:workers";
interface Env {
MY_WORKFLOW: Workflow;
MyAgent: AgentNamespace<MyAgent>;
}
interface WorkflowState {
workflowsTriggered: number;
activeWorkflows: string[];
}
export class WorkflowAgent extends Agent<Env, WorkflowState> {
initialState: WorkflowState = {
workflowsTriggered: 0,
activeWorkflows: []
};
async onRequest(request: Request): Promise<Response> {
const url = new URL(request.url);
// POST /workflow/trigger - Trigger workflow immediately
if (url.pathname === "/workflow/trigger") {
const { userId, data } = await request.json();
const instance = await this.env.MY_WORKFLOW.create({
id: `workflow-${userId}-${Date.now()}`,
params: { userId, ...data }
});
this.setState({
...this.state,
workflowsTriggered: this.state.workflowsTriggered + 1,
activeWorkflows: [...this.state.activeWorkflows, instance.id]
});
return Response.json({
workflowId: instance.id,
status: 'triggered'
});
}
// POST /workflow/schedule - Schedule workflow for later
if (url.pathname === "/workflow/schedule") {
const { delaySeconds, data } = await request.json();
// Schedule a task that will trigger the workflow
const { id: taskId } = await this.schedule(
delaySeconds,
"triggerWorkflow",
data
);
return Response.json({
scheduledTaskId: taskId,
runsIn: delaySeconds
});
}
// POST /workflow/status - Check workflow status
if (url.pathname === "/workflow/status") {
const { workflowId } = await request.json();
// Note: Workflow status checking depends on your Workflow implementation
// See Cloudflare Workflows docs for details
return Response.json({
workflowId,
message: 'Status checking not implemented (see Workflows docs)'
});
}
return new Response("Not Found", { status: 404 });
}
// Triggered by scheduled task
async triggerWorkflow(data: any) {
const instance = await this.env.MY_WORKFLOW.create({
id: `delayed-workflow-${Date.now()}`,
params: data
});
this.setState({
...this.state,
workflowsTriggered: this.state.workflowsTriggered + 1,
activeWorkflows: [...this.state.activeWorkflows, instance.id]
});
// Schedule another task to check workflow status
await this.schedule("*/5 * * * *", "checkWorkflowStatus", {
workflowId: instance.id
});
console.log('Workflow triggered:', instance.id);
}
// Check workflow status periodically
async checkWorkflowStatus(data: { workflowId: string }) {
console.log('Checking workflow status:', data.workflowId);
// Implement status checking logic here
// If workflow completed, cancel this recurring task
}
}
// Example Workflow definition (can be in same or different file/project)
export class MyWorkflow extends WorkflowEntrypoint<Env> {
async run(event: WorkflowEvent<{ userId: string; data: any }>, step: WorkflowStep) {
// Step 1: Process data
const processed = await step.do('process-data', async () => {
console.log('Processing data for user:', event.payload.userId);
return { processed: true, userId: event.payload.userId };
});
// Step 2: Send notification
await step.do('send-notification', async () => {
console.log('Sending notification to:', processed.userId);
// Send email, push notification, etc.
});
// Step 3: Update records
await step.do('update-records', async () => {
console.log('Updating records');
// Update database, etc.
});
return { success: true, steps: 3 };
}
}
export default WorkflowAgent;
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |