Agent skill

Inngest Middleware

by Asymmetric-al in Asymmetric-al/core

A skill your agent uses when adding cross-cutting concerns to durable functions — structured logging or tracing across all functions, error tracking with Sentry, payload encryption for sensitive…

AGPL-3.0Auto-check passedDevOps & Cloud

Install Inngest Middleware

skills CLI
$ npx skills add Asymmetric-al/core --skill inngest-middleware -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Asymmetric-al/core inngest-middleware --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Asymmetric-al/core.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/inngest-middleware .claude/skills/inngest-middleware && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
inngest-middleware
GitHub stars
381
Token cost
~2.9k tokens
SKILL.md length
650 words
Files
3 (incl. references)
Skills in repo
43
Repo updated
First seen
Licence
AGPL-3.0

At a glance

A skill your agent uses when adding cross-cutting concerns to durable functions — structured logging or tracing across all functions, error tracking with Sentry, payload encryption for sensitive…

  • Works in 5 steps: Keep middleware focused: One concern per… → Handle errors gracefully: Don't let… → Consider performance: Middleware runs on… → …
  • Adding cross-cutting concerns to durable functions — structured logging
  • SKILL.md covers What is Middleware?, Middleware Lifecycle, Creating Custom Middleware and Middleware Packages, plus 6 more sections
  • Calls npm; needs ENCRYPTION_KEY

What it does

Inngest Middleware is an agent skill from Asymmetric-al/core. Use when adding cross-cutting concerns to durable functions — structured logging or tracing across all functions, error tracking with Sentry, payload encryption for sensitive data, dependency injection of clients (DB, Stripe, etc.) into function handlers, custom telemetry, or behavior that should apply uniformly across many functions. Covers Inngest middleware lifecycle, creating custom middleware, dependencyInjectionMiddleware, @inngest/middleware-encryption, @inngest/middleware-sentry, and custom middleware…

