What problem does it solve? Building secure Next.js server actions requires repetitive boilerplate for authentication, authorization, logging, and rate limiting. This Skill provides patterns for composing reusable middleware chains with next-safe-action so these cross-cutting concerns are handled consistently and type-safely. ## Core Features & Use Cases - Pre- and Post-Validation Middleware: Use .use() for session checks and rate limiting before validation, and .useValidated() for authorization logic that depends on typed, parsed input. - Auth & Authorization Patterns: Ready-made examples for session lookup, role-based access, resource ownership checks, and API key authentication. - Observability & Reusability: Structured logging, request timing, Sentry error reporting, and standalone middleware via createMiddleware() and createValidatedMiddleware() with type constraints. - Use Case: You need an admin-only action that updates a post. Chain an auth middleware that injects userId into context, then a useValidated() middleware that verifies the user owns the post before the action runs. ## Quick Start Ask the AI to create a next-safe-action middleware chain that requires a logged-in session and checks resource ownership before running a server action.