← All skills
Active October 2026

Day's Almanac

An Alexa skill that tells you each day's name-day saint, sunrise and sunset, the moon phase, a historical fact and a joke — all precomputed, with no live calls to external services.

Invocation: “Alexa, apri almanacco del giorno”

TypeScriptCloudflare WorkersPythonAlexaFlash Briefing

The idea

A small daily digest to hear in the morning: whose name-day it is, what time the sun rises and sets, what phase the moon is in, what happened on this day in history, and a joke to start the day. The natural channel is Alexa’s Flash Briefing — what you hear saying “Alexa, good morning” — paired with an on-demand skill to ask for it by voice whenever you like.

Cloudflare-first, precomputed content

No server running around the clock: a scheduled Worker runs every night, composes the day’s almanac and writes it to a small key-value store. A second Worker just serves that ready-made content whenever Alexa (or anyone else) asks for it. The constraint driving all of this is that Amazon’s Flash Briefing API has no user context: it’s a static file, the same for everyone, that Alexa polls roughly every 15 minutes — so it has to always be “correct for today,” with the date recalculated in the Italian time zone.

Expected running cost: zero — everything comfortably fits Cloudflare Workers’ free tier.

The Flash Briefing API’s hidden constraints

The format Alexa accepts has precise rules, found by reading the documentation (and verifying them): the text is plain text only — no SSML, HTML or markup — so reading “prosody” comes only from punctuation, writing dates and numbers the way they’d be spoken aloud (“in 1940,” not “1940”). The total text can’t exceed 4,500 characters, and items older than 7 days are ignored, so the item’s uid and date have to be regenerated every day — writing the content once isn’t enough.

Sunrise, sunset and the moon: computed locally

Sun and moon data isn’t pulled from an external service — it’s computed locally, with a simplified solar equation and a truncated lunar algorithm, for a fixed, configurable location. Getting these calculations to a reliable precision took a little validation work: a Julian Day bug (it must be passed as an integer referenced to noon, not midnight) swapped sunrise and sunset by half a day, and computing day length by subtracting local times instead of UTC ones was off by an hour on daylight-saving change days. Checked against a reference astronomy library over a full year: average error of about a minute on sunrise/sunset, within one percentage point on the moon’s illumination.

Curating 366 days of data, not just generating them

Saints, name-days and historical facts start from a public dataset (Italian Wikipedia), but generating the files isn’t enough — it needs a line-by-line check. A manual spot-check across all 366 days found six real bugs an automated test wouldn’t have caught — for example “San Marino” (the country) mistaken for a saint because of the “San” prefix, collective words like “Apostles” or “Maccabees” mistaken for proper names, and ancient Roman festivals sharing a word with modern Christian ones (“Feast of Minerva” confused with Christmas). The jokes, on the other hand, come from a hand-curated dataset — no text generated on the fly — with deterministic rotation so they don’t repeat.

From code to a real skill

Testing locally isn’t enough: creating the actual custom skill, the console had mistakenly provisioned a Python runtime instead of the intended Node.js one — found and fixed by recreating it from scratch before publishing any code. Once live, two more details only surfaced with the real skill: the runtime didn’t have fetch available by default, and Alexa sometimes returns a spoken name entirely lowercase (“vincenzo” instead of “Vincenzo”), so it needs re-capitalizing before it’s used in a reply.

Observability

An automatic check posts to Telegram if the nightly build fails or comes out degraded, with deduplication so the same alert doesn’t fire twice in one day. Verified end-to-end: the bot was created, the connection tested with a real message, and a forced “clean” build confirmed the alert stays quiet when everything’s fine.

The first real production incident

The day after the observability deploy, the first real Telegram alert arrived: “Today’s almanac degraded — Wikipedia unavailable.” Not a test — an actual outage, though a transient one (the endpoint came back up on its own a few minutes later). The response was to add an automatic second attempt 15 minutes after the main build: if the day is already fine it does nothing, otherwise it rebuilds from scratch and, if Wikipedia is back by then, refreshes the content without firing a redundant second alert.

Rolling out that second attempt surfaced a non-obvious limit of Cloudflare’s free tier: 5 cron triggers per account, total — not per Worker. Registering 4 separate times for just this one Worker made the deploy fail halfway (code uploaded, triggers not). The fix is a single cron entry using list syntax (10,25 1,4 * * *, four fire times in one line) instead of four separate entries — with the side effect that the handler can no longer tell the main build apart from the retry by the cron pattern it received, and reads the exact trigger time instead.

The jokes, take two

The first dataset of 132 jokes, written by me, got a blunt verdict: “terrible, not funny.” Replaced with 141 jokes from Italian oral tradition — classic one-liners, riddles, doctor’s-office and waiter sketches — told in my own words but approved one by one, over several rounds, to a specific taste: classic back-and-forth jokes yes, nothing poking fun at deaf or frail elderly people. Changing the ids avoided collisions with the history already written to the store: with 141 entries instead of 132, a four-year simulation confirms no joke repeats before 141 days.

Status

Every planned phase — dataset, live feed, on-demand skill, self-healing observability — is complete, deployed and verified, with a first real incident already weathered without manual intervention. Both skills, Flash Briefing and custom, were submitted for Amazon certification on 2026-09-27 and were published on the Alexa Store on 6 October 2026, with distribution limited to Italy. The project is done: the feed and API content changes without recertification, since the Worker serves it, while a change to the voice skill’s code would need a new certification. Phase 3 (MP3 audio, a dedicated web page) remains optional and unplanned. The same API that powers the skill also runs the small “Day’s Almanac” widget on this site’s home page, now working smoothly after opening up the API for browser reads (CORS).

Stack

TypeScript (Cloudflare Workers, KV) · Python (dataset generation and validation) · Alexa Flash Briefing API · Alexa Skills Kit