cron-doctor
Fungsinya
Memeriksa apakah kode penjadwalan (disebut 'cron expression') sudah benar dan tidak akan menimbulkan masalah yang tidak diinginkan. Alat ini menghindari kesalahan umum yang membuat tugas tidak pernah berjalan atau berjalan lebih sering dari yang seharusnya.
Kapan dipakai
- βSaat menulis atau meninjau kode yang menjadwalkan tugas.
- βSaat tugas terjadwal tidak berjalan sebagaimana mestinya.
- βUntuk memahami kapan sebuah tugas terjadwal akan berjalan.
Link skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/cron-doctor/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βPeriksa cron expression ini: 0 0 30 2 *β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Alat ini menganalisis kode penjadwalan, memeriksa apakah tanggalnya memungkinkan (misalnya, Februari tidak punya tanggal 30), dan apakah logika 'OR' bisa membuat tugas berjalan terlalu sering. Setelah itu, alat ini menampilkan kapan tugas tersebut akan berjalan.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
cron-doctor
Overview
Cron is deceptively error-prone. The failure mode is silent β a syntactically
valid expression that simply never fires, or fires far more often than intended.
0 0 30 2 * parses cleanly and then sits dead forever (February has no 30th).
0 0 1,15 * 1 looks like "1st and 15th if Monday" but actually means "1st, 15th,
OR every Monday" β ~6 fires/month instead of ~2.
This skill teaches an agent to catch those before they reach production. It comes
with a zero-dependency validation engine (scripts/cron-engine.js, no install
needed) that parses, describes, deep-validates, and computes next fire times.
When to Use This Skill
- Use when a user writes, edits, reviews, or deploys a cron expression β in a
crontab, a Kubernetes
CronJob, a GitHub Actionsschedule, an Airflow DAG, a Celery beat schedule, a systemd timer, or any scheduled task. - Use when debugging a job that "didn't fire" or "fired at the wrong time."
- Use when a user asks "what does this cron expression mean?" or "when will this run next?" or "how often does this run per year?"
- Use when reviewing a CI/CD pipeline or infrastructure config that contains a
schedulefield. - Use when a user pastes a 5-field cron expression and asks for a sanity check.
How It Works
Step 1: Parse the expression
Split on whitespace into 5 fields: minute, hour, day-of-month, month, day-of-week. Confirm valid ranges:
| Field | Position | Range | Notes |
|---|---|---|---|
| minute | 1 | 0β59 | |
| hour | 2 | 0β23 | |
| day-of-month | 3 | 1β31 | |
| month | 4 | 1β12 | names (JANβDEC) accepted |
| day-of-week | 5 | 0β7 | 0 and 7 both = Sunday; names (SUNβSAT) accepted |
Step 2: Describe it in plain English
State what the user thinks it does vs. what it actually does. Be explicit about OR-vs-AND semantics for day-of-month + day-of-week (see death-trap #2).
Step 3: Run the trap checklist
Check the five death-traps below and flag any that apply.
Step 4: Calculate next runs and annual fire count
Compute the next 5 fire times as concrete dates so the user can verify the schedule behaves as expected. Estimate annual fire count β a schedule that fires 365Γ/year vs. 12Γ/year is a ~30Γ cost and load difference.
The Five Cron Death-Traps
These are the bugs that pass crontab -l validation but break in production.
1. Impossible dates β the "never fires" bug
0 0 30 2 *
Valid syntax. Never fires. February has no 30th. This schedule is a dead job
that silently sits forever. The same applies to day 31 in any 30-day month:
0 0 31 4 *, 0 0 31 6 *, 0 0 31 9 *, 0 0 31 11 *.
Fix: use 0 0 28-31 * * and check for end-of-month in the script, or use L
(last day) syntax if your scheduler supports it.
2. OR-semantics β the "fires too often" bug
0 0 1,15 * 1
Does NOT mean "midnight on the 1st and 15th if it's Monday." Does mean "midnight on the 1st, the 15th, OR every Monday." That's ~6 fires/month instead of ~2.
This is the single most misunderstood cron rule. When both day-of-month AND
day-of-week are restricted (neither is *), cron uses OR logic, not AND.
Fix: if you need "1st and 15th only if Monday," run daily and check in the script:
0 0 * * 1 [ "$(date +%d)" = "01" -o "$(date +%d)" = "15" ] && your-command
3. Midnight spike β the "everything at once" bug
0 0 * * *
Every job scheduled at 0 0 competes for resources at exactly 00:00. Database
backups, log rotations, cert renewals, report generation β all fire simultaneously.
This causes load spikes, connection-pool exhaustion, and cascading timeouts.
Fix: stagger jobs across the hour. Use 17 2 * * * or 43 3 * * * instead of
0 0. Jitter is your friend.
4. Uneven steps β the "drift" bug
*/7 * * * *
Does NOT mean "every 7 minutes evenly." It means "every 7 minutes starting at 0, then resets at 60." So: 0, 7, 14, 21, 28, 35, 42, 49, 56 β then 0 again (a 4-minute gap). The intervals drift: 7,7,7,7,7,7,7,7,4.
Fix: 60 is not divisible by 7. Use step values that divide 60 evenly: */5,
*/10, */15, */20, */30. If you truly need every-7-minutes, use a loop with
sleep 420.
5. Leap-year February 29 β the "annual surprise"
0 0 29 2 *
Fires only on leap years β February 29, 2024 / 2028 / 2032β¦ If someone writes this
β¦
Pertanyaan umum
Apa itu 'cron expression'?
Itu adalah kode yang dipakai dalam sistem untuk menentukan kapan sebuah tugas harus berjalan secara otomatis (misalnya, setiap hari pukul 03.00).
Apa saja kesalahan umum yang bisa dideteksi?
Tugas yang tidak pernah berjalan (misalnya, tanggal 30 Februari), tugas yang berjalan lebih sering dari rencana (misalnya, tanggal 1, tanggal 15, DAN setiap hari Senin), atau ketika terlalu banyak tugas berjalan di waktu yang sama.
Apakah alat ini memperbaiki kesalahan secara otomatis?
Alat ini mengidentifikasi kesalahan dan menyarankan cara memperbaikinya, tetapi koreksi akhirnya biasanya perlu dilakukan oleh pengguna.
Detail
Deskripsi asli dari pembuat
Diagnose and validate cron expressions before they ship. Catches the five silent death-traps: impossible dates that never fire, OR-semantics that fire too often, midnight spikes, uneven step drift, and leap-year February 29.
Popularitas
- Bintang GitHub
- 48k
- Peringkat
- #4285
- Lisensi
- MIT
- Diperbarui
- 15/10/2026
Komentar
- β¦
Skill lain dari repositori ini
00-andruia-consultant
48kMembantu agent Anda memulai atau meningkatkan proyek AI. Agent menganalisis kode, menyarankan tools, dan membuat rencana aksi dalam bahasa Spanyol.
007
48kMemungkinkan agent Anda melakukan audit keamanan dan threat modeling. Berguna untuk melindungi proyek dari serangan dan celah keamanan.
10-andruia-skill-smith
48kMembantu agent Anda membuat atau meningkatkan tools AI. Agent mendefinisikan cara kerja tools, menulis dokumentasi, dan memvalidasi strukturnya.
20-andruia-niche-intelligence
48kMemungkinkan agent Anda membuat ringkasan industri tertentu. Berguna untuk memahami konteks, aturan, pola penggunaan, dan risiko proyek dengan sumber terpercaya.
Skill serupa
test-driven-development
311kMengajari agent Anda menulis tes yang gagal dulu, melihatnya gagal, lalu menulis kode terkecil yang lulus, sebelum membangun fitur atau perbaikan apa pun.
verification-before-completion
311kMengajari agent Anda menjalankan pemeriksaan nyata dan membaca keluarannya sebelum menyatakan tugas, perbaikan, atau build sudah selesai atau lulus.
migrate-to-shoehorn
310kMengganti type cast berisiko di file tes Anda dengan pustaka shoehorn, sehingga tes bisa memakai data parsial dan tetap lulus pemeriksaan tipe.