← ClaudeAtlas

inngest-handlerlisted

Create and manage Inngest functions for reliable background jobs, workflows, and scheduled tasks.
aiskillstore/marketplace · ★ 329 · AI & Automation · score 79
Install: claude install-skill aiskillstore/marketplace
# Inngest Function Handler Skill This skill defines the standards for building durable, multi-step workflows using Inngest. ## 🚨 HARD RULES (Strictly Follow) 1. **NO `setTimeout` / `setInterval`**: - ❌ **Bad**: `await new Promise(r => setTimeout(r, 1000))` - ✅ **Good**: `await step.sleep("wait-1s", "1s")` - *Reason*: Serverless functions time out; Inngest sleeps persist for up to a year. 2. **NO Side Effects Outside Steps**: - Any database write, API call, or non-deterministic logic (random, date) **MUST** be wrapped in `step.run()`. - *Reason*: Inngest functions execute multiple times (memoization). Code outside steps runs every time. 3. **Deterministic Steps**: - Steps are memoized by their ID (1st arg). IDs must be unique and stable. - Do not dynamically generate step IDs unless you know what you are doing (e.g., inside loops with index). 4. **Return Data from Steps**: - If you need a value later, return it from the step. - ❌ **Bad**: `let userId; await step.run(..., () => { userId = ... })` - ✅ **Good**: `const userId = await step.run(..., () => { return ... })` ## Core Patterns ### 1. Multi-Step Execution Wrap all logic in steps to ensure retriability and resumability. ```typescript export const processOrder = inngest.createFunction( { id: "process-order" }, { event: "shop/order.created" }, async ({ event, step }) => { // 1. Step: Validate (Retriable) const user = await step.run("get-