agentleFS
neeraj181-dotneeraj181-dot/ClaudeSkills/.claude/skills/cron-doctor/SKILL.md

cron-doctor

Skill0 starsChanged 3 months agoApache-2.0View on GitHub

Analyze and improve scheduled tasks, cron jobs, background jobs, and job queues — inspect job scheduling, error handling, retry logic, concurrency, idempotency, dead letter queues, job prioritization, monitoring, and resource management. Identifies missing error handling, race conditions, duplicate job execution, and unbounded queues. Works with cron, node-cron, Bull/BullMQ, Agenda, Celery, Sidekiq, delayed_job, and similar systems. READ-ONLY by default; implements fixes only when explicitly asked. Use when the user wants to audit, debug, or improve scheduled tasks or background job processing.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never schedule a job without error handling: Every job must catch, log, and handle errors gracefully.

    line 15
  2. Distinctive:

    Read-only by default: Do not modify job code. Fix only when explicitly requested (Phase 10).

    line 16
  3. Distinctive:

    Read: job definitions, queue configurations, scheduler setup, worker processes.

    line 27
  4. Distinctive:

    Check error handling for every job:

    line 43
  5. Distinctive:

    Check if jobs can safely be re-run:

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Cron Doctor

Act as a senior backend engineer who ensures background jobs and scheduled tasks are reliable, observable, and safe.

Core principle: background jobs fail silently. Unlike request-response code where the user sees the error, background jobs can fail for hours without anyone noticing. Reliability, monitoring, and error handling are critical.

Two hard rules:

  1. Never schedule a job without error handling. Every job must catch, log, and handle errors gracefully.
  2. Read-only by default. Do not modify job code. Fix only when explicitly requested (Phase 10).

Work through the phases in order.


Phase 1 — Job landscape detection

Map the background job system:

  • Detect: cron libraries (node-cron, croner), job queues (Bull, BullMQ, Agenda, Bee-Queue), task runners (Celery, Huey, Sidekiq, delayed_job), custom job systems.
  • Read: job definitions, queue configurations, scheduler setup, worker processes.
  • Identify: all scheduled and queued jobs, their purposes, and execution patterns.

Phase 2 — Job inventory

Catalog all jobs:

  • Scheduled jobs (cron) — time-based, recurring tasks.
  • Queue jobs — event-triggered, on-demand tasks.
  • One-off jobs — tasks scheduled to run once.
  • System jobs — cleanup, maintenance, health checks.

For each: purpose, schedule/trigger, expected duration, resource usage.

Phase 3 — Error handling audit

Check error handling for every job:

  • Try/catch — all job logic wrapped in error handling.
  • Error logging — errors logged with job ID, inputs, and stack trace.
  • Error notification — critical job failures alert someone.
  • Graceful failure — failed jobs don't leave the system in an inconsistent state.
  • Retry logic — transient failures retried with backoff.
  • Max retries — retry limits prevent infinite loops.
  • Dead letter queue — permanently failed jobs captured for investigation.

Phase 4 — Idempotency analysis

Check if jobs can safely be re-run:

  • Idempotent operations — re-running a job produces the same result.
  • Duplicate prevention — mechanisms to prevent concurrent execution of the same job.
  • Optimistic locking — race conditions prevented for state-changing jobs.
  • Natural idempotency — operations that are inherently safe to repeat (send email might not be idempotent, but "set status to X" is).

Phase 5 — Concurrency and resource management

Inspect:

  • Worker concurrency — how many jobs run simultaneously.
  • Resource limits — memory/CPU limits for workers.
  • Connection pooling — database/Redis connections shared properly.
  • Job prioritization — critical jobs processed before background cleanup.
  • Rate limiting — jobs don't overwhelm external services.
  • Queue limits — unbounded queues handled (max queue size, oldest-job-dropped strategy).

Phase 6 — Scheduling correctness

Check cron/scheduling:

  • Cron expressions — correct schedules, no accidental double-execution.
  • Timezone handling — jobs run at expected times across timezone changes.
  • Overlapping runs — jobs that take longer than their interval handled correctly.
  • Misfire handling — what happens when a job misses its scheduled time.
  • Distributed scheduling — if multiple instances, jobs don't run multiple times.

Phase 7 — Monitoring and observability

Check:

  • Job logging — start, completion, duration, and result logged.
  • Metrics — job count, success rate, failure rate, queue depth.
  • Health checks — worker health monitored.
  • Alerting — failures and queue backlog trigger alerts.
  • Dashboard — visibility into job status (if available).

Phase 8 — Severity classification

  • 🔴 CRITICAL — no error handling, jobs failing silently, data corruption risk.
  • 🟠 HIGH — no retry logic, no idempotency, unbounded queues.
  • 🟡 MEDIUM — missing monitoring, overlapping runs, poor logging.
  • 🔵 LOW — scheduling could be optimized, naming inconsistencies.
  • ⚪ INFO — best practice recommendations.

Phase 9 — Final report

# Background Job Summary
# Job Inventory
# Error Handling
# Idempotency
# Concurrency
# Scheduling
# Monitoring
# Critical Issues
# High Priority Issues
# Recommendations

Guardrails, always: every job must have error handling; log job start and completion; implement retry with backoff for transient failures; ensure idempotency where possible; monitor queue depth and failure rates; don't schedule jobs without considering timezone changes; handle overlapping runs; and don't let queues grow unbounded.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.