inngest – skill Khác cho agent AI
Chuyên gia Inngest về background job serverless-first, workflow hướng sự kiện và thực thi bền vững mà không cần quản lý queue hay worker.
Cài skill inngest bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/inngest-57dba.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /inngest – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/inngest-57dba.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $inngest – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/inngest-57dba.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /inngest – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/inngest-57dba.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /inngest – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Inngest Integration
Inngest expert for serverless-first background jobs, event-driven workflows,
and durable execution without managing queues or workers.
These are source sketches for a version-pinned SDK, not a complete deployable application. Supply reviewed database/email/payment adapters and compile against the installed SDK. Events and webhook payloads require server-side validation and authorization. Verify provider signatures before enqueueing webhook events. Keep secrets and unnecessary personal data out of durable step outputs; these may be retained remotely.
Principles
- Events are the primitive - everything triggers from events, not queues
- Steps are your checkpoints - each step result is durably stored
- Sleep is not a hack - Inngest sleeps are real, not blocking threads
- Retries are automatic - but you control the policy
- Functions are just HTTP handlers - deploy anywhere that serves HTTP
- Concurrency is a first-class concern - protect downstream services
- Workflow deduplication does not make external side effects exactly-once; use provider idempotency keys and reconcile uncertain outcomes
- Fan-out is built-in - one event can trigger many functions
Capabilities
- inngest-functions
- event-driven-workflows
- step-functions
- serverless-background-jobs
- durable-sleep
- fan-out-patterns
- concurrency-control
- scheduled-functions
Scope
- redis-queues -> bullmq-specialist
- serverless-queues -> upstash-qstash
- workflow-orchestration -> temporal-craftsman
- message-streaming -> event-architect
- infrastructure -> infra-architect
Tooling
Core
- inngest
- inngest-cli
Frameworks
- nextjs
- express
- hono
- remix
- sveltekit
Deployment
- vercel
- cloudflare-workers
- netlify
- railway
- fly-io
#Side effects such as messages, charges, fulfillment, deployments and remote indexing require the user's task scope. Use synthetic records in development and do not execute these examples during review.
Patterns
- step-functions
- event-fan-out
- scheduled-cron
- webhook-handling
Patterns
Basic Function Setup
Inngest function with typed events in Next.js
When to use: Starting with Inngest in any Next.js project
// lib/inngest/client.ts
import { Inngest, EventSchemas } from 'inngest';
export const inngest = new Inngest({
id: 'my-app',
schemas: new EventSchemas().fromRecord<Events>(),
});
// Define your events with types
type Events = {
'user/signed.up': { data: { userId: string; email: string } };
'order/placed': { data: { orderId: string; total: number } };
};
// lib/inngest/functions.ts
import { inngest } from './client';
export const sendWelcomeEmail = inngest.createFunction(
{ id: 'send-welcome-email' },
{ event: 'user/signed.up' },
async ({ event, step }) => {
// Step 1: Get user details
const user = await step.run('get-user', async () => {
return await db.users.findUnique({ where: { id: event.data.userId } });
});
// Step 2: Send welcome email
await step.run('send-email', async () => {
await resend.emails.send({
to: user.email,
subject: 'Welcome!',
template: 'welcome',
});
});
// Step 3: Wait 24 hours, then send tips
await step.sleep('wait-for-tips', '24h');
await step.run('send-tips', async () => {
await resend.emails.send({
to: user.email,
subject: 'Getting Started Tips',
template: 'tips',
});
});
}
);
// app/api/inngest/route.ts (Next.js App Router)
import { serve } from 'inngest/next';
import { inngest } from '@/lib/inngest/client';
import { sendWelcomeEmail } from '@/lib/inngest/functions';
export const { GET, POST, PUT } = serve({
client: inngest,
functions: [sendWelcomeEmail],
});
Multi-Step Workflow
Complex workflow with parallel steps and error handling
When to use: Processing that involves multiple services or long waits
export const processOrder = inngest.createFunction(
{
id: 'process-order',
retries: 3,
concurrency: { limit: 10 }, // Max 10 orders processing at once
},
{ event: 'order/placed' },
async ({ event, step }) => {
const { orderId } = event.data;
// Parallel steps - both run simultaneously
const [inventory, payment] = await Promise.all([
step.run('check-inventory', () => checkInventory(orderId)),
step.run('validate-payment', () => validatePayment(orderId)),
]);
if (!inventory.available) {
// Send event instead of direct call (fan-out pattern)
await step.sendEvent('notify-backorder', {
name: 'order/backordered',
data: { orderId, items: inventory.missing },
});
return { status: 'backordered' };
}
// Read authoritative amount/currency and customer from the server-side order.
// Never charge an amount accepted only from an untrusted event.
const order = await step.run('load-order', () => loadAuthorizedOrder(orderId));
// Process payment
const charge = await step.run('charge-payment', async () => {
return await stripe.charges.create({
amount: order.totalMinorUnits,
currency: order.currency,
customer: payment.customerId,
}, { idempotencyKey: order:${orderId}:charge:v1 });
});
// Ship order
await step.run('ship-order', () => fulfillment.ship(orderId));
return { status: 'completed', chargeId: charge.id };
}
);
Scheduled/Cron Functions
Functions that run on a schedule
When to use: Recurring tasks like daily reports or cleanup jobs
export const dailyDigest = inngest.createFunction(
{ id: 'daily-digest' },
{ cron: '0 9 * * *' }, // Every day at 9am UTC
async ({ step }) => {
// Get all users who want digests
const users = await step.run('get-users', async () => {
return await db.users.findMany({
where: { digestEnabled: true },
});
});
// Send to each user (creates child events)
await step.sendEvent(
'send-digests',
users.map(user => ({
name: 'digest/send',
data: { userId: user.id },
}))
);
return { sent: users.length };
}
);
// Separate function handles individual digest sending
export const sendDigest = inngest.createFunction(
{ id: 'send-digest', concurrency: { limit: 50 } },
{ event: 'digest/send' },
async ({ event, step }) => {
// ... send individual digest
}
);
Webhook Handler with Idempotency
Safely process webhooks with deduplication
When to use: Handling Stripe, GitHub, or other webhooks
export const handleStripeWebhook = inngest.createFunction(
{
id: 'stripe-webhook',
// Deduplicate by Stripe event ID
idempotency: 'event.data.stripeEventId',
},
{ event: 'stripe/webhook.received' },
async ({ event, step }) => {
const { type, data } = event.data;
switch (type) {
case 'checkout.session.completed':
await step.run('fulfill-order', async () => {
await fulfillOrder(data.session.id);
});
break;
case 'customer.subscription.deleted':
await step.run('cancel-subscription', async () => {
await cancelSubscription(data.subscription.id);
});
break;
}
}
);
AI Pipeline with Long Processing
Multi-step AI processing with chunked work
When to use: AI workflows that may take minutes to complete
export const processDocument = inngest.createFunction(
{
id: 'process-document',
retries: 2,
concurrency: { limit: 5 }, // Limit API usage
},
{ event: 'document/uploaded' },
async ({ event, step }) => {
// Step 1: Extract text (may take a while)
const text = await step.run('extract-text', async () => {
return await extractTextFromPDF(event.data.fileUrl);
});
// Step 2: Chunk for embedding
const chunks = await step.run('chunk-text', async () => {
return chunkText(text, { maxTokens: 500 });
});
// Step 3: Generate embeddings (API rate limited)
const embeddings = await step.run('generate-embeddings', async () => {
return await openai.embeddings.create({
model: 'text-embedding-3-small',
input: chunks,
});
});
// Step 4: Store in vector DB
await step.run('store-vectors', async () => {
await vectorDb.upsert({
vectors: embeddings.data.map((e, i) => ({
id: ${event.data.documentId}-${i},
values: e.embedding,
metadata: { chunk: chunks[i] },
})),
});
});
return { chunks: chunks.length, status: 'indexed' };
}
);
Validation Checks
Inngest serve handler present
Severity: CRITICAL
Message: Inngest requires a serve handler to receive events
Fix action: Create app/api/inngest/route.ts with serve() export
Functions registered with serve
Severity: ERROR
Message: Ensure all Inngest functions are registered in the serve() call
Fix action: Add function to the functions array in serve()
Step.run has descriptive
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- internal-communication – Nhật ký liên lạc nội bộ: tiêu đề, loại, ngày, phòng ban, người chủ trì và người tham dự…
- internal-link-suggestion-tool – Công cụ gợi ý liên kết nội bộ. Dùng khi làm việc với văn bản nguồn và các trang đích có…
- internal-linking-planner – Công cụ lập kế hoạch liên kết nội bộ. Dùng khi làm việc với danh sách trang trên website…
- interview-style-doc-building – Xây dựng tài liệu chiến lược có cấu trúc bằng cách hỏi từng câu một và cập nhật file.
- inventory-demand-planning – Kiến thức chuyên môn được hệ thống hóa để dự báo nhu cầu, tối ưu tồn kho an toàn, lập kế…
- inventory-stock-reconciliation – Sổ đối chiếu tồn kho: ngày kiểm đếm, mặt hàng, kho, số lượng sổ sách so với thực tế, số…
- invoices-billing – Sổ hóa đơn và thanh toán: số hóa đơn, khách hàng, dự án, ngày phát hành và ngày đến hạn…
- ios-redteam-pipeline – Quy trình red-team iOS đầu cuối