By the end of this page you will have a schedule you can defend: the right expression, the right time zone, a lock so two runs never overlap, and a log line you can search at 2 a.m. These seven Claude prompts for cron jobs cover each of those steps in a few lines of text. Run them in order on a new job, or jump to the one that matches the thing that just broke.
Quick checklist
- — The expression is tested against a real calendar, not just eyeballed.
- — The server time zone is written next to the job.
- — Long jobs cannot start a second copy of themselves.
- — Failures leave a log line with an exit code.
- — Nothing important runs only on the first day of the month.
- — A human gets notified when the job fails twice in a row.
The prompts
1. Expression from a plain sentence
Give me the cron expression for this schedule: [plain English schedule]. Assume the server runs in [time zone] and explain each field.
What it does: Converts a sentence like “every weekday morning” into five fields you can paste.
How to use: Replace [plain English schedule] and [time zone]; check the day-of-week numbering your cron dialect expects.
2. Read an existing expression out loud
Explain this cron expression in plain English: [cron expression]. Tell me when it runs next and name one schedule it is easy to confuse with.
What it does: Turns a string nobody wants to parse into a sentence you can verify.
How to use: Replace [cron expression]; do this before you edit a job you inherited.
3. Time zone and daylight saving check
My job runs at [cron expression] on a server set to [server time zone]. I need it to fire at [local time] in [target time zone]. What breaks at a daylight saving change, and how do I fix it?
What it does: Surfaces the twice-a-year failure that silently shifts a job by an hour.
How to use: Replace the four bracketed values; if the answer is “use a scheduler with time zone support”, take it.
4. Overlap guard
Write a shell wrapper that prevents my [job name] cron job from starting if the previous run is still going. Use a lock file and explain what happens when the process crashes.
What it does: Stops a slow run from stacking copies of itself until the box falls over.
How to use: Replace [job name]; test it by starting the job twice by hand.
5. Logging and alerting wrapper
Write a cron wrapper for [command] that logs start time, end time, duration, and exit code to [log file], and sends an alert to [alert channel] on failure.
What it does: Leaves a trail you can actually read when something fails overnight.
How to use: Replace [command], [log file], and [alert channel]; rotate the log so it does not fill the disk.
6. Retry and backoff policy
My job calls [external service] and sometimes fails on a temporary error. Design a retry policy with backoff and a cap, and tell me which errors should not be retried.
What it does: Separates “try again” from “stop and page someone”.
How to use: Replace [external service]; keep the retry window shorter than the gap between runs.
7. Move it off cron
I have a cron job that [job purpose]. Rewrite the same schedule as a [systemd timer or queue job] and list what I gain and lose by switching.
What it does: Shows whether the old tool is still the right one before you debug it again.
How to use: Replace [job purpose] and pick one target; migrate the smallest job first.
How to score your own output
- You can say out loud when the job runs next, in local time, without opening a calculator.
- Kill the job mid-run and nothing else breaks.
- Read the log after a failure and you know which step failed and why.
Keep going
- Browse the Coding prompt library
- Claude prompts for web scraping
- Gemini prompts for ORM queries
- ChatGPT prompts for conditional formatting
Want more like this? Browse the full free library at GuPrompt.