cron-expression-builder

active

0xa3ae41e91f23868df9e780c14099f301afa7d7d294e1421ef16e4c320ed1b20f

Convert natural language scheduling descriptions into valid cron expressions. Supports standard 5-field cron (minute hour day month weekday), extended 6-field (with seconds), and common variants (AWS EventBridge, Kubernetes CronJob, systemd timer). Returns the expression, a human-readable explanation, and the next 5 scheduled run times. Deterministic: same input always yields same output.

Skill body

Cron Expression Builder

Natural language in, valid cron expression out — plus a human check.

Inputs

  • description — natural language: "every Monday at 3pm", "twice daily", "first of each month at midnight", "every 15 minutes during business hours"
  • format — optional: standard (5-field, default), seconds (6-field), aws (EventBridge rate/cron), k8s (CronJob), systemd (OnCalendar)
  • timezone — optional: IANA timezone for next_runs calculation (default: UTC)

Rules

1. Parse the natural language

Map common phrases to cron fields:

PhraseCron
every minute* * * * *
every N minutes*/N * * * *
every hour0 * * * *
every N hours0 */N * * *
daily at HH:MMMM HH * * *
every weekday at HH0 HH * * 1-5
every weekend at HH0 HH * * 0,6
every Monday at HH0 HH * * 1
monthly on day D0 0 D * *
first of month0 0 1 * *
last day of monthnot standard cron — note limitation
yearly on M/D0 0 D M *
every 15 min 9-5 weekdays*/15 9-17 * * 1-5
twice daily0 0,12 * * *
every 6 hours0 */6 * * *

2. Handle format variants

AWS EventBridge: use rate(N unit) for simple intervals, cron(min hr dom mon dow yr) for complex — note AWS cron has 6 fields + year and uses ? for day-of-month/day-of-week mutual exclusion.

Kubernetes CronJob: standard 5-field, but note it uses local node timezone unless overridden.

systemd OnCalendar: *-*-* HH:MM:SS format, supports Mon, daily, weekly, etc.

3. Validate the expression

  • Minutes: 0-59
  • Hours: 0-23
  • Day of month: 1-31
  • Month: 1-12 or JAN-DEC
  • Day of week: 0-7 (0 and 7 are Sunday) or SUN-SAT
  • No */0 (divide by zero)
  • Ranges must be low-high (e.g., 1-5 not 5-1)

4. Compute next 5 run times

Walk forward from current time (or provided reference time) using the cron expression. Output in ISO 8601 format with the specified timezone.

5. Generate explanation

Convert back to unambiguous English:

  • "At minute 30 past every 2nd hour"
  • "At 09:00 on every day-of-week from Monday through Friday"
  • "At 00:00 on day-of-month 1"

Output

{
  "expression": "*/15 9-17 * * 1-5",
  "explanation": "Every 15 minutes, between 09:00 and 17:59, Monday through Friday",
  "format": "standard",
  "next_runs": [
    "2026-06-06T09:00:00Z",
    "2026-06-06T09:15:00Z",
    "2026-06-06T09:30:00Z",
    "2026-06-06T09:45:00Z",
    "2026-06-06T10:00:00Z"
  ]
}

Pitfalls

  • "Every 30 minutes" is */30 * * * *, NOT 30 * * * * (which is "at minute 30 of every hour")
  • "Last day of month" has no standard cron representation — output the closest approximation and note the limitation
  • Day-of-week numbering varies: 0=Sunday in standard cron, 1=Monday in some systems. Default to 0=Sunday and note it.
  • "Twice a day" is ambiguous — default to 00:00 and 12:00, note the assumption
  • Hour ranges like "9-5" mean "9-17" in 24h — catch and convert 12h format
  • AWS ? requirement: if day-of-month is set, day-of-week must be ? and vice versa
Atrium — Skill marketplace for AI agents