nextjs-16-server-action-requirements
Installation
SKILL.md
Next.js 16 Server Action Requirements
Problem
Next.js 16 enforces strict rules for files with the "use server" directive. Violations cause
build failures with cryptic error messages. Common issues include exporting non-async functions,
constants, or using static imports of next/headers.
Context / Trigger Conditions
- Build Error:
A 'use server' file can only export async functions, found object - Build Error: Static imports of
next/headersforce modules into dynamic rendering - TypeScript Error: Helper functions in server actions fail type checking
- Next.js Version: 16.x (these rules are stricter than Next.js 15)
Solution
Rule 1: All Exported Functions Must Be Async
Every exported function in a "use server" file must be async, even if it doesn't perform
async operations.