secondsky/claude-skills / plugins/cloudflare-workflows/skills/cloudflare-workflows
cloudflare-workflows
VerifiedCloudflare Workflows for durable long-running execution. Use for multi-step workflows, retries, state persistence, or encountering NonRetryableError, execution failed errors.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 16.5 KB |
| references/2025-features.md | markdown | 7.9 KB |
| references/common-issues.md | markdown | 9.9 KB |
| references/limits-quotas.md | markdown | 8.7 KB |
| references/metrics-analytics.md | markdown | 11.7 KB |
| references/production-checklist.md | markdown | 11.8 KB |
| references/troubleshooting.md | markdown | 15.1 KB |
| references/workflow-patterns.md | markdown | 15.2 KB |
| references/wrangler-commands.md | markdown | 6.6 KB |
| templates/basic-workflow.ts | script | 3.4 KB |
| templates/circuit-breaker-workflow.ts | script | 12.6 KB |
| templates/parallel-execution-workflow.ts | script | 8.6 KB |
| templates/scheduled-workflow.ts | script | 7.2 KB |
| templates/worker-trigger.ts | script | 6.6 KB |
| templates/workflow-with-events.ts | script | 9.2 KB |
| templates/workflow-with-retries.ts | script | 6.2 KB |
| templates/wrangler-workflows-config.jsonc | other | 3.8 KB |
templates/basic-workflow.ts
View on GitHub/**
* Basic Cloudflare Workflow Example
*
* Demonstrates:
* - WorkflowEntrypoint class
* - step.do() for executing work
* - step.sleep() for delays
* - Accessing environment bindings
* - Returning state from workflow
*/
import { WorkflowEntrypoint, WorkflowStep, WorkflowEvent } from 'cloudflare:workers';
// Define environment bindings
type Env = {
MY_WORKFLOW: Workflow;
// Add your bindings here:
// MY_KV: KVNamespace;
// DB: D1Database;
// MY_BUCKET: R2Bucket;
};
// Define workflow parameters
type Params = {
userId: string;
email: string;
};
/**
* Basic Workflow
*
* Three-step workflow that:
* 1. Fetches user data
* 2. Processes user data
* 3. Sends notification
*/
export class BasicWorkflow extends WorkflowEntrypoint<Env, Params> {
async run(event: WorkflowEvent<Params>, step: WorkflowStep) {
// Access parameters from event.payload
const { userId, email } = event.payload;
console.log(`Starting workflow for user ${userId}`);
// Step 1: Fetch user data
const userData = await step.do('fetch user data', async () => {
// Example: Fetch from external API
const response = await fetch(`https://api.example.com/users/${userId}`);
const data = await response.json();
return {
id: data.id,
name: data.name,
email: data.email,
preferences: data.preferences
};
});
console.log(`Fetched user: ${userData.name}`);
// Step 2: Process user data
const processedData = await step.do('process user data', async () => {
// Example: Perform some computation
return {
userId: userData.id,
processedAt: new Date().toISOString(),
status: 'processed'
};
});
// Step 3: Wait before sending notification
await step.sleep('wait before notification', '5 minutes');
// Step 4: Send notification
await step.do('send notification', async () => {
// Example: Send email or push notification
await fetch('https://api.example.com/notifications', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
to: email,
subject: 'Processing Complete',
body: `Your data has been processed at ${processedData.processedAt}`
})
});
return { sent: true, timestamp: Date.now() };
});
// Return final state (must be serializable)
return {
userId,
status: 'complete',
processedAt: processedData.processedAt
};
}
}
/**
* Worker that triggers the workflow
*/
export default {
async fetch(req: Request, env: Env): Promise<Response> {
const url = new URL(req.url);
// Handle favicon
if (url.pathname.startsWith('/favicon')) {
return Response.json({}, { status: 404 });
}
// Get instance status if ID provided
const instanceId = url.searchParams.get('instanceId');
if (instanceId) {
const instance = await env.MY_WORKFLOW.get(instanceId);
const status = await instance.status();
return Response.json({
id: instanceId,
status
});
}
// Create new workflow instance
const instance = await env.MY_WORKFLOW.create({
params: {
userId: '123',
email: 'user@example.com'
}
});
return Response.json({
id: instance.id,
details: await instance.status(),
statusUrl: `${url.origin}?instanceId=${instance.id}`
});
}
};
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |