본문으로 건너뛰기
Skillpedia
테스트48k · #4285

cron-doctor

하는 일

스케줄링 코드(‘크론 표현식’이라고 부릅니다)가 올바른지, 예상치 못한 문제를 일으키지 않는지 확인합니다. 작업이 전혀 실행되지 않거나 의도보다 더 자주 실행되게 만드는 흔한 오류를 피하도록 돕습니다.

사용하는 경우

  • ✓작업을 예약하는 코드를 작성하거나 검토할 때.
  • ✓예약된 작업이 기대대로 작동하지 않을 때.
  • ✓예약된 작업이 언제 실행될지 이해하고 싶은 경우.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/cron-doctor/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/cron-doctor/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 크론 표현식이 올바른지 확인해 주세요: 0 0 30 2 *”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

스케줄링 코드를 분석하고, 날짜가 가능한지(예: 2월에는 30일이 없음) 확인합니다. 또한 ‘OR’ 로직 때문에 작업이 너무 자주 실행될 수 있는지도 점검합니다. 그다음 작업이 언제 실행될지 보여 줍니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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 Actions schedule, 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 schedule field.
  • 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

…

자주 묻는 질문

‘크론 표현식’이란 무엇인가요?

시스템에서 작업이 자동으로 언제 실행될지 알려 주는 코드입니다(예: 매일 오전 3시).

어떤 흔한 오류를 잡아내나요?

절대 실행되지 않는 작업(예: 2월 30일), 계획보다 더 자주 실행되는 작업(예: 1일, 15일, 그리고 매주 월요일 모두), 또는 너무 많은 작업이 동시에 실행되는 경우를 찾아냅니다.

오류를 자동으로 고치나요?

오류를 찾고 고치는 방법을 제안하지만, 최종 수정은 보통 사용자가 해야 합니다.

상세 정보

작성자의 원본 설명

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.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#4285
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