Skip to content

jackson2w/claude-code-skills / cloudflare-workers-cron-email

cloudflare-workers-cron-email

Verified

This skill should be used when the user asks to debug a Cloudflare Workers Cron Trigger that "isn't firing" or "not running" (or fires on the wrong day), set up or troubleshoot the send_email binding or Email Routing destination addresses for Workers, size a Worker against Cloudflare's per-invocation subrequest limits, test a scheduled() handler locally against real R2/KV/email bindings, verify an R2 delete/rename actually took effect, or rename/reorganize keys in an R2 bucket. Trigger phrases include "cron trigger not firing", "scheduled worker not running", "cron ran on the wrong day", "wrangler cron", "cron trigger debug", "send_email binding", "Workers email binding", "Email Routing destination address", "workers subrequest limit", "test-scheduled --remote", "r2 object rename", "r2 delete not working", "r2 move objects".

FileKindSize
SKILL.mdskill md12.1 KB
references/diagnosing-cron.mdmarkdown4.6 KB
references/email-binding.mdmarkdown4.4 KB
scripts/check-cron-invocations.shexecutablescript1.9 KB
scripts/check-schedule-registered.shexecutablescript586 B

scripts/check-cron-invocations.sh

View on GitHub
#!/usr/bin/env bash
# Query the GraphQL Analytics API for a Worker's actual invocation count over
# a time window — ground truth for "has this cron fired", independent of the
# unreliable wrangler tail / dashboard summary tile.
#
# Usage:
#   CLOUDFLARE_API_TOKEN=... CLOUDFLARE_ACCOUNT_ID=... \
#     ./check-cron-invocations.sh <script-name> [since-iso8601] [until-iso8601]
#
# Defaults: since = 1 hour ago, until = now.
set -euo pipefail

SCRIPT_NAME="${1:?Usage: $0 <script-name> [since] [until]}"
: "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}"
: "${CLOUDFLARE_ACCOUNT_ID:?Set CLOUDFLARE_ACCOUNT_ID}"

SINCE="${2:-$(date -u -v-1H +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%SZ)}"
UNTIL="${3:-$(date -u +%Y-%m-%dT%H:%M:%SZ)}"

echo "Window: $SINCE to $UNTIL" >&2

RESULT=$(curl -s -X POST "https://api.cloudflare.com/client/v4/graphql" \
  -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"query\": \"query { viewer { accounts(filter: {accountTag: \\\"$CLOUDFLARE_ACCOUNT_ID\\\"}) { workersInvocationsAdaptive(limit: 50, filter: {scriptName: \\\"$SCRIPT_NAME\\\", datetimeMinute_geq: \\\"$SINCE\\\", datetimeMinute_leq: \\\"$UNTIL\\\"}, orderBy: [datetimeMinute_DESC]) { dimensions { datetimeMinute } sum { requests errors } } } } }\"}")

echo "$RESULT" | python3 -c "
import json, sys
d = json.load(sys.stdin)
if d.get('errors'):
    print('GraphQL error:', d['errors'], file=sys.stderr)
    sys.exit(1)
rows = d['data']['viewer']['accounts'][0]['workersInvocationsAdaptive']
total_req = sum(r['sum']['requests'] for r in rows)
total_err = sum(r['sum']['errors'] for r in rows)
print(f'total_invocations={total_req} total_errors={total_err}')
for r in sorted(rows, key=lambda r: r['dimensions']['datetimeMinute']):
    print(f\"  {r['dimensions']['datetimeMinute']}  requests={r['sum']['requests']} errors={r['sum']['errors']}\")
"
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall