Claude Templates / B-tier · Situational

Infrastructure

The Scheduler Engine Playbook

One queue for every future-dated action — drips, reminders, scheduled sends.

SCHEDULER-ENGINE-PLAYBOOK.md · 14 sections · 2,469 words · 21 KB · markdown

A generic scheduled_actions table plus a tick worker, so you build the scheduling layer once instead of per feature. Covers claim-and-lock dispatch, cancellation, retry with an attempt ceiling, and timezone handling that doesn't drift across DST.

What's inside

When to use it

Weeks 3-4, the second time you need to schedule something.

Build these first

Trigger.dev Workers

Straight from the file

Reconciliation runs server-side every minute so it doesn't depend on a client tab being open. It (a) inserts missing rows for newly-approved items, (b) updates publish_at when the upstream wall time changes, (c) deletes orphan rows when the upstream item moves out of "scheduled" state.

Table of contents

  1. 0. Use this spec
  2. 1. Architecture
  3. 2. Schema (generic scheduledactions)
  4. 3. Status state machine
  5. 4. Scheduler-tick cron (the fan-out)
  6. 5. Reconciler cron (queue ↔ source-of-truth sync)
  7. 6. Worker dispatch — atomic claim
  8. 7. DB-level publish guard (belt-and-braces)
  9. 8. Cancel / reschedule / retry
  10. 9. Timezones
  11. 10. Recurring schedules (bulk)
  12. 11. Drip-sequence variant
  13. 12. Common pitfalls
  14. 13. Kickoff prompt

How to run it

Drop SCHEDULER-ENGINE-PLAYBOOK.md into your repo, then tell Claude Code: “Read SCHEDULER-ENGINE-PLAYBOOK.md and implement it in this codebase.” It's written for an agent to execute end to end. Search the file for angle-bracket placeholders and swap in your own project names, domains, and keys before the first run.

↓ Download the playbook

More infrastructure playbooks

← All 28 Claude templates