---
name: "react-19-server-actions"
description: "Execute type-safe server-side mutations directly from React components with zero boilerplate."
metadata:
  author: "React"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "write react 19 server action"
  - "progressive enhancement form nextjs"
  - "zod validate server action"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# React 19 Server Actions & Progressive Form Mutations

Implements React 19 / Next.js Server Actions: 'use server' directives, progressive enhancement without JavaScript, optimistic UI responses, automatic cache invalidation, and integrating Zod input schema validation.

## When to Invoke
Invoke this skill whenever you need to:
- write react 19 server action
- progressive enhancement form nextjs
- zod validate server action

## Execution SOP & Rules
1. Declare 'use server' at top of action function or standalone server action module.
2. Validate FormData with safeParse using Zod: const validated = schema.safeParse(Object.fromEntries(formData)).
3. Return structured response: { success: true, data } or { success: false, errors }.
4. Call revalidatePath() or revalidateTag() upon successful database mutation.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
