One of the most common mistakes AI assistants make in Next.js 15 App Router projects is slapping 'use client' at the top of page-level components.
Here is the clean boundary pattern to enforce in your codebase:
Keep 'use client' at the Leaves
Only interactive buttons, inputs, and stateful widgets need client hydration. Data fetching, permission checks, and database queries belong strictly in Server Components.
Structured Server Action Responses
Avoid throwing raw exceptions from Server Actions—return predictable discriminated results instead:
'use server' import { z } from 'zod' const CreateItemSchema = z.object({ title: z.string().min(2).max(100), }) export async function createItemAction(formData: FormData) { const parsed = CreateItemSchema.safeParse({ title: formData.get('title') }) if (!parsed.success) { return { success: false as const, error: 'Invalid title input.' } } // Persist to DB inside authenticated context... return { success: true as const, data: parsed.data } } Pair With Strict Linting Rules
When your .cursorrules explicitly dictates Zod boundary parsing and Server-Component-first layout trees, Cursor generates clean Next.js 15 PRs on the first pass.
Want Production-Ready .cursorrules & Boilerplates?
I'm a student developer in Japan funding my upcoming new life next spring by packaging strict, battle-tested AI coding setups:
- Free Starter
.cursorrules& Reviewer Prompts ($0+): Download Free Starter Pack (or GitHub Repo) - Next.js 15 & React 19 Production Kit ($19): Get Stack Kit
- All 10 Production Stacks Bundled ($99): 10-in-1 Ultimate Developer Suite