nextjs

nextjs is a cursor rule for Cursor from inboxpraveen/Minimize-Cursor-Cost. It costs 0 tokens per session (509 once invoked), scanned A, original, Apache-2.0.

Project rules for Next.js, a framework for building web applications with React. They cover both the newer App Router and the older Pages Router.

In plain words
What is it for?
Use them when adding or changing pages, layouts, API endpoints, data fetching, or server and client components in a Next.js project.
Why use it?
They prevent mixing conventions that can break routing, data loading, or server and browser code. They also help preserve the project's existing URL structure and performance settings.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/inboxpraveen/minimize-cursor-cost/nextjs
Clone the repo
git clone --depth 1 https://github.com/inboxpraveen/Minimize-Cursor-Cost

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for nextjs

README.md
[![agentmods](https://agentmods.dev/badge/rules/inboxpraveen/minimize-cursor-cost/nextjs.svg)](https://agentmods.dev/rules/inboxpraveen/minimize-cursor-cost/nextjs)
Your own site
<a href="https://agentmods.dev/rules/inboxpraveen/minimize-cursor-cost/nextjs"><img src="https://agentmods.dev/badge/rules/inboxpraveen/minimize-cursor-cost/nextjs.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 509 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00509
Opus 5 $0.00000 $0.00254
Sonnet 5 $0.00000 $0.00102
Haiku 4.5 $0.00000 $0.00051

Measured 5d ago against content hash 756b26ecf552, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

nextjs scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

lean-cursor/.cursor/rules/nextjs.mdc · 47 lines

What it actually says

Next.js Rules

Detect the router first

  • App Router: files under app/, uses page.tsx / layout.tsx / route.ts.
  • Pages Router: files under pages/, uses default-exported components.
  • Don't mix idioms across routers.

Server vs Client Components

  • A component is server by default in App Router. Add "use client" only when needed (state, effects, browser APIs, event handlers).
  • Don't sprinkle "use client" "to be safe" — it disables the biggest perf wins.
  • Don't import server-only modules (e.g., fs, node:*) into client components.

Data Fetching

  • App Router: prefer server components + fetch with caching. Don't introduce SWR/React Query in server components.
  • Pages Router: match existing pattern (getServerSideProps vs getStaticProps).
  • Don't change revalidate, cache, or dynamic values without flagging.

Routing

  • Don't restructure app/ or pages/ folders to refactor URLs unless asked.
  • Don't move files between routers.
  • Don't add catch-all or dynamic segments speculatively.

API / Route Handlers

  • App Router: route.ts handlers — match existing return shape (Response vs NextResponse).
  • Pages Router: pages/api/* — match existing handler signature.
  • Don't add middleware unless asked.

Server Actions

  • Add "use server" only when the function actually runs on the server.
  • Don't pass server-action references to non-form props without flagging.

Images / Fonts / Metadata

  • Use next/image, next/font, and metadata/generateMetadata only if siblings already do.
  • Don't switch from <img> to <Image> as a side-effect.

Never

  • Don't change next.config.* while doing a feature task.
  • Don't change tsconfig.json paths or compiler options unless asked.
  • Don't add experimental flags to next.config.
  • Don't introduce a new auth provider — match existing (NextAuth/Clerk/Supabase/etc.).
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 47 lines · 0 tokens per session scan A 756b26ecf552

Subscribe to this mod's changes

nextjs is a cursor rule published in the GitHub repository inboxpraveen/Minimize-Cursor-Cost (7 stars, last pushed 20d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 509 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.