npx skills add ...
npx skills add waynesutton/convexskills --skill convex-cron-jobs
Scheduled function patterns for background tasks including interval scheduling, cron expressions, job monitoring, retry strategies, and best practices for long-running tasks
npx skills add waynesutton/convexskills --skill convex-cron-jobs
Schedule recurring functions for background tasks, cleanup jobs, data syncing, and automated workflows in Convex applications.
Before implementing, do not assume; fetch the latest documentation:
Convex cron jobs allow you to schedule functions to run at regular intervals or specific times. Key features:
Use crons.interval for simple recurring tasks:
Use crons.cron for precise scheduling with cron expressions:
Common patterns:
* * * * * - Every minute0 * * * * - Every hour0 0 * * * - Every day at midnight0 0 * * 0 - Every Sunday at midnight0 0 1 * * - First day of every month*/5 * * * * - Every 5 minutes0 9-17 * * 1-5 - Every hour from 9 AM to 5 PM, Monday through FridayCron jobs should call internal functions for security:
Pass static arguments to cron jobs:
Add logging to track cron job execution:
Handle large datasets in batches to avoid timeouts:
Use actions for external API calls:
npx convex deploy unless explicitly instructedcrons.interval or crons.cron methods, not deprecated helpersinternal from _generated/api even for functions in the same filecrons.hourly, crons.daily, etc.