server-actions
Installation
SKILL.md
Server Actions
Server Actions run only on the server, invoked from the client over a POST. They are the App Router's tool for mutations — create, update, delete, form submissions.
Reads don't belong here. Fetch data directly in a Server Component (no HTTP round-trip). Reach for a Server Action only when state changes.
Stack-agnostic: examples use placeholder modules (~/auth, ~/lib/logger, your ORM, your toast library) — swap them.
The one thing standardized is the result contract, because a consistent return shape lets every form, hook, and
error path compose.
Setup: the result contract
Every action returns a typed discriminated union, not a bare object or a thrown error. Do this once per project before writing actions: