Audit mechanical Next.js App Router CRUD scaffolds for correctness, security, UX, and maintainability.
trigger
Use when reviewing mechanically generated Next.js App Router CRUD route handlers, pages, forms, and tests.
auto_generated
{"by":"skill-opt","date":"2026-05-31T00:00:00.000Z","source_goal":"Generate a reviewer workflow for auditing Next.js App Router CRUD route and page scaffolds created by mechanical executors.","planner_model":"codex-cli/default","review_required":true}
nextjs-app-router-crud-scaffold-review
When to use
Use this skill to review Next.js App Router CRUD scaffolds generated by mechanical executors before accepting, merging, or extending them.
Apply it to generated:
app/**/page.tsx, layout.tsx, loading.tsx, error.tsx, and not-found.tsx
app/api/**/route.ts
Server Actions and form handlers
CRUD list/detail/create/edit/delete pages
Generated validation, auth, database, and test code
Steps
Identify the generated CRUD surface: model/entity, routes, pages, API handlers, actions, schemas, tests, and linked navigation.
Audit route handlers and server actions for HTTP correctness: status codes, method coverage, request parsing, response shape, idempotency, cache behavior, and invalid method handling.
Check data access correctness: query filters, tenant/user scoping, pagination, sorting, unique constraints, relation loading, transactions, and delete semantics.
Review validation: shared schemas where appropriate, server-side validation always present, useful field errors, safe coercion, and no trust in client-only checks.
Review auth and authorization: every read/write path enforces the intended permission model, object-level access, ownership checks, and unauthenticated behavior.
Inspect security risks: injection, mass assignment, leaked internal fields, unsafe redirects, CSRF-sensitive mutations, over-broad error messages, and accidental secret exposure.
Confirm data freshness: appropriate revalidatePath, revalidateTag, router.refresh, cache options, optimistic updates, and redirect-after-mutation behavior.
Check generated code quality: no duplicated boilerplate that should be factored locally, no placeholder names, no unused imports, no console.log, no TODOs without owner, and no broad refactors.
Validate tests: unit/integration/E2E coverage for list, create, read, update, delete, validation failure, auth failure, not-found, and one edge case.
Produce review findings grouped by severity, each with file path, issue, impact, and recommended fix.
DoD
All generated route handlers and pages were mapped to the intended CRUD lifecycle.
App Router conventions are correct for server components, client components, route handlers, params, redirects, and not-found behavior.
Every mutation path has server-side validation, authorization, and safe error handling.
Every data query is scoped correctly for tenant/user/ownership rules.
UI states cover loading, empty, success, validation error, server error, and destructive action confirmation where relevant.
Cache invalidation or refresh behavior is explicitly verified after create, update, and delete.
Tests cover happy paths, validation failures, auth failures, not-found cases, and at least one edge case.
Findings are actionable, path-specific, severity-ranked, and avoid rewriting unrelated architecture.
Anti-patterns
Approving scaffolds because they compile without checking authorization and object-level access.
Treating generated client validation as sufficient without server-side validation.
Ignoring cache invalidation after mutations.
Accepting CRUD pages with no empty, loading, error, or destructive-confirmation states.
Reviewing only API routes while skipping pages, forms, navigation, and tests.
Suggesting broad refactors instead of scoped fixes to generated scaffold defects.
Duplicating the FastAPI CRUD scaffold review workflow instead of focusing on Next.js App Router behavior.