Its SKILL.md is about 2.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/built-in-middleware.md` and `references/dependency-injection.md`).

It sits in DevOps & Cloud, covering Observability and Design patterns. It works with Sentry, Stripe and Python. The repository describes itself as: A high-performance, enterprise-grade Next.js 16 application for mission-focused non-profit organizations. Built for high impact teams. The licence is AGPL-3.0.

When your agent uses it

  • Adding cross-cutting concerns to durable functions — structured logging
  • Tracing across all functions
  • Error tracking with Sentry
  • Payload encryption for sensitive data

Example prompts

  • “/inngest-middleware”

Requirements

  • Python 3
  • Node.js
  • A credential in ENCRYPTION_KEY

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Keep middleware focused: One concern per middleware
  2. Handle errors gracefully: Don't let middleware crash functions
  3. Consider performance: Middleware runs on every execution
  4. Use proper typing: Let TypeScript infer middleware types
  5. Test thoroughly: Middleware affects all functions that use it

What it can do on your machine

Read from SKILL.md and the folder at commit c30c8ff. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • inngest.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • ENCRYPTION_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Inngest Middleware loads about 2.9k tokens when it runs, and up to ~8.7k if it reads all its reference files. Until then it costs about 136 tokens; SKILL.md has 650 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~136
When it runs · the whole SKILL.md, loaded when a task matches
~2.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~8.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Asymmetric-al/core at commit c30c8ff, republished under its AGPL-3.0 licence (© Asymmetric-al). 650 words, ~2,861 tokens.

Download SKILL.mdSave it as .claude/skills/inngest-middleware/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
inngest-middleware
description
Use when adding cross-cutting concerns to durable functions — structured logging or tracing across all functions, error tracking with Sentry, payload encryption for sensitive data, dependency injection of clients (DB, Stripe, etc.) into function handlers, custom telemetry, or behavior that should apply uniformly across many functions. Covers Inngest middleware lifecycle, creating custom middleware, dependencyInjectionMiddleware, @inngest/middleware-encryption, @inngest/middleware-sentry, and custom middleware patterns.

Inngest Middleware

Master Inngest middleware to handle cross-cutting concerns like logging, error tracking, dependency injection, and data transformation. Middleware runs at key points in the function lifecycle, enabling powerful patterns for observability and shared functionality.

These skills are focused on TypeScript. For Python or Go, refer to the Inngest documentation for language-specific guidance. Core concepts apply across all languages.

Note: The middleware system was significantly rewritten in v4. The lifecycle hooks documented here reflect the v4 API. If migrating from v3, consult the migration guide for details on breaking changes.

⚠ For Realtime use the inngest-realtime skill, NOT this one. Inngest v3 used realtimeMiddleware() from @inngest/realtime to inject a publish arg into function handlers. v4 ships realtime natively — step.realtime.publish is built-in, no middleware required. Do NOT install @inngest/realtime on a v4 project (it's a v3-era package and produces TypeError: Cls is not a constructor at runtime). See the inngest-realtime skill for the v4 pattern.

What is Middleware?

Middleware allows code to run at various points in an Inngest client's lifecycle - during function execution, event sending, and more. Think of middleware as hooks into the Inngest execution pipeline.

When to use middleware:

  • Observability: Add logging, tracing, or metrics
  • Dependency injection: Share client instances across functions
  • Data transformation: Encrypt/decrypt, validate, or enrich data
  • Error handling: Custom error tracking and alerting
  • Authentication: Validate user context or permissions

Middleware Lifecycle

Middleware can be registered at client-level (affects all functions) or function-level (affects specific functions).

Execution Order
typescript
const inngest = new Inngest({
  id: "my-app",
  middleware: [
    loggingMiddleware, // Runs 1st
    errorMiddleware, // Runs 2nd
  ],
});

inngest.createFunction(
  {
    id: "example",
    middleware: [
      authMiddleware, // Runs 3rd
      metricsMiddleware, // Runs 4th
    ],
    triggers: [{ event: "test" }],
  },
  async () => {
    /* function code */
  },
);

Order matters: Client middleware runs first, then function middleware, in the order specified.

Creating Custom Middleware

Basic Middleware Structure
typescript
import { InngestMiddleware } from "inngest";

const loggingMiddleware = new InngestMiddleware({
  name: "Logging Middleware",
  init() {
    // Setup phase - runs when client initializes
    const logger = setupLogger();

    return {
      // Function execution lifecycle
      // Note: `fn` is loosely typed in middleware generics; fn.id works at runtime
      onFunctionRun({ ctx, fn }) {
        return {
          beforeExecution() {
            logger.info("Function starting", {
              functionId: fn.id,
              eventName: ctx.event.name,
              runId: ctx.runId,
            });
          },

          afterExecution() {
            logger.info("Function completed", {
              functionId: fn.id,
              runId: ctx.runId,
            });
          },

          transformOutput({ result }) {
            // Log function output
            logger.debug("Function output", {
              functionId: fn.id,
              output: result.data,
            });

            // Return unmodified result
            return { result };
          },
        };
      },

      // Event sending lifecycle
      onSendEvent() {
        return {
          transformInput({ payloads }) {
            logger.info("Sending events", {
              count: payloads.length,
              events: payloads.map((p) => p.name),
            });

            // Spread to convert readonly array to mutable array
            return { payloads: [...payloads] };
          },
        };
      },
    };
  },
});
Python Implementation

Python middleware follows a similar pattern. See Dependency Injection Reference for complete Python examples.


## Dependency Injection

Share expensive or stateful clients across all functions. **See [Dependency Injection Reference](./references/dependency-injection.md) for detailed patterns.**

### Quick Example - Built-in DI

```typescript
import { dependencyInjectionMiddleware } from "inngest";

const inngest = new Inngest({
  id: 'my-app',
  middleware: [
    dependencyInjectionMiddleware({
      openai: new OpenAI(),
      db: new PrismaClient(),
    }),
  ],
});

