Skip to content
Development
Command

/workflow-setup

Interactive wizard for complete Cloudflare Workflows setup from scratch. Use when user wants to create first workflow, setup workflow infrastructure, or add workflows to existing Worker project.

From plugin
secondsky-claude-skills
20466 skills46 agents66 commands
Install
$ npx -y skills add secondsky/claude-skills --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/workflow-setup

Context preview

What this command does when you run it.

Interactive wizard for complete Cloudflare Workflows setup from scratch. Use when user wants to create first workflow, setup workflow infrastructure, or add workflows to existing Worker project.

Command definition

workflow-setup.md
name: cloudflare-workflows:setup
description: Interactive wizard for complete Cloudflare Workflows setup from scratch. Use when user wants to create first workflow, setup workflow infrastructure, or add workflows to existing Worker project.

Workflow Setup Wizard

Overview

Complete interactive setup wizard for Cloudflare Workflows: project initialization, configuration, class scaffolding, and deployment preparation.

Prerequisites

Check before starting:

  • Cloudflare account with wrangler authenticated (`wrangler whoami`)
  • Node.js/Bun installed
  • Existing Worker project OR willingness to create one
  • Write access to wrangler.jsonc

Steps

Step 1: Project Detection

Check if this is a new or existing project:

# Check for wrangler.jsonc
if [ -f "wrangler.jsonc" ]; then
  EXISTING_PROJECT=true
else
  EXISTING_PROJECT=false
fi

# Check for package.json
if [ -f "package.json" ]; then
  HAS_PACKAGE_JSON=true
else
  HAS_PACKAGE_JSON=false
fi

**If new project** (`$EXISTING_PROJECT == false`):

Use AskUserQuestion:

  • **Question**: "No Worker project detected. Create new project?"
  • **Options**:
  • "Yes - Create new Worker project" → Run `npm create cloudflare@latest`
  • "No - I'll set up manually" → Exit with setup instructions

**If existing project**: Continue to Step 2

---

Step 2: Gather Workflow Requirements

Use AskUserQuestion to collect setup preferences.

**Question 1: Workflow Name**

  • **Header**: "Workflow Name"
  • **Question**: "What should your workflow be named?"
  • **multiSelect**: false
  • **Options**:
  • **label**: "Custom name (I'll type it)"
  • **description**: "Enter a unique workflow name (e.g., order-processing, user-onboarding)"

**Capture input**: Ask user to provide workflow name

  • **Validation**: Must be lowercase, alphanumeric + hyphens only (`^[a-z0-9-]+$`)
  • **Store as**: `workflowName`
  • **Generate**: `className` = PascalCase version (e.g., "order-processing" → "OrderProcessing")

---

**Question 2: Workflow Purpose**

  • **Header**: "Workflow Type"
  • **Question**: "What type of workflow are you building?"
  • **multiSelect**: false
  • **Options**:
  • **label**: "Sequential Processing"
  • **description**: "Multi-step data processing with automatic retries"
  • **label**: "Scheduled Tasks"
  • **description**: "Workflows with delays and scheduled execution"
  • **label**: "Event-Driven"
  • **description**: "Wait for external events or approvals"
  • **label**: "Approval Flow"
  • **description**: "Human-in-the-loop approval with escalation"
  • **label**: "Data Pipeline"
  • **description**: "Process large datasets in batches over time"

**Store as**: `workflowType`

---

**Question 3: Expected Duration**

  • **Header**: "Duration"
  • **Question**: "How long will your workflow typically run?"
  • **multiSelect**: false
  • **Options**:
  • **label**: "Minutes (< 1 hour)"
  • **description**: "Short-running workflows with quick execution"
  • **label**: "Hours (1-24 hours)"
  • **description**: "Medium-duration workflows with scheduling"
  • **label**: "Days (> 24 hours)"
  • **description**: "Long-running workflows with extensive delays"

**Store as**: `expectedDuration`

---

**Question 4: External Integrations**

  • **Header**: "Integrations"
  • **Question**: "Will your workflow integrate with external services?"
  • **multiSelect**: true (user can select multiple)
  • **Options**:
  • **label**: "HTTP APIs"
  • **description**: "Call external REST/GraphQL APIs"
  • **label**: "D1 Database"
  • **description**: "Query and update D1 database"
  • **label**: "KV Storage"
  • **description**: "Read/write to KV namespace"
  • **label**: "R2 Storage"
  • **description**: "Store/retrieve files from R2"
  • **label**: "Queues"
  • **description**: "Send/receive messages via Queues"

**Store as**: `integrations` (array)

---

**Question 5: Error Handling Strategy**

  • **Header**: "Error Handling"
  • **Question**: "How should failures be handled?"
  • **multiSelect**: false
  • **Options**:
  • **label**: "Automatic Retry (Recommended)"
  • **description**: "Retry failed steps with exponential backoff"
  • **label**: "Fail Fast"
  • **description**: "Stop workflow immediately on any error"
  • **label**: "Custom Retry Logic"
  • **description**: "I'll implement specific retry strategies per step"

**Store as**: `errorStrategy`

---

Step 3: Create Workflow Class

Generate WorkflowEntrypoint class based on user inputs.

**File Location**: `src/workflows/${workflowName}.ts`

**Template Selection**:

  • If `workflowType == "Sequential Processing"` → Use basic sequential template
  • If `workflowType == "Scheduled Tasks"` → Use scheduled workflow template
  • If `workflowType == "Event-Driven"` → Use event-driven template
  • If `workflowType == "Approval Flow"` → Use approval flow template
  • If `workflowType == "Data Pipeline"` → Use batch processing template

**Generate Class**:

/**
 * ${className} Workflow
 * Type: ${workflowType}
 * Expected Duration: ${expectedDuration}
 * Generated: ${currentDate}
 */

import { WorkflowEntrypoint, WorkflowStep, WorkflowEvent } from 'cloudflare:workers';
import { NonRetryableError } from 'cloudflare:workflows';

// Define environment bindings
type Env = {
  ${workflowName.toUpperCase()}_WORKFLOW: Workflow;
  ${generateEnvBindings(integrations)}
};

// Define workflow parameters
type Params = {
  id: string;
  // Add your parameters here
};

/**
 * ${className} Workflow
 *
 * ${generateWorkflowDescription(workflowType)}
 */
export class ${className} extends WorkflowEntrypoint<Env, Params> {
  async run(event: WorkflowEvent<Params>, step: WorkflowStep) {
    const { id } = event.payload;

    console.log('Workflow started:', {
      instanceId: event.instanceId,
      params: event.payload
    });

    ${generateStepScaffolding(workflowType, errorStrategy)}

    return {
      status: 'complete',
      id,
      completedAt: new Date().toISOString()
    };
  }
}

**Helper Function Logic**:

`g

Read more
Ships withsecondsky-claude-skills

142 production-ready skills for Claude Code CLI 🔌 Platform / Harness Support These plugins ship as Claude Code marketplace plugins (.claude-plugin/ manifests) and Codex CLI plugins (.codex-plugin/ manifests).

Get the whole plugin, auto-invoked
Stats
204
Stars
0
Views
30
Forks
Active
Maintenance
TypeScript
Language
MIT
License
24m ago
Last commit
9mo ago
Created

Repo: secondsky/claude-skills