Use it when you are

  • Adding an authenticated dashboard section with its own layouts and data loading
  • Deciding between server actions and route handlers for a set of mutations
  • Working out a caching and revalidation approach for content with mixed freshness needs
  • Migrating a feature from the Pages Router and wanting a file-level plan first

Why this prompt works

The hard-to-reverse choices come first

In the App Router, the route tree, the server and client split and the caching approach shape every file that follows. Changing them after implementation means rewriting, not editing. Splitting the work into an approved plan and a build stage puts your review at the point where a correction costs one message.

Client components have to earn the label

The boundary table asks for a reason beside every client component and sets server as the default. That counters the habit of marking a whole page as client because one button needs a handler, and it produces a record you can check against what each component actually does.

Version-dependent behavior is flagged, not assumed

A model's knowledge of Next.js blends several major versions, and caching defaults are one of the places they differ. Naming the version, requiring the model to state the behavior it relies on and marking uncertain points [VERIFY] gives you a short list to confirm in the official documentation.

Authorization is a line item for every write

Server actions are reachable endpoints, so each one needs its own check. Requiring the check and its location per mutation, and banning reliance on hidden UI, makes a missing check visible in the plan as an empty cell instead of leaving it to be found in production.

How to use it

  1. Look up your exact Next.js version in package.json and enter it. Do not write "latest".
  2. State freshness per kind of data. "Always current" and "a few minutes stale is fine" lead to different caching plans.
  3. Describe roles and permissions in plain sentences, including who must not see what.
  4. Send the prompt and review sections B, C and D of the plan closely. Check every [VERIFY] item against the Next.js documentation for your version.
  5. Answer the model's questions, correct the plan, and only then tell it to begin Stage 2.
  6. Build and run after each group of files instead of waiting for the full implementation.

AI model compatibility

ModelStatusNotes
ChatGPTExpected to workNo model-specific adjustment needed. Paste the prompt as written.
ClaudeExpected to workFor long schemas or existing files, wrap each in its own XML-style tag below the project facts, as Anthropic's prompting guidance suggests, so the plan can refer to them by name.
GeminiExpected to workKeep the lettered plan sections as written. Google's prompting guidance favors explicit, ordered instructions, and the letters make it easy to ask for a revision of one section.
CursorExpected to workRun Stage 1 as a question rather than an edit so no files change, and point the existing-structure field at your app directory and data-access files instead of describing them.

“Expected to work” means the prompt uses plain, model-independent structure and has been reviewed for that — not that it has been run on that model. A model is marked Tested only when a test record is published below.

Worked example

Scenario: An illustrative case: a B2B SaaS app adding a members area to team settings.

Example: filled-in prompt
You are a senior engineer who has shipped production apps on the Next.js App Router. Help me plan, then build, one feature.

## Feature
A team settings area at /settings/members where admins see all members, invite by email, change a member's role and remove a member. Regular members can view the list but not change it.

## Project facts
- Next.js version: 15.3
- Data layer: PostgreSQL via Drizzle; query functions live in src/db/queries
- Authentication and who may do what: Auth.js session cookie. Roles: owner, admin, member. Only owner and admin can invite, change roles or remove. Nobody can remove the owner.
- How fresh the data must be: Member list must reflect changes immediately after any mutation; pending invites can be up to a minute old
- Existing structure and conventions: app/(dashboard)/settings/layout.tsx already exists with a sidebar. Server actions go in actions.ts beside the page. Forms use plain form elements with useActionState.

## Stage 1: plan only
Write no implementation code in this stage. Produce:

A. Route map. A file tree of every file you would add or change under app/, with one line on what each is for (page, layout, loading, error, not-found, route handler, server action).

B. Server and client boundary. A table with columns: component, server or client, reason. Default to server. A component is client only if it needs state, effects, event handlers or browser APIs. Place the boundary as low in the tree as possible and note what is passed across it.

C. Data reads. For each read: where it runs, whether its result is cached, what invalidates it, and how that satisfies the freshness requirement. Caching defaults differ between Next.js versions, so state the behavior you are relying on for the version above and mark anything you are not certain of [VERIFY].

D. Mutations. For each write: server action or route handler, input validation, the authorization check and where it runs, what is revalidated afterward, and what the user sees while it is pending and when it fails.

E. Risks. Anything that could expose data to the wrong user, send secrets or oversized payloads to the client, or cause a request waterfall.

F. Questions for me, at most five.

Then stop and wait for my reply.

## Stage 2: after I approve
Implement the plan one file at a time: complete files with their paths, in dependency order. If you need to depart from the approved plan, say so before the file in question.

## Rules for both stages
- Use only APIs that exist in the stated version. If unsure, say so; do not guess a signature.
- Never rely on client-side checks or hidden UI for authorization.
- Do not add packages or invent database tables, columns or environment variables. Ask instead.

What a good response should contain

  • A file tree under app/(dashboard)/settings/members that includes loading and error files, not only page.tsx
  • A boundary table where the member list is a server component and only the role select, invite form and remove button are client components
  • A statement of how the member list read behaves in the stated version, with at least one [VERIFY] marker where the model is unsure
  • Each of the three mutations listed with validation, a server-side role check, the owner-removal rule and what is revalidated
  • Questions about things it cannot know, such as how invites are delivered and what happens to an invited email that already has an account

This is an illustrative scenario showing how to fill in the prompt and what to look for. It is not a recorded model output. Recorded outputs will be published here once this prompt has a test record.

Testing and editorial review

Status: Untested. Reviewed for structure and clarity by the editorial team. No recorded model test yet.

No test record has been published for this prompt yet. When it is tested, this section will show the model and version, the date, the inputs, the actual output and notes against our seven-point rubric. We do not publish numerical scores.

Editorial record
AuthorTheBestPromptFor Editorial Team — The editorial team writes, reviews and maintains the prompts and guides on TheBestPromptFor. Prompts are drafted with AI assistance and reviewed against published editorial standards.
PublishedNovember 15, 2026
Last reviewedNovember 15, 2026
Last testedNot yet tested
Version history
  • v1.0 — November 15, 2026 · Initial version

Limitations and things to check

  • The model may describe APIs or defaults from a different Next.js version than yours. Treat every [VERIFY] item, and anything about caching, as something to confirm.
  • A plan that looks secure is not a security review. Test each mutation as a user who should be refused.
  • The model cannot see runtime behavior such as actual cache hits, waterfalls or bundle size. Measure those in your app.
  • Hosting platforms differ in how they handle caching and revalidation; the plan assumes the framework's documented behavior.

Alternative prompts

All Web Development prompts →

Frequently asked questions

Why does the prompt stop after the plan?

Because the plan is where your knowledge matters most. You know which data is sensitive, which routes already exist and how fresh things must be. Approving the route map, boundaries and caching before code is written avoids a full rewrite when one of those turns out to be wrong.

Can I use this with the Pages Router?

No. The plan sections assume App Router concepts such as layouts, server components and server actions. For a Pages Router project, use the technical spec prompt to plan and the React component prompt to build the interactive parts.

What if I don't know how fresh my data needs to be?

Say what would go wrong if a user saw data that was a minute old, or an hour old. That consequence is enough for the model to propose a requirement, which it should then list among its questions for you to confirm.

Sources and references

  1. Next.js documentation — Vercel
  2. React documentation: Learn — React
  3. Prompt design strategies — Google AI for Developers

Was this prompt useful?

No account needed. Do not include personal information.