nextjs-16-use-server-exports

Installation
SKILL.md

Next.js 16 "use server" Export Compliance

Problem

Next.js 16 enforces strict rules for files with the "use server" directive: they can only export async functions. Any attempt to export constants, objects, enums, or type definitions from these files will cause a build error:

Error: A "use server" file can only export async functions, found object.
Read more: https://nextjs.org/docs/messages/invalid-use-server-value

This error is not immediately obvious because:

  • The error message doesn't clearly indicate which export is problematic
  • Many developers expect to co-locate related constants with their server actions
  • TypeScript compilation succeeds but Next.js build fails

Context / Trigger Conditions

When to use this skill:

Installs
1
GitHub Stars
1
First Seen
Mar 4, 2026
nextjs-16-use-server-exports — hankanman/claude-config