// Functions automatically get injected dependencies
inngest.createFunction(
  { id: "ai-summary", triggers: [{ event: "document/uploaded" }] },
  async ({ event, openai, db }) => {
    // Dependencies available in function context
    const summary = await openai.chat.completions.create({
      messages: [{ role: "user", content: event.data.content }],
      model: "gpt-4",
    });

    await db.document.update({
      where: { id: event.data.documentId },
      data: { summary: summary.choices[0].message.content }
    });
  }
);

Middleware Packages

Beyond dependencyInjectionMiddleware (built-in, shown above), Inngest provides official middleware as separate packages. See Middleware Reference for complete details.

Encryption Middleware
bash
npm install @inngest/middleware-encryption
typescript
import { encryptionMiddleware } from "@inngest/middleware-encryption";

const inngest = new Inngest({
  id: "my-app",
  middleware: [
    encryptionMiddleware({
      key: process.env.ENCRYPTION_KEY,
    }),
  ],
});

Automatically encrypts all step data, function output, and event data.encrypted field. Supports key rotation via fallbackDecryptionKeys.

Sentry Error Tracking
bash
npm install @inngest/middleware-sentry
typescript
import * as Sentry from "@sentry/node";
import { sentryMiddleware } from "@inngest/middleware-sentry";

Sentry.init({
  /* your Sentry config */
});

const inngest = new Inngest({
  id: "my-app",
  middleware: [sentryMiddleware()],
});

Captures exceptions, adds tracing to each function run, and includes function ID and event names as context. Requires @sentry/*@>=8.0.0.

Common Middleware Patterns

Metrics and Performance Tracking
typescript
const metricsMiddleware = new InngestMiddleware({
  name: "Metrics Tracking",
  init() {
    return {
      onFunctionRun({ ctx, fn }) {
        let startTime: number;

        return {
          beforeExecution() {
            startTime = Date.now();
            metrics.increment("inngest.step.started", {
              function: fn.id,
              event: ctx.event.name,
            });
          },

          afterExecution() {
            const duration = Date.now() - startTime;
            metrics.histogram("inngest.step.duration", duration, {
              function: fn.id,
              event: ctx.event.name,
            });
          },

          transformOutput({ result }) {
            const status = result.error ? "error" : "success";
            metrics.increment("inngest.step.completed", {
              function: fn.id,
              status: status,
            });

            return { result };
          },
        };
      },
    };
  },
});
Advanced Patterns

Authentication: Validate tokens and inject user context Conditional logic: Apply middleware based on event type or function Circuit breakers: Prevent cascading failures from external services

Configuration-Based Middleware

Create reusable middleware with configuration options for different environments and use cases. See reference documentation for complete examples.

Show full SKILL.md (260 more words)Show less

Best Practices

Design Principles
  1. Keep middleware focused: One concern per middleware
  2. Handle errors gracefully: Don't let middleware crash functions
  3. Consider performance: Middleware runs on every execution
  4. Use proper typing: Let TypeScript infer middleware types
  5. Test thoroughly: Middleware affects all functions that use it
Common Use Cases to Implement
  • Retry logic for transient failures
  • Circuit breakers for external service calls
  • Request/response logging for debugging
  • User context enrichment from external sources
  • Feature flags for gradual rollouts
  • Custom authentication and authorization checks
Error Handling in Middleware
typescript
const robustMiddleware = new InngestMiddleware({
  name: "Robust Middleware",
  init() {
    return {
      onFunctionRun({ ctx, fn }) {
        return {
          transformOutput({ result }) {
            try {
              // Your middleware logic here
              return performTransformation(result);
            } catch (middlewareError) {
              // Log error but don't break the function
              console.error("Middleware error:", middlewareError);

              // Return original result on middleware failure
              return { result };
            }
          },
        };
      },
    };
  },
});
Testing Middleware

Use Inngest's testing utilities (createMockContext, createMockFunction) to unit test middleware behavior.

For complete implementation examples and advanced patterns, see:

This Repository

These upstream Inngest instructions are vendored for agent tooling and integration work in this monorepo.

Repository Triggers

Use this skill when inngest-middleware matches the current Inngest task. If the right skill is unclear, start with docs/ai/skills/inngest/SKILL.md.

Repository Workflow

  1. Confirm whether the request is agent-tooling guidance or product runtime integration.
  2. Use inngest-brownfield-audit before changing existing app workflows or fragile background work.
  3. Follow this upstream guidance under OpenSpec, root AGENTS.md, repo rulebooks, framework docs, and runtime evidence.
  4. Keep runtime packages, app code, migrations, and INNGEST_* env requirements out of agent-tooling-only changes.

Repository Checklist

  • The task has explicit product-runtime scope before adding Inngest app code or dependencies.
  • Existing workflows were audited before introducing or changing durable workflow behavior.
  • Any MCP usage is backed by a running Inngest dev server on the configured port.
  • Upstream source and license attribution remain documented in docs/ai/skills/inngest/references/upstream.md.

© Asymmetric-al, AGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in .agents/skills/inngest-middleware of Asymmetric-al/core.

  • SKILL.md
  • references/built-in-middleware.md
  • references/dependency-injection.md

Open the folder on GitHubat commit c30c8ff

Compare with similar skills

Inngest Middleware next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Inngest Middleware compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Inngest Middleware this skillAsymmetric-al/core381—~2.9kAutomated safety check: PassAGPL-3.0
Secret Serializationgetsentry/skills1k—~2.6kAutomated safety check: NotesApache-2.0
Logging Observabilitygetsentry/toolkit920—~2.6kAutomated safety check: PassCustom licence
Sentry Advanced Troubleshootingjeremylongshore/tons-of-skills-marketplace2.8k—~3.7kAutomated safety check: PassMIT
Agent Kill Switchvivekchand/clawmetry426—~1.1kAutomated safety check: PassMIT
Clawmetry Selfcheckvivekchand/clawmetry426—~515Automated safety check: PassMIT

Similar skills

  • Secret Serialization

    getsentry/skills

    Official

    Finds secrets, tokens, passwords, and API keys that can leak through generated serialization: Python dataclass repr and asdict, attrs, pydantic modeldump, NamedTuple, JavaScript JSON.stringify and…

    1k GitHub stars~2.6k tokensUpdated yesterday
    DevOps & CloudAuto-check: notes
  • Logging Observability

    getsentry/toolkit

    Official

    Review code for correct logging and error handling patterns.

    920 GitHub stars~2.6k tokensUpdated yesterday
    DevOps & CloudAuto-check passed
  • Sentry Advanced Troubleshooting

    jeremylongshore/tons-of-skills-marketplace

    Advanced Sentry troubleshooting for complex SDK issues, silent event drops, source map failures, distributed tracing gaps, and SDK conflicts.

    2.8k GitHub stars~3.7k tokensUpdated yesterday
    DevOps & CloudAuto-check passed
  • Agent Kill Switch

    vivekchand/clawmetry

    Give the human an off switch and a cost meter for the coding agents on this machine, using ClawMetry.

    426 GitHub stars~1.1k tokensUpdated 3 days ago
    DevOps & CloudAuto-check passed
  • Clawmetry Selfcheck

    vivekchand/clawmetry

    Read your own agent telemetry from ClawMetry (waste, progress, cost) and act on it before finishing a task.

    426 GitHub stars~515 tokensUpdated 3 days ago
    DevOps & CloudAuto-check passed
  • Temps Best Practices

    gotempsh/temps

    Best-practices reference for preparing and instrumenting applications on Temps.

    833 GitHub stars~2.9k tokensUpdated today
    DevOps & CloudAuto-check passed

More from Asymmetric-al/core

All 43 skills in this repo
  • Idempotency Handling

    Asymmetric-al/core

    Implement idempotency keys and handling to ensure operations can be safely retried without duplicate effects.

    381 GitHub stars~867 tokensUpdated today
    Auto-check passed
  • Accessibility Review

    Asymmetric-al/core

    Audit and fix accessibility in Core UI. An agent skill from Asymmetric-al/core.

    381 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Email Inbox

    Asymmetric-al/core

    A skill your agent uses when building any system where email content triggers actions — AI agent inboxes, automated support handlers, email-to-task pipelines, or any workflow processing untrusted…

    381 GitHub stars~4.1k tokensUpdated today
    Auto-check: notes
  • Components Build

    Asymmetric-al/core

    Build modern, composable, and accessible React UI components following the components.build specification.

    381 GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • Create Agent

    Asymmetric-al/core

    Guides a one-question-at-a-time design interview, captures alignment in agent/EVE-BRIEF.md, then scaffolds and implements a runnable eve agent with verbose teaching comments.

    381 GitHub stars~2.6k tokensUpdated today
    Auto-check: notes
  • Emil Design Engineering

    Asymmetric-al/core

    Design engineering principles and patterns for building polished, accessible web interfaces.

    381 GitHub stars~1.4k tokensUpdated today
    Auto-check passed

Questions about Inngest Middleware

What does Inngest Middleware do?

A skill your agent uses when adding cross-cutting concerns to durable functions — structured logging or tracing across all functions, error tracking with Sentry, payload encryption for sensitive…. Inngest Middleware is an agent skill from Asymmetric-al/core.) into function handlers, custom telemetry, or behavior that should apply uniformly across many functions.

When should I use Inngest Middleware?

Inngest Middleware fits situations like: adding cross-cutting concerns to durable functions — structured logging; tracing across all functions; error tracking with Sentry; payload encryption for sensitive data.

How do I install Inngest Middleware in Claude Code?

Run `npx skills add Asymmetric-al/core --skill inngest-middleware -a claude-code`. Or copy the skill folder (.agents/skills/inngest-middleware in Asymmetric-al/core) into .claude/skills/inngest-middleware in your project. Claude Code loads it when a task matches its description.

How do I install Inngest Middleware in Codex?

Run `npx skills add Asymmetric-al/core --skill inngest-middleware -a codex`. Or copy the skill folder (.agents/skills/inngest-middleware in Asymmetric-al/core) into .agents/skills/inngest-middleware in your project. Codex loads it when a task matches its description.

Can I use Inngest Middleware in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Asymmetric-al/core --skill inngest-middleware -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/inngest-middleware, .gemini/skills/inngest-middleware, .github/skills/inngest-middleware and .opencode/skills/inngest-middleware in your project.

What does Inngest Middleware need to run?

Going by SKILL.md and its folder, Inngest Middleware needs the command-line tools its instructions call (npm) and credentials named ENCRYPTION_KEY. Our summary lists: Python 3; Node.js; A credential in ENCRYPTION_KEY.

Does Inngest Middleware access the network?

SKILL.md names 1 domain. As links in the text: inngest.com. This is read from the text; nothing was executed.

Is Inngest Middleware safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Inngest Middleware use?

Inngest Middleware is published under the AGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Inngest Middleware use?

About 2.9k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5.8k tokens, read only when the agent opens those files.

What are the alternatives to Inngest Middleware?

Skills that share tags, products or a category with Inngest Middleware: Secret Serialization (getsentry/skills, 1k stars), Logging Observability (getsentry/toolkit, 920 stars), Sentry Advanced Troubleshooting (jeremylongshore/tons-of-skills-marketplace, 2.8k stars) and Agent Kill Switch (vivekchand/clawmetry, 426 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Inngest Middleware?

Asymmetric-al (a GitHub organization) maintains it in Asymmetric-al/core, which has 381 GitHub stars. The repository holds 43 skills in this directory. The repository was last updated on October 9, 2026.

Source: Asymmetric-al/core on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.