void-server-action

Creates Next.js Server Actions with Zod validation, auth, rate limiting, and observability layers.

Updated May 29, 2026
One-click install
npx skills add https://github.com/voidcorp-core/void-harness --skill void-server-action-voidcorp-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: void-server-action
Source: https://github.com/voidcorp-core/void-harness/tree/main/packages/cli/core-assets/packs/pack-server/skills/void-server-action
Command: npx skills add https://github.com/voidcorp-core/void-harness --skill void-server-action-voidcorp-core

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Server Actions are reachable from the public internet via forged requests, yet developers often treat them like internal function calls, skipping authentication, input validation, and rate limiting. This Skill enforces a five-layer trust-boundary checklist so every 'use server' function is secured and observable by default. ## Core Features & Use Cases - Five-layer enforcement: Every action applies auth, Zod ingress validation, rate limiting, observability (trace ID plus hashed Sentry user scope), and a pure service call, in that order. - Canonical skeleton and helper pattern: Provides a copy-ready 40-line action template plus guidance on when to extract a defineAction helper after the pattern repeats. - FormData and return-type discipline: Covers typed payloads versus HTML form actions, safe getAll handling for repeated fields, and discriminated-union results instead of thrown errors. - Use Case: When asked to "add a Server Action for canceling a subscription," the Skill produces an action that verifies the session, validates input with Zod, rate-limits per user, logs with a trace ID, and delegates domain logic to a tested service. ## Quick Start Ask the agent to create a Server Action for a specific mutation, such as "add a Server Action that handles the contact form," and it will scaffold the full five-layer implementation.

Frequently Asked Questions about void-server-action

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

FAQPage Schema
How do I create a secure Next.js Server Action?

Apply five layers in order: verify the session, validate input with a Zod schema, apply a per-user rate limit, attach a trace ID and hashed Sentry user scope, then call a pure service function. Return a discriminated union result instead of throwing errors to the client.

How to validate FormData in Server Actions with Zod?

Parse FormData through a Zod schema rather than raw .get() casts. Use getAll with z.array for any repeatable field like multi-selects, because Object.fromEntries silently keeps only the last value of repeated fields.

Where should Server Actions live in a Next.js monorepo?

Place them in apps/<app>/src/actions/<feature>/<verb>.ts, or in a route-local _actions.ts only when tightly coupled to one route. Server Actions never belong in packages/, which own pure services; apps own the trust boundary.

Should Server Actions throw errors or return results?

Return a discriminated union like { ok: true, data } or { ok: false, error } with a stable error code. Thrown errors are swallowed by Next.js, leaving the client with an opaque 500 and no actionable information.

When should I extract a defineAction helper?

Extract a defineAction helper only after the five-layer pattern repeats three or more times across actions. The helper is convenience; the underlying auth, validation, rate limit, and observability layers are the substance and must remain explicit.