safe-action-middleware

Compose type-safe middleware for Next-safe-action with immutable chains.

1|Updated Feb 6, 2026
One-click install
npx skills add https://github.com/gepetojj/umo --skill safe-action-middleware
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: safe-action-middleware
Source: https://github.com/gepetojj/umo/tree/main/.agents/skills/safe-action-middleware
Command: npx skills add https://github.com/gepetojj/umo --skill safe-action-middleware

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a framework to implement and compose middleware for Next-safe-action, enabling authentication, authorization, logging, rate limiting, error interception, context extension, and reusable standalone middleware via createMiddleware() or createValidatedMiddleware().

Core Features & Use Cases

  • .use() pre-validation middleware for authentication and logging
  • .useValidated() post-validation middleware for authorization and data enrichment
  • createMiddleware() and createValidatedMiddleware() for reusable patterns across clients
  • Immutable chaining and context merging to ensure predictable flows across actions

Quick Start

Create a Safe Action client with a simple authentication middleware using .use(), then add input validation with .inputSchema() and attach a post-validation middleware with .useValidated().

Frequently Asked Questions about safe-action-middleware

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add authentication and authorization middleware to Next-safe-action server actions?

You can add authentication and authorization middleware to Next-safe-action server actions by using .use() for pre-validation tasks like authentication and .useValidated() for post-validation tasks like authorization, ensuring predictable flows.

Can I create reusable middleware patterns for multiple Next-safe-action clients?

Yes, you can create reusable middleware patterns for multiple Next-safe-action clients by utilizing the createMiddleware() and createValidatedMiddleware() functions, enabling standalone middleware to be applied across different server action implementations.

What is the best way to compose rate limiting and logging middleware in Next.js server actions?

The best way to compose rate limiting and logging middleware in Next.js server actions is by applying an immutable middleware framework that chains these functions securely, merging context and ensuring errors propagate correctly.

Does this middleware framework support inputSchema and bindArgs schemas for Next-safe-action?

Yes, the middleware framework supports both inputSchema and bindArgs schemas for Next-safe-action, allowing you to apply pre-validation and post-validation middleware while maintaining strict type safety across your server actions.

How does context extension work when chaining middleware in Next-safe-action?

Context extension works by merging contexts immutably as you chain middleware via .use() or .useValidated(), ensuring that data enriched in earlier middleware layers is predictably accessible in subsequent server action steps.