Cloudflare Cron Trigger Review: Twice, Late, Never
Recommended
Reviews the scheduled() handler of a Cloudflare Worker that dispatches jobs every minute, and its watchdog, for runs that happen twice, at the wrong minute, late or not at all. Finds a Cron Trigger event that arrives twice with the same scheduledTime and no claim before the outward action, a claim keyed from Date.now() instead of scheduledTime, Math.floor on a scheduledTime that arrives about 2 seconds early so everything runs a minute late, a daily job that needs one exact minute to fire, a catch-up that is unbounded or has no claim, a watchdog threshold shorter than the real gaps, and a Durable Object alarm that re-arms after its work or holds it outside waitUntil. Gives the fix in code for each finding and ends a review with VERDICT: OK or VERDICT: CHANGE; a symptom question gets the cause first. Use when asked to review a Cloudflare cron scheduler, or why scheduled jobs ran twice, a minute late or were skipped.
Cloudflare Cron Trigger Review: Twice, Late, Never is a SKILL.md that reviews the scheduled() handler of a Cloudflare Worker that dispatches jobs every minute, and its watchdog, for runs that happen twice, at the wrong minute, late or not at all; an agent buys it once for $0.05 over x402.
Failing job calls, retries, D1 errors or crashes, and the day-of-week numbering of cron expressions: other reviews cover those. It cannot read a live account or a log, so real gaps between wake-ups must come from the person. Cloudflare gives no delivery guarantee, and the figures in it were measured on one scheduler Worker in October 2026.
Tested, honestly
Tested 2026-11-22 with a strong and a weak model.
With and without the skill
Results with and without the skill, for Sonnet and Haiku
Sonnet
Haiku
with
without
with
without
Setups answered right (12 setups)
Setups answered right (12 setups)
12/12
7/12
9/12
4/12
Same request and checks on both sides. Sonnet without the skill knew that a minute can come twice and needs a claim, caught the key from Date.now(), kept the catch-up and answered OK on four of five sound twins. It missed three measured facts: scheduledTime comes about 2 seconds early (it approved a plain Math.floor, and for jobs at :58 blamed delivery); minutes get skipped (it said 0 7 * * * runs at 07:00 and passed a 2-minute watchdog); and waitUntil holds a Durable Object (it said waitUntil does nothing there and asked to await the work in alarm()). Haiku without the skill missed the first two too, set the watchdog to 4 minutes, and called four sound twins a change over D1 errors or a crash the request had put out of scope. With the skill Haiku still flagged two sound twins.
Same cases and the same checks with and without the skill. The cases are ours, written around what the skill is for; with a handful of cases, a difference of one or two is within noise.
SonnetStrong model, claude-sonnet-5-5
Right on all 12 setups on the 1.0.1 bytes, read by hand. It put a claim on each minute and job ahead of the call in the hub that had none, replaced Math.floor on scheduledTime with rounding and explained that a 02:00 job matched only on the next event, and traced jobs that started at :58 past their minute to that same floor. It keyed the claim of the two-clock hub from the minute the event stands for instead of Date.now(), moved the 07:00 digest onto a trigger that fires each minute inside a send window that ends, and raised a 2-minute watchdog threshold above the gaps between wake-ups, with consecutive checks. For catch-up lines in the log it said the hub works and the catch-up must stay. It answered VERDICT: OK on all five sound setups: the hub with claim and catch-up, a floor taken after adding 30 seconds, two clocks with one claim and one catch-up, the digest window and a 15-minute threshold.
HaikuWeak model, claude-haiku-5-5
Right on 9 of 12 on the 1.0.1 bytes, read by hand. It named the missing claim, the floor on an early scheduledTime in the review and in the symptom, the claim key taken from Date.now(), the daily job that a skipped minute loses, the tight watchdog, and it told the person to keep the catch-up. It answered OK on two sound setups (the digest window and the 15-minute threshold) but missed three: on the hub with a claim and catch-up and on the two clocks with one claim it raised failure handling (a D1 error, a pulse that moves past a failed claim) that the request had put out of scope, and on the floor taken after adding 30 seconds it raised a job enabled inside the catch-up window.
Our own test text, before and after the skill ran. Excerpts only.
English · claude-sonnet-5-5
Before
Before I deploy our job hub: one Cron Trigger ("* * * * *" in wrangler.jsonc) calls the code below every minute; the
jobs (about 20) and their cron expressions live in D1. fire() posts to the job URL and logs the status; failed calls
show up in our log and we rerun those by hand.
// src/index.ts
// D1: jobs(id, name, cron, url, enabled) · meta(key TEXT PRIMARY KEY, value INTEGER)…
After
**[NO-CLAIM]** in `runJob()` / `fire()`: nothing claims a (minute, job) pair before `fire()` posts to the job URL.
Cloudflare can deliver the same minute twice, and the second copy carries the same `scheduledTime` 1 to 2 minutes later. The pulse is written only at the end of `tick()`, after up to 30 s of calls.…
What is in the file
What was measured (on our scheduler Worker)
What to check, in this order
1. Claim before the outward action
2. The claim key comes from `scheduledTime`
3. Rounding the minute
4. A job must not need one exact minute to fire
5. Catch-up: bounded, and under the same claim
6. The watchdog threshold
7. A Durable Object alarm as the second clock
Answer format
Not a finding
What not to do
Languages
Any language. Tried in: English.
License
Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing. Holder: Georgi Kalchev, aiskills402.com. Full terms.
Versions
Current version 1.0.1, updated 2026-11-22. Whoever bought an earlier version gets new ones free through the same re-download token.
v1.0.1 · 2026-11-22
Fact fixed: the file had said that Cloudflare's documentation promises best effort. Re-read on 22 November 2026, the page has no such words; it says that triggers run on underutilized machines and that runs can be missed while a change propagates. The opening line, a rule at the end and the listing now say that the documentation gives no delivery guarantee. Two other sentences reworded with the same meaning, so that no published post on our blog shares a run of five words with the file. One check widened for both sides. The side with the skill was run again in full, one run per model and setup: Sonnet 12 of 12, Haiku 9 of 12. Without the skill, re-scored: 7 and 4 of 12, unchanged.
v1.0.0 · 2026-11-22
- First version. - Before publishing, after the first run with the skill: the watchdog section now ties the threshold to the silence between wake-ups only. Events that arrive tens of minutes after their minute no longer argue for a longer threshold, and a pulse stored after calls with a short timeout is no longer a finding. With the old wording Sonnet flagged a sound 15-minute threshold that it had passed without the skill. - Before publishing: the section on a second clock now says that an alarm next to the cron does not make the catch-up unnecessary, since each clock only handles the minute it woke in. - Test: the sound two-clock case had no catch-up, so a minute lost by both clocks was really lost; both models with the skill said so. It now has a bounded catch-up from a shared pulse and is run again on both sides. - Test: the check for the claim-key cause also accepts "both claims succeed" for the two copies of one minute (a bare Haiku answer named the right cause in those words). Widened for both sides. - Test: the same check also accepts a backtick before the variable name ("gets a later `slot`"). Haiku with the skill named the right cause that way. Widened for both sides; test/control.mjs now checks that wording too. - Measured on 22 November 2026 on this text, one run per model and setup, 12 setups (5 reviews with a planted fault, 5 sound twins, 2 symptom questions): Claude Sonnet 12 of 12 with the skill, 7 of 12 without; Claude Haiku 10 of 12 with, 4 of 12 without. Sonnet's gain is five setups on three distinct facts: the early scheduledTime and the floor (a review and a symptom), skipped minutes (a daily trigger and a 2-minute watchdog), and waitUntil inside a Durable Object (a sound two-clock hub it wanted changed). - Price $0.05 (50000 micro): Sonnet gained five setups, on three distinct facts it did not know. - After the run, for the catalog's safety gate: the three code examples are indented blocks instead of fenced ones. The words and the code are otherwise unchanged. - Skill side re-run in full on the final bytes, 22 November 2026: Sonnet 12 of 12, Haiku 9 of 12.
FAQ
Scheduler review: what comes back?
Only what must change in a scheduled handler, each item tagged with a short code, its location, its cause and its fix. Nine codes cover a missing claim, a claim key taken from the clock, a minute computed with a plain floor, a job that needs one exact minute, a missing or unbounded catch-up, a watchdog threshold below the real gaps, and a Durable Object alarm that re-arms late or awaits its work. Safe look-alikes are listed apart. The last line is a verdict, OK or CHANGE.
Can one cron minute really run a job twice?
On our scheduler Worker, yes. On 12 October 2026 each minute brought two events, the second one to two minutes after the first, both stamped with the same minute. Two articles and a duplicate social post went out. The cure is a claim on the minute and the task, written with ON CONFLICT DO NOTHING before the action, keyed from the event's own time and never from the current clock.
Why did every job start about a minute late?
The event time arrived about two seconds before the minute, and flooring it gave the minute before. The job was then matched to the wrong minute and started late by a minute. Rounding to the nearest minute removed it. The same measurements showed skipped minutes, gaps up to eight minutes and some wake-ups twenty to forty-seven minutes late, so the skill also asks for a bounded catch-up.
Does it help Claude Sonnet?
Clearly, through three facts from our own measurements. The test: twelve job hubs on an every-minute trigger, five with a planted timing fault, five sound twins, two symptom questions. On its own Sonnet answered 7 correctly; given the skill, all 12. It already caught a missing claim and a claim keyed from Date.now(). It did not know that the event time comes two seconds early, so it approved Math.floor; that minutes get skipped, so a 07:00-only digest and a 2-minute watchdog looked fine; or that waitUntil keeps a Durable Object running. Haiku rose from 4 correct to 9.
One minute can be delivered twice, a little early, or never. How to write a scheduled() handler so that each job still runs once and on the minute it was due.
Durable Objects bill wall-clock time in memory, not the work done. The timers, sockets and undeleted objects that keep the meter running, and the fixes.
Reviews the description, configuration or code of an agent loop, anything that repeats on its own: a scheduled job that calls a model, an agent that retries until it is done, a batch of actions, a self-improving prompt loop. It finds where the loop runs away or repeats a side effect (no ceiling on iterations, the same scheduled tick delivered twice, a progress marker written after the effect, nothing kept between iterations, a batch that goes on after a refusal that will repeat for every item), where it judges its own work (the model says it is finished), where it acts beyond its brief (a token or tool set wider than the job, a delete, publish or mass send with no approval step) and where a dead source looks healthy (an empty reply counted as success, parallel workers writing one shared file). Each finding has a fixed code, the place, the reason and a fix, then one verdict. Use for an agent loop review, to find out why a cron job runs twice, to check a retry until done loop, or to catch a runaway agent loop before it runs unattended.
Turns a schedule described in words into cron expressions for Cloudflare Workers Cron Triggers, answered as JSON with the crons and a note. Knows where Cloudflare differs from classic cron, measured on a live Worker - day-of-week 1 is Sunday, so 1-5 runs Sunday to Thursday and 7 is Saturday, while 0 and ? are rejected; times are UTC only. Writes day names instead of numbers, uses L, LW, W and # for last and n-th days, splits intervals that do not divide an hour or a day (every 45 or 90 minutes) into several crons, ends a range on its stated last run, and handles a local time with daylight saving by firing at both UTC hours and checking the local hour in the handler. Use when asked to write, check or fix a cron expression, a Cron Trigger in wrangler, or a scheduled job, or to convert a schedule in words or in another time zone into cron.
Reviews pasted Cloudflare Workers code and configuration (a Worker, a Next.js app on OpenNext, D1 queries, wrangler config) for platform pitfalls that pass every local test and then fail in production or quietly cost money. It flags the edge runtime under OpenNext, a fetch to your own Worker's workers.dev address (error 1042), D1 queries that bind more than 100 parameters as data grows, LIKE patterns over D1's 50-byte limit, reading rowsAffected where D1 returns meta.changes, interactive transactions D1 does not have, secrets kept in plain vars, outbound fetch code that treats only a thrown error as failure, a browser User-Agent that bot protection challenges, client hop-by-hop headers forwarded to fetch, cron triggers whose day of the week is written as numbers, and unbounded queries on the request path. Each finding has a fixed code, the place, the reason and a fix, then one verdict. Use to review a Cloudflare Worker before deploy, check D1 or wrangler code, or audit a Next.js app running on Cloudflare.
Reviews Cloudflare Durable Object code, wrangler config and a Durable Objects bill for what costs money. Finds an object kept awake and billed for wall-clock time it does not need (a pending timer, AbortSignal.timeout that is never cleared, even inside a helper, setInterval instead of an alarm, WebSockets that cannot hibernate, work held by waitUntil), objects and SQL storage that pile up because nobody deletes them (an object per visitor or per MCP session, McpAgent probes), and bills that cross the included amount by a few percent and are charged a whole started unit. Explains how the bill is computed: GB-seconds at 128 MB, one allowance for the whole account, rounding up. Gives the fix in code for each finding and ends a review with VERDICT: OK or VERDICT: CHANGE. Use when asked to review Durable Object code or config for cost, or why a Durable Objects bill is higher than the work done.
Computes the real contrast ratio of every text and background pair in pasted CSS, design tokens or a palette, says whether each pair passes WCAG AA and AAA, and gives every failing pair a replacement color that passes on its real background. It carries a table of 256 channel values so the ratio is added and divided instead of guessed, and it reads the cases a glance gets wrong: a rgba color or opacity is blended with its background first, a placeholder is text, 18px bold is not large text, a border or an icon is a 3:1 component, a disabled control and a logo are exempt, short hex and color names are expanded, and 4.48 is never rounded up to 4.5. One line per pair, then a Verdict line. Use when asked for a WCAG color contrast check of a stylesheet, theme or palette, whether colors pass AA or AAA, or to fix text colors that are too pale.
Safe Refactoring: Refactor Without Changing Behavior
Code & Engineering
SKILL.md · v1.0.1 · 9.7 KB
Refactors, cleans up and modernizes Python, JavaScript, TypeScript and React code without changing what it does. It guards the change that cleanups make most often without saying so - how the code treats missing and empty values - and ends each answer with a short Behavior section that names what was checked and anything that changed. Use when asked to refactor, clean up, tidy, simplify or modernize a function, class, component or file.
Reviews pasted application code, scripts and config for the four ways a secret leaks from the code that uses it, and lists only those, one line each with a fixed code, the place, who can then read the secret and the fix - or exactly No findings. It catches a secret value written to a log or printed (the key itself, an object or environment dump that contains it), a secret placed in a URL query string, a secret typed into source or a committed file, and a server secret sent to the browser through a public environment prefix or a prop of a client component. It leaves out the safe look-alikes: printing only that a key is present, its length or its last four characters, a publishable key that is public by design, and a secret read from the environment on the server. Use to review code that calls an API with a key, to check a Next.js or Vite project before release, or to gate a pull request that touches credentials.