Skip to content
Development
Command

/workflow-test

Test workflow instances locally and remotely with validation and metrics. Use when user wants to test workflow execution, validate behavior, or measure performance.

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-test

Context preview

What this command does when you run it.

Test workflow instances locally and remotely with validation and metrics. Use when user wants to test workflow execution, validate behavior, or measure performance.

Command definition

workflow-test.md
name: cloudflare-workflows:test
description: Test workflow instances locally and remotely with validation and metrics. Use when user wants to test workflow execution, validate behavior, or measure performance.

Workflow Test

Overview

Interactive testing for Cloudflare Workflows with execution monitoring and validation.

Prerequisites

  • wrangler CLI authenticated
  • Workflow deployed (for remote testing)
  • Worker running locally (for local testing)

Steps

Step 1: Select Workflow

Use AskUserQuestion:

**Question**: "Which workflow would you like to test?"

  • **Header**: "Workflow"
  • **Question**: "Select workflow to test"
  • **multiSelect**: false
  • **Options**:
  • **label**: "List available workflows"
  • **description**: "Show workflows from wrangler.jsonc"
  • **label**: "Enter workflow name"
  • **description**: "Type workflow name manually"

**If "List available workflows"**:

# Parse wrangler.jsonc
grep -A 3 "workflows" wrangler.jsonc | grep "name"

Display list, ask user to select

---

Step 2: Choose Test Type

Use AskUserQuestion:

**Question**: "How would you like to test?"

  • **Header**: "Test Type"
  • **Question**: "Choose testing environment"
  • **multiSelect**: false
  • **Options**:
  • **label**: "Local Testing (Recommended)"
  • **description**: "Test with wrangler dev (fast, safe)"
  • **label**: "Remote Testing"
  • **description**: "Test deployed workflow (production)"
  • **label**: "Both"
  • **description**: "Local first, then remote"

**Store as**: `testType`

---

Step 3: Configure Test Parameters

Use AskUserQuestion:

**Question**: "Provide test parameters"

  • **Header**: "Parameters"
  • **Question**: "Enter workflow parameters as JSON"
  • **multiSelect**: false
  • **Options**:
  • **label**: "Use default test data"
  • **description**: "Simple test with id: 'test-123'"
  • **label**: "Custom JSON"
  • **description**: "I'll provide specific test data"

**If "Custom JSON"**:

  • Ask user to input JSON string
  • Validate JSON syntax
  • **Store as**: `testParams`

**If "Use default"**:

{
  "id": "test-123",
  "timestamp": "${currentTimestamp}"
}

---

Step 4: Run Local Test (if selected)

**Start dev server**:

# Start wrangler dev in background
wrangler dev &
DEV_PID=$!

# Wait for startup
sleep 3

**Create instance**:

# Trigger workflow via HTTP endpoint
curl -X POST "http://localhost:8787" \
  -H "Content-Type: application/json" \
  -d '${testParams}'

**Capture response**:

  • Instance ID
  • Initial status
  • Timestamp

**Monitor execution**:

# Poll for completion
while true; do
  STATUS=$(curl -s "http://localhost:8787?instanceId=${instanceId}")
  echo "Status: ${STATUS}"

  if [[ "${STATUS}" == *"complete"* ]]; then
    break
  fi

  sleep 2
done

**Display results**:

Local Test Results:
- Instance ID: ${instanceId}
- Status: ${finalStatus}
- Duration: ${duration}s
- Result: ${result}

**Stop dev server**:

kill $DEV_PID

---

Step 5: Run Remote Test (if selected)

**Create instance via deployed Worker**:

# Get Worker URL from wrangler
WORKER_URL=$(wrangler deployments list --name ${workerName} | grep "https://" | head -n 1)

# Create instance
curl -X POST "${WORKER_URL}" \
  -H "Content-Type: application/json" \
  -d '${testParams}'

**Monitor with wrangler**:

# Get instance ID from response
INSTANCE_ID=$(echo "${response}" | jq -r '.id')

# Describe instance
wrangler workflows instances describe ${workflowName} ${INSTANCE_ID}

**Poll for completion**:

MAX_ATTEMPTS=30
ATTEMPT=0

while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
  STATUS=$(wrangler workflows instances describe ${workflowName} ${INSTANCE_ID} | grep "Status:")

  echo "Attempt $((ATTEMPT+1))/$MAX_ATTEMPTS: ${STATUS}"

  if [[ "${STATUS}" == *"complete"* ]]; then
    break
  fi

  sleep 2
  ((ATTEMPT++))
done

**Display results**:

Remote Test Results:
- Instance ID: ${INSTANCE_ID}
- Status: ${finalStatus}
- Duration: ${duration}s
- Steps Completed: ${stepsCompleted}
- Result: ${result}

---

Step 6: Validate Results

Check test outcomes:

**Validation Checks**:

  • ✅ Instance created successfully
  • ✅ All steps completed
  • ✅ No errors in execution
  • ✅ Expected output received
  • ✅ Duration within acceptable range

**If validation fails**:

⚠️  Test Validation Issues:

${validationErrors}

Recommendations:
1. Check error logs: wrangler tail ${workerName}
2. Debug instance: /workflow-debug ${workflowName} ${instanceId}
3. Review workflow logic

---

Step 7: Performance Metrics

Calculate and display metrics:

Performance Metrics:
- Total Duration: ${totalDuration}s
- Steps Executed: ${stepsExecuted}
- Average Step Time: ${avgStepTime}s
- Retry Count: ${retryCount}
- Estimated Cost: $${estimatedCost}

Cost Breakdown:
- Requests: ${requestCount} × $0.15/million = $${requestCost}
- Duration: ${durationGBS} GB-s × $0.02/million = $${durationCost}
- Total: $${totalCost}

**Recommendations** (based on metrics):

  • If duration >5 min: Consider breaking into smaller steps
  • If retry count >5: Improve error handling
  • If cost >$0.001: Optimize with step.sleep() (free)

---

Step 8: Summary & Next Steps

Test Summary:
- Workflow: ${workflowName}
- Test Type: ${testType}
- Status: ${passOrFail}
- Duration: ${totalDuration}s
- Cost: $${totalCost}

${testType == "Both" ? `
Comparison:
- Local: ${localDuration}s
- Remote: ${remoteDuration}s
- Difference: ${Math.abs(localDuration - remoteDuration)}s
` : ''}

Next Steps:
${status == "pass" ? `
✅ Test passed! Ready for deployment.
1. Deploy: wrangler deploy
2. Monitor: wrangler workflows instances list ${workflowName}
3. Set up alerts for production
` : `
❌ Test failed. Debug needed.
1. Review error logs
2. Use /workflow-debug for diagnosis
3. Fix issues and re-test
`}

Commands:
- Re-test: /workflow-test
- Debug: /workflow-debug
- Benchmark: ./scripts/benchmark-workflow.sh ${workflowName} 10

---

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
25m ago
Last commit
9mo ago
Created

Repo: secondsky/claude-skills