agent-instructions
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what…
Use when designing asynchronous job processing. Covers queue selection, idempotency, retry and backoff policy, scheduling, poison messages, and observability for work that happens outside the request. Trigger on "move this to a background job", "emails are being sent twice",
Claude Code
$ npx -y skills add nimadorostkar/Claude-Skills-collection --skill background-jobs --agent claude-code
Codex
$ npx skills add nimadorostkar/Claude-Skills-collection --skill background-jobs -a codex -y
Cursor
$ npx skills add nimadorostkar/Claude-Skills-collection --skill background-jobs -a cursor -y
Gemini CLI
$ npx skills add nimadorostkar/Claude-Skills-collection --skill background-jobs -a gemini-cli -y
GitHub Copilot
$ npx skills add nimadorostkar/Claude-Skills-collection --skill background-jobs -a github-copilot -y
OpenCode
$ npx skills add nimadorostkar/Claude-Skills-collection --skill background-jobs -a opencode -y
Windsurf
$ npx skills add nimadorostkar/Claude-Skills-collection --skill background-jobs -a windsurf -y
name: background-jobs description: Use when designing asynchronous job processing. Covers queue selection, idempotency, retry and backoff policy, scheduling, poison messages, and observability for work that happens outside the request. Trigger on "move this to a background job", "emails are being sent twice", "the queue is stuck", "retry failed jobs with backoff". Do not use for event schemas other teams consume — see the event-driven-architecture skill. metadata: category: backend version: 1.0.0 tags: [jobs, queues, workers, retries, scheduling]
Move work out of the request path without losing it. A job system is a distributed system with a friendly interface; the failure modes are the same, and they are hidden until they are not.
1. **Make it idempotent first** — Before anything else. A job will run twice; design so that this is harmless. Key the side effect, not the invocation. 2. **Pass identifiers, not objects** — Enqueue `{"order_id": "..."}`, not a serialized order. By the time the job runs, the object may be stale. 3. **Set the retry policy per job** — A transient network failure deserves exponential backoff and ten attempts. A validation failure deserves zero retries and a DLQ. 4. **Isolate the queues** — A flood of low-priority image resizes must not delay password-reset emails. Separate queues, separate workers. 5. **Deduplicate scheduled work** — With multiple instances, every instance's scheduler fires. Use a lock keyed on the job name and window. 6. **Alert on age, not just depth** — A queue with 10 messages that are 3 hours old is a worse signal than a queue with 10,000 that are 5 seconds old.
**Idempotent handler with a natural key:**
@job(queue="billing", max_attempts=5, backoff="exponential", timeout=30)
def send_invoice(invoice_id: str) -> None:
invoice = Invoice.get(invoice_id)
# The natural idempotency key: an invoice is sent at most once.
if invoice.sent_at is not None:
logger.info("invoice_already_sent", extra={"invoice_id": invoice_id})
return
message_id = mailer.send(
to=invoice.customer_email,
template="invoice",
context=invoice.render_context(),
idempotency_key=f"invoice:{invoice_id}", # the provider dedupes too
)
invoice.update(sent_at=utcnow(), provider_message_id=message_id)Two protections, deliberately: the local check handles the common case, and the provider's idempotency key handles the crash between `send` and `update`.
**Enqueue after commit, not inside the transaction:**
with db.transaction():
order = Order.create(...)
db.after_commit(lambda: send_invoice.enqueue(order.invoice_id))A curated library of 137 production-grade skills for Claude and other AI coding agents. Every skill follows one structure, speaks with one voice, and earns its place by changing what the agent does.
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what…
Use when an agent needs state that survives a session or a context compaction. Covers what to persist, file-based memory,…
Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should…
Use when packaging skills, commands, hooks, and MCP servers into a distributable plugin. Covers manifest structure, bundling,…
Use when writing a new skill for an AI agent. Covers scoping, description writing for reliable triggering, progressive…
Use when reviewing or improving an existing agent skill. Covers triggering accuracy, content quality, redundancy with the base…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.