inngest-handler
Create and manage Inngest functions for reliable background jobs, workflows, and scheduled tasks.
Best use case
inngest-handler is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Create and manage Inngest functions for reliable background jobs, workflows, and scheduled tasks.
Create and manage Inngest functions for reliable background jobs, workflows, and scheduled tasks.
Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.
Practical example
Example input
Use the "inngest-handler" skill to help with this workflow task. Context: Create and manage Inngest functions for reliable background jobs, workflows, and scheduled tasks.
Example output
A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.
When to use this skill
- Use this skill when you want a reusable workflow rather than writing the same prompt again and again.
When not to use this skill
- Do not use this when you only need a one-off answer and do not need a reusable workflow.
- Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/inngest-handler/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How inngest-handler Compares
| Feature / Agent | inngest-handler | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Create and manage Inngest functions for reliable background jobs, workflows, and scheduled tasks.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 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-user", async () => {
return await db.users.findById(event.data.userId);
});
// 2. Step: Sleep (Durable pause)
await step.sleep("wait-for-payment", "1h");
// 3. Step: Wait for Event (Human/System interaction)
const payment = await step.waitForEvent("wait-payment", {
event: "shop/payment.success",
match: "data.orderId",
timeout: "24h"
});
// 4. Step: Conditional Logic
if (!payment) {
await step.run("cancel-order", async () => { ... });
}
}
);
```
### 2. Parallelism
Run steps concurrently to speed up execution.
```typescript
const [user, subscription] = await Promise.all([
step.run("fetch-user", () => db.users.find(...)),
step.run("fetch-sub", () => stripe.subscriptions.retrieve(...))
]);
```
### 3. Working with Loops
Inside loops, ensure step IDs are unique.
```typescript
const items = event.data.items;
for (const item of items) {
// Use dynamic ID to ensure uniqueness per item
await step.run(`process-item-${item.id}`, async () => {
await processItem(item);
});
}
```
## Configuration & Flow Control
### Rate Limiting & Throttling
Prevent overwhelming 3rd party APIs.
```typescript
inngest.createFunction({
id: "sync-crm",
// Max 10 requests per minute per user
rateLimit: { limit: 10, period: "1m", key: "event.data.userId" },
// Drop events if queue is full
throttle: { limit: 5, period: "1s" }
}, ...);
```
### Debounce
Process only the latest event in a window (e.g., search indexing).
```typescript
inngest.createFunction({
id: "index-product",
// Wait 10s for more events; only run with the latest data
debounce: { period: "10s", key: "event.data.productId" }
}, ...);
```
### Priority
Prioritize specific events (e.g., Paid users).
```typescript
inngest.createFunction({
id: "generate-report",
// High number = High priority
priority: { run: "event.data.plan === 'enterprise' ? 100 : 0" }
}, ...);
```
## Error Handling
### Automatic Retries
Inngest retries steps automatically on error (default ~4-5 times with backoff).
- **Customize**: `{ retries: 10 }` in config.
### Non-Retriable Errors
Stop execution immediately if the error is fatal (e.g., 400 Bad Request).
```typescript
import { NonRetriableError } from "inngest";
await step.run("validate", async () => {
if (!isValid) throw new NonRetriableError("Invalid payload");
});
```
### Failure Handlers (Rollbacks)
Execute cleanup logic if the function fails after all retries.
```typescript
export const riskyFunc = inngest.createFunction(
{
id: "risky-transfer",
// Runs if main handler fails
onFailure: async ({ error, event, step }) => {
await step.run("rollback-funds", async () => {
await reverseTransfer(event.data.transferId);
});
await step.run("notify-admin", async () => {
await sendAlert(`Transfer failed: ${error.message}`);
});
}
},
{ event: "bank/transfer.init" },
async ({ step }) => { /* ... */ }
);
```
## Registration
**MANDATORY**: All functions must be imported and exported in `src/lib/inngest/functions/index.ts`.Related Skills
inngest
Inngest expert for serverless-first background jobs, event-driven workflows, and durable execution without managing queues or workers. Use when: inngest, serverless background job, event-driven workflow, step function, durable execution.
error-handler-advisor
Proactively reviews error handling patterns and suggests improvements using Result types, proper error propagation, and idiomatic patterns. Activates when users write error handling code or use unwrap/expect.
ui-handler
Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.
theme-handler
Manage and update application themes using shadcn and tweakcn.
stripe-handler
Handle Stripe payments, custom checkouts, and webhook fulfillment outside of standard plans/credits.
seo-handler
Manage SEO, sitemaps, and metadata for optimal search engine visibility
s3-upload-handler
Handle S3 file uploads including UI components, client-side logic, and server-side processing
replicate-handler
Integrate with Replicate AI for running models (image generation, LLMs, etc.).
plate-handler
Implement rich text editors using Plate.js. Supports creating both simple (comment/chat) and detailed (document/blog) editors.
plans-handler
Manage subscription plans, pricing, and quotas. Use when adding plan features, updating limits, or building pricing pages.
env-handler
Manage environment variables securely. Handles distinction between .env (template) and .env.local (secrets).
email-handler
Create and send transactional emails using React Email. Covers templates, layout integration, and sending logic.