safe-action-client

Create next-safe-action clients with input/output validation and centralized error handling.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers need a structured, safe way to define server actions with validated inputs/outputs, centralized error handling, and reusable clients across an app.

Core Features & Use Cases

  • Client creation and configuration: createSafeActionClient with custom server error handling and default validation shapes.
  • Input & Output validation: .inputSchema(), .outputSchema(), and support for Standard Schema libraries.
  • Action definitions: define .action() and .stateAction() for server and stateful actions.
  • Middleware & metadata: use() middleware chaining and .metadata() support for contextual data.
  • Error handling: centralized handleServerError, DEFAULT_SERVER_ERROR_MESSAGE, and structured server errors.

Quick Start

Create a next-safe-action client, define input/output schemas, and implement a sample action to validate inputs and handle server errors.

Frequently Asked Questions about safe-action-client

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

FAQPage Schema
How do I validate inputs and outputs for Next.js server actions?

Validate Next.js server actions by defining input and output schemas using a reusable client, ensuring data integrity before execution. You apply schema validation directly to action definitions to enforce consistent responses.

What is the best way to centralize error handling in Next.js server actions?

Centralize error handling in Next.js server actions by configuring a reusable client with a dedicated handleServerError hook. This approach captures and structures server errors globally for consistent responses across your application.

How does middleware chaining work with Next.js server actions?

Middleware chaining for Next.js server actions works by using the use() method to attach sequential logic before action execution. This allows you to pass contextual metadata and enforce pre-processing checks.

Can I use Standard Schema libraries to validate Next.js server actions?

Yes, you can use Standard Schema libraries to validate Next.js server actions by passing them into the inputSchema and outputSchema methods. This supports flexible validation without being locked into a single schema library.

How do I create stateful server actions in Next.js?

Create stateful server actions in Next.js by defining stateAction() instead of action() on your configured client. This allows you to manage form state and bind previous state to the current validation and execution flow.