Skip to main content
prompt GP ChatGPT

Next.js App Router taste — ChatGPT prompt: what it does

An opinionated set of Next.js App Router conventions enforcing Server Components by default, Server Actions validated with Zod, and feature-based folder organization.

Open on GitHub

What Next.js App Router taste does

The prompt supplies the model with strict App Router architecture guidelines paired with confidence scores. Server Components act as the default baseline, while "use client" stays confined to interactive leaf nodes. Data fetching happens directly on the server. The setup bypasses intermediary internal API routes for reads, routing all mutations through Server Actions verified by Zod schemas.

Code organization groups loaders, components, and tests by feature instead of file types. For persistence, the instructions specify Prisma or Drizzle with clients contained inside lib/db.ts. Cache invalidation relies on fetch tags and revalidateTag rather than ad-hoc in-memory storage. Large projects must omit barrel files, preventing slow build times.

Testing splits responsibilities: Playwright verifies critical user flows, while Vitest handles isolated components. Middleware logic remains restricted to authentication redirects and locale resolution, keeping heavy compute out of the request pipeline.

What it helps with

  • Restrict "use client" directives strictly to interactive leaf components
  • Validate Server Action mutation payloads with Zod schemas
  • Colocate loaders, tests, and UI components by feature
  • Prevent slow build times by eliminating barrel files in large apps
  • Manage cache invalidation using fetch tags and revalidateTag

Example prompts for the agent

  • Create a user profile form using Next.js Server Actions and Zod validation
  • Generate a product route segment with direct server fetching, loading.tsx, and error.tsx
  • Set up a database query module using Drizzle through lib/db.ts with fetch tags

How to install Next.js App Router taste

How to use

Paste the text at the start of a chat or into project instructions

Questions about Next.js App Router taste

How to install Next.js App Router taste in ChatGPT or Claude.ai?

Paste the prompt instructions directly into your custom instructions or system prompt. In Claude Code, place the file at .claude/commands/prompts.csv.md.

What does Next.js App Router taste do?

It forces the AI model to write Next.js code following Server Component best practices, feature colocation, next/image usage, and clean data caching.

Which database and testing libraries does this prompt require?

The prompt mandates either Prisma or Drizzle configured in lib/db.ts. Testing relies on Vitest for component units and Playwright for full end-to-end flows.

Source text

prompts.csv · CC0-1.0
# Next.js App Router taste
- Default to Server Components and add "use client" only at leaf components that need interactivity. Confidence: 0.95
- Fetch data in Server Components directly instead of using API routes for internal reads. Confidence: 0.90
- Use Server Actions for mutations and validate input with zod. Confidence: 0.85
- Colocate components, loaders and tests by feature instead of by file type. Confidence: 0.80
- Use Tailwind CSS with a small set of design tokens in CSS variables. Confidence: 0.85
- Use next/image and next/font for all images and fonts. Confidence: 0.90
- Add loading.tsx and error.tsx to every route segment that fetches data. Confidence: 0.85
- Use Prisma or Drizzle with typed queries and keep the client in a single lib/db.ts. Confidence: 0.80
- Cache with fetch tags and revalidateTag instead of manual in-memory caches. Confidence: 0.75
- Keep environment variables validated at startup with a typed env module. Confidence: 0.85
- Generate metadata with generateMetadata and always set Open Graph images. Confidence: 0.85
- Avoid barrel files in large apps because they hurt build times. Confidence: 0.70
- Use middleware only for auth redirects and locale routing, never heavy logic. Confidence: 0.80
- Test critical flows with Playwright and components with vitest. Confidence: 0.80
- Deploy on Vercel with preview deployments for every pull request. Confidence: 0.75

© f · CC0-1.0 · f/prompts.chat

Similar prompts

All prompts for Frontend and UI →

From the same set143

The whole set →
Python Packaging taste A prompt that hands the model a fixed set of Python packaging rules: pyproject.toml, src/, uv, Ruff. Useful when a new package needs one consistent style. GP ChatGPT ★ 174,676repo stars API Design taste Opinionated REST API design rules with confidence scores. It guides AI models on clean routing, error contracts, and schema validation. GP ChatGPT ★ 174,676repo stars Open Source Release Checklist Builder (YAML) This prompt turns an upcoming open-source release into a YAML checklist for versions, tests, artifacts, security notes, rollback, and announcements. GP ChatGPT ★ 174,676repo stars Dockerfile and CI taste A prompt that lists rules for Dockerfiles and CI: multi-stage builds, non-root user, image scanning. Useful when you ask an AI to write or review a build config. GP ChatGPT ★ 174,676repo stars Senior Code Reviewer (severity-ranked) A code review prompt that ranks findings from blockers down to nits and closes with a verdict. Useful when you need to know what in a patch actually breaks. GP ChatGPT ★ 174,676repo stars TypeScript Library taste A prompt that pins down conventions for a TypeScript library: pnpm, strict tsconfig, tsup, vitest, Changesets. Useful when a project needs one style from the first commit. GP ChatGPT ★ 174,676repo stars Act as a Senior Codebase Auditor & Tech Debt Refactorer Turns an AI assistant into a senior codebase auditor. It pinpoints dead code, redundant logic, and tech debt, delivering a phased refactoring plan. GP ChatGPT ★ 174,676repo stars Claude Web Page Redesign Planning Prompt A prompt that makes the model audit the current markup and code first, then hand back a redesign plan in markdown. No edits get made. GP ChatGPT ★ 174,676repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor