sdxc-jobs

Declare and dispatch background jobs with cron scheduling, retries, and pluggable queue backends.

5|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-jobs-sergiodxa
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sdxc-jobs
Source: https://github.com/sergiodxa/monorepo/tree/main/.agents/skills/sdxc-jobs
Command: npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-jobs-sergiodxa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Background work in Cloudflare Workers often ends up scattered across ad-hoc queue consumers and inline cron handlers with no retries, timeouts, or per-run records. This Skill guides you through the @sdxc/jobs package, which centralizes job declarations in one map and runs them through a single dispatcher over a pluggable queue backend. ## Core Features & Use Cases - Declarative job maps: Define jobs with job() and jobs() including payload schemas, cron expressions, and metadata, while handlers load lazily via dynamic imports so the request path stays lean. - Dispatcher runtime: createJobDispatcher() handles enqueuing, timeouts, retries, dead-letter routing, and per-run logging, with adapters for Cloudflare Queues and in-memory queues for tests. - Testable handlers: Write handlers with createJobHandler() and exercise them in isolation using createJobContext() without a live queue. - Use Case: You need a nightly cleanup job and an HTTP monitor check in a Remix app on Cloudflare Workers. Declare both in one jobs map, wire the dispatcher to your Queue binding, and get per-run logs, automatic retries, and a dead-letter path for poison messages. ## Quick Start Ask the AI to declare a jobs map with a cron job and an input-validated job using @sdxc/jobs, then wire a dispatcher with the Cloudflare Queues adapter in your worker.

Frequently Asked Questions about sdxc-jobs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I declare background jobs with @sdxc/jobs?▼

Use the jobs() and job() functions to build a map where each key names a job with an optional payload schema, cron expression, and metadata. Handlers stay in separate modules and are mapped lazily with dispatcher.map(job, () => import(...)).

How do I add a cron scheduled job in Cloudflare Workers?▼

Pass a cron expression to job() and ensure it exactly matches the trigger in your wrangler.jsonc, since the package validates syntax but not platform config. Assert dispatcher.crons against your wrangler config in a test to catch drift.

Does @sdxc/jobs work without Cloudflare Queues?▼

Yes, the @sdxc/jobs/memory entry point provides an in-process queue for tests and environments without a platform backend. You can also implement the JobQueue contract from @sdxc/jobs/queue to write a custom adapter.

How do I test a job handler without a live queue?▼

Use createJobContext() to build a handler context in tests, letting you invoke the handler directly and assert on retries, exits, and logged records. The memory adapter also supports end-to-end dispatcher tests.

Why does my retry logic swallow job endings?▼

A catch block around ctx.retry() or ctx.exit() also catches the thrown ending, breaking delivery settlement. Re-throw with if (error instanceof Job.Ending) throw error, and write return ctx.retry(...) so unreachable code is type-checked.

How do job timeouts actually cancel work?▼

The dispatcher's timeout only cancels work if you pass ctx.signal to every fetch and async call inside the handler. Without it, the dispatcher stops waiting but the underlying work continues running